Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changelog for v0.24 #1656

Merged
merged 5 commits into from
Jan 31, 2022
Merged

Changelog for v0.24 #1656

merged 5 commits into from
Jan 31, 2022

Conversation

HeroicKatora
Copy link
Member

@HeroicKatora HeroicKatora commented Jan 20, 2022

Closes: #1433

Copy link
Contributor

@fintelia fintelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Pointed out some typos.

Cargo.toml Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
@HeroicKatora HeroicKatora marked this pull request as ready for review January 21, 2022 21:51
@HeroicKatora
Copy link
Member Author

Upgrading quickcheck made it discover some inconsistencies in our resize_dimensions code. I'm checking those before publishing.

@micahsnyder
Copy link
Contributor

Does this mean we'll get a new release soon? 😃

@micahsnyder
Copy link
Contributor

micahsnyder commented Jan 23, 2022

Upgrading quickcheck made it discover some inconsistencies in our resize_dimensions code. I'm checking those before publishing.

@HeroicKatora I don't know if this is related to resize_dimensions, but it appears that resize_exact gives me more accurate resizes in the unreleased master branch than in 0.23.14. I'm attributing the improvement to it doing the calculations internally using an ImageBuffer<Rgba<f32>, Vec<...>> type.

For context: I'm trying to replicate fuzzy hashes using your image crate as the Python imagehash::phash() function. My Rust implementation is off by a (literal) bit on some hashes when using image v0.23.14 but I get exact matches for my current sample set if I use the master branch.

@HeroicKatora
Copy link
Member Author

HeroicKatora commented Jan 23, 2022

Time for some findings. It looks like the quickcheck based test diverged from the implementation in that the special case of ensuring a non-empty result was never introduced. Somehow, the previous version (quickcheck = 0.9) also did not find this case. After that change, we find some cases in very large numbers:

thread 'math::utils::test::resize_bounds_correctly_width' panicked at '[quickcheck] TEST FAILED. Arguments: (1, 10737419)', […]/src/github.com-1ecc6299db9ec823/quickcheck-1.0.3/src/tester.rs:165:28

This case should resize one dimension to u32::MAX.

Diff for the fix to the implementation
diff --git a/src/math/utils.rs b/src/math/utils.rs
index 1ed129cf..1999f350 100644
--- a/src/math/utils.rs
+++ b/src/math/utils.rs
@@ -45,7 +45,9 @@ mod test {
         fn resize_bounds_correctly_width(old_w: u32, new_w: u32) -> bool {
             if old_w == 0 || new_w == 0 { return true; }
             let result = super::resize_dimensions(old_w, 400, new_w, ::std::u32::MAX, false);
-            result.0 == new_w && result.1 == (400 as f64 * new_w as f64 / old_w as f64).round() as u32
+            let exact = (400 as f64 * new_w as f64 / old_w as f64).round() as u32;
+            println!("{:?}, {:?}", result, (new_w, exact.max(1)));
+            result.0 == new_w && result.1 == exact.max(1)
         }
     }
 
@@ -53,7 +55,9 @@ mod test {
         fn resize_bounds_correctly_height(old_h: u32, new_h: u32) -> bool {
             if old_h == 0 || new_h == 0 { return true; }
             let result = super::resize_dimensions(400, old_h, ::std::u32::MAX, new_h, false);
-            result.1 == new_h && result.0 == (400 as f64 * new_h as f64 / old_h as f64).round() as u32
+            let exact = (400 as f64 * new_h as f64 / old_h as f64).round() as u32;
+            println!("{:?}, {:?}", result, (exact.max(1), new_h));
+            result.1 == new_h && result.0 == exact.max(1)
         }
     }

CHANGES.md Outdated Show resolved Hide resolved
src/math/utils.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@fintelia fintelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we shouldn't be mixing code changes, dependency bumps, and the changelog updates all in the same PR. However, everything here looks good to me.

CHANGES.md Show resolved Hide resolved
@HeroicKatora HeroicKatora changed the title Draft of Changelog for v0.24 Changelog for v0.24 Jan 31, 2022
@HeroicKatora HeroicKatora merged commit 398b087 into master Jan 31, 2022
@HeroicKatora HeroicKatora deleted the release-0.24 branch January 31, 2022 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

What to do in 0.24
3 participants