Skip to content

Commit a5e7a8e

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 d5a81a1 commit a5e7a8e

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
@@ -164,11 +164,15 @@ pub fn to_64x64_ycbcr_tile(
164164
assert!(width <= 64);
165165
assert!(height <= 64);
166166

167-
let to_rgb = pixel_format_to_rgb_fn(format);
168167
let bpp = format.bytes_per_pixel() as usize;
169168

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

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

0 commit comments

Comments
 (0)