summaryrefslogtreecommitdiffstats
path: root/libAACenc/src/quantize.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libAACenc/src/quantize.cpp')
-rw-r--r--libAACenc/src/quantize.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libAACenc/src/quantize.cpp b/libAACenc/src/quantize.cpp
index da6f85e..5380e35 100644
--- a/libAACenc/src/quantize.cpp
+++ b/libAACenc/src/quantize.cpp
@@ -127,7 +127,7 @@ static void FDKaacEnc_quantizeLines(INT gain,
accu = fMultDiv2(FDKaacEnc_mTab_3_4[tabIndex],FDKaacEnc_quantTableE[totalShift&3]);
totalShift = (16-4)-(3*(totalShift>>2));
FDK_ASSERT(totalShift >=0); /* MAX_QUANT_VIOLATION */
- accu>>=totalShift;
+ accu >>= fixMin(totalShift,DFRACT_BITS-1);
quaSpectrum[line] = (SHORT)(-((LONG)(k + accu) >> (DFRACT_BITS-1-16)));
}
else if(accu > FL2FXCONST_DBL(0.0f))
@@ -140,7 +140,7 @@ static void FDKaacEnc_quantizeLines(INT gain,
accu = fMultDiv2(FDKaacEnc_mTab_3_4[tabIndex],FDKaacEnc_quantTableE[totalShift&3]);
totalShift = (16-4)-(3*(totalShift>>2));
FDK_ASSERT(totalShift >=0); /* MAX_QUANT_VIOLATION */
- accu>>=totalShift;
+ accu >>= fixMin(totalShift,DFRACT_BITS-1);
quaSpectrum[line] = (SHORT)((LONG)(k + accu) >> (DFRACT_BITS-1-16));
}
else