aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.bp1
-rw-r--r--libAACdec/src/aacdecoder_lib.cpp19
-rw-r--r--libFDK/src/FDK_decorrelate.cpp18
3 files changed, 29 insertions, 9 deletions
diff --git a/Android.bp b/Android.bp
index 50cc092..b322d07 100644
--- a/Android.bp
+++ b/Android.bp
@@ -22,6 +22,7 @@ cc_library_static {
"-Wno-#warnings",
"-Wuninitialized",
"-Wno-self-assign",
+ "-Wno-implicit-fallthrough",
],
sanitize: {
misc_undefined:["unsigned-integer-overflow", "signed-integer-overflow"],
diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp
index 86f4a6c..705f758 100644
--- a/libAACdec/src/aacdecoder_lib.cpp
+++ b/libAACdec/src/aacdecoder_lib.cpp
@@ -368,6 +368,23 @@ static INT aacDecoder_CtrlCFGChangeCallback(
return errTp;
}
+static INT aacDecoder_SbrCallback(
+ void *handle, HANDLE_FDK_BITSTREAM hBs, const INT sampleRateIn,
+ const INT sampleRateOut, const INT samplesPerFrame,
+ const AUDIO_OBJECT_TYPE coreCodec, const MP4_ELEMENT_ID elementID,
+ const INT elementIndex, const UCHAR harmonicSBR,
+ const UCHAR stereoConfigIndex, const UCHAR configMode, UCHAR *configChanged,
+ const INT downscaleFactor) {
+ HANDLE_SBRDECODER self = (HANDLE_SBRDECODER)handle;
+
+ INT errTp = sbrDecoder_Header(self, hBs, sampleRateIn, sampleRateOut,
+ samplesPerFrame, coreCodec, elementID,
+ elementIndex, harmonicSBR, stereoConfigIndex,
+ configMode, configChanged, downscaleFactor);
+
+ return errTp;
+}
+
static INT aacDecoder_SscCallback(void *handle, HANDLE_FDK_BITSTREAM hBs,
const AUDIO_OBJECT_TYPE coreCodec,
const INT samplingRate,
@@ -961,7 +978,7 @@ LINKSPEC_CPP HANDLE_AACDECODER aacDecoder_Open(TRANSPORT_TYPE transportFmt,
goto bail;
}
aacDec->qmfModeUser = NOT_DEFINED;
- transportDec_RegisterSbrCallback(aacDec->hInput, (cbSbr_t)sbrDecoder_Header,
+ transportDec_RegisterSbrCallback(aacDec->hInput, aacDecoder_SbrCallback,
(void *)aacDec->hSbrDecoder);
if (mpegSurroundDecoder_Open(
diff --git a/libFDK/src/FDK_decorrelate.cpp b/libFDK/src/FDK_decorrelate.cpp
index 8e665b7..c5de79a 100644
--- a/libFDK/src/FDK_decorrelate.cpp
+++ b/libFDK/src/FDK_decorrelate.cpp
@@ -1086,8 +1086,9 @@ static INT DuckerCalcEnergy(DUCKER_INSTANCE *const self,
pb = SpatialDecGetProcessingBand(maxHybBand, self->mapHybBands2ProcBands);
for (qs = startHybBand; qs <= maxHybBand; qs++) {
pb = SpatialDecGetProcessingBand(qs, self->mapHybBands2ProcBands);
- energy[pb] +=
- (fPow2Div2(inputReal[qs] << clz) + fPow2Div2(inputImag[qs] << clz));
+ energy[pb] =
+ fAddSaturate(energy[pb], fPow2Div2(inputReal[qs] << clz) +
+ fPow2Div2(inputImag[qs] << clz));
}
pb++;
@@ -1100,7 +1101,7 @@ static INT DuckerCalcEnergy(DUCKER_INSTANCE *const self,
FIXP_DBL nrg = 0;
qs_next = (int)self->qs_next[pb];
for (; qs < qs_next; qs++) {
- nrg += fPow2Div2(inputReal[qs] << clz);
+ nrg = fAddSaturate(nrg, fPow2Div2(inputReal[qs] << clz));
}
energy[pb] = nrg;
}
@@ -1138,13 +1139,14 @@ static INT DuckerCalcEnergy(DUCKER_INSTANCE *const self,
#else
for (qs = startHybBand; qs <= maxHybBand; qs++) {
int pb = SpatialDecGetProcessingBand(qs, self->mapHybBands2ProcBands);
- energy[pb] +=
- (fPow2Div2(inputReal[qs] << clz) + fPow2Div2(inputImag[qs] << clz));
+ energy[pb] =
+ fAddSaturate(energy[pb], fPow2Div2(inputReal[qs] << clz) +
+ fPow2Div2(inputImag[qs] << clz));
}
for (; qs <= maxHybridBand; qs++) {
int pb = SpatialDecGetProcessingBand(qs, self->mapHybBands2ProcBands);
- energy[pb] += fPow2Div2(inputReal[qs] << clz);
+ energy[pb] = fAddSaturate(energy[pb], fPow2Div2(inputReal[qs] << clz));
}
#endif /* FUNCTION_DuckerCalcEnergy_func4 */
}
@@ -1237,9 +1239,9 @@ static INT DuckerApply(DUCKER_INSTANCE *const self,
tmp1 = scaleValue(tmp1, scaleSmoothDirRevNrg_asExponent);
tmp2 = scaleValue(tmp2, scaleSmoothDirRevNrg_asExponent);
- tmp1 = fMultAddDiv2(tmp1, directNrg[pb] >> scaleDirectNrg,
+ tmp1 = fMultAddDiv2(tmp1, scaleValue(directNrg[pb], -scaleDirectNrg),
DUCK_ONE_MINUS_ALPHA_X4_FDK);
- tmp2 = fMultAddDiv2(tmp2, reverbNrg[pb] >> scaleReverbNrg,
+ tmp2 = fMultAddDiv2(tmp2, scaleValue(reverbNrg[pb], -scaleReverbNrg),
DUCK_ONE_MINUS_ALPHA_X4_FDK);
} else {
tmp1 = fMultAddDiv2(tmp1, directNrg[pb], DUCK_ONE_MINUS_ALPHA_X4_FDK);