diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-06-01 14:42:00 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-06-01 14:42:00 +0200 |
commit | e0835d4cbde8e3b61b0c965afcd41f8f4b7ac121 (patch) | |
tree | f49619fc806249da71afaf2ac14f99e088d24153 /fdk-aac/libSACdec/src/sac_dec.cpp | |
parent | 5ad4acef6721a67b8156cd6f7b45ad59849ca09b (diff) | |
download | ODR-AudioEnc-e0835d4cbde8e3b61b0c965afcd41f8f4b7ac121.tar.gz ODR-AudioEnc-e0835d4cbde8e3b61b0c965afcd41f8f4b7ac121.tar.bz2 ODR-AudioEnc-e0835d4cbde8e3b61b0c965afcd41f8f4b7ac121.zip |
Update fdk to v2.0.2
Diffstat (limited to 'fdk-aac/libSACdec/src/sac_dec.cpp')
-rw-r--r-- | fdk-aac/libSACdec/src/sac_dec.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/fdk-aac/libSACdec/src/sac_dec.cpp b/fdk-aac/libSACdec/src/sac_dec.cpp index 3f55a7d..a7b50df 100644 --- a/fdk-aac/libSACdec/src/sac_dec.cpp +++ b/fdk-aac/libSACdec/src/sac_dec.cpp @@ -766,7 +766,7 @@ SACDEC_ERROR FDK_SpatialDecInit(spatialDec *self, SPATIAL_BS_FRAME *frame, /* output scaling */ for (nCh = 0; nCh < self->numOutputChannelsAT; nCh++) { - int outputScale = 0, outputGain_e = 0, scale = 0; + int outputScale = 0, outputGain_e = 0, scale = -(8) + (1); FIXP_DBL outputGain_m = getChGain(self, nCh, &outputGain_e); if (!isTwoChMode(self->upmixType) && !bypassMode) { @@ -775,7 +775,7 @@ SACDEC_ERROR FDK_SpatialDecInit(spatialDec *self, SPATIAL_BS_FRAME *frame, synthesis qmf */ } - scale = outputScale; + scale += outputScale; qmfChangeOutScalefactor(&self->pQmfDomain->QmfDomainOut[nCh].fb, scale); qmfChangeOutGain(&self->pQmfDomain->QmfDomainOut[nCh].fb, outputGain_m, @@ -1223,18 +1223,24 @@ static SACDEC_ERROR SpatialDecApplyParameterSets( !(self->stereoConfigIndex == 3)) { for (i = 0; i < self->qmfBands; i++) { self_qmfResidualReal__FDK_0_0[i] = - fMult(self_qmfResidualReal__FDK_0_0[i] << 1, + fMult(scaleValueSaturate(self_qmfResidualReal__FDK_0_0[i], + 1 + self->sacInDataHeadroom - (1)), self->clipProtectGain__FDK); self_qmfResidualImag__FDK_0_0[i] = - fMult(self_qmfResidualImag__FDK_0_0[i] << 1, + fMult(scaleValueSaturate(self_qmfResidualImag__FDK_0_0[i], + 1 + self->sacInDataHeadroom - (1)), self->clipProtectGain__FDK); } } else { for (i = 0; i < self->qmfBands; i++) { - self_qmfResidualReal__FDK_0_0[i] = fMult( - self_qmfResidualReal__FDK_0_0[i], self->clipProtectGain__FDK); - self_qmfResidualImag__FDK_0_0[i] = fMult( - self_qmfResidualImag__FDK_0_0[i], self->clipProtectGain__FDK); + self_qmfResidualReal__FDK_0_0[i] = + fMult(scaleValueSaturate(self_qmfResidualReal__FDK_0_0[i], + self->sacInDataHeadroom - (1)), + self->clipProtectGain__FDK); + self_qmfResidualImag__FDK_0_0[i] = + fMult(scaleValueSaturate(self_qmfResidualImag__FDK_0_0[i], + self->sacInDataHeadroom - (1)), + self->clipProtectGain__FDK); } } } @@ -1317,10 +1323,12 @@ static SACDEC_ERROR SpatialDecApplyParameterSets( if ((self->tempShapeConfig == 1) && (!isTwoChMode(self->upmixType))) { for (ch = 0; ch < self->numOutputChannels; ch++) { for (hyb = 0; hyb < self->tp_hybBandBorder; hyb++) { - self->hybOutputRealDry__FDK[ch][hyb] += - self->hybOutputRealWet__FDK[ch][hyb]; - self->hybOutputImagDry__FDK[ch][hyb] += - self->hybOutputImagWet__FDK[ch][hyb]; + self->hybOutputRealDry__FDK[ch][hyb] = + fAddSaturate(self->hybOutputRealDry__FDK[ch][hyb], + self->hybOutputRealWet__FDK[ch][hyb]); + self->hybOutputImagDry__FDK[ch][hyb] = + fAddSaturate(self->hybOutputImagDry__FDK[ch][hyb], + self->hybOutputImagWet__FDK[ch][hyb]); } /* loop hyb */ } /* loop ch */ err = subbandTPApply( @@ -1341,11 +1349,11 @@ static SACDEC_ERROR SpatialDecApplyParameterSets( FIXP_DBL *RESTRICT pRealWet = self->hybOutputRealWet__FDK[ch]; FIXP_DBL *RESTRICT pImagWet = self->hybOutputImagWet__FDK[ch]; for (hyb = 0; hyb < nHybBands; hyb++) { - pRealDry[hyb] += pRealWet[hyb]; - pImagDry[hyb] += pImagWet[hyb]; + pRealDry[hyb] = fAddSaturate(pRealDry[hyb], pRealWet[hyb]); + pImagDry[hyb] = fAddSaturate(pImagDry[hyb], pImagWet[hyb]); } /* loop hyb */ for (; hyb < self->hybridBands; hyb++) { - pRealDry[hyb] += pRealWet[hyb]; + pRealDry[hyb] = fAddSaturate(pRealDry[hyb], pRealWet[hyb]); } /* loop hyb */ } /* loop ch */ } /* ( self->tempShapeConfig == 1 ) || ( self->tempShapeConfig == 2 ) */ @@ -1414,6 +1422,7 @@ SACDEC_ERROR SpatialDecApplyFrame( FDK_ASSERT(self != NULL); FDK_ASSERT(pControlFlags != NULL); FDK_ASSERT(pcmOutBuf != NULL); + FDK_ASSERT(self->sacInDataHeadroom >= (1)); self->errInt = err; /* Init internal error */ |