Skip to content

Commit e9825d7

Browse files
committed
perf(graphics): help Rust to inline iter_to_ycbcr with format
rgb2yuv time: [11.706 µs 11.716 µs 11.727 µs] change: [-24.083% -23.682% -23.394%] (p = 0.00 < 0.05) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
1 parent 876e91d commit e9825d7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/ironrdp-graphics/src/color_conversion.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,15 @@ pub fn to_64x64_ycbcr_tile(
165165
assert!(width <= 64);
166166
assert!(height <= 64);
167167

168-
let to_rgb = pixel_format_to_rgb_fn(format);
169168
let bpp = format.bytes_per_pixel() as usize;
170169

171170
let input = TileIterator::new(input, width, height, stride, bpp);
172-
iter_to_ycbcr::<4096, _, _>(input, y, cb, cr, to_rgb);
171+
match format {
172+
PixelFormat::ARgb32 | PixelFormat::XRgb32 => iter_to_ycbcr::<4096, _, _>(input, y, cb, cr, xrgb_to_rgb),
173+
PixelFormat::ABgr32 | PixelFormat::XBgr32 => iter_to_ycbcr::<4096, _, _>(input, y, cb, cr, xbgr_to_rgb),
174+
PixelFormat::BgrA32 | PixelFormat::BgrX32 => iter_to_ycbcr::<4096, _, _>(input, y, cb, cr, bgrx_to_rgb),
175+
PixelFormat::RgbA32 | PixelFormat::RgbX32 => iter_to_ycbcr::<4096, _, _>(input, y, cb, cr, rgbx_to_rgb),
176+
};
173177
}
174178

175179
/// Convert a 16-bit RDP color to RGB representation. Input value should be represented in

0 commit comments

Comments
 (0)