From 39b60359dbf7936eb1ef6a05b76ea7d821d115f5 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 21 Jan 2020 01:23:47 +0100 Subject: avcodec/j2kenc: Fix undefined shifts of negative numbers Also add parentheses to some lines to make the operator precedence clearer. This affected the FATE-tests vsynth*-jpeg2000 and vsynth*-jpeg2000-97 (where * ranges over { 1, 2, 3, _lena }) as well as ticket #7983. Signed-off-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer --- libavcodec/j2kenc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libavcodec/j2kenc.c') diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c index e91d932bb7..38643c9a28 100644 --- a/libavcodec/j2kenc.c +++ b/libavcodec/j2kenc.c @@ -521,13 +521,13 @@ static void init_luts(void) mask = ~((1<> (NMSEDEC_BITS-2)&2) + 1; - lut_nmsedec_ref[i] = FFMAX((-2*i + (1<i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x] << NMSEDEC_FRACBITS; + *ptr++ = comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x] * (1 << NMSEDEC_FRACBITS); } } } else{ -- cgit v1.2.3