Skip to content

Commit 2ca483d

Browse files
committed
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>
1 parent 5c65f1a commit 2ca483d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/ironrdp-graphics/src/color_conversion.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn ycbcr_to_bgra(input: YCbCrBuffer<'_>, mut output: &mut [u8]) -> io::Resul
1717

1818
fn iter_to_ycbcr<'a, I, C>(input: I, y: &mut [i16], cb: &mut [i16], cr: &mut [i16], conv: C)
1919
where
20-
I: IntoIterator<Item = &'a [u8]>,
20+
I: ExactSizeIterator<Item = &'a [u8]>,
2121
C: Fn(&[u8]) -> Rgb,
2222
{
2323
for (i, pixel) in input.into_iter().enumerate() {
@@ -144,6 +144,12 @@ impl<'a> Iterator for TileIterator<'a> {
144144
}
145145
}
146146

147+
impl ExactSizeIterator for TileIterator<'_> {
148+
fn len(&self) -> usize {
149+
64 * 64
150+
}
151+
}
152+
147153
#[allow(clippy::too_many_arguments)]
148154
pub fn to_64x64_ycbcr_tile(
149155
input: &[u8],

0 commit comments

Comments
 (0)