aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-09-28 04:26:06 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-07-02 10:43:52 +0200
commitd5f9f2ded0ccadc68e84fb20b0dbc2a59e250999 (patch)
tree0e240b8a4d0046cecdc9c5b1f1ff42dc18ac4373
parent6bae72ff8509fade57aec03b7ea43f3d8bbbac32 (diff)
downloadffmpeg-d5f9f2ded0ccadc68e84fb20b0dbc2a59e250999.tar.gz
avcodec/dnxhdenc: Fix undefined left shifts of negative numbers
Affected 61 FATE-tests: 60 vsynth tests and lavf-mxf_opatom. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit b7f156e8cbdf3256c7860c62ebb7a6c3002cbb03) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavcodec/dnxhdenc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 86e71ca8b0..831b491682 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -220,7 +220,7 @@ static av_cold int dnxhd_init_vlc(DNXHDEncContext *ctx)
ctx->vlc_bits += max_level * 2;
for (level = -max_level; level < max_level; level++) {
for (run = 0; run < 2; run++) {
- int index = (level << 1) | run;
+ int index = level * (1 << 1) | run;
int sign, offset = 0, alevel = level;
MASK_ABS(sign, alevel);
@@ -610,7 +610,7 @@ void dnxhd_encode_block(DNXHDEncContext *ctx, int16_t *block,
slevel = block[j];
if (slevel) {
int run_level = i - last_non_zero - 1;
- int rlevel = (slevel << 1) | !!run_level;
+ int rlevel = slevel * (1 << 1) | !!run_level;
put_bits(&ctx->m.pb, ctx->vlc_bits[rlevel], ctx->vlc_codes[rlevel]);
if (run_level)
put_bits(&ctx->m.pb, ctx->run_bits[run_level],
@@ -690,7 +690,7 @@ int dnxhd_calc_ac_bits(DNXHDEncContext *ctx, int16_t *block, int last_index)
level = block[j];
if (level) {
int run_level = i - last_non_zero - 1;
- bits += ctx->vlc_bits[(level << 1) |
+ bits += ctx->vlc_bits[level * (1 << 1) |
!!run_level] + ctx->run_bits[run_level];
last_non_zero = i;
}