diff options
Diffstat (limited to 'libAACdec')
-rw-r--r-- | libAACdec/src/aacdec_drc.cpp | 38 | ||||
-rw-r--r-- | libAACdec/src/aacdec_drc.h | 5 | ||||
-rw-r--r-- | libAACdec/src/aacdecoder.cpp | 15 | ||||
-rw-r--r-- | libAACdec/src/aacdecoder_lib.cpp | 2 |
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__ |