exr::image::read::specific_channels

Function read_and_convert_all_samples_batched

Source
fn read_and_convert_all_samples_batched<'t, From, To>(
    in_bytes: impl Read,
    out_samples: &mut impl ExactSizeIterator<Item = &'t mut To>,
    convert_batch: fn(_: &[From], _: &mut [To]),
)
where From: Data + Default + Copy, To: 't + Default + Copy,
Expand description

Does the same as convert_batch(in_bytes.chunks().map(From::from_bytes)), but vectorized. Reads the samples for one line, using the sample type specified in the file, and then converts those to the desired sample types. Uses batches to allow vectorization, converting multiple values with one instruction.