summaryrefslogtreecommitdiffstats
path: root/libAACdec/src
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2012-11-01 11:08:03 +0200
committerMartin Storsjo <martin@martin.st>2012-11-01 11:08:03 +0200
commit54dfe1ec6972ca0d56dcb671448f84fea5e37e35 (patch)
tree5d26aa077f3aa32d3e5113546abc5a4219332640 /libAACdec/src
parentfea3c1d0ffaf5975bb15462e11edf9c7a664890d (diff)
parent6ab36997af5d5acda4f21d33031f4e45c85f96b7 (diff)
downloadfdk-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 'libAACdec/src')
-rw-r--r--libAACdec/src/aac_rom.cpp30
-rw-r--r--libAACdec/src/aac_rom.h4
-rw-r--r--libAACdec/src/aacdec_drc.cpp38
-rw-r--r--libAACdec/src/aacdec_drc.h5
-rw-r--r--libAACdec/src/aacdec_tns.cpp4
-rw-r--r--libAACdec/src/aacdecoder.cpp18
-rw-r--r--libAACdec/src/aacdecoder_lib.cpp2
7 files changed, 68 insertions, 33 deletions
diff --git a/libAACdec/src/aac_rom.cpp b/libAACdec/src/aac_rom.cpp
index 13da0f6..dd51919 100644
--- a/libAACdec/src/aac_rom.cpp
+++ b/libAACdec/src/aac_rom.cpp
@@ -1729,20 +1729,36 @@ const UCHAR tns_max_bands_tbl[13][2] =
{ 39, 14 }, /* 7350 */
};
-/* TNS_MAX_BANDS for low delay. The array index is sampleRateIndex-3 */
-const UCHAR tns_max_bands_tbl_480[5] = {
- 31, /* 48000 */
+/* TNS_MAX_BANDS for low delay. The array index is the sampleRateIndex */
+const UCHAR tns_max_bands_tbl_480[13] = {
+ 31, /* 96000 */
+ 31, /* 88200 */
+ 31, /* 64000 */
+ 31, /* 48000 */
32, /* 44100 */
37, /* 32000 */
30, /* 24000 */
- 30 /* 22050 */
+ 30, /* 22050 */
+ 30, /* 16000 */
+ 30, /* 12000 */
+ 30, /* 11025 */
+ 30, /* 8000 */
+ 30 /* 7350 */
};
-const UCHAR tns_max_bands_tbl_512[5] = {
- 31, /* 48000 */
+const UCHAR tns_max_bands_tbl_512[13] = {
+ 31, /* 96000 */
+ 31, /* 88200 */
+ 31, /* 64000 */
+ 31, /* 48000 */
32, /* 44100 */
37, /* 32000 */
31, /* 24000 */
- 31 /* 22050 */
+ 31, /* 22050 */
+ 31, /* 16000 */
+ 31, /* 12000 */
+ 31, /* 11025 */
+ 31, /* 8000 */
+ 31 /* 7350 */
};
#define TCC(x) (FIXP_DBL(x))
diff --git a/libAACdec/src/aac_rom.h b/libAACdec/src/aac_rom.h
index ca971fe..beec2ee 100644
--- a/libAACdec/src/aac_rom.h
+++ b/libAACdec/src/aac_rom.h
@@ -164,8 +164,8 @@ extern const UINT aHuffTreeRvlCodewds[];
extern const UCHAR tns_max_bands_tbl[13][2];
-extern const UCHAR tns_max_bands_tbl_480[5];
-extern const UCHAR tns_max_bands_tbl_512[5];
+extern const UCHAR tns_max_bands_tbl_480[13];
+extern const UCHAR tns_max_bands_tbl_512[13];
#define FIXP_TCC FIXP_DBL
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/aacdec_tns.cpp b/libAACdec/src/aacdec_tns.cpp
index db67c9b..702196f 100644
--- a/libAACdec/src/aacdec_tns.cpp
+++ b/libAACdec/src/aacdec_tns.cpp
@@ -374,10 +374,10 @@ void CTns_Apply (
switch (granuleLength) {
case 480:
- tns_max_bands = tns_max_bands_tbl_480[pSamplingRateInfo->samplingRateIndex-3];
+ tns_max_bands = tns_max_bands_tbl_480[pSamplingRateInfo->samplingRateIndex];
break;
case 512:
- tns_max_bands = tns_max_bands_tbl_512[pSamplingRateInfo->samplingRateIndex-3];
+ tns_max_bands = tns_max_bands_tbl_512[pSamplingRateInfo->samplingRateIndex];
break;
default:
tns_max_bands = GetMaximumTnsBands(pIcsInfo, pSamplingRateInfo->samplingRateIndex);
diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp
index 4cf1391..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,
@@ -1646,10 +1657,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
self->sbrEnabled
);
- if ( flags&AACDEC_FLUSH ) {
- FDKmemclear(pAacDecoderChannelInfo->pSpectralCoefficient, sizeof(FIXP_DBL)*self->streamInfo.aacSamplesPerFrame);
- }
-
switch (pAacDecoderChannelInfo->renderMode)
{
case AACDEC_RENDER_IMDCT:
@@ -1677,6 +1684,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
break;
}
if ( flags&AACDEC_FLUSH ) {
+ 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 451d659..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 4
+#define AACDECODER_LIB_VL2 7
#define AACDECODER_LIB_TITLE "AAC Decoder Lib"
#define AACDECODER_LIB_BUILD_DATE __DATE__
#define AACDECODER_LIB_BUILD_TIME __TIME__