[FFmpeg-cvslog] swscale/utils: Fix invalid left shifts of negative numbers

Andreas Rheinhardt git at videolan.org
Fri Jul 3 20:31:06 EEST 2020


ffmpeg | branch: release/3.2 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sat Sep 28 04:26:02 2019 +0200| [c690866ee009ae2b93d839bb85f67624d218d657] | committer: Andreas Rheinhardt

swscale/utils: Fix invalid left shifts of negative numbers

Affected the FATE-tests vsynth_lena-dv-411, vsynth1-dv-411,
vsynth2-dv-411 and hevc-paramchange-yuv420p.yuv420p10.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit e2646e23be69bdef1e41d4decee1a4298701b8d1)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c690866ee009ae2b93d839bb85f67624d218d657
---

 libswscale/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index 0aef672041..030ffc1e1b 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -372,7 +372,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
             (*filterPos)[i] = xx;
             // bilinear upscale / linear interpolate / area averaging
             for (j = 0; j < filterSize; j++) {
-                int64_t coeff= fone - FFABS(((int64_t)xx<<16) - xDstInSrc)*(fone>>16);
+                int64_t coeff = fone - FFABS((int64_t)xx * (1 << 16) - xDstInSrc) * (fone >> 16);
                 if (coeff < 0)
                     coeff = 0;
                 filter[i * filterSize + j] = coeff;



More information about the ffmpeg-cvslog mailing list