refactor(graphics): use an ExactSizeIterator for iter_to_ycbcr

Unfortunately, that doesn't seem to help unrolling & vectorizing: no
perf improvements.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau
2024-11-05 20:16:43 +09:00
committed by Benoît Cortier
parent 4583de2c42
commit d0bacffc27
@@ -17,7 +17,7 @@ pub fn ycbcr_to_bgra(input: YCbCrBuffer<'_>, mut output: &mut [u8]) -> io::Resul
fn iter_to_ycbcr<'a, I, C>(input: I, y: &mut [i16], cb: &mut [i16], cr: &mut [i16], conv: C)
where
I: IntoIterator<Item = &'a [u8]>,
I: ExactSizeIterator<Item = &'a [u8]>,
C: Fn(&[u8]) -> Rgb,
{
for (i, pixel) in input.into_iter().enumerate() {
@@ -144,6 +144,12 @@ impl<'a> Iterator for TileIterator<'a> {
}
}
impl ExactSizeIterator for TileIterator<'_> {
fn len(&self) -> usize {
64 * 64
}
}
#[allow(clippy::too_many_arguments)]
pub fn to_64x64_ycbcr_tile(
input: &[u8],