imageproc icon indicating copy to clipboard operation
imageproc copied to clipboard

Expand `stetch_contrast()` to color images also using `u8`

Open ripytide opened this issue 1 year ago • 1 comments

Ideally we'd want to use the Enlargeable trait currently private inside image to make this work for all types rather than just u8, but this is still an improvement that should be good enough for https://github.com/image-rs/image/issues/2238.

ripytide avatar Jun 22 '24 14:06 ripytide

It seems we need to bump the minimal rust version now since one of our dependencies, I think bitstream-io now requires v1.79

ripytide avatar Jun 22 '24 14:06 ripytide

Thanks! What impact does this have on function run time for the greyscale case?

theotherphil avatar Aug 15 '24 04:08 theotherphil

Looks like no impact: Before PR:

test contrast::benches::bench_stretch_contrast                                        ... bench:         660.08 ns/iter (+/- 2.24)
test contrast::benches::bench_stretch_contrast_mut                                    ... bench:           0.25 ns/iter (+/- 0.00)

After PR:

test contrast::benches::bench_stretch_contrast                                        ... bench:         658.86 ns/iter (+/- 7.36)
test contrast::benches::bench_stretch_contrast_mut                                    ... bench:           0.25 ns/iter (+/- 0.00)

ripytide avatar Aug 17 '24 23:08 ripytide

Thanks!

(Aside: it looks like the _mut variant of that benchmark is optimising out the function and so not actually running .)

theotherphil avatar Aug 18 '24 06:08 theotherphil