[FFmpeg-devel] [PATCH] swscale/yuv2rgb: fix shift values for conversion to X2RGB10

Michael Niedermayer michael at niedermayer.cc
Wed Sep 22 19:53:36 EEST 2021


On Mon, Sep 20, 2021 at 10:21:23PM -0400, Manuel Stoeckl wrote:
> This resolves a problem where conversions from YUV to X2RGB10LE
> would produce color values a factor 4 too small.
> 
> The variable 'yval' used later in the switch case 30 has range
> [0,255], but the color channel values in X2RGB10 have two more
> bits than 'yval' and can go up to 1023. Increasing (r|g|b)base
> by 2 effectively multiplies yval by 4 and fixes this discrepancy.

does white have 1023 ? or 1020 ?
a multiplication by 4 would not in general produce a correctly scaled 10bit
per channel value from 8bit

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210922/b4851569/attachment.sig>


More information about the ffmpeg-devel mailing list