diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-29 12:06:51 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-29 12:16:08 +0200 |
commit | e1b0019568430ee80c3bb474829897700ef31f1c (patch) | |
tree | 936714f072231a9b40e7822174634af10bf41dbd /libavformat | |
parent | 4b8b3efb1e40ba028c31a0e8747867f9240cc755 (diff) | |
download | ffmpeg-e1b0019568430ee80c3bb474829897700ef31f1c.tar.gz |
avformat/mov: Avoid float usage in yuv_to_rgba()
This avoids the possibility for rounding/precision differences between platforms
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mov.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 51cdd21abd..60729343dd 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1711,9 +1711,9 @@ static uint32_t yuv_to_rgba(uint32_t ycbcr) cr = (ycbcr >> 8) & 0xFF; cb = ycbcr & 0xFF; - b = av_clip_uint8(1.164 * (y - 16) + 2.018 * (cb - 128)); - g = av_clip_uint8(1.164 * (y - 16) - 0.813 * (cr - 128) - 0.391 * (cb - 128)); - r = av_clip_uint8(1.164 * (y - 16) + 1.596 * (cr - 128)); + b = av_clip_uint8((1164 * (y - 16) + 2018 * (cb - 128)) / 1000); + g = av_clip_uint8((1164 * (y - 16) - 813 * (cr - 128) - 391 * (cb - 128)) / 1000); + r = av_clip_uint8((1164 * (y - 16) + 1596 * (cr - 128) ) / 1000); return (r << 16) | (g << 8) | b; } |