diff options
author | Martin Storsjo <martin@martin.st> | 2012-11-01 11:08:03 +0200 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2012-11-01 11:08:03 +0200 |
commit | 54dfe1ec6972ca0d56dcb671448f84fea5e37e35 (patch) | |
tree | 5d26aa077f3aa32d3e5113546abc5a4219332640 /libAACenc/src/band_nrg.cpp | |
parent | fea3c1d0ffaf5975bb15462e11edf9c7a664890d (diff) | |
parent | 6ab36997af5d5acda4f21d33031f4e45c85f96b7 (diff) | |
download | fdk-aac-dabplus-54dfe1ec6972ca0d56dcb671448f84fea5e37e35.tar.gz fdk-aac-dabplus-54dfe1ec6972ca0d56dcb671448f84fea5e37e35.tar.bz2 fdk-aac-dabplus-54dfe1ec6972ca0d56dcb671448f84fea5e37e35.zip |
Merge remote-tracking branch 'aosp/jb-mr1-release' into master
Conflicts:
libAACenc/src/band_nrg.cpp
libAACenc/src/grp_data.cpp
libSBRenc/src/env_est.cpp
Diffstat (limited to 'libAACenc/src/band_nrg.cpp')
-rw-r--r-- | libAACenc/src/band_nrg.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libAACenc/src/band_nrg.cpp b/libAACenc/src/band_nrg.cpp index c672c6c..0e46b45 100644 --- a/libAACenc/src/band_nrg.cpp +++ b/libAACenc/src/band_nrg.cpp @@ -260,21 +260,21 @@ FDKaacEnc_CalcBandEnergyOptimShort(const FIXP_DBL *RESTRICT mdctSpectrum, for(i=0; i<numBands; i++) { - int leadingBits = fixMax(0,sfbMaxScaleSpec[i]-4); /* max sfbWidth = 96 ; 2^7=128 => 7/2 = 4 (spc*spc) */ + int leadingBits = sfbMaxScaleSpec[i]-3; /* max sfbWidth = 36 ; 2^6=64 => 6/2 = 3 (spc*spc) */ FIXP_DBL tmp = FL2FXCONST_DBL(0.0); for (j=bandOffset[i];j<bandOffset[i+1];j++) { - FIXP_DBL spec = mdctSpectrum[j]<<leadingBits; + FIXP_DBL spec = scaleValue(mdctSpectrum[j],leadingBits); tmp = fPow2AddDiv2(tmp, spec); } - bandEnergy[i] = scaleValueSaturate(tmp, 1); + bandEnergy[i] = tmp; } for(i=0; i<numBands; i++) { - INT scale = 2*fixMax(0,sfbMaxScaleSpec[i]-4); /* max sfbWidth = 96 ; 2^7=128 => 7/2 = 4 (spc*spc) */ - scale = fixMin(scale,(DFRACT_BITS-1)); - bandEnergy[i] >>= scale; + INT scale = (2*(sfbMaxScaleSpec[i]-3))-1; /* max sfbWidth = 36 ; 2^6=64 => 6/2 = 3 (spc*spc) */ + scale = fixMax(fixMin(scale,(DFRACT_BITS-1)),-(DFRACT_BITS-1)); + bandEnergy[i] = scaleValueSaturate(bandEnergy[i], -scale); } } @@ -343,7 +343,7 @@ void FDKaacEnc_CalcBandNrgMSOpt(const FIXP_DBL *RESTRICT mdctSpectrumLeft, { /* using the minimal scaling of left and right channel can cause very small energies; check ldNrg before subtract scaling multiplication: fract*INT we don't need fMult */ - + int minus = scale*FL2FXCONST_DBL(1.0/64); if (bandEnergyMidLdData[i] != FL2FXCONST_DBL(-1.0f)) |