mirror of https://github.com/mstorsjo/fdk-aac.git
Snap for 6203617 from 31f66f6d3f
to rvc-release
Change-Id: Iefbacc1498ce7caf6c6ccb2df4c8b4c6cca4ab76
This commit is contained in:
commit
4e14250c10
Binary file not shown.
|
@ -901,6 +901,16 @@ typedef struct {
|
||||||
metadata found in the bitstream \n 0: DRC presentation
|
metadata found in the bitstream \n 0: DRC presentation
|
||||||
mode not indicated \n 1: DRC presentation mode 1 \n 2:
|
mode not indicated \n 1: DRC presentation mode 1 \n 2:
|
||||||
DRC presentation mode 2 \n 3: Reserved */
|
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;
|
} CStreamInfo;
|
||||||
|
|
||||||
|
|
|
@ -1225,6 +1225,8 @@ static void CStreamInfoInit(CStreamInfo *pStreamInfo) {
|
||||||
pStreamInfo->drcProgRefLev =
|
pStreamInfo->drcProgRefLev =
|
||||||
-1; /* set program reference level to not indicated */
|
-1; /* set program reference level to not indicated */
|
||||||
pStreamInfo->drcPresMode = -1; /* default: presentation mode not indicated */
|
pStreamInfo->drcPresMode = -1; /* default: presentation mode not indicated */
|
||||||
|
|
||||||
|
pStreamInfo->outputLoudness = -1; /* default: no loudness metadata present */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -120,7 +120,7 @@ amm-info@iis.fraunhofer.de
|
||||||
/* Decoder library info */
|
/* Decoder library info */
|
||||||
#define AACDECODER_LIB_VL0 3
|
#define AACDECODER_LIB_VL0 3
|
||||||
#define AACDECODER_LIB_VL1 1
|
#define AACDECODER_LIB_VL1 1
|
||||||
#define AACDECODER_LIB_VL2 2
|
#define AACDECODER_LIB_VL2 3
|
||||||
#define AACDECODER_LIB_TITLE "AAC Decoder Lib"
|
#define AACDECODER_LIB_TITLE "AAC Decoder Lib"
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#define AACDECODER_LIB_BUILD_DATE ""
|
#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) {
|
if (self->streamInfo.extAot != AOT_AAC_SLS) {
|
||||||
INT pcmLimiterScale = 0;
|
INT pcmLimiterScale = 0;
|
||||||
|
|
|
@ -114,6 +114,8 @@ amm-info@iis.fraunhofer.de
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DRC_DEC_LOUDNESS_NOT_PRESENT (LONG)0x7FFFFFFE
|
||||||
|
|
||||||
typedef struct s_drc_decoder* HANDLE_DRC_DECODER;
|
typedef struct s_drc_decoder* HANDLE_DRC_DECODER;
|
||||||
typedef struct s_uni_drc_interface* HANDLE_UNI_DRC_INTERFACE;
|
typedef struct s_uni_drc_interface* HANDLE_UNI_DRC_INTERFACE;
|
||||||
typedef struct s_selection_process_output* HANDLE_SEL_PROC_OUTPUT;
|
typedef struct s_selection_process_output* HANDLE_SEL_PROC_OUTPUT;
|
||||||
|
@ -150,9 +152,12 @@ typedef enum {
|
||||||
DRC_DEC_IS_ACTIVE, /**< MPEG-D DRC payload is present and at least one of
|
DRC_DEC_IS_ACTIVE, /**< MPEG-D DRC payload is present and at least one of
|
||||||
Dynamic Range Control (DRC) or Loudness Normalization
|
Dynamic Range Control (DRC) or Loudness Normalization
|
||||||
(LN) is activated */
|
(LN) is activated */
|
||||||
DRC_DEC_TARGET_CHANNEL_COUNT_SELECTED /**< number of output channels if
|
DRC_DEC_TARGET_CHANNEL_COUNT_SELECTED, /**< number of output channels if
|
||||||
appropriate downmixInstruction exists
|
appropriate downmixInstruction
|
||||||
*/
|
exists */
|
||||||
|
DRC_DEC_OUTPUT_LOUDNESS /**< output loudness in dB, with exponent e = 7, or
|
||||||
|
DRC_DEC_LOUDNESS_NOT_PRESENT if no loudness is
|
||||||
|
contained in the bitstream */
|
||||||
} DRC_DEC_USERPARAM;
|
} DRC_DEC_USERPARAM;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -519,6 +519,8 @@ LONG FDK_drcDec_GetParam(HANDLE_DRC_DECODER hDrcDec,
|
||||||
}
|
}
|
||||||
case DRC_DEC_TARGET_CHANNEL_COUNT_SELECTED:
|
case DRC_DEC_TARGET_CHANNEL_COUNT_SELECTED:
|
||||||
return (LONG)hDrcDec->selProcOutput.targetChannelCount;
|
return (LONG)hDrcDec->selProcOutput.targetChannelCount;
|
||||||
|
case DRC_DEC_OUTPUT_LOUDNESS:
|
||||||
|
return (LONG)hDrcDec->selProcOutput.outputLoudness;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,8 +103,6 @@ amm-info@iis.fraunhofer.de
|
||||||
#include "drcDec_selectionProcess.h"
|
#include "drcDec_selectionProcess.h"
|
||||||
#include "drcDec_tools.h"
|
#include "drcDec_tools.h"
|
||||||
|
|
||||||
#define UNDEFINED_LOUDNESS_VALUE (FIXP_DBL) MAXVAL_DBL
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DETR_NONE = 0,
|
DETR_NONE = 0,
|
||||||
DETR_NIGHT = 1,
|
DETR_NIGHT = 1,
|
||||||
|
@ -1136,9 +1134,8 @@ static DRCDEC_SELECTION_PROCESS_RETURN _preSelectionRequirement8(
|
||||||
|
|
||||||
FIXP_DBL loudnessDeviationMax =
|
FIXP_DBL loudnessDeviationMax =
|
||||||
((FIXP_DBL)hSelProcInput->loudnessDeviationMax) << (DFRACT_BITS - 1 - 7);
|
((FIXP_DBL)hSelProcInput->loudnessDeviationMax) << (DFRACT_BITS - 1 - 7);
|
||||||
;
|
|
||||||
|
|
||||||
if (hSelProcInput->loudnessNormalizationOn) {
|
{
|
||||||
retVal = _getLoudness(hLoudnessInfoSet, hSelProcInput->albumMode,
|
retVal = _getLoudness(hLoudnessInfoSet, hSelProcInput->albumMode,
|
||||||
hSelProcInput->loudnessMeasurementMethod,
|
hSelProcInput->loudnessMeasurementMethod,
|
||||||
hSelProcInput->loudnessMeasurementSystem,
|
hSelProcInput->loudnessMeasurementSystem,
|
||||||
|
@ -1147,9 +1144,10 @@ static DRCDEC_SELECTION_PROCESS_RETURN _preSelectionRequirement8(
|
||||||
hSelProcInput->downmixIdRequested[downmixIdIndex],
|
hSelProcInput->downmixIdRequested[downmixIdIndex],
|
||||||
&loudnessNormalizationGainDb, &loudness);
|
&loudnessNormalizationGainDb, &loudness);
|
||||||
if (retVal) return (retVal);
|
if (retVal) return (retVal);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (!hSelProcInput->loudnessNormalizationOn) {
|
||||||
loudnessNormalizationGainDb = (FIXP_DBL)0;
|
loudnessNormalizationGainDb = (FIXP_DBL)0;
|
||||||
loudness = UNDEFINED_LOUDNESS_VALUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
retVal = _getSignalPeakLevel(
|
retVal = _getSignalPeakLevel(
|
||||||
|
@ -2070,6 +2068,7 @@ static DRCDEC_SELECTION_PROCESS_RETURN _generateOutputInfo(
|
||||||
pSelectionData->loudnessNormalizationGainDbAdjusted +
|
pSelectionData->loudnessNormalizationGainDbAdjusted +
|
||||||
hSelProcInput->loudnessNormalizationGainModificationDb;
|
hSelProcInput->loudnessNormalizationGainModificationDb;
|
||||||
hSelProcOutput->outputPeakLevelDb = pSelectionData->outputPeakLevel;
|
hSelProcOutput->outputPeakLevelDb = pSelectionData->outputPeakLevel;
|
||||||
|
hSelProcOutput->outputLoudness = pSelectionData->outputLoudness;
|
||||||
|
|
||||||
hSelProcOutput->boost = boost;
|
hSelProcOutput->boost = boost;
|
||||||
hSelProcOutput->compress = compress;
|
hSelProcOutput->compress = compress;
|
||||||
|
|
|
@ -111,6 +111,8 @@ amm-info@iis.fraunhofer.de
|
||||||
|
|
||||||
typedef struct s_drcdec_selection_process* HANDLE_DRC_SELECTION_PROCESS;
|
typedef struct s_drcdec_selection_process* HANDLE_DRC_SELECTION_PROCESS;
|
||||||
|
|
||||||
|
#define UNDEFINED_LOUDNESS_VALUE (FIXP_DBL)(MAXVAL_DBL - 1)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DRCDEC_SELECTION_PROCESS_NO_ERROR = 0,
|
DRCDEC_SELECTION_PROCESS_NO_ERROR = 0,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue