diff options
author | Xin Li <delphij@google.com> | 2020-08-27 10:16:06 -0700 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2020-08-27 10:16:06 -0700 |
commit | 7a0dde5d5dc4d24095c0391e7fa8297de3c7cd45 (patch) | |
tree | 0e353968c34e8c9699663a9b252836b70847c30b /libAACenc/src/aacenc.cpp | |
parent | 946a672b0f5b8481eb3a429f854fcb34d847d692 (diff) | |
parent | e0624f4c05df8b171555bc8c8748ee93655f5b3e (diff) | |
download | fdk-aac-7a0dde5d5dc4d24095c0391e7fa8297de3c7cd45.tar.gz fdk-aac-7a0dde5d5dc4d24095c0391e7fa8297de3c7cd45.tar.bz2 fdk-aac-7a0dde5d5dc4d24095c0391e7fa8297de3c7cd45.zip |
Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: I9bd31724ae68b9a0b3eb4bb5be3782359824aa1f
Change-Id: Idcdb13a8c37b0b4b5446169c3e80dfe55586bc77
Diffstat (limited to 'libAACenc/src/aacenc.cpp')
-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 */ |