diff options
Diffstat (limited to 'libAACdec')
47 files changed, 305 insertions, 163 deletions
diff --git a/libAACdec/include/aacdecoder_lib.h b/libAACdec/include/aacdecoder_lib.h index 79b4ba1..60efe8d 100644 --- a/libAACdec/include/aacdecoder_lib.h +++ b/libAACdec/include/aacdecoder_lib.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -504,7 +504,8 @@ typedef struct INT aacSamplesPerFrame; /*!< Samples per frame for the AAC core (from ASC). \n 1024 or 960 for AAC-LC \n 512 or 480 for AAC-LD and AAC-ELD */ - + INT aacNumChannels; /*!< The number of audio channels after AAC core processing (before PS or MPS processing). + CAUTION: This are not the final number of output channels! */ AUDIO_OBJECT_TYPE extAot; /*!< Extension Audio Object Type (from ASC) */ INT extSamplingRate; /*!< Extension sampling rate in Hz (from ASC) */ diff --git a/libAACdec/src/aac_ram.cpp b/libAACdec/src/aac_ram.cpp index 75c9a94..a38f57c 100644 --- a/libAACdec/src/aac_ram.cpp +++ b/libAACdec/src/aac_ram.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aac_ram.h b/libAACdec/src/aac_ram.h index 2130ca1..4527e27 100644 --- a/libAACdec/src/aac_ram.h +++ b/libAACdec/src/aac_ram.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aac_rom.cpp b/libAACdec/src/aac_rom.cpp index dd51919..fa04c42 100644 --- a/libAACdec/src/aac_rom.cpp +++ b/libAACdec/src/aac_rom.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aac_rom.h b/libAACdec/src/aac_rom.h index beec2ee..536d184 100644 --- a/libAACdec/src/aac_rom.h +++ b/libAACdec/src/aac_rom.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdec_drc.cpp b/libAACdec/src/aacdec_drc.cpp index ebc6975..2666454 100644 --- a/libAACdec/src/aacdec_drc.cpp +++ b/libAACdec/src/aacdec_drc.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -135,10 +135,13 @@ void aacDecoder_drcInit ( /* init params */ pParams = &self->params; pParams->bsDelayEnable = 0; - pParams->cut = FL2FXCONST_DBL(0.0f); - pParams->boost = FL2FXCONST_DBL(0.0f); + pParams->cut = FL2FXCONST_DBL(0.0f); + pParams->usrCut = FL2FXCONST_DBL(0.0f); + pParams->boost = FL2FXCONST_DBL(0.0f); + pParams->usrBoost = FL2FXCONST_DBL(0.0f); pParams->targetRefLevel = AACDEC_DRC_DEFAULT_REF_LEVEL; pParams->expiryFrame = AACDEC_DRC_DFLT_EXPIRY_FRAMES; + pParams->applyHeavyCompression = 0; /* initial program ref level = target ref level */ self->progRefLevel = pParams->targetRefLevel; @@ -193,7 +196,9 @@ AAC_DECODER_ERROR aacDecoder_drcSetParam ( if (self == NULL) { return AAC_DEC_INVALID_HANDLE; } - self->params.cut = (FIXP_DBL)((INT)(DRC_PARAM_QUANT_STEP>>DRC_PARAM_SCALE) * (INT)value); + self->params.usrCut = (FIXP_DBL)((INT)(DRC_PARAM_QUANT_STEP>>DRC_PARAM_SCALE) * (INT)value); + if (self->params.applyHeavyCompression == 0) + self->params.cut = self->params.usrCut; break; case DRC_BOOST_SCALE: /* set boost factor */ @@ -204,7 +209,9 @@ AAC_DECODER_ERROR aacDecoder_drcSetParam ( if (self == NULL) { return AAC_DEC_INVALID_HANDLE; } - self->params.boost = (FIXP_DBL)((INT)(DRC_PARAM_QUANT_STEP>>DRC_PARAM_SCALE) * (INT)value); + self->params.usrBoost = (FIXP_DBL)((INT)(DRC_PARAM_QUANT_STEP>>DRC_PARAM_SCALE) * (INT)value); + if (self->params.applyHeavyCompression == 0) + self->params.boost = self->params.usrBoost; break; case TARGET_REF_LEVEL: if ( value > MAX_REFERENCE_LEVEL @@ -220,9 +227,11 @@ AAC_DECODER_ERROR aacDecoder_drcSetParam ( else { /* ref_level must be between 0 and MAX_REFERENCE_LEVEL, inclusive */ self->digitalNorm = 1; - 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. */ + if (self->params.targetRefLevel != (SCHAR)value) { + self->params.targetRefLevel = (SCHAR)value; + self->progRefLevel = (SCHAR)value; /* Always 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: @@ -232,7 +241,19 @@ AAC_DECODER_ERROR aacDecoder_drcSetParam ( if (self == NULL) { return AAC_DEC_INVALID_HANDLE; } - self->params.applyHeavyCompression = (UCHAR)value; + if (self->params.applyHeavyCompression != (UCHAR)value) { + if (value == 1) { + /* Disable scaling of DRC values by setting the max values */ + self->params.boost = FL2FXCONST_DBL(1.0f/(float)(1<<DRC_PARAM_SCALE)); + self->params.cut = FL2FXCONST_DBL(1.0f/(float)(1<<DRC_PARAM_SCALE)); + } else { + /* Restore the user params */ + self->params.boost = self->params.usrBoost; + self->params.cut = self->params.usrCut; + } + /* Store new parameter value */ + self->params.applyHeavyCompression = (UCHAR)value; + } break; case DRC_BS_DELAY: if (value < 0 || value > 1) { @@ -473,7 +494,7 @@ static int aacDecoder_drcParse ( } } else { - pDrcBs->channelData.bandTop[0] = 255; + pDrcBs->channelData.bandTop[0] = (1024 >> 2) - 1; /* ... comprising the whole spectrum. */; } pDrcBs->channelData.numBands = numBands; @@ -627,10 +648,17 @@ static int aacDecoder_drcExtractAndMap ( { CDrcPayload threadBs[MAX_DRC_THREADS]; CDrcPayload *validThreadBs[MAX_DRC_THREADS]; + CDrcParams *pParams; UINT backupBsPosition; int i, thread, validThreads = 0; int numExcludedChns[MAX_DRC_THREADS]; + FDK_ASSERT(self != NULL); + FDK_ASSERT(hBs != NULL); + FDK_ASSERT(pAacDecoderStaticChannelInfo != NULL); + + pParams = &self->params; + self->numThreads = 0; backupBsPosition = FDKgetValidBits(hBs); @@ -752,6 +780,7 @@ static int aacDecoder_drcExtractAndMap ( */ if (pThreadBs->progRefLevel >= 0) { self->progRefLevel = pThreadBs->progRefLevel; + self->prlExpiryCount = 0; /* Got a new value -> Reset counter */ } /* SCE, CPE and LFE */ @@ -769,6 +798,14 @@ static int aacDecoder_drcExtractAndMap ( /* CCEs not supported by now */ } + /* Increment and check expiry counter for the program reference level: */ + if ( (pParams->expiryFrame > 0) + && (self->prlExpiryCount++ > pParams->expiryFrame) ) + { /* The program reference level is too old, so set it back to the target level. */ + self->progRefLevel = pParams->targetRefLevel; + self->prlExpiryCount = 0; + } + return 0; } diff --git a/libAACdec/src/aacdec_drc.h b/libAACdec/src/aacdec_drc.h index 9c90e32..2ebae2c 100644 --- a/libAACdec/src/aacdec_drc.h +++ b/libAACdec/src/aacdec_drc.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -143,6 +143,16 @@ int aacDecoder_drcProlog ( UCHAR channelMapping[], int numChannels ); +/** + * \brief Apply DRC. If SBR is present, DRC data is handed over to the SBR decoder. + * \param self AAC decoder instance + * \param pSbrDec pointer to SBR decoder instance + * \param pAacDecoderChannelInfo AAC decoder channel instance to be processed + * \param pDrcDat DRC channel data + * \param ch channel index + * \param aacFrameSize AAC frame size + * \param bSbrPresent flag indicating that SBR is present, in which case DRC is handed over to the SBR instance pSbrDec + */ void aacDecoder_drcApply ( HANDLE_AAC_DRC self, void *pSbrDec, diff --git a/libAACdec/src/aacdec_drc_types.h b/libAACdec/src/aacdec_drc_types.h index 3871b4b..1b5cd76 100644 --- a/libAACdec/src/aacdec_drc_types.h +++ b/libAACdec/src/aacdec_drc_types.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -132,8 +132,10 @@ typedef struct typedef struct { - FIXP_DBL cut; - FIXP_DBL boost; + FIXP_DBL cut; /* The attenuation scale factor currently used. */ + FIXP_DBL usrCut; /* The latest attenuation scale factor set by user. */ + FIXP_DBL boost; /* The boost scale factor currently used. */ + FIXP_DBL usrBoost; /* The latest boost scale factor set by user. */ UINT expiryFrame; SCHAR targetRefLevel; @@ -154,6 +156,8 @@ typedef struct USHORT numThreads; /* The number of DRC data threads extracted from the found payload elements */ SCHAR progRefLevel; /* Program reference level for all channels */ + UINT prlExpiryCount; /* Counter that can be used to monitor the life time of the program reference level. */ + UCHAR dvbAncDataAvailable; /* Flag that indicates whether DVB ancillary data is present or not */ UINT dvbAncDataPosition; /* Used to store the DVB ancillary data payload position in the bitstream (only one per frame) */ UINT drcPayloadPosition[MAX_DRC_THREADS]; /* Used to store the DRC payload positions in the bitstream */ diff --git a/libAACdec/src/aacdec_hcr.cpp b/libAACdec/src/aacdec_hcr.cpp index 5b86833..e314e27 100644 --- a/libAACdec/src/aacdec_hcr.cpp +++ b/libAACdec/src/aacdec_hcr.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdec_hcr.h b/libAACdec/src/aacdec_hcr.h index f8f3abf..6fc527b 100644 --- a/libAACdec/src/aacdec_hcr.h +++ b/libAACdec/src/aacdec_hcr.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdec_hcr_bit.cpp b/libAACdec/src/aacdec_hcr_bit.cpp index ab82ca3..df2685b 100644 --- a/libAACdec/src/aacdec_hcr_bit.cpp +++ b/libAACdec/src/aacdec_hcr_bit.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdec_hcr_bit.h b/libAACdec/src/aacdec_hcr_bit.h index c191b1d..8994ff1 100644 --- a/libAACdec/src/aacdec_hcr_bit.h +++ b/libAACdec/src/aacdec_hcr_bit.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdec_hcr_types.h b/libAACdec/src/aacdec_hcr_types.h index 54b3dbd..323ec4e 100644 --- a/libAACdec/src/aacdec_hcr_types.h +++ b/libAACdec/src/aacdec_hcr_types.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdec_hcrs.cpp b/libAACdec/src/aacdec_hcrs.cpp index 74ecb65..c0b2173 100644 --- a/libAACdec/src/aacdec_hcrs.cpp +++ b/libAACdec/src/aacdec_hcrs.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdec_hcrs.h b/libAACdec/src/aacdec_hcrs.h index 7a004c4..678ba26 100644 --- a/libAACdec/src/aacdec_hcrs.h +++ b/libAACdec/src/aacdec_hcrs.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdec_pns.cpp b/libAACdec/src/aacdec_pns.cpp index a3f7a78..541ef07 100644 --- a/libAACdec/src/aacdec_pns.cpp +++ b/libAACdec/src/aacdec_pns.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdec_pns.h b/libAACdec/src/aacdec_pns.h index c07656c..fc9bdcb 100644 --- a/libAACdec/src/aacdec_pns.h +++ b/libAACdec/src/aacdec_pns.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdec_tns.cpp b/libAACdec/src/aacdec_tns.cpp index 702196f..352f04a 100644 --- a/libAACdec/src/aacdec_tns.cpp +++ b/libAACdec/src/aacdec_tns.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdec_tns.h b/libAACdec/src/aacdec_tns.h index 499f763..f029d96 100644 --- a/libAACdec/src/aacdec_tns.h +++ b/libAACdec/src/aacdec_tns.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp index 8d3c18d..3a2a561 100644 --- a/libAACdec/src/aacdecoder.cpp +++ b/libAACdec/src/aacdecoder.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -183,7 +183,7 @@ void CAacDecoder_SyncQmfMode(HANDLE_AACDECODER self) if ( self->qmfModeCurr == NOT_DEFINED ) { if ( (IS_LOWDELAY(self->streamInfo.aot) && (self->flags & AC_MPS_PRESENT)) - || ( (self->ascChannels == 1) + || ( (self->streamInfo.aacNumChannels == 1) && ( (CAN_DO_PS(self->streamInfo.aot) && !(self->flags & AC_MPS_PRESENT)) || ( IS_USAC(self->streamInfo.aot) && (self->flags & AC_MPS_PRESENT)) ) ) ) { @@ -196,7 +196,7 @@ void CAacDecoder_SyncQmfMode(HANDLE_AACDECODER self) /* Set SBR to current QMF mode. Error does not matter. */ sbrDecoder_SetParam(self->hSbrDecoder, SBR_QMF_MODE, (self->qmfModeCurr == MODE_LP)); - self->psPossible = ((CAN_DO_PS(self->streamInfo.aot) && self->aacChannels == 1 && ! (self->flags & AC_MPS_PRESENT))) && self->qmfModeCurr == MODE_HQ ; + self->psPossible = ((CAN_DO_PS(self->streamInfo.aot) && self->streamInfo.aacNumChannels == 1 && ! (self->flags & AC_MPS_PRESENT))) && self->qmfModeCurr == MODE_HQ ; FDK_ASSERT( ! ( (self->flags & AC_MPS_PRESENT) && self->psPossible ) ); } @@ -373,7 +373,7 @@ static AAC_DECODER_ERROR CDataStreamElement_Read ( { INT readBits, dataBits = count<<3; - + /* Move to the beginning of the data junk */ FDKpushBack(bs, dataStart-FDKgetValidBits(bs)); @@ -394,23 +394,26 @@ static AAC_DECODER_ERROR CDataStreamElement_Read ( \brief Read Program Config Element \bs Bitstream Handle - \count Pointer to program config element. + \pTp Transport decoder handle for CRC handling + \pce Pointer to PCE buffer + \channelConfig Current channel configuration + \alignAnchor Anchor for byte alignment - \return Error code + \return PCE status (-1: fail, 0: no new PCE, 1: PCE updated, 2: PCE updated need re-config). */ -static AAC_DECODER_ERROR CProgramConfigElement_Read ( +static int CProgramConfigElement_Read ( HANDLE_FDK_BITSTREAM bs, HANDLE_TRANSPORTDEC pTp, CProgramConfig *pce, - UINT channelConfig, - UINT alignAnchor ) + const UINT channelConfig, + const UINT alignAnchor ) { - AAC_DECODER_ERROR error = AAC_DEC_OK; + int pceStatus = 0; int crcReg; /* read PCE to temporal buffer first */ C_ALLOC_SCRATCH_START(tmpPce, CProgramConfig, 1); - + CProgramConfig_Init(tmpPce); CProgramConfig_Reset(tmpPce); @@ -421,22 +424,43 @@ static AAC_DECODER_ERROR CProgramConfigElement_Read ( transportDec_CrcEndReg(pTp, crcReg); if ( CProgramConfig_IsValid(tmpPce) - && ( (channelConfig == 6 && (tmpPce->NumChannels == 6)) - || (channelConfig == 5 && (tmpPce->NumChannels == 5)) - || (channelConfig == 0 && (tmpPce->NumChannels == pce->NumChannels)) ) - && (tmpPce->NumFrontChannelElements == 2) - && (tmpPce->NumSideChannelElements == 0) - && (tmpPce->NumBackChannelElements == 1) && (tmpPce->Profile == 1) ) - { /* Copy the complete PCE including metadata. */ - FDKmemcpy(pce, tmpPce, sizeof(CProgramConfig)); + { + if ( !pce->isValid && (channelConfig > 0) ) { + /* Create a standard channel config PCE to compare with */ + CProgramConfig_GetDefault( pce, channelConfig ); + } + + if (pce->isValid) { + /* Compare the new and the old PCE (tags ignored) */ + switch ( CProgramConfig_Compare( pce, tmpPce ) ) + { + case 1: /* Channel configuration not changed. Just new metadata. */ + FDKmemcpy(pce, tmpPce, sizeof(CProgramConfig)); /* Store the complete PCE */ + pceStatus = 1; /* New PCE but no change of config */ + break; + case 2: /* The number of channels are identical but not the config */ + if (channelConfig == 0) { + FDKmemcpy(pce, tmpPce, sizeof(CProgramConfig)); /* Store the complete PCE */ + pceStatus = 2; /* Decoder needs re-configuration */ + } + break; + case -1: /* The channel configuration is completely different */ + pceStatus = -1; /* Not supported! */ + break; + case 0: /* Nothing to do because PCE matches the old one exactly. */ + default: + /* pceStatus = 0; */ + break; + } + } } C_ALLOC_SCRATCH_END(tmpPce, CProgramConfig, 1); - return error; + return pceStatus; } -#endif +#endif /* TP_PCE_ENABLE */ /*! \brief Parse Extension Payload @@ -591,7 +615,7 @@ AAC_DECODER_ERROR CAacDecoder_ExtPayloadParse (HANDLE_AACDECODER self, { /* ... created to circumvent the missing length in ER-Syntax. */ int bitCnt, len = FDKreadBits(hBs, 4); *count -= 4; - + if (len == 15) { int add_len = FDKreadBits(hBs, 8); *count -= 8; @@ -609,9 +633,7 @@ AAC_DECODER_ERROR CAacDecoder_ExtPayloadParse (HANDLE_AACDECODER self, /* Check NOTE 2: The extension_payload() included here must not have extension_type == EXT_DATA_LENGTH. */ error = AAC_DEC_PARSE_ERROR; - goto bail; - } - else { + } else { /* rewind and call myself again. */ FDKpushBack(hBs, 4); @@ -622,7 +644,7 @@ AAC_DECODER_ERROR CAacDecoder_ExtPayloadParse (HANDLE_AACDECODER self, &bitCnt, previous_element, elIndex, - 1 ); /* Treat same as fill element */ + 0 ); *count -= len - bitCnt; } @@ -754,8 +776,12 @@ LINKSPEC_CPP void CAacDecoder_Close(HANDLE_AACDECODER self) for (ch=0; ch<(6); ch++) { if (self->pAacDecoderStaticChannelInfo[ch] != NULL) { - FreeOverlapBuffer (&self->pAacDecoderStaticChannelInfo[ch]->pOverlapBuffer); - FreeAacDecoderStaticChannelInfo (&self->pAacDecoderStaticChannelInfo[ch]); + if (self->pAacDecoderStaticChannelInfo[ch]->pOverlapBuffer != NULL) { + FreeOverlapBuffer (&self->pAacDecoderStaticChannelInfo[ch]->pOverlapBuffer); + } + if (self->pAacDecoderStaticChannelInfo[ch] != NULL) { + FreeAacDecoderStaticChannelInfo (&self->pAacDecoderStaticChannelInfo[ch]); + } } if (self->pAacDecoderChannelInfo[ch] != NULL) { FreeAacDecoderChannelInfo (&self->pAacDecoderChannelInfo[ch]); @@ -768,8 +794,12 @@ LINKSPEC_CPP void CAacDecoder_Close(HANDLE_AACDECODER self) FreeDrcInfo(&self->hDrcInfo); } - FreeWorkBufferCore1 (&self->aacCommonData.workBufferCore1); - FreeWorkBufferCore2 (&self->aacCommonData.workBufferCore2); + if (self->aacCommonData.workBufferCore1 != NULL) { + FreeWorkBufferCore1 (&self->aacCommonData.workBufferCore1); + } + if (self->aacCommonData.workBufferCore2 != NULL) { + FreeWorkBufferCore2 (&self->aacCommonData.workBufferCore2); + } FreeAacDecoder ( &self); } @@ -994,12 +1024,14 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_Init(HANDLE_AACDECODER self, const CS CPns_InitPns(&self->pAacDecoderChannelInfo[ch]->data.aac.PnsData, &self->aacCommonData.pnsInterChannelData, &self->aacCommonData.pnsCurrentSeed, self->aacCommonData.pnsRandomSeed); } + if (ascChannels > self->aacChannels) + { + /* Make allocated channel count persistent in decoder context. */ + self->aacChannels = ascChannels; + } HcrInitRom(&self->aacCommonData.overlay.aac.erHcrInfo); setHcrType(&self->aacCommonData.overlay.aac.erHcrInfo, ID_SCE); - - /* Make allocated channel count persistent in decoder context. */ - self->aacChannels = ascChannels; } /* Make amount of signalled channels persistent in decoder context. */ @@ -1009,8 +1041,10 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_Init(HANDLE_AACDECODER self, const CS /* Update structures */ if (ascChanged) { - /* Things to be done for each channel, which do not involved allocating memory. */ - for (ch = 0; ch < ascChannels; ch++) { + /* Things to be done for each channel, which do not involve allocating memory. + Doing these things only on the channels needed for the current configuration + (ascChannels) could lead to memory access violation later (error concealment). */ + for (ch = 0; ch < self->aacChannels; ch++) { switch (self->streamInfo.aot) { case AOT_ER_AAC_ELD: case AOT_ER_AAC_LD: @@ -1241,10 +1275,10 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( else { self->frameOK = 0; } - /* Create SBR element for SBR for upsampling. */ - if ( (type == ID_LFE) - && ( (self->flags & AC_SBR_PRESENT) - || (self->sbrEnabled == 1) ) ) + /* Create SBR element for SBR for upsampling for LFE elements, + and if SBR was explicitly signaled, because the first frame(s) + may not contain SBR payload (broken encoder, bit errors). */ + if ( (self->flags & AC_SBR_PRESENT) || (self->sbrEnabled == 1) ) { SBR_ERROR sbrError; @@ -1254,7 +1288,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( self->streamInfo.extSamplingRate, self->streamInfo.aacSamplesPerFrame, self->streamInfo.aot, - ID_LFE, + type, previous_element_index ); if (sbrError != SBRDEC_OK) { @@ -1394,26 +1428,34 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( #ifdef TP_PCE_ENABLE case ID_PCE: - - if ( CProgramConfigElement_Read( bs, + { + int result = CProgramConfigElement_Read( + bs, self->hInput, pce, self->streamInfo.channelConfig, - auStartAnchor ) ) - { /* Built element table */ - int elIdx = CProgramConfig_GetElementTable(pce, self->elements, 7); - /* Reset the remaining tabs */ - for ( ; elIdx<7; elIdx++) { - self->elements[elIdx] = ID_NONE; - } - /* Make new number of channel persistant */ - self->ascChannels = pce->NumChannels; - /* If PCE is not first element conceal this frame to avoid inconsistencies */ - if ( element_count != 0 ) { + auStartAnchor ); + if ( result < 0 ) { + /* Something went wrong */ + ErrorStatus = AAC_DEC_PARSE_ERROR; self->frameOK = 0; } + else if ( result > 1 ) { + /* Built element table */ + int elIdx = CProgramConfig_GetElementTable(pce, self->elements, 7); + /* Reset the remaining tabs */ + for ( ; elIdx<7; elIdx++) { + self->elements[elIdx] = ID_NONE; + } + /* Make new number of channel persistant */ + self->ascChannels = pce->NumChannels; + /* If PCE is not first element conceal this frame to avoid inconsistencies */ + if ( element_count != 0 ) { + self->frameOK = 0; + } + } + pceRead = (result>=0) ? 1 : 0; } - pceRead = 1; break; #endif /* TP_PCE_ENABLE */ @@ -1573,7 +1615,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( } /* Update number of output channels */ - self->streamInfo.numChannels = aacChannels; + self->streamInfo.aacNumChannels = aacChannels; #ifdef TP_PCE_ENABLE if (pceRead == 1 && CProgramConfig_IsValid(pce)) { diff --git a/libAACdec/src/aacdecoder.h b/libAACdec/src/aacdecoder.h index f153c84..16351e6 100644 --- a/libAACdec/src/aacdecoder.h +++ b/libAACdec/src/aacdecoder.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp index a3db39e..ec8f41e 100644 --- a/libAACdec/src/aacdecoder_lib.cpp +++ b/libAACdec/src/aacdecoder_lib.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -109,8 +109,8 @@ amm-info@iis.fraunhofer.de /* Decoder library info */ #define AACDECODER_LIB_VL0 2 -#define AACDECODER_LIB_VL1 4 -#define AACDECODER_LIB_VL2 7 +#define AACDECODER_LIB_VL1 5 +#define AACDECODER_LIB_VL2 5 #define AACDECODER_LIB_TITLE "AAC Decoder Lib" #define AACDECODER_LIB_BUILD_DATE __DATE__ #define AACDECODER_LIB_BUILD_TIME __TIME__ @@ -261,7 +261,7 @@ setConcealMethod ( const HANDLE_AACDECODER self, /*!< Handle of the decoder i HANDLE_SBRDECODER hSbrDec = NULL; HANDLE_AAC_DRC hDrcInfo = NULL; HANDLE_PCM_DOWNMIX hPcmDmx = NULL; - CConcealmentMethod backupMethod; + CConcealmentMethod backupMethod = ConcealMethodNone; int backupDelay = 0; int bsDelay = 0; @@ -396,11 +396,15 @@ aacDecoder_SetParam ( const HANDLE_AACDECODER self, /*!< Handle of the decode AAC_DECODER_ERROR errorStatus = AAC_DEC_OK; CConcealParams *pConcealData = NULL; HANDLE_AAC_DRC hDrcInfo = NULL; + HANDLE_PCM_DOWNMIX hPcmDmx = NULL; /* check decoder handle */ if (self != NULL) { pConcealData = &self->concealCommonData; hDrcInfo = self->hDrcInfo; + hPcmDmx = self->hPcmUtils; + } else { + errorStatus = AAC_DEC_INVALID_HANDLE; } /* configure the subsystems */ @@ -417,11 +421,14 @@ aacDecoder_SetParam ( const HANDLE_AACDECODER self, /*!< Handle of the decode break; case AAC_PCM_OUTPUT_CHANNELS: + if (value < -1 || value > (6)) { + return AAC_DEC_SET_PARAM_FAIL; + } { PCMDMX_ERROR err; err = pcmDmx_SetParam ( - self->hPcmUtils, + hPcmDmx, NUMBER_OF_OUTPUT_CHANNELS, value ); @@ -441,7 +448,7 @@ aacDecoder_SetParam ( const HANDLE_AACDECODER self, /*!< Handle of the decode PCMDMX_ERROR err; err = pcmDmx_SetParam ( - self->hPcmUtils, + hPcmDmx, DUAL_CHANNEL_DOWNMIX_MODE, value ); @@ -459,10 +466,14 @@ aacDecoder_SetParam ( const HANDLE_AACDECODER self, /*!< Handle of the decode case AAC_PCM_OUTPUT_CHANNEL_MAPPING: switch (value) { case 0: - self->channelOutputMapping = channelMappingTablePassthrough; + if (self != NULL) { + self->channelOutputMapping = channelMappingTablePassthrough; + } break; case 1: - self->channelOutputMapping = channelMappingTableWAV; + if (self != NULL) { + self->channelOutputMapping = channelMappingTableWAV; + } break; default: errorStatus = AAC_DEC_SET_PARAM_FAIL; @@ -472,6 +483,9 @@ aacDecoder_SetParam ( const HANDLE_AACDECODER self, /*!< Handle of the decode case AAC_QMF_LOWPOWER: + if (value < -1 || value > 1) { + return AAC_DEC_SET_PARAM_FAIL; + } if (self == NULL) { return AAC_DEC_INVALID_HANDLE; } @@ -794,8 +808,8 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame( /* Export data into streaminfo structure */ self->streamInfo.sampleRate = self->streamInfo.aacSampleRate; self->streamInfo.frameSize = self->streamInfo.aacSamplesPerFrame; - self->streamInfo.numChannels = self->aacChannels; } + self->streamInfo.numChannels = self->streamInfo.aacNumChannels; @@ -832,7 +846,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame( pTimeData, &self->streamInfo.numChannels, &self->streamInfo.sampleRate, - self->channelOutputMapping[self->aacChannels-1], + self->channelOutputMapping[self->streamInfo.numChannels-1], interleaved, self->frameOK, &self->psPossible); diff --git a/libAACdec/src/arm/block_arm.cpp b/libAACdec/src/arm/block_arm.cpp index 4c0fcdd..fbc1bf3 100644 --- a/libAACdec/src/arm/block_arm.cpp +++ b/libAACdec/src/arm/block_arm.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/block.cpp b/libAACdec/src/block.cpp index 1f82780..9d703cc 100644 --- a/libAACdec/src/block.cpp +++ b/libAACdec/src/block.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -589,7 +589,6 @@ AAC_DECODER_ERROR CBlock_ReadSpectralData(HANDLE_FDK_BITSTREAM bs, { H_HCR_INFO hHcr = &pAacDecoderChannelInfo->pComData->overlay.aac.erHcrInfo; int hcrStatus = 0; - int hcrConcealWholeFrame = 0; /* advanced Huffman decoding starts here (HCR decoding :) */ if ( pAacDecoderChannelInfo->pDynData->specificTo.aac.lenOfReorderedSpectralData != 0 ) { @@ -598,24 +597,19 @@ AAC_DECODER_ERROR CBlock_ReadSpectralData(HANDLE_FDK_BITSTREAM bs, hcrStatus = HcrInit(hHcr, pAacDecoderChannelInfo, pSamplingRateInfo, bs); if (hcrStatus != 0) { -#if HCR_ERROR_CONCEALMENT - hcrConcealWholeFrame = 1; - return AAC_DEC_DECODE_FRAME_ERROR; /* concealment is muting in the first step, therefore return now */ - // hcr decoding is not skipped because of returning above -#else return AAC_DEC_DECODE_FRAME_ERROR; -#endif } /* HCR decoding short */ hcrStatus = HcrDecoder(hHcr, pAacDecoderChannelInfo, pSamplingRateInfo, bs); - + if (hcrStatus != 0) { #if HCR_ERROR_CONCEALMENT - HcrMuteErroneousLines(hHcr); + HcrMuteErroneousLines(hHcr); #else - return AAC_DEC_DECODE_FRAME_ERROR; + return AAC_DEC_DECODE_FRAME_ERROR; #endif /* HCR_ERROR_CONCEALMENT */ + } FDKpushFor (bs, pAacDecoderChannelInfo->pDynData->specificTo.aac.lenOfReorderedSpectralData); } diff --git a/libAACdec/src/block.h b/libAACdec/src/block.h index f97b85c..f9394f6 100644 --- a/libAACdec/src/block.h +++ b/libAACdec/src/block.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/channel.cpp b/libAACdec/src/channel.cpp index 21517f5..5475079 100644 --- a/libAACdec/src/channel.cpp +++ b/libAACdec/src/channel.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/channel.h b/libAACdec/src/channel.h index 4c428c8..1146998 100644 --- a/libAACdec/src/channel.h +++ b/libAACdec/src/channel.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/channelinfo.cpp b/libAACdec/src/channelinfo.cpp index 6e520c0..76d5895 100644 --- a/libAACdec/src/channelinfo.cpp +++ b/libAACdec/src/channelinfo.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/channelinfo.h b/libAACdec/src/channelinfo.h index 9be07da..e092ab3 100644 --- a/libAACdec/src/channelinfo.h +++ b/libAACdec/src/channelinfo.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/conceal.cpp b/libAACdec/src/conceal.cpp index dc5d99f..c26051c 100644 --- a/libAACdec/src/conceal.cpp +++ b/libAACdec/src/conceal.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -441,7 +441,7 @@ AAC_DECODER_ERROR /* set confort noise level which will be inserted while in state 'muting' */ if (comfNoiseLevel != AACDEC_CONCEAL_PARAM_NOT_SPECIFIED) { - if ( (comfNoiseLevel < 0) + if ( (comfNoiseLevel < -1) || (comfNoiseLevel > 127) ) { return AAC_DEC_SET_PARAM_FAIL; } @@ -1527,8 +1527,13 @@ static void { case ConcealState_Ok: if (!frameOk) { - /* change to state SINGLE-FRAME-LOSS */ - pConcealmentInfo->concealState = ConcealState_Single; + if (pConcealCommonData->numFadeOutFrames > 0) { + /* change to state SINGLE-FRAME-LOSS */ + pConcealmentInfo->concealState = ConcealState_Single; + } else { + /* change to state MUTE */ + pConcealmentInfo->concealState = ConcealState_Mute; + } pConcealmentInfo->cntFadeFrames = 0; pConcealmentInfo->cntValidFrames = 0; } @@ -1561,11 +1566,16 @@ static void case ConcealState_FadeOut: pConcealmentInfo->cntFadeFrames += 1; /* used to address the fade-out factors */ if (pConcealmentInfo->cntValidFrames > pConcealCommonData->numMuteReleaseFrames) { - /* change to state FADE-IN */ - pConcealmentInfo->concealState = ConcealState_FadeIn; - pConcealmentInfo->cntFadeFrames = findEquiFadeFrame( pConcealCommonData, - pConcealmentInfo->cntFadeFrames-1, - 0 /* FadeOut -> FadeIn */); + if (pConcealCommonData->numFadeInFrames > 0) { + /* change to state FADE-IN */ + pConcealmentInfo->concealState = ConcealState_FadeIn; + pConcealmentInfo->cntFadeFrames = findEquiFadeFrame( pConcealCommonData, + pConcealmentInfo->cntFadeFrames-1, + 0 /* FadeOut -> FadeIn */); + } else { + /* change to state OK */ + pConcealmentInfo->concealState = ConcealState_Ok; + } } else { if (pConcealmentInfo->cntFadeFrames >= pConcealCommonData->numFadeOutFrames) { /* change to state MUTE */ @@ -1576,9 +1586,14 @@ static void case ConcealState_Mute: if (pConcealmentInfo->cntValidFrames > pConcealCommonData->numMuteReleaseFrames) { - /* change to state FADE-IN */ - pConcealmentInfo->concealState = ConcealState_FadeIn; - pConcealmentInfo->cntFadeFrames = pConcealCommonData->numFadeInFrames - 1; + if (pConcealCommonData->numFadeInFrames > 0) { + /* change to state FADE-IN */ + pConcealmentInfo->concealState = ConcealState_FadeIn; + pConcealmentInfo->cntFadeFrames = pConcealCommonData->numFadeInFrames - 1; + } else { + /* change to state OK */ + pConcealmentInfo->concealState = ConcealState_Ok; + } } break; @@ -1590,11 +1605,16 @@ static void pConcealmentInfo->concealState = ConcealState_Ok; } } else { - /* change to state FADE-OUT */ - pConcealmentInfo->concealState = ConcealState_FadeOut; - pConcealmentInfo->cntFadeFrames = findEquiFadeFrame( pConcealCommonData, - pConcealmentInfo->cntFadeFrames+1, - 1 /* FadeIn -> FadeOut */); + if (pConcealCommonData->numFadeOutFrames > 0) { + /* change to state FADE-OUT */ + pConcealmentInfo->concealState = ConcealState_FadeOut; + pConcealmentInfo->cntFadeFrames = findEquiFadeFrame( pConcealCommonData, + pConcealmentInfo->cntFadeFrames+1, + 1 /* FadeIn -> FadeOut */); + } else { + /* change to state MUTE */ + pConcealmentInfo->concealState = ConcealState_Mute; + } } break; @@ -1625,8 +1645,13 @@ static void case ConcealState_Ok: if (!(pConcealmentInfo->prevFrameOk[1] || (pConcealmentInfo->prevFrameOk[0] && !pConcealmentInfo->prevFrameOk[1] && frameOk))) { - /* Fade out only if the energy interpolation algorithm can not be applied! */ - pConcealmentInfo->concealState = ConcealState_FadeOut; + if (pConcealCommonData->numFadeOutFrames > 0) { + /* Fade out only if the energy interpolation algorithm can not be applied! */ + pConcealmentInfo->concealState = ConcealState_FadeOut; + } else { + /* change to state MUTE */ + pConcealmentInfo->concealState = ConcealState_Mute; + } pConcealmentInfo->cntFadeFrames = 0; pConcealmentInfo->cntValidFrames = 0; } @@ -1640,11 +1665,16 @@ static void pConcealmentInfo->cntFadeFrames += 1; if (pConcealmentInfo->cntValidFrames > pConcealCommonData->numMuteReleaseFrames) { - /* change to state FADE-IN */ - pConcealmentInfo->concealState = ConcealState_FadeIn; - pConcealmentInfo->cntFadeFrames = findEquiFadeFrame( pConcealCommonData, - pConcealmentInfo->cntFadeFrames-1, - 0 /* FadeOut -> FadeIn */); + if (pConcealCommonData->numFadeInFrames > 0) { + /* change to state FADE-IN */ + pConcealmentInfo->concealState = ConcealState_FadeIn; + pConcealmentInfo->cntFadeFrames = findEquiFadeFrame( pConcealCommonData, + pConcealmentInfo->cntFadeFrames-1, + 0 /* FadeOut -> FadeIn */); + } else { + /* change to state OK */ + pConcealmentInfo->concealState = ConcealState_Ok; + } } else { if (pConcealmentInfo->cntFadeFrames >= pConcealCommonData->numFadeOutFrames) { /* change to state MUTE */ @@ -1655,9 +1685,14 @@ static void case ConcealState_Mute: if (pConcealmentInfo->cntValidFrames > pConcealCommonData->numMuteReleaseFrames) { - /* change to state FADE-IN */ - pConcealmentInfo->concealState = ConcealState_FadeIn; - pConcealmentInfo->cntFadeFrames = pConcealCommonData->numFadeInFrames - 1; + if (pConcealCommonData->numFadeInFrames > 0) { + /* change to state FADE-IN */ + pConcealmentInfo->concealState = ConcealState_FadeIn; + pConcealmentInfo->cntFadeFrames = pConcealCommonData->numFadeInFrames - 1; + } else { + /* change to state OK */ + pConcealmentInfo->concealState = ConcealState_Ok; + } } break; @@ -1670,11 +1705,16 @@ static void pConcealmentInfo->concealState = ConcealState_Ok; } } else { - /* change to state FADE-OUT */ - pConcealmentInfo->concealState = ConcealState_FadeOut; - pConcealmentInfo->cntFadeFrames = findEquiFadeFrame( pConcealCommonData, - pConcealmentInfo->cntFadeFrames+1, - 1 /* FadeIn -> FadeOut */); + if (pConcealCommonData->numFadeOutFrames > 0) { + /* change to state FADE-OUT */ + pConcealmentInfo->concealState = ConcealState_FadeOut; + pConcealmentInfo->cntFadeFrames = findEquiFadeFrame( pConcealCommonData, + pConcealmentInfo->cntFadeFrames+1, + 1 /* FadeIn -> FadeOut */); + } else { + /* change to state MUTE */ + pConcealmentInfo->concealState = ConcealState_Mute; + } } break; } /* End switch(pConcealmentInfo->concealState) */ diff --git a/libAACdec/src/conceal.h b/libAACdec/src/conceal.h index 2abc26a..20e674f 100644 --- a/libAACdec/src/conceal.h +++ b/libAACdec/src/conceal.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/conceal_types.h b/libAACdec/src/conceal_types.h index c1cc6f2..31bc645 100644 --- a/libAACdec/src/conceal_types.h +++ b/libAACdec/src/conceal_types.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/debug.h b/libAACdec/src/debug.h index 9486c66..e903291 100644 --- a/libAACdec/src/debug.h +++ b/libAACdec/src/debug.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/ldfiltbank.cpp b/libAACdec/src/ldfiltbank.cpp index 8f719c8..c08cc41 100644 --- a/libAACdec/src/ldfiltbank.cpp +++ b/libAACdec/src/ldfiltbank.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/ldfiltbank.h b/libAACdec/src/ldfiltbank.h index 97c71b3..d1f9402 100644 --- a/libAACdec/src/ldfiltbank.h +++ b/libAACdec/src/ldfiltbank.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/overlapadd.h b/libAACdec/src/overlapadd.h index 08bef69..1469be7 100644 --- a/libAACdec/src/overlapadd.h +++ b/libAACdec/src/overlapadd.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/pulsedata.cpp b/libAACdec/src/pulsedata.cpp index 4edfd39..0f2f0ec 100644 --- a/libAACdec/src/pulsedata.cpp +++ b/libAACdec/src/pulsedata.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/pulsedata.h b/libAACdec/src/pulsedata.h index 7b10666..fa97d99 100644 --- a/libAACdec/src/pulsedata.h +++ b/libAACdec/src/pulsedata.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/rvlc.cpp b/libAACdec/src/rvlc.cpp index 7b533a5..16f0bf5 100644 --- a/libAACdec/src/rvlc.cpp +++ b/libAACdec/src/rvlc.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/rvlc.h b/libAACdec/src/rvlc.h index 7903659..18d5fa3 100644 --- a/libAACdec/src/rvlc.h +++ b/libAACdec/src/rvlc.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/rvlc_info.h b/libAACdec/src/rvlc_info.h index e245090..63934af 100644 --- a/libAACdec/src/rvlc_info.h +++ b/libAACdec/src/rvlc_info.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/rvlcbit.cpp b/libAACdec/src/rvlcbit.cpp index 9ddc5a6..6efbb93 100644 --- a/libAACdec/src/rvlcbit.cpp +++ b/libAACdec/src/rvlcbit.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/rvlcbit.h b/libAACdec/src/rvlcbit.h index 176e816..02fba88 100644 --- a/libAACdec/src/rvlcbit.h +++ b/libAACdec/src/rvlcbit.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/rvlcconceal.cpp b/libAACdec/src/rvlcconceal.cpp index 682e6eb..ae6b4da 100644 --- a/libAACdec/src/rvlcconceal.cpp +++ b/libAACdec/src/rvlcconceal.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/rvlcconceal.h b/libAACdec/src/rvlcconceal.h index fdc5795..750cbcd 100644 --- a/libAACdec/src/rvlcconceal.h +++ b/libAACdec/src/rvlcconceal.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/stereo.cpp b/libAACdec/src/stereo.cpp index 79ebc7d..4f28244 100644 --- a/libAACdec/src/stereo.cpp +++ b/libAACdec/src/stereo.cpp @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION diff --git a/libAACdec/src/stereo.h b/libAACdec/src/stereo.h index 1ed0d9d..899b485 100644 --- a/libAACdec/src/stereo.h +++ b/libAACdec/src/stereo.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2012 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION |