]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/dcaenc: Fix undefined left shift of negative numbers
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 26 Mar 2021 05:03:49 +0000 (06:03 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Thu, 1 Apr 2021 12:01:47 +0000 (14:01 +0200)
Affected the acodec-dca and acodec-dca2 FATE tests.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/dcaenc.c

index 63e6dfb7802bf899523e0d6c047d18a11f2bcb73..12aa7e0df24c9814d4e6bfb2711d1b6600e91217 100644 (file)
@@ -925,10 +925,10 @@ static void fill_in_adpcm_bufer(DCAEncContext *c)
              * But there are no proper value in decoder history, so likely result will be no good.
              * Bitstream has "Predictor history flag switch", but this flag disables history for all subbands
              */
-            samples[0] = c->adpcm_history[ch][band][0] << 7;
-            samples[1] = c->adpcm_history[ch][band][1] << 7;
-            samples[2] = c->adpcm_history[ch][band][2] << 7;
-            samples[3] = c->adpcm_history[ch][band][3] << 7;
+            samples[0] = c->adpcm_history[ch][band][0] * (1 << 7);
+            samples[1] = c->adpcm_history[ch][band][1] * (1 << 7);
+            samples[2] = c->adpcm_history[ch][band][2] * (1 << 7);
+            samples[3] = c->adpcm_history[ch][band][3] * (1 << 7);
         }
      }
 }