Cykooz / fast_image_resize

Rust library for fast image resizing with using of SIMD instructions.
Apache License 2.0
310 stars 29 forks source link

ImageView::from_buffer returns an error if the provided buffer larger than the minimum required size #5

Closed Farmadupe closed 2 years ago

Farmadupe commented 2 years ago

I am using this library to resize video frames from Gstreamer. Gstreamer sometimes creates frame buffers which are oversized.

When calling ImageView::from_buffer before resizing such frames, fast_image_resize returns error ImageBufferError::InvalidBufferSize. I expected that an oversize buffer would not cause an error.

For comparison, the image crate's "equivalent" type ImageBuffer::<Luma, &[u8]> does accept buffers which are oversized.

(It is easy to slice the buffer down to the right size before passing it into this crate, but it would be nice if this was not necessary)

(P.S. This crate is very fast :) -- it is nice to be able to resize frames in rust with competetive speed to resizing inside the Gstreamer pipeline)

Cykooz commented 2 years ago

Fixed in v0.8