1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-06-05 22:39:13 +02:00

Extend decoder API with audio output loudness info (FDKdec v3.1.3).

Bug: 148385721
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I68b09883def21baef259c9ab914922567ab8cee3
This commit is contained in:
Fraunhofer IIS FDK
2019-12-19 17:21:07 +01:00
committed by Jean-Michel Trivi
parent 3255d513ce
commit 31f66f6d3f
8 changed files with 71 additions and 19 deletions

View File

@ -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;