Skip to content

Commit bb41724

Browse files
elmarcoCBenoit
authored andcommitted
test: use the XRGB sample from the spec
It's unclear where the RGB_BUFFER was coming from, it's better to use the one from the spec, like the YCBCR buffers. Unfortunately, we don't match with the reference data after conversion. This doesn't seem a big issue in practice. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
1 parent d7ba22f commit bb41724

File tree

2 files changed

+894
-870
lines changed

2 files changed

+894
-870
lines changed

crates/ironrdp-graphics/src/color_conversion.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
use std::io;
22

33
use yuvutils_rs::{
4-
rdp_abgr_to_yuv444, rdp_argb_to_yuv444, rdp_bgra_to_yuv444, rdp_rgba_to_yuv444, rdp_yuv444_to_bgra, BufferStoreMut,
5-
YuvPlanarImage, YuvPlanarImageMut,
4+
rdp_abgr_to_yuv444, rdp_argb_to_yuv444, rdp_bgra_to_yuv444, rdp_rgba_to_yuv444, rdp_yuv444_to_argb,
5+
rdp_yuv444_to_bgra, BufferStoreMut, YuvPlanarImage, YuvPlanarImageMut,
66
};
77

88
use crate::image_processing::PixelFormat;
99

10+
// FIXME: used for the test suite, we may want to drop it
11+
pub fn ycbcr_to_argb(input: YCbCrBuffer<'_>, output: &mut [u8]) -> io::Result<()> {
12+
let len = u32::try_from(output.len()).map_err(io::Error::other)?;
13+
let width = len / 4;
14+
let planar = YuvPlanarImage {
15+
y_plane: input.y,
16+
y_stride: width,
17+
u_plane: input.cb,
18+
u_stride: width,
19+
v_plane: input.cr,
20+
v_stride: width,
21+
width,
22+
height: 1,
23+
};
24+
rdp_yuv444_to_argb(&planar, output, len).map_err(io::Error::other)
25+
}
26+
1027
pub fn ycbcr_to_bgra(input: YCbCrBuffer<'_>, output: &mut [u8]) -> io::Result<()> {
1128
let len = u32::try_from(output.len()).map_err(io::Error::other)?;
1229
let width = len / 4;

0 commit comments

Comments
 (0)