Enhance encoder audio quality for vbr (FDKenc v4.0.1).

Bug: 149489652
Test: atest android.media.cts.EncoderTest#testAACEncoders
Change-Id: I4af82bd104a94710d1977eaa0bd086aa743d3adf
This commit is contained in:
Fraunhofer IIS FDK 2019-12-19 17:25:55 +01:00 committed by Jean-Michel Trivi
parent 79305e068e
commit 443d38963e
6 changed files with 36 additions and 48 deletions

Binary file not shown.

View File

@ -436,31 +436,32 @@ audio quality.
\subsection vbrmode Variable Bitrate Mode \subsection vbrmode Variable Bitrate Mode
The encoder provides various Variable Bitrate Modes that differ in audio quality The variable bitrate (VBR) mode coding adapts the bit consumption to the
and average overall bitrate. The given values are averages over time, different psychoacoustic requirements of the signal. The encoder ignores the user-defined
encoder settings and strongly depend on the type of audio signal. The VBR bit rate and selects a suitable pre-defined configuration based on the provided
configurations can be adjusted via ::AACENC_BITRATEMODE encoder parameter. AOT. The VBR mode 1 is tuned for HE-AACv2, for VBR mode 2, HE-AACv1 should be
used. VBR modes 3-5 should be used with Low-Complexity AAC. When encoding
AAC-ELD, the best mode is selected automatically.
The bitrates given in the table are averages over time and different encoder
settings. They strongly depend on the type of audio signal. The VBR
configurations can be adjusted with the ::AACENC_BITRATEMODE encoder parameter.
\verbatim \verbatim
-------------------------------------------- -----------------------------------------------
VBR_MODE | Approx. Bitrate in kbps/channel VBR_MODE | Approx. Bitrate in kbps for stereo
| AAC-LC | AAC-LD/AC_ELD | AAC-LC | AAC-ELD
----------+---------------+----------------- ----------+---------------+--------------------
VBR_1 | 32 - 48 | 32 - 56 VBR_1 | 32 (HE-AACv2) | 48
VBR_2 | 40 - 56 | 40 - 64 VBR_2 | 72 (HE-AACv1) | 56
VBR_3 | 48 - 64 | 48 - 72 VBR_3 | 112 | 72
VBR_4 | 64 - 80 | 64 - 88 VBR_4 | 148 | 148
VBR_5 | 96 - 120 | 112 - 144 VBR_5 | 228 | 224
-------------------------------------------- --------------------------------------------
\endverbatim \endverbatim
The bitrate ranges apply for individual audio channels. In case of multichannel Note that these figures are valid for stereo encoding only. VBR modes 2-5 will
configurations the average bitrate might be estimated by multiplying with the yield much lower bit rates when encoding single-channel input. For
number of effective channels. This corresponds to all audio input channels configurations which are making use of downmix modules the AAC core channels
exclusively the low frequency channel. At configurations which are making use of respectively downmix channels shall be considered.
downmix modules the AAC core channels respectively downmix channels shall be
considered. For ::AACENC_AOT which are using SBR, the average bitrate can be
estimated by using the ratio of 0.5 for dualrate SBR and 0.75 for downsampled
SBR configurations.
\subsection encQual Audio Quality Considerations \subsection encQual Audio Quality Considerations
The default encoder configuration is suggested to be used. Encoder tools such as The default encoder configuration is suggested to be used. Encoder tools such as

View File

@ -110,7 +110,7 @@ amm-info@iis.fraunhofer.de
/* Encoder library info */ /* Encoder library info */
#define AACENCODER_LIB_VL0 4 #define AACENCODER_LIB_VL0 4
#define AACENCODER_LIB_VL1 0 #define AACENCODER_LIB_VL1 0
#define AACENCODER_LIB_VL2 0 #define AACENCODER_LIB_VL2 1
#define AACENCODER_LIB_TITLE "AAC Encoder" #define AACENCODER_LIB_TITLE "AAC Encoder"
#ifdef __ANDROID__ #ifdef __ANDROID__
#define AACENCODER_LIB_BUILD_DATE "" #define AACENCODER_LIB_BUILD_DATE ""

View File

@ -1302,14 +1302,6 @@ static void FDKaacEnc_reduceThresholdsVBR(
if (sfbThrReducedLdData < FL2FXCONST_DBL(-0.5f)) if (sfbThrReducedLdData < FL2FXCONST_DBL(-0.5f))
sfbThrReducedLdData = FL2FXCONST_DBL(-1.f); sfbThrReducedLdData = FL2FXCONST_DBL(-1.f);
/* minimum of 29 dB Ratio for Thresholds */
if ((sfbEnLdData + FL2FXCONST_DBL(1.0f)) >
FL2FXCONST_DBL(9.6336206 / LD_DATA_SCALING)) {
sfbThrReducedLdData = fixMax(
sfbThrReducedLdData,
sfbEnLdData - FL2FXCONST_DBL(9.6336206 / LD_DATA_SCALING));
}
sfbThrReducedLdData = fixMax(MIN_LDTHRESH, sfbThrReducedLdData); sfbThrReducedLdData = fixMax(MIN_LDTHRESH, sfbThrReducedLdData);
qcOutChan->sfbThresholdLdData[sfbGrp + sfb] = sfbThrReducedLdData; qcOutChan->sfbThresholdLdData[sfbGrp + sfb] = sfbThrReducedLdData;

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
@ -151,11 +151,11 @@ typedef struct {
static const BANDWIDTH_TAB_VBR bandWidthTableVBR[] = { static const BANDWIDTH_TAB_VBR bandWidthTableVBR[] = {
{AACENC_BR_MODE_CBR, 0, 0}, {AACENC_BR_MODE_CBR, 0, 0},
{AACENC_BR_MODE_VBR_1, 13050, 13050}, {AACENC_BR_MODE_VBR_1, 13000, 13000},
{AACENC_BR_MODE_VBR_2, 13050, 13050}, {AACENC_BR_MODE_VBR_2, 13000, 13000},
{AACENC_BR_MODE_VBR_3, 14260, 14260}, {AACENC_BR_MODE_VBR_3, 15750, 15750},
{AACENC_BR_MODE_VBR_4, 15500, 15500}, {AACENC_BR_MODE_VBR_4, 16500, 16500},
{AACENC_BR_MODE_VBR_5, 48000, 48000}, {AACENC_BR_MODE_VBR_5, 19293, 19293},
{AACENC_BR_MODE_SFR, 0, 0}, {AACENC_BR_MODE_SFR, 0, 0},
{AACENC_BR_MODE_FF, 0, 0} {AACENC_BR_MODE_FF, 0, 0}

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
@ -121,20 +121,15 @@ typedef struct {
static const TAB_VBR_QUAL_FACTOR tableVbrQualFactor[] = { static const TAB_VBR_QUAL_FACTOR tableVbrQualFactor[] = {
{QCDATA_BR_MODE_VBR_1, {QCDATA_BR_MODE_VBR_1,
FL2FXCONST_DBL(0.160f)}, /* Approx. 32 - 48 (AC-LC), 32 - 56 FL2FXCONST_DBL(0.150f)}, /* Approx. 32 kbps mono AAC-LC + SBR + PS */
(AAC-LD/ELD) kbps/channel */
{QCDATA_BR_MODE_VBR_2, {QCDATA_BR_MODE_VBR_2,
FL2FXCONST_DBL(0.148f)}, /* Approx. 40 - 56 (AC-LC), 40 - 64 FL2FXCONST_DBL(0.162f)}, /* Approx. 64 kbps stereo AAC-LC + SBR */
(AAC-LD/ELD) kbps/channel */
{QCDATA_BR_MODE_VBR_3, {QCDATA_BR_MODE_VBR_3,
FL2FXCONST_DBL(0.135f)}, /* Approx. 48 - 64 (AC-LC), 48 - 72 FL2FXCONST_DBL(0.176f)}, /* Approx. 96 kbps stereo AAC-LC */
(AAC-LD/ELD) kbps/channel */
{QCDATA_BR_MODE_VBR_4, {QCDATA_BR_MODE_VBR_4,
FL2FXCONST_DBL(0.111f)}, /* Approx. 64 - 80 (AC-LC), 64 - 88 FL2FXCONST_DBL(0.120f)}, /* Approx. 128 kbps stereo AAC-LC */
(AAC-LD/ELD) kbps/channel */
{QCDATA_BR_MODE_VBR_5, {QCDATA_BR_MODE_VBR_5,
FL2FXCONST_DBL(0.070f)} /* Approx. 96 - 120 (AC-LC), 112 - 144 FL2FXCONST_DBL(0.070f)} /* Approx. 192 kbps stereo AAC-LC */
(AAC-LD/ELD) kbps/channel */
}; };
static INT isConstantBitrateMode(const QCDATA_BR_MODE bitrateMode) { static INT isConstantBitrateMode(const QCDATA_BR_MODE bitrateMode) {