diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2014-05-20 17:29:03 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2014-05-20 17:29:03 -0700 |
commit | 8e087bf394c5ceddcdb8b1d029795aff3026eea0 (patch) | |
tree | e280804f0e5c2f36d575f430b7f897b1b0b5bc06 /libAACdec/src | |
parent | af967fcc55656a0d3c2a05982713f1ca43c1252b (diff) | |
download | fdk-aac-8e087bf394c5ceddcdb8b1d029795aff3026eea0.tar.gz fdk-aac-8e087bf394c5ceddcdb8b1d029795aff3026eea0.tar.bz2 fdk-aac-8e087bf394c5ceddcdb8b1d029795aff3026eea0.zip |
AAC-Decoder: DRC metadata in stream info
Provide relevant DRC metadata information via API needed for DRC
presentation mode wrapper.
Bug 9428126
Change-Id: I827cd6bdfd2a8799c21935ae32af23739c90a9b6
Diffstat (limited to 'libAACdec/src')
-rw-r--r-- | libAACdec/src/aacdec_drc.cpp | 32 | ||||
-rw-r--r-- | libAACdec/src/aacdec_drc.h | 12 | ||||
-rw-r--r-- | libAACdec/src/aacdec_drc_types.h | 3 | ||||
-rw-r--r-- | libAACdec/src/aacdecoder.cpp | 11 | ||||
-rw-r--r-- | libAACdec/src/aacdecoder_lib.cpp | 2 |
5 files changed, 58 insertions, 2 deletions
diff --git a/libAACdec/src/aacdec_drc.cpp b/libAACdec/src/aacdec_drc.cpp index ba7419d..0c33a2b 100644 --- a/libAACdec/src/aacdec_drc.cpp +++ b/libAACdec/src/aacdec_drc.cpp @@ -145,6 +145,8 @@ void aacDecoder_drcInit ( /* initial program ref level = target ref level */ self->progRefLevel = pParams->targetRefLevel; + self->progRefLevelPresent = 0; + self->presMode = -1; } @@ -572,7 +574,7 @@ static int aacDecoder_drcReadCompression ( return 0; } FDKreadBits(bs, 2); /* dolby_surround_mode */ - FDKreadBits(bs, 2); /* presentation_mode */ + pDrcBs->presMode = FDKreadBits(bs, 2); /* presentation_mode */ FDKreadBits(bs, 1); /* stereo_downmix_mode */ if (FDKreadBits(bs, 1) != 0) { /* reserved, set to 0 */ return 0; @@ -803,9 +805,15 @@ static int aacDecoder_drcExtractAndMap ( */ if (pThreadBs->progRefLevel >= 0) { self->progRefLevel = pThreadBs->progRefLevel; + self->progRefLevelPresent = 1; self->prlExpiryCount = 0; /* Got a new value -> Reset counter */ } + if (drcPayloadType == DVB_DRC_ANC_DATA) { + /* Announce the presentation mode of this valid thread. */ + self->presMode = pThreadBs->presMode; + } + /* SCE, CPE and LFE */ for (ch = 0; ch < validChannels; ch++) { int mapedChannel = channelMapping[ch]; @@ -825,6 +833,7 @@ static int aacDecoder_drcExtractAndMap ( if ( (pParams->expiryFrame > 0) && (self->prlExpiryCount++ > pParams->expiryFrame) ) { /* The program reference level is too old, so set it back to the target level. */ + self->progRefLevelPresent = 0; self->progRefLevel = pParams->targetRefLevel; self->prlExpiryCount = 0; } @@ -1156,3 +1165,24 @@ int aacDecoder_drcEpilog ( return err; } +/* + * Export relevant metadata info from bitstream payload. + */ +void aacDecoder_drcGetInfo ( + HANDLE_AAC_DRC self, + SCHAR *pPresMode, + SCHAR *pProgRefLevel ) +{ + if (self != NULL) { + if (pPresMode != NULL) { + *pPresMode = self->presMode; + } + if (pProgRefLevel != NULL) { + if (self->progRefLevelPresent) { + *pProgRefLevel = self->progRefLevel; + } else { + *pProgRefLevel = -1; + } + } + } +} diff --git a/libAACdec/src/aacdec_drc.h b/libAACdec/src/aacdec_drc.h index 41aac69..c850aa5 100644 --- a/libAACdec/src/aacdec_drc.h +++ b/libAACdec/src/aacdec_drc.h @@ -173,5 +173,17 @@ int aacDecoder_drcEpilog ( UCHAR channelMapping[], int validChannels ); +/** + * \brief Get metadata information found in bitstream. + * \param self DRC module instance handle. + * \param pPresMode Pointer to field where the presentation mode will be written to. + * \param pProgRefLevel Pointer to field where the program reference level will be written to. + * \return Nothing. + */ +void aacDecoder_drcGetInfo ( + HANDLE_AAC_DRC self, + SCHAR *pPresMode, + SCHAR *pProgRefLevel ); + #endif /* AACDEC_DRC_H */ diff --git a/libAACdec/src/aacdec_drc_types.h b/libAACdec/src/aacdec_drc_types.h index 1f595b9..4c6d163 100644 --- a/libAACdec/src/aacdec_drc_types.h +++ b/libAACdec/src/aacdec_drc_types.h @@ -124,6 +124,7 @@ typedef struct { UINT excludedChnsMask; SCHAR progRefLevel; + SCHAR presMode; /* Presentation mode: 0 (not indicated), 1, 2, and 3 (reserved). */ SCHAR pceInstanceTag; CDrcChannelData channelData; @@ -156,9 +157,11 @@ typedef struct USHORT numPayloads; /* The number of DRC data payload elements found within frame */ USHORT numThreads; /* The number of DRC data threads extracted from the found payload elements */ SCHAR progRefLevel; /* Program reference level for all channels */ + UCHAR progRefLevelPresent; /* Program reference level found in bitstream */ UINT prlExpiryCount; /* Counter that can be used to monitor the life time of the program reference level. */ + SCHAR presMode; /* Presentation mode as defined in ETSI TS 101 154 */ 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/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp index 15b47ab..e19c501 100644 --- a/libAACdec/src/aacdecoder.cpp +++ b/libAACdec/src/aacdecoder.cpp @@ -719,6 +719,10 @@ void CStreamInfoInit(CStreamInfo *pStreamInfo) pStreamInfo->frameSize = 0; pStreamInfo->outputDelay = 0; + + /* DRC */ + pStreamInfo->drcProgRefLev = -1; /* set program reference level to not indicated */ + pStreamInfo->drcPresMode = -1; /* default: presentation mode not indicated */ } /*! @@ -1785,6 +1789,13 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( /* Add additional concealment delay */ self->streamInfo.outputDelay += CConcealment_GetDelay(&self->concealCommonData) * self->streamInfo.aacSamplesPerFrame; + /* Map DRC data to StreamInfo structure */ + aacDecoder_drcGetInfo ( + self->hDrcInfo, + &self->streamInfo.drcPresMode, + &self->streamInfo.drcProgRefLev + ); + /* Reorder channel type information tables. */ { AUDIO_CHANNEL_TYPE types[(8)]; diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp index e2c757a..8e3027a 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 8 +#define AACDECODER_LIB_VL2 9 #define AACDECODER_LIB_TITLE "AAC Decoder Lib" #define AACDECODER_LIB_BUILD_DATE __DATE__ #define AACDECODER_LIB_BUILD_TIME __TIME__ |