[FFmpeg-devel,10/15] swscale/utils: Fix invalid left shifts of negative numbers

Submitted by Andreas Rheinhardt on Sept. 24, 2019, 10:03 p.m.

Details

Message ID 20190924220310.31157-11-andreas.rheinhardt@gmail.com
State New
Headers show

Commit Message

Andreas Rheinhardt Sept. 24, 2019, 10:03 p.m.
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@gmail.com>
---
 libswscale/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libswscale/utils.c b/libswscale/utils.c
index 1b1f779532..4249e0bb78 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -390,7 +390,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(FFLSHIFT((int64_t)xx, 16) - xDstInSrc)*(fone>>16);
                 if (coeff < 0)
                     coeff = 0;
                 filter[i * filterSize + j] = coeff;