From ca594df622abae0c59ef735d63f071db983a35f7 Mon Sep 17 00:00:00 2001 From: Manuel Stoeckl Date: Thu, 23 Sep 2021 23:22:29 -0400 Subject: swscale/yuv2rgb: fix conversion to X2RGB10 This resolves a problem where conversions from YUV to X2RGB10LE would produce color values a factor 4 too small, because an 8-bit value was placed in a 10-bit channel. Signed-off-by: Manuel Stoeckl Signed-off-by: Michael Niedermayer --- libswscale/yuv2rgb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libswscale/yuv2rgb.c') diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index cac82f4c6f..c2e8d4894c 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -976,7 +976,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], y_table32 = c->yuvTable; yb = -(384 << 16) - YUVRGB_TABLE_LUMA_HEADROOM*cy - oy; for (i = 0; i < table_plane_size; i++) { - unsigned yval = av_clip_uint8((yb + 0x8000) >> 16); + unsigned yval = av_clip_uintp2((yb + 0x8000) >> 14, 10); y_table32[i]= (yval << rbase) + (needAlpha ? 0 : (255u << abase)); y_table32[i + table_plane_size] = yval << gbase; y_table32[i + 2 * table_plane_size] = yval << bbase; -- cgit v1.2.3