MPEG-4/D DRC unification, loudness norm default at -24

Unify API parameter of MPEG-4/D DRC and introduce rounding to boost/compress setParam function (FDKdec v3.1.1).

Enable Loudness Normalization with target loudness -24 by default (FDKdec v3.1.2).

Bug: 131255165
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: I249a36b4861d0c8d4a0ed2df4dc1f444576bac6b
This commit is contained in:
Fraunhofer IIS FDK 2019-03-08 16:03:49 +01:00 committed by Jean-Michel Trivi
parent 37972d5a1f
commit 14f7e13693
5 changed files with 70 additions and 54 deletions

Binary file not shown.

View File

@ -741,46 +741,62 @@ typedef enum {
::CONCEAL_INTER. only some AOTs are ::CONCEAL_INTER. only some AOTs are
supported). \n */ supported). \n */
AAC_DRC_BOOST_FACTOR = AAC_DRC_BOOST_FACTOR =
0x0200, /*!< Dynamic Range Control: Scaling factor for boosting gain 0x0200, /*!< MPEG-4 / MPEG-D Dynamic Range Control (DRC): Scaling factor
values. Defines how the boosting DRC factors (conveyed in the for boosting gain values. Defines how the boosting DRC factors
bitstream) will be applied to the decoded signal. The valid (conveyed in the bitstream) will be applied to the decoded
values range from 0 (don't apply boost factors) to 127 (fully signal. The valid values range from 0 (don't apply boost
apply boost factors). Default value is 0. */ factors) to 127 (fully apply boost factors). Default value is 0
AAC_DRC_ATTENUATION_FACTOR = for MPEG-4 DRC and 127 for MPEG-D DRC. */
0x0201, /*!< Dynamic Range Control: Scaling factor for attenuating gain AAC_DRC_ATTENUATION_FACTOR = 0x0201, /*!< MPEG-4 / MPEG-D DRC: Scaling factor
values. Same as for attenuating gain values. Same as
::AAC_DRC_BOOST_FACTOR but for attenuating DRC factors. */ ::AAC_DRC_BOOST_FACTOR but for
attenuating DRC factors. */
AAC_DRC_REFERENCE_LEVEL = AAC_DRC_REFERENCE_LEVEL =
0x0202, /*!< Dynamic Range Control (DRC): Target reference level. Defines 0x0202, /*!< MPEG-4 / MPEG-D DRC: Target reference level / decoder target
the level below full-scale (quantized in steps of 0.25dB) to loudness.\n Defines the level below full-scale (quantized in
which the output audio signal will be normalized to by the DRC steps of 0.25dB) to which the output audio signal will be
module. The parameter controls loudness normalization for both normalized to by the DRC module.\n The parameter controls
MPEG-4 DRC and MPEG-D DRC. The valid values range from 40 (-10 loudness normalization for both MPEG-4 DRC and MPEG-D DRC. The
dBFS) to 127 (-31.75 dBFS). Any value smaller than 0 switches valid values range from 40 (-10 dBFS) to 127 (-31.75 dBFS).\n
off loudness normalization and MPEG-4 DRC. By default, loudness Example values:\n
normalization and MPEG-4 DRC is switched off. */ 124 (-31 dBFS) for audio/video receivers (AVR) or other
devices allowing audio playback with high dynamic range,\n 96
(-24 dBFS) for TV sets or equivalent devices (default),\n 64
(-16 dBFS) for mobile devices where the dynamic range of audio
playback is restricted.\n Any value smaller than 0 switches off
loudness normalization and MPEG-4 DRC. */
AAC_DRC_HEAVY_COMPRESSION = AAC_DRC_HEAVY_COMPRESSION =
0x0203, /*!< Dynamic Range Control: En-/Disable DVB specific heavy 0x0203, /*!< MPEG-4 DRC: En-/Disable DVB specific heavy compression (aka
compression (aka RF mode). If set to 1, the decoder will apply RF mode). If set to 1, the decoder will apply the compression
the compression values from the DVB specific ancillary data values from the DVB specific ancillary data field. At the same
field. At the same time the MPEG-4 Dynamic Range Control tool time the MPEG-4 Dynamic Range Control tool will be disabled. By
will be disabled. By default, heavy compression is disabled. */ default, heavy compression is disabled. */
AAC_DRC_DEFAULT_PRESENTATION_MODE = AAC_DRC_DEFAULT_PRESENTATION_MODE =
0x0204, /*!< Dynamic Range Control: Default presentation mode (DRC 0x0204, /*!< MPEG-4 DRC: Default presentation mode (DRC parameter
parameter handling). \n Defines the handling of the DRC handling). \n Defines the handling of the DRC parameters boost
parameters boost factor, attenuation factor and heavy factor, attenuation factor and heavy compression, if no
compression, if no presentation mode is indicated in the presentation mode is indicated in the bitstream.\n For options,
bitstream.\n For options, see see ::AAC_DRC_DEFAULT_PRESENTATION_MODE_OPTIONS.\n Default:
::AAC_DRC_DEFAULT_PRESENTATION_MODE_OPTIONS.\n Default:
::AAC_DRC_PARAMETER_HANDLING_DISABLED */ ::AAC_DRC_PARAMETER_HANDLING_DISABLED */
AAC_DRC_ENC_TARGET_LEVEL = AAC_DRC_ENC_TARGET_LEVEL =
0x0205, /*!< Dynamic Range Control: Encoder target level for light (i.e. 0x0205, /*!< MPEG-4 DRC: Encoder target level for light (i.e. not heavy)
not heavy) compression.\n If known, this declares the target compression.\n If known, this declares the target reference
reference level that was assumed at the encoder for calculation level that was assumed at the encoder for calculation of
of limiting gains. The valid values range from 0 (full-scale) limiting gains. The valid values range from 0 (full-scale) to
to 127 (31.75 dB below full-scale). This parameter is used only 127 (31.75 dB below full-scale). This parameter is used only
with ::AAC_DRC_PARAMETER_HANDLING_ENABLED and ignored with ::AAC_DRC_PARAMETER_HANDLING_ENABLED and ignored
otherwise.\n Default: 127 (worst-case assumption).\n */ otherwise.\n Default: 127 (worst-case assumption).\n */
AAC_UNIDRC_SET_EFFECT = 0x0206, /*!< MPEG-D DRC: Request a DRC effect type for
selection of a DRC set.\n Supported indices
are:\n -1: DRC off. Completely disables
MPEG-D DRC.\n 0: None (default). Disables
MPEG-D DRC, but automatically enables DRC
if necessary to prevent clipping.\n 1: Late
night\n 2: Noisy environment\n 3: Limited
playback range\n 4: Low playback level\n 5:
Dialog enhancement\n 6: General
compression. Used for generally enabling
MPEG-D DRC without particular request.\n */
AAC_UNIDRC_ALBUM_MODE = AAC_UNIDRC_ALBUM_MODE =
0x0207, /*!< MPEG-D DRC: Enable album mode. 0: Disabled (default), 1: 0x0207, /*!< MPEG-D DRC: Enable album mode. 0: Disabled (default), 1:
Enabled.\n Disabled album mode leads to application of gain Enabled.\n Disabled album mode leads to application of gain
@ -793,20 +809,9 @@ typedef enum {
Use complex QMF data mode. \n 1: Use real (low Use complex QMF data mode. \n 1: Use real (low
power) QMF data mode. \n */ power) QMF data mode. \n */
AAC_TPDEC_CLEAR_BUFFER = AAC_TPDEC_CLEAR_BUFFER =
0x0603, /*!< Clear internal bit stream buffer of transport layers. The 0x0603 /*!< Clear internal bit stream buffer of transport layers. The
decoder will start decoding at new data passed after this event decoder will start decoding at new data passed after this event
and any previous data is discarded. */ and any previous data is discarded. */
AAC_UNIDRC_SET_EFFECT = 0x0903 /*!< MPEG-D DRC: Request a DRC effect type for
selection of a DRC set.\n Supported indices
are:\n -1: DRC off. Completely disables
MPEG-D DRC.\n 0: None (default). Disables
MPEG-D DRC, but automatically enables DRC if
necessary to prevent clipping.\n 1: Late
night\n 2: Noisy environment\n 3: Limited
playback range\n 4: Low playback level\n 5:
Dialog enhancement\n 6: General compression.
Used for generally enabling MPEG-D DRC
without particular request.\n */
} AACDEC_PARAM; } AACDEC_PARAM;

