Skip to main content

downsample_average_f32

Function downsample_average_f32 

Source
pub fn downsample_average_f32(
    src: &[f32],
    src_width: usize,
    src_height: usize,
    dst: &mut [f32],
    dst_width: usize,
    dst_height: usize,
) -> Result<()>
Expand description

Downsample using area averaging (for antialiasing)

When downsampling, this method averages pixels in the source region to produce smoother results with less aliasing.

§Arguments

  • src - Source image data (row-major)
  • src_width - Source image width
  • src_height - Source image height
  • dst - Destination buffer (must be dst_width * dst_height)
  • dst_width - Destination width
  • dst_height - Destination height

§Errors

Returns an error if buffer sizes don’t match dimensions or upsampling is attempted