From 603f48ab99ce76f552f4f6f85d06b8c5b94c698e Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Mon, 30 Dec 2013 16:01:08 -0800 Subject: AAC Decoder: introduce time domain limiter Introduce time domain limiter. The module is per default enabled for all AAC-LC and HE-AAC v1/2 streams. For all ER-AAC-LD and ER-AAC-ELD streams the limiter is disabled per default. The feature can be en- or disabled via dynamic API parameter. Note that the limiter introduces an additional output delay which depends on the module parameters and the streams sampling rate. Bug 9428126 Change-Id: I299a072340b33e2c324facbd347a72c8de3d380e --- libAACdec/src/aacdecoder.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libAACdec/src/aacdecoder.cpp') diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp index 7903f76..18c9afa 100644 --- a/libAACdec/src/aacdecoder.cpp +++ b/libAACdec/src/aacdecoder.cpp @@ -1653,6 +1653,8 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( { int stride, offset, c; + /* Turn on/off DRC modules level normalization in digital domain depending on the limiter status. */ + aacDecoder_drcSetParam( self->hDrcInfo, APPLY_NORMALIZATION, (self->limiterEnableCurr) ? 0 : 1 ); /* Extract DRC control data and map it to channels (without bitstream delay) */ aacDecoder_drcProlog ( self->hDrcInfo, @@ -1703,12 +1705,15 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( /* Reset DRC control data for this channel */ aacDecoder_drcInitChannelData ( &self->pAacDecoderStaticChannelInfo[c]->drcData ); } + /* The DRC module demands to be called with the gain field holding the gain scale. */ + self->extGain[0] = (FIXP_DBL)TDL_GAIN_SCALING; /* DRC processing */ aacDecoder_drcApply ( self->hDrcInfo, self->hSbrDecoder, pAacDecoderChannelInfo, &self->pAacDecoderStaticChannelInfo[c]->drcData, + self->extGain, c, self->streamInfo.aacSamplesPerFrame, self->sbrEnabled @@ -1726,6 +1731,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( (self->frameOK && !(flags&AACDEC_CONCEAL)), self->aacCommonData.workBufferCore1->mdctOutTemp ); + self->extGainDelay = self->streamInfo.aacSamplesPerFrame; break; case AACDEC_RENDER_ELDFB: CBlock_FrequencyToTimeLowDelay( @@ -1735,6 +1741,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( self->streamInfo.aacSamplesPerFrame, stride ); + self->extGainDelay = (self->streamInfo.aacSamplesPerFrame*2 - self->streamInfo.aacSamplesPerFrame/2 - 1)/2; break; default: ErrorStatus = AAC_DEC_UNKNOWN; -- cgit v1.2.3