summaryrefslogtreecommitdiffstats
path: root/libAACdec
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2013-08-27 16:28:09 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2013-08-27 16:28:09 -0700
commit5016eb7f6582fbb2d72d79be782325a12df08864 (patch)
treebc2325ebc6840a20d25f35a0c5a6a13454d2e402 /libAACdec
parentb9774f90651be61065ae40171fc321f6ced60e49 (diff)
downloadandroid_external_aac-5016eb7f6582fbb2d72d79be782325a12df08864.tar.gz
android_external_aac-5016eb7f6582fbb2d72d79be782325a12df08864.tar.bz2
android_external_aac-5016eb7f6582fbb2d72d79be782325a12df08864.zip
Decoder stability, sanity checks improvements
* AAC-Decoder - Improved PCE handling for saver (re-)configuration and metadata processing. Modified file(s): libAACdec/src/aacdecoder.cpp libAACdec/src/aacdecoder_lib.cpp - Transport layer changes (config found) -> to be evaluated. Modified file(s): libMpegTPDec/include/tpdec_lib.h libMpegTPDec/src/tpdec_latm.h libMpegTPDec/src/version libMpegTPDec/src/tpdec_asc.cpp libMpegTPDec/src/tpdec_lib.cpp libMpegTPDec/src/tpdec_adts.cpp libMpegTPDec/src/tpdec_latm.cpp libSYS/include/FDK_audio.h libSYS/src/genericStds.cpp - Enable concealment state machine to skip states if the corresponding parameter is set to zero. Modified file(s): libAACdec/src/conceal.cpp - Add some more sanity checks to avoid segmentation faults especially when setting dynamic API params. Modified file(s): libAACdec/src/aacdecoder_lib.cpp - Fix to do a fail-safe initialization of IMDCT for all channels even with corrupt streams. Modified file(s): libAACdec/src/aacdecoder.cpp - HCR decoder fix (remove warnings). Modified file(s): libAACdec/src/block.cpp - Fix border calculation in SBR decoder's LPP transposer patch determination. Modified file(s): libSBRdec/src/env_dec.cpp libSBRdec/src/sbrdecoder.cpp libSBRdec/src/lpp_tran.cpp Bug 9428126 Change-Id: Ib415b702b88a7ec8e9a55789d79cafb39296d26b
Diffstat (limited to 'libAACdec')
-rw-r--r--libAACdec/src/aacdecoder.cpp144
-rw-r--r--libAACdec/src/aacdecoder_lib.cpp26
-rw-r--r--libAACdec/src/block.cpp14
-rw-r--r--libAACdec/src/conceal.cpp102
4 files changed, 188 insertions, 98 deletions
diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp
index 3d00d34..3a2a561 100644
--- a/libAACdec/src/aacdecoder.cpp
+++ b/libAACdec/src/aacdecoder.cpp
@@ -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 */
diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp
index 247fcef..9a70f24 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 5
-#define AACDECODER_LIB_VL2 3
+#define AACDECODER_LIB_VL2 4
#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;
}
diff --git a/libAACdec/src/block.cpp b/libAACdec/src/block.cpp
index 0424edb..9d703cc 100644
--- a/libAACdec/src/block.cpp
+++ b/libAACdec/src/block.cpp
@@ -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/conceal.cpp b/libAACdec/src/conceal.cpp
index 733b959..c26051c 100644
--- a/libAACdec/src/conceal.cpp
+++ b/libAACdec/src/conceal.cpp
@@ -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) */