[FFmpeg-devel] [PATCH 3/3] swscale/output: Fix several invalid shifts in yuv2rgb_full_1_c_template()

Michael Niedermayer michael at niedermayer.cc
Wed Jan 22 00:14:54 EET 2020


Fixes: Invalid shifts
Fixes: #8320

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libswscale/output.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index d192ea854b..439de04a05 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2111,8 +2111,8 @@ yuv2rgb_full_1_c_template(SwsContext *c, const int16_t *buf0,
         int A = 0; //init to silence warning
         for (i = 0; i < dstW; i++) {
             int Y = buf0[i] << 2;
-            int U = (ubuf0[i] + ubuf1[i] - (128<<8)) << 1;
-            int V = (vbuf0[i] + vbuf1[i] - (128<<8)) << 1;
+            int U = (ubuf0[i] + ubuf1[i] - (128<<8)) * 2;
+            int V = (vbuf0[i] + vbuf1[i] - (128<<8)) * 2;
 
             if (hasAlpha) {
                 A = (abuf0[i] + 64) >> 7;
-- 
2.25.0



More information about the ffmpeg-devel mailing list