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>
This commit is contained in:
Marc-André Lureau
2024-11-05 20:16:43 +09:00
committed by Benoît Cortier
parent d0bacffc27
commit 2a4d357d27
@@ -164,11 +164,15 @@ pub fn to_64x64_ycbcr_tile(
assert!(width <= 64);
assert!(height <= 64);
let to_rgb = pixel_format_to_rgb_fn(format);
let bpp = format.bytes_per_pixel() as usize;
let input = TileIterator::new(input, width, height, stride, bpp);
iter_to_ycbcr(input, y, cb, cr, to_rgb);
match format {
PixelFormat::ARgb32 | PixelFormat::XRgb32 => iter_to_ycbcr(input, y, cb, cr, xrgb_to_rgb),
PixelFormat::ABgr32 | PixelFormat::XBgr32 => iter_to_ycbcr(input, y, cb, cr, xbgr_to_rgb),
PixelFormat::BgrA32 | PixelFormat::BgrX32 => iter_to_ycbcr(input, y, cb, cr, bgrx_to_rgb),
PixelFormat::RgbA32 | PixelFormat::RgbX32 => iter_to_ycbcr(input, y, cb, cr, rgbx_to_rgb),
};
}
/// Convert a 16-bit RDP color to RGB representation. Input value should be represented in