Closed lian closed 2 years ago
@lian , thanks for PR I hope everything else works as intended)
I'll take a look into commit soon
p.s. some benchmarks would be great to see also :) (what performance gain would we expect?)
name old time/op new time/op delta
Image2Float32-32 7.98ms ± 4% 5.19ms ± 9% -35.04% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
Image2Float32-32 12.0MB ± 0% 1.7MB ± 0% -85.71% (p=0.000 n=9+9)
name old allocs/op new allocs/op delta
Image2Float32-32 7.00 ± 0% 3.00 ± 0% -57.14% (p=0.000 n=10+10)
approved and merged next action would be updating release tag)
Thank you for PR
imgTofloat32 + fill_image_f32 took more than double the time since tofloat created needless allocations and iterate over each pixel, and fill_image in c then iterate over each pixel*3 again just to move it into the c image.
also add ImageRGBA2Float32 to optionally skip the draw.Copy call.