summaryrefslogtreecommitdiffstats
path: root/libAACenc/src/band_nrg.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2012-10-02 10:16:04 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2012-10-02 10:46:47 -0700
commit6ab36997af5d5acda4f21d33031f4e45c85f96b7 (patch)
tree4696e6feca7d1243bb9e90da7699b00d8f026441 /libAACenc/src/band_nrg.cpp
parented8b5a747e97c9b8b029ba6485e33f3aad081652 (diff)
downloadfdk-aac-dabplus-6ab36997af5d5acda4f21d33031f4e45c85f96b7.tar.gz
fdk-aac-dabplus-6ab36997af5d5acda4f21d33031f4e45c85f96b7.tar.bz2
fdk-aac-dabplus-6ab36997af5d5acda4f21d33031f4e45c85f96b7.zip
Bug 7170947 Update AAC codec
From Fraunhofer: * AAC Decoder - Stick to the written MPEG standard instead of the MPEG reference software in terms of reference level normalization. Always set the program reference level equal to the target level. This disables level normalization using a default level for streams without embedded metadata. Modified file(s): libAACdec\src\aacdec_drc.cpp - Fix downmix channel assignment when using a WAV output channel ordering. Modified file(s): libPCMutils\src\pcmutils_lib.cpp - Retain signal accuracy and prevent LSB alteration when no level correction needs to be done. Modified file(s): libAACdec\src\aacdec_drc.h libAACdec\src\aacdec_drc.cpp libSBRdec\src\sbrdecoder.cpp libSBRdec\src\sbr_dec.cpp libSBRdec\src\sbrdec_drc.cpp - Align metadata processing with reference implementation. Modified file(s): libAACdec\src\aacdec_drc.h libAACdec\src\aacdecoder.cpp * AAC-Encoder - Prevent potential overflow in energy calculation after TNS processing. Modified file(s): libAACenc\src\band_nrg.cpp - Added saturation for number of relevant lines which are used in pe calculation. Modified file(s): libAACenc\src\line_pe.cpp - Removed obsolete files. Deleded file(s): libAACenc\src\tns_param.h libAACenc\src\tns_param.cpp * FDK-Library - Added x86 Count Leading Zeros intrinsic. Modified file(s): libFDK\include\clz.h Added file(s): libFDK\include\x86\clz_x86.h - Fixed compilation for MIPS GCC-4.4 and higher. Modified file(s): libFDK\include\mips\cplx_mul.h libFDK\include\mips\fixmul_mips.h Change-Id: I4be65f07f88d412224c7fddc3f054e8f451176cc
Diffstat (limited to 'libAACenc/src/band_nrg.cpp')
-rw-r--r--libAACenc/src/band_nrg.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/libAACenc/src/band_nrg.cpp b/libAACenc/src/band_nrg.cpp
index 458aa9c..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] = 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))