aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src
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 /libAACdec/src
parented8b5a747e97c9b8b029ba6485e33f3aad081652 (diff)
downloadfdk-aac-6ab36997af5d5acda4f21d33031f4e45c85f96b7.tar.gz
fdk-aac-6ab36997af5d5acda4f21d33031f4e45c85f96b7.tar.bz2
fdk-aac-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 'libAACdec/src')
-rw-r--r--libAACdec/src/aacdec_drc.cpp38
-rw-r--r--libAACdec/src/aacdec_drc.h5
-rw-r--r--libAACdec/src/aacdecoder.cpp15
-rw-r--r--libAACdec/src/aacdecoder_lib.cpp2
4 files changed, 41 insertions, 19 deletions
diff --git a/libAACdec/src/aacdec_drc.cpp b/libAACdec/src/aacdec_drc.cpp
index c660b83..ebc6975 100644
--- a/libAACdec/src/aacdec_drc.cpp
+++ b/libAACdec/src/aacdec_drc.cpp
@@ -220,8 +220,9 @@ AAC_DECODER_ERROR aacDecoder_drcSetParam (
else {
/* ref_level must be between 0 and MAX_REFERENCE_LEVEL, inclusive */
self->digitalNorm = 1;
- self->progRefLevel = AACDEC_DRC_DEFAULT_REF_LEVEL;
self->params.targetRefLevel = value;
+ self->progRefLevel = (SCHAR)value; /* Set the program reference level equal to the target
+ level according to 4.5.2.7.3 of ISO/IEC 14496-3. */
}
break;
case APPLY_HEAVY_COMPRESSION:
@@ -783,6 +784,7 @@ void aacDecoder_drcApply (
{
int band, top, bin, numBands;
int bottom = 0;
+ int modifyBins = 0;
FIXP_DBL max_mantissa;
INT max_exponent;
@@ -937,6 +939,12 @@ void aacDecoder_drcApply (
if (fact_exponent[band] < max_exponent) {
fact_mantissa[band] >>= max_exponent - fact_exponent[band];
}
+ if (fact_mantissa[band] != FL2FXCONST_DBL(0.5f)) {
+ modifyBins = 1;
+ }
+ }
+ if (max_exponent != 1) {
+ modifyBins = 1;
}
}
@@ -948,23 +956,28 @@ void aacDecoder_drcApply (
{
bottom = 0;
- for (band = 0; band < numBands; band++)
+ if (!modifyBins) {
+ /* We don't have to modify the spectral bins because the fractional part of all factors is 0.5.
+ In order to keep accurancy we don't apply the factor but decrease the exponent instead. */
+ max_exponent -= 1;
+ } else
{
- top = fixMin((int)( (pDrcChData->bandTop[band]+1)<<2 ), aacFrameSize); /* ... * DRC_BAND_MULT; */
+ for (band = 0; band < numBands; band++)
+ {
+ top = fixMin((int)( (pDrcChData->bandTop[band]+1)<<2 ), aacFrameSize); /* ... * DRC_BAND_MULT; */
- for (bin = bottom; bin < top; bin++) {
- pSpectralCoefficient[bin] = fMult(pSpectralCoefficient[bin], fact_mantissa[band]);
- }
+ for (bin = bottom; bin < top; bin++) {
+ pSpectralCoefficient[bin] = fMult(pSpectralCoefficient[bin], fact_mantissa[band]);
+ }
- bottom = top;
+ bottom = top;
+ }
}
/* above topmost DRC band gain factor is 1 */
if (max_exponent > 0) {
- FIXP_DBL fact = FL2FXCONST_DBL(0.5f) >> (max_exponent - 1);
-
- for (bin = top; bin < aacFrameSize; bin++) {
- pSpectralCoefficient[bin] = fMult(pSpectralCoefficient[bin], fact);
+ for (bin = bottom; bin < aacFrameSize; bin+=1) {
+ pSpectralCoefficient[bin] >>= max_exponent;
}
}
@@ -980,12 +993,13 @@ void aacDecoder_drcApply (
}
else {
HANDLE_SBRDECODER hSbrDecoder = (HANDLE_SBRDECODER)pSbrDec;
+ UINT numBands = pDrcChData->numBands;
/* feed factors into SBR decoder for application in QMF domain. */
sbrDecoder_drcFeedChannel (
hSbrDecoder,
ch,
- pDrcChData->numBands,
+ numBands,
fact_mantissa,
max_exponent,
pDrcChData->drcInterpolationScheme,
diff --git a/libAACdec/src/aacdec_drc.h b/libAACdec/src/aacdec_drc.h
index 07e7eff..9c90e32 100644
--- a/libAACdec/src/aacdec_drc.h
+++ b/libAACdec/src/aacdec_drc.h
@@ -99,10 +99,7 @@ amm-info@iis.fraunhofer.de
#include "FDK_bitstream.h"
#define AACDEC_DRC_DEFAULT_REF_LEVEL ( 108 ) /* -27 dB below full scale (typical for movies) */
-#define AACDEC_DRC_DFLT_EXPIRY_FRAMES ( 40 ) /* Default DRC data expiry time in AAC frames */
-#define MAX_SBR_SYN_CHAN ( 64 )
-#define MAX_SBR_COLS ( 32 )
-
+#define AACDEC_DRC_DFLT_EXPIRY_FRAMES ( 50 ) /* Default DRC data expiry time in AAC frames */
/**
* \brief DRC module setting parameters
diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp
index 2843e9f..8d3c18d 100644
--- a/libAACdec/src/aacdecoder.cpp
+++ b/libAACdec/src/aacdecoder.cpp
@@ -865,6 +865,17 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_Init(HANDLE_AACDECODER self, const CS
self->chMapping[ch] = 255;
}
}
+ #ifdef TP_PCE_ENABLE
+ else {
+ if (CProgramConfig_IsValid(&asc->m_progrConfigElement)) {
+ /* Set matrix mixdown infos if available from PCE. */
+ pcmDmx_SetMatrixMixdownFromPce ( self->hPcmUtils,
+ asc->m_progrConfigElement.MatrixMixdownIndexPresent,
+ asc->m_progrConfigElement.MatrixMixdownIndex,
+ asc->m_progrConfigElement.PseudoSurroundEnable );
+ }
+ }
+ #endif
self->streamInfo.channelConfig = asc->m_channelConfiguration;
@@ -1565,7 +1576,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
self->streamInfo.numChannels = aacChannels;
#ifdef TP_PCE_ENABLE
- if (pceRead == 1 || CProgramConfig_IsValid(pce)) {
+ if (pceRead == 1 && CProgramConfig_IsValid(pce)) {
/* Set matrix mixdown infos if available from PCE. */
pcmDmx_SetMatrixMixdownFromPce ( self->hPcmUtils,
pce->MatrixMixdownIndexPresent,
@@ -1673,7 +1684,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
break;
}
if ( flags&AACDEC_FLUSH ) {
- FDKmemclear(pAacDecoderChannelInfo->pSpectralCoefficient, sizeof(FIXP_DBL)*self->streamInfo.aacSamplesPerFrame);
+ FDKmemclear(pAacDecoderChannelInfo->pSpectralCoefficient, sizeof(FIXP_DBL)*self->streamInfo.aacSamplesPerFrame);
FDKmemclear(self->pAacDecoderStaticChannelInfo[c]->pOverlapBuffer, OverlapBufferSize*sizeof(FIXP_DBL));
}
}
diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp
index 87f9ab0..a3db39e 100644
--- a/libAACdec/src/aacdecoder_lib.cpp
+++ b/libAACdec/src/aacdecoder_lib.cpp
@@ -110,7 +110,7 @@ amm-info@iis.fraunhofer.de
/* Decoder library info */
#define AACDECODER_LIB_VL0 2
#define AACDECODER_LIB_VL1 4
-#define AACDECODER_LIB_VL2 5
+#define AACDECODER_LIB_VL2 7
#define AACDECODER_LIB_TITLE "AAC Decoder Lib"
#define AACDECODER_LIB_BUILD_DATE __DATE__
#define AACDECODER_LIB_BUILD_TIME __TIME__