View File

@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten © Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved. Forschung e.V. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -174,9 +174,9 @@ void aacDecoder_drcInit(HANDLE_AAC_DRC self) {
pParams->usrCut = FL2FXCONST_DBL(0.0f); pParams->usrCut = FL2FXCONST_DBL(0.0f);
pParams->boost = FL2FXCONST_DBL(0.0f); pParams->boost = FL2FXCONST_DBL(0.0f);
pParams->usrBoost = FL2FXCONST_DBL(0.0f); pParams->usrBoost = FL2FXCONST_DBL(0.0f);
pParams->targetRefLevel = -1; pParams->targetRefLevel = 96;
pParams->expiryFrame = AACDEC_DRC_DFLT_EXPIRY_FRAMES; pParams->expiryFrame = AACDEC_DRC_DFLT_EXPIRY_FRAMES;
pParams->applyDigitalNorm = OFF; pParams->applyDigitalNorm = ON;
pParams->applyHeavyCompression = OFF; pParams->applyHeavyCompression = OFF;
pParams->usrApplyHeavyCompression = OFF; pParams->usrApplyHeavyCompression = OFF;

View File

@ -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 0 #define AACDECODER_LIB_VL2 2
#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 ""
@ -823,11 +823,15 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_SetParam(
case AAC_DRC_ATTENUATION_FACTOR: case AAC_DRC_ATTENUATION_FACTOR:
/* DRC compression factor (where 0 is no and 127 is max compression) */ /* DRC compression factor (where 0 is no and 127 is max compression) */
errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_CUT_SCALE, value); errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_CUT_SCALE, value);
uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_COMPRESS,
value * (FL2FXCONST_DBL(0.5f / 127.0f)));
break; break;
case AAC_DRC_BOOST_FACTOR: case AAC_DRC_BOOST_FACTOR:
/* DRC boost factor (where 0 is no and 127 is max boost) */ /* DRC boost factor (where 0 is no and 127 is max boost) */
errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_BOOST_SCALE, value); errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_BOOST_SCALE, value);
uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_BOOST,
value * (FL2FXCONST_DBL(0.5f / 127.0f)));
break; break;
case AAC_DRC_REFERENCE_LEVEL: case AAC_DRC_REFERENCE_LEVEL:

