Skip to content

Commit bc30582

Browse files
committed
refactor(graphics): use fixed-size slices in to_64x64_ycbcr_tile
In theory, this could help the compiler to unroll loops.. doesn't seem to be the case though. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
1 parent d41d3a1 commit bc30582

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

crates/ironrdp-graphics/src/color_conversion.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,12 @@ pub fn to_64x64_ycbcr_tile(
135135
height: usize,
136136
stride: usize,
137137
format: PixelFormat,
138-
y: &mut [i16],
139-
cb: &mut [i16],
140-
cr: &mut [i16],
138+
y: &mut [i16; 64 * 64],
139+
cb: &mut [i16; 64 * 64],
140+
cr: &mut [i16; 64 * 64],
141141
) {
142142
assert!(width <= 64);
143143
assert!(height <= 64);
144-
assert_eq!(y.len(), 64 * 64);
145-
assert_eq!(cb.len(), 64 * 64);
146-
assert_eq!(cr.len(), 64 * 64);
147144

148145
let to_rgb = pixel_format_to_rgb_fn(format);
149146
let bpp = format.bytes_per_pixel() as usize;

crates/ironrdp-testsuite-core/tests/graphics/color_conversion.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use ironrdp_graphics::{color_conversion::*, image_processing::PixelFormat};
44
fn to_64x64_ycbcr() {
55
let input = [0u8; 4];
66

7-
let mut y = vec![0; 4096];
8-
let mut cb = vec![0; 4096];
9-
let mut cr = vec![0; 4096];
7+
let mut y = [0; 64 * 64];
8+
let mut cb = [0; 64 * 64];
9+
let mut cr = [0; 64 * 64];
1010
to_64x64_ycbcr_tile(&input, 1, 1, 4, PixelFormat::ABgr32, &mut y, &mut cb, &mut cr);
1111
}
1212

0 commit comments

Comments
 (0)