summaryrefslogtreecommitdiff
path: root/libswscale
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2021-09-23 23:22:29 -0400
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-26 16:26:10 +0200
commitca594df622abae0c59ef735d63f071db983a35f7 (patch)
treed401f85ff70c20dbe2f6f724214cd1843c83861a /libswscale
parent78ec2f3bd70a3f065967b68b0ddc51ba3f552410 (diff)
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 <code@mstoeckl.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/yuv2rgb.c2
1 files changed, 1 insertions, 1 deletions
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;