/** * struct pixel_yuv_u8 - Internal representation of a pixel color. * @y: Luma value, stored in 8 bits, without padding, using * machine endianness * @u: Blue difference chroma value, stored in 8 bits, without padding, using * machine endianness * @v: Red difference chroma value, stored in 8 bits, without padding, using * machine endianness
*/ struct pixel_yuv_u8 {
u8 y, u, v;
};
/* * struct yuv_u8_to_argb_u16_case - Reference values to test the color * conversions in VKMS between YUV to ARGB * * @encoding: Encoding used to convert RGB to YUV * @range: Range used to convert RGB to YUV * @n_colors: Count of test colors in this case * @format_pair.name: Name used for this color conversion, used to * clarify the test results * @format_pair.rgb: RGB color tested * @format_pair.yuv: Same color as @format_pair.rgb, but converted to * YUV using @encoding and @range.
*/ struct yuv_u8_to_argb_u16_case { enum drm_color_encoding encoding; enum drm_color_range range;
size_t n_colors; struct format_pair { char *name; struct pixel_yuv_u8 yuv; struct pixel_argb_u16 argb;
} colors[TEST_BUFF_SIZE];
};
/* * vkms_format_test_yuv_u8_to_argb_u16 - Testing the conversion between YUV * colors to ARGB colors in VKMS * * This test will use the functions get_conversion_matrix_to_argb_u16 and * argb_u16_from_yuv888 to convert YUV colors (stored in * yuv_u8_to_argb_u16_cases) into ARGB colors. * * The conversion between YUV and RGB is not totally reversible, so there may be * some difference between the expected value and the result. * In addition, there may be some rounding error as the input color is 8 bits * and output color is 16 bits.
*/ staticvoid vkms_format_test_yuv_u8_to_argb_u16(struct kunit *test)
{ conststruct yuv_u8_to_argb_u16_case *param = test->param_value; struct pixel_argb_u16 argb;
for (size_t i = 0; i < param->n_colors; i++) { conststruct format_pair *color = ¶m->colors[i]; struct conversion_matrix matrix;
KUNIT_EXPECT_LE_MSG(test, abs_diff(argb.a, color->argb.a), 0x1ff, "On the A channel of the color %s expected 0x%04x, got 0x%04x",
color->name, color->argb.a, argb.a);
KUNIT_EXPECT_LE_MSG(test, abs_diff(argb.r, color->argb.r), 0x1ff, "On the R channel of the color %s expected 0x%04x, got 0x%04x",
color->name, color->argb.r, argb.r);
KUNIT_EXPECT_LE_MSG(test, abs_diff(argb.g, color->argb.g), 0x1ff, "On the G channel of the color %s expected 0x%04x, got 0x%04x",
color->name, color->argb.g, argb.g);
KUNIT_EXPECT_LE_MSG(test, abs_diff(argb.b, color->argb.b), 0x1ff, "On the B channel of the color %s expected 0x%04x, got 0x%04x",
color->name, color->argb.b, argb.b);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.