diff options
author | Fraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de> | 2019-12-19 17:24:21 +0100 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2020-02-13 14:48:27 -0800 |
commit | 79305e068e75df9123f114c95606ef49590f0019 (patch) | |
tree | ad989e29f4c1b5c4e05b3136186bff7a541028de | |
parent | 6b0aab087dd4230e2e64f0fdc4656276c00e22bc (diff) | |
download | fdk-aac-79305e068e75df9123f114c95606ef49590f0019.tar.gz fdk-aac-79305e068e75df9123f114c95606ef49590f0019.tar.bz2 fdk-aac-79305e068e75df9123f114c95606ef49590f0019.zip |
Improve encoder audio quality for low bitreservoir configuration.
Bug: 149489652
Test: atest android.media.cts.EncoderTest#testAACEncoders
Change-Id: I87d5695a93b1f130b95b45d48157e6aaf947709d
-rw-r--r-- | libAACenc/src/aacenc.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libAACenc/src/aacenc.cpp b/libAACenc/src/aacenc.cpp index 8b8a1ad..b6f733d 100644 --- a/libAACenc/src/aacenc.cpp +++ b/libAACenc/src/aacenc.cpp @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- 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. 1. INTRODUCTION @@ -114,6 +114,8 @@ amm-info@iis.fraunhofer.de #include "genericStds.h" +#define BITRES_MIN \ + 300 /* default threshold for using reduced/disabled bitres mode */ #define BITRES_MAX_LD 4000 #define BITRES_MIN_LD 500 #define BITRATE_MAX_LD 70000 /* Max assumed bitrate for bitres calculation */ @@ -550,7 +552,8 @@ AAC_ENCODER_ERROR FDKaacEnc_Initialize( (config->minBitsPerFrame != -1) ? config->minBitsPerFrame : 0; qcInit.minBits = fixMin(qcInit.minBits, averageBitsPerFrame & ~7); } else { - INT bitreservoir = -1; /* default bitrservoir size*/ + INT bitreservoir = -1; /* default bitreservoir size*/ + bitresMin = BITRES_MIN; if (isLowDelay(config->audioObjectType)) { INT brPerChannel = config->bitRate / config->nChannels; brPerChannel = fMin(BITRATE_MAX_LD, fMax(BITRATE_MIN_LD, brPerChannel)); @@ -601,9 +604,9 @@ AAC_ENCODER_ERROR FDKaacEnc_Initialize( qcInit.nSubFrames = config->nSubFrames; qcInit.padding.paddingRest = config->sampleRate; - if (qcInit.bitRes >= bitresMin * config->nChannels) { + if (qcInit.maxBits - qcInit.averageBits >= bitresMin * config->nChannels) { qcInit.bitResMode = AACENC_BR_MODE_FULL; /* full bitreservoir */ - } else if (qcInit.bitRes > 0) { + } else if (qcInit.maxBits > qcInit.averageBits) { qcInit.bitResMode = AACENC_BR_MODE_REDUCED; /* reduced bitreservoir */ } else { qcInit.bitResMode = AACENC_BR_MODE_DISABLED; /* disabled bitreservoir */ |