mirror of
https://github.com/mstorsjo/fdk-aac.git
synced 2025-06-05 22:39:13 +02:00
Decode parametric stereo even with invalid channel config
AAC decoder: Allow decoding of Parametric Stereo (AOT 29) bitstreams with invalid channel config 2. Bug 9428126 Change-Id: I1e8b801dfc0e6b1706421342d4985512e83f0dbe
This commit is contained in:
@@ -504,7 +504,8 @@ typedef struct
|
|||||||
INT aacSamplesPerFrame; /*!< Samples per frame for the AAC core (from ASC). \n
|
INT aacSamplesPerFrame; /*!< Samples per frame for the AAC core (from ASC). \n
|
||||||
1024 or 960 for AAC-LC \n
|
1024 or 960 for AAC-LC \n
|
||||||
512 or 480 for AAC-LD and AAC-ELD */
|
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) */
|
AUDIO_OBJECT_TYPE extAot; /*!< Extension Audio Object Type (from ASC) */
|
||||||
INT extSamplingRate; /*!< Extension sampling rate in Hz (from ASC) */
|
INT extSamplingRate; /*!< Extension sampling rate in Hz (from ASC) */
|
||||||
|
|
||||||
|
@@ -183,7 +183,7 @@ void CAacDecoder_SyncQmfMode(HANDLE_AACDECODER self)
|
|||||||
if ( self->qmfModeCurr == NOT_DEFINED )
|
if ( self->qmfModeCurr == NOT_DEFINED )
|
||||||
{
|
{
|
||||||
if ( (IS_LOWDELAY(self->streamInfo.aot) && (self->flags & AC_MPS_PRESENT))
|
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))
|
&& ( (CAN_DO_PS(self->streamInfo.aot) && !(self->flags & AC_MPS_PRESENT))
|
||||||
|| ( IS_USAC(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. */
|
/* Set SBR to current QMF mode. Error does not matter. */
|
||||||
sbrDecoder_SetParam(self->hSbrDecoder, SBR_QMF_MODE, (self->qmfModeCurr == MODE_LP));
|
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 ) );
|
FDK_ASSERT( ! ( (self->flags & AC_MPS_PRESENT) && self->psPossible ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1573,7 +1573,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Update number of output channels */
|
/* Update number of output channels */
|
||||||
self->streamInfo.numChannels = aacChannels;
|
self->streamInfo.aacNumChannels = aacChannels;
|
||||||
|
|
||||||
#ifdef TP_PCE_ENABLE
|
#ifdef TP_PCE_ENABLE
|
||||||
if (pceRead == 1 && CProgramConfig_IsValid(pce)) {
|
if (pceRead == 1 && CProgramConfig_IsValid(pce)) {
|
||||||
|
@@ -110,7 +110,7 @@ amm-info@iis.fraunhofer.de
|
|||||||
/* Decoder library info */
|
/* Decoder library info */
|
||||||
#define AACDECODER_LIB_VL0 2
|
#define AACDECODER_LIB_VL0 2
|
||||||
#define AACDECODER_LIB_VL1 5
|
#define AACDECODER_LIB_VL1 5
|
||||||
#define AACDECODER_LIB_VL2 1
|
#define AACDECODER_LIB_VL2 2
|
||||||
#define AACDECODER_LIB_TITLE "AAC Decoder Lib"
|
#define AACDECODER_LIB_TITLE "AAC Decoder Lib"
|
||||||
#define AACDECODER_LIB_BUILD_DATE __DATE__
|
#define AACDECODER_LIB_BUILD_DATE __DATE__
|
||||||
#define AACDECODER_LIB_BUILD_TIME __TIME__
|
#define AACDECODER_LIB_BUILD_TIME __TIME__
|
||||||
@@ -794,8 +794,8 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(
|
|||||||
/* Export data into streaminfo structure */
|
/* Export data into streaminfo structure */
|
||||||
self->streamInfo.sampleRate = self->streamInfo.aacSampleRate;
|
self->streamInfo.sampleRate = self->streamInfo.aacSampleRate;
|
||||||
self->streamInfo.frameSize = self->streamInfo.aacSamplesPerFrame;
|
self->streamInfo.frameSize = self->streamInfo.aacSamplesPerFrame;
|
||||||
self->streamInfo.numChannels = self->aacChannels;
|
|
||||||
}
|
}
|
||||||
|
self->streamInfo.numChannels = self->streamInfo.aacNumChannels;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -832,7 +832,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(
|
|||||||
pTimeData,
|
pTimeData,
|
||||||
&self->streamInfo.numChannels,
|
&self->streamInfo.numChannels,
|
||||||
&self->streamInfo.sampleRate,
|
&self->streamInfo.sampleRate,
|
||||||
self->channelOutputMapping[self->aacChannels-1],
|
self->channelOutputMapping[self->streamInfo.numChannels-1],
|
||||||
interleaved,
|
interleaved,
|
||||||
self->frameOK,
|
self->frameOK,
|
||||||
&self->psPossible);
|
&self->psPossible);
|
||||||
|
@@ -206,7 +206,7 @@ void CProgramConfig_Read ( CProgramConfig *pPce,
|
|||||||
*/
|
*/
|
||||||
int CProgramConfig_LookupElement(
|
int CProgramConfig_LookupElement(
|
||||||
CProgramConfig *pPce,
|
CProgramConfig *pPce,
|
||||||
const UINT channelConfig,
|
UINT channelConfig,
|
||||||
const UINT tag,
|
const UINT tag,
|
||||||
const UINT channelIdx,
|
const UINT channelIdx,
|
||||||
UCHAR chMapping[],
|
UCHAR chMapping[],
|
||||||
|
@@ -267,7 +267,7 @@ void getImplicitAudioChannelTypeAndIndex(
|
|||||||
|
|
||||||
int CProgramConfig_LookupElement(
|
int CProgramConfig_LookupElement(
|
||||||
CProgramConfig *pPce,
|
CProgramConfig *pPce,
|
||||||
const UINT channelConfig,
|
UINT channelConfig,
|
||||||
const UINT tag,
|
const UINT tag,
|
||||||
const UINT channelIdx,
|
const UINT channelIdx,
|
||||||
UCHAR chMapping[],
|
UCHAR chMapping[],
|
||||||
@@ -289,7 +289,13 @@ int CProgramConfig_LookupElement(
|
|||||||
*elMapping = pPce->elCounter;
|
*elMapping = pPce->elCounter;
|
||||||
if (elList[pPce->elCounter] != elType) {
|
if (elList[pPce->elCounter] != elType) {
|
||||||
/* Not in the list */
|
/* Not in the list */
|
||||||
return 0;
|
if ( (channelConfig == 2) && (elType == ID_SCE) )
|
||||||
|
{ /* This scenario occurs with HE-AAC v2 streams of buggy encoders.
|
||||||
|
Due to other decoder implementations decoding of these kind of streams is desired. */
|
||||||
|
channelConfig = 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Assume all front channels */
|
/* Assume all front channels */
|
||||||
getImplicitAudioChannelTypeAndIndex(&chType[channelIdx], &chIndex[channelIdx], channelConfig, channelIdx);
|
getImplicitAudioChannelTypeAndIndex(&chType[channelIdx], &chIndex[channelIdx], channelConfig, channelIdx);
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/* library info */
|
/* library info */
|
||||||
#define TP_LIB_VL0 2
|
#define TP_LIB_VL0 2
|
||||||
#define TP_LIB_VL1 3
|
#define TP_LIB_VL1 3
|
||||||
#define TP_LIB_VL2 0
|
#define TP_LIB_VL2 1
|
||||||
#define TP_LIB_TITLE "MPEG Transport"
|
#define TP_LIB_TITLE "MPEG Transport"
|
||||||
#define TP_LIB_BUILD_DATE __DATE__
|
#define TP_LIB_BUILD_DATE __DATE__
|
||||||
#define TP_LIB_BUILD_TIME __TIME__
|
#define TP_LIB_BUILD_TIME __TIME__
|
||||||
|
Reference in New Issue
Block a user