aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec
diff options
context:
space:
mode:
Diffstat (limited to 'libAACdec')
-rw-r--r--libAACdec/include/aacdecoder_lib.h28
-rw-r--r--libAACdec/src/aacdecoder.cpp2
-rw-r--r--libAACdec/src/aacdecoder_lib.cpp34
3 files changed, 54 insertions, 10 deletions
diff --git a/libAACdec/include/aacdecoder_lib.h b/libAACdec/include/aacdecoder_lib.h
index 6c2fda4..6084bd3 100644
--- a/libAACdec/include/aacdecoder_lib.h
+++ b/libAACdec/include/aacdecoder_lib.h
@@ -892,15 +892,25 @@ typedef struct {
1770. If no level has been found in the bitstream the
value is -1. */
SCHAR
- drcPresMode; /*!< DRC presentation mode. According to ETSI TS 101 154,
- this field indicates whether light (MPEG-4 Dynamic Range
- Control tool) or heavy compression (DVB heavy
- compression) dynamic range control shall take priority
- on the outputs. For details, see ETSI TS 101 154, table
- C.33. Possible values are: \n -1: No corresponding
- metadata found in the bitstream \n 0: DRC presentation
- mode not indicated \n 1: DRC presentation mode 1 \n 2:
- DRC presentation mode 2 \n 3: Reserved */
+ drcPresMode; /*!< DRC presentation mode. According to ETSI TS 101 154,
+ this field indicates whether light (MPEG-4 Dynamic Range
+ Control tool) or heavy compression (DVB heavy
+ compression) dynamic range control shall take priority
+ on the outputs. For details, see ETSI TS 101 154, table
+ C.33. Possible values are: \n -1: No corresponding
+ metadata found in the bitstream \n 0: DRC presentation
+ mode not indicated \n 1: DRC presentation mode 1 \n 2:
+ DRC presentation mode 2 \n 3: Reserved */
+ INT outputLoudness; /*!< Audio output loudness in steps of -0.25 dB. Range: 0
+ (0 dBFS) to 231 (-57.75 dBFS).\n A value of -1
+ indicates that no loudness metadata is present.\n If
+ loudness normalization is active, the value corresponds
+ to the target loudness value set with
+ ::AAC_DRC_REFERENCE_LEVEL.\n If loudness normalization
+ is not active, the output loudness value corresponds to
+ the loudness metadata given in the bitstream.\n
+ Loudness metadata can originate from MPEG-4 DRC or
+ MPEG-D DRC. */
} CStreamInfo;
diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp
index bd12d96..f747b2d 100644
--- a/libAACdec/src/aacdecoder.cpp
+++ b/libAACdec/src/aacdecoder.cpp
@@ -1225,6 +1225,8 @@ static void CStreamInfoInit(CStreamInfo *pStreamInfo) {
pStreamInfo->drcProgRefLev =
-1; /* set program reference level to not indicated */
pStreamInfo->drcPresMode = -1; /* default: presentation mode not indicated */
+
+ pStreamInfo->outputLoudness = -1; /* default: no loudness metadata present */
}
/*!
diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp
index e90dbef..2ba0e86 100644
--- a/libAACdec/src/aacdecoder_lib.cpp
+++ b/libAACdec/src/aacdecoder_lib.cpp
@@ -120,7 +120,7 @@ amm-info@iis.fraunhofer.de
/* Decoder library info */
#define AACDECODER_LIB_VL0 3
#define AACDECODER_LIB_VL1 1
-#define AACDECODER_LIB_VL2 2
+#define AACDECODER_LIB_VL2 3
#define AACDECODER_LIB_TITLE "AAC Decoder Lib"
#ifdef __ANDROID__
#define AACDECODER_LIB_BUILD_DATE ""
@@ -1764,6 +1764,38 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern,
}
}
}
+ if (FDK_drcDec_GetParam(self->hUniDrcDecoder, DRC_DEC_IS_ACTIVE)) {
+ /* return output loudness information for MPEG-D DRC */
+ LONG outputLoudness =
+ FDK_drcDec_GetParam(self->hUniDrcDecoder, DRC_DEC_OUTPUT_LOUDNESS);
+ if (outputLoudness == DRC_DEC_LOUDNESS_NOT_PRESENT) {
+ /* no valid MPEG-D DRC loudness value contained */
+ self->streamInfo.outputLoudness = -1;
+ } else {
+ if (outputLoudness > 0) {
+ /* positive output loudness values (very unusual) are limited to 0
+ * dB */
+ self->streamInfo.outputLoudness = 0;
+ } else {
+ self->streamInfo.outputLoudness =
+ -(INT)outputLoudness >>
+ 22; /* negate and scale from e = 7 to e = (31-2) */
+ }
+ }
+ } else {
+ /* return output loudness information for MPEG-4 DRC */
+ if (self->streamInfo.drcProgRefLev <
+ 0) { /* no MPEG-4 DRC loudness metadata contained */
+ self->streamInfo.outputLoudness = -1;
+ } else {
+ if (self->defaultTargetLoudness <
+ 0) { /* loudness normalization is off */
+ self->streamInfo.outputLoudness = self->streamInfo.drcProgRefLev;
+ } else {
+ self->streamInfo.outputLoudness = self->defaultTargetLoudness;
+ }
+ }
+ }
if (self->streamInfo.extAot != AOT_AAC_SLS) {
INT pcmLimiterScale = 0;