Repository navigation
Add reference tests for image operations - #2877
RunDevelopment wants to merge 9 commits into
Conversation
|
I forgot to mention: The cat image is CC0. I got it from here. The other two images I created myself. |
197g
left a comment
There was a problem hiding this comment.
Apart from the code nits, I'm not entirely sure. Should we bit-for-bit test these methods yet? In particular with fast_blur still having some outstanding discussion. Then again such tests should be in place before we add diverging implementation paths for arch-specific vectorization. Maybe you can lean in to either side of the argument?
I would like to answer it like this: The right time to add such tests for these functions was years ago when they were added. The second best time is right now. Suppose we change |
| for image in [bw_edge, noise] { | ||
| for sigma in [0.1, 0.5, 1.0, 1.5, 2.0, 5.0, 10.0, 50.0] { | ||
| trials.add( | ||
| format!("blur/{} blur sigma={sigma:.1}", image.name), |
There was a problem hiding this comment.
Having filenames with spaces in them does make command line analysis of the files somewhat more awkward in general. (You cannot as easily do tricks like ls -l tests/imageops/blur/* | cut -w -f 5,9 | sort -n, which is a bit silly of an example.) But this is only a weak preference of mine.
There was a problem hiding this comment.
If your tools can't handle valid file paths, you need better tools!
There was a problem hiding this comment.
This type of test is indeed very useful to have, and the test files are small. (Oxipng could only shave off 10 KiB in total, were you to run it.)
Pedantic testing philosophy note: these are technically snapshot/expect tests, not reference tests, because the test files aren't certainly fixed and correct, and the snapshot of behavior that we expect from them will change in the future. (edit: OK, I'm slightly wrong with this note :-)
This does need rebasing to fix a (trivial) merge conflict.
|
Thanks for the review! I implemented your png suggestion.
Sorry, but that's not worth the effort now. |
I added reference tests for image operations. For now, I tested
blur,fast_blur,invert,filter3x3, andhuerotate.Reference images currently capture the bugs of these functions as is:
blurproduces incorrect outputs if kernel size=1.fast_blurwith a sigma <=1.5 are the same. (fast_blurdoes not approximate a Gaussian blur well for small sigma #2858)filter3x3adds a black border. (Clamp abyss policy forfilter3x3#2874)