]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/sbrdsp_fixed.c
avcodec/vorbis: Fix another 1 << 31 > int32_t::max() with 1u.
[ffmpeg] / libavcodec / sbrdsp_fixed.c
index 896b2d75c6c6c09df8c297fc05420024fb194eeb..57d98da97997f3f0b743963c57e97a9b019d1d6e 100644 (file)
@@ -133,7 +133,7 @@ static av_always_inline SoftFloat autocorr_calc(int64_t accu)
 
         round = 1U << (nz-1);
         mant = (int)((accu + round) >> nz);
-        mant = (mant + 0x40)>>7;
+        mant = (mant + 0x40LL)>>7;
         mant *= 64;
         expo = nz + 15;
         return av_int2sf(mant, 30 - expo);
@@ -244,12 +244,14 @@ static void sbr_hf_g_filt_c(int (*Y)[2], const int (*X_high)[40][2],
     int64_t accu;
 
     for (m = 0; m < m_max; m++) {
-        int64_t r = 1LL << (22-g_filt[m].exp);
-        accu = (int64_t)X_high[m][ixh][0] * ((g_filt[m].mant + 0x40)>>7);
-        Y[m][0] = (int)((accu + r) >> (23-g_filt[m].exp));
+        if (22 - g_filt[m].exp < 61) {
+            int64_t r = 1LL << (22-g_filt[m].exp);
+            accu = (int64_t)X_high[m][ixh][0] * ((g_filt[m].mant + 0x40)>>7);
+            Y[m][0] = (int)((accu + r) >> (23-g_filt[m].exp));
 
-        accu = (int64_t)X_high[m][ixh][1] * ((g_filt[m].mant + 0x40)>>7);
-        Y[m][1] = (int)((accu + r) >> (23-g_filt[m].exp));
+            accu = (int64_t)X_high[m][ixh][1] * ((g_filt[m].mant + 0x40)>>7);
+            Y[m][1] = (int)((accu + r) >> (23-g_filt[m].exp));
+        }
     }
 }