View File

@ -603,14 +603,21 @@ drcDec_SelectionProcess_SetParam(HANDLE_DRC_SELECTION_PROCESS hInstance,
if ((requestValue < (FIXP_DBL)0) || if ((requestValue < (FIXP_DBL)0) ||
(requestValue > FL2FXCONST_DBL(1.0f / (float)(1 << 1)))) (requestValue > FL2FXCONST_DBL(1.0f / (float)(1 << 1))))
return DRCDEC_SELECTION_PROCESS_PARAM_OUT_OF_RANGE; return DRCDEC_SELECTION_PROCESS_PARAM_OUT_OF_RANGE;
diff |= _compAssign(&pSelProcInput->boost, FX_DBL2FX_SGL(requestValue)); diff |= _compAssign(
&pSelProcInput->boost,
FX_DBL2FX_SGL(
requestValue +
(FIXP_DBL)(1 << 15))); /* convert to FIXP_SGL with rounding */
break; break;
case SEL_PROC_COMPRESS: case SEL_PROC_COMPRESS:
if ((requestValue < (FIXP_DBL)0) || if ((requestValue < (FIXP_DBL)0) ||
(requestValue > FL2FXCONST_DBL(1.0f / (float)(1 << 1)))) (requestValue > FL2FXCONST_DBL(1.0f / (float)(1 << 1))))
return DRCDEC_SELECTION_PROCESS_PARAM_OUT_OF_RANGE; return DRCDEC_SELECTION_PROCESS_PARAM_OUT_OF_RANGE;
diff |= diff |= _compAssign(
_compAssign(&pSelProcInput->compress, FX_DBL2FX_SGL(requestValue)); &pSelProcInput->compress,
FX_DBL2FX_SGL(
requestValue +
(FIXP_DBL)(1 << 15))); /* convert to FIXP_SGL with rounding */
break; break;
default: default:
return DRCDEC_SELECTION_PROCESS_INVALID_PARAM; return DRCDEC_SELECTION_PROCESS_INVALID_PARAM;