aboutsummaryrefslogtreecommitdiffstats
path: root/libAACenc/src/aacenc_lib.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2016-04-09 05:44:33 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-04-09 05:44:33 +0000
commit4a5a256a01c0f6aa0ebd1b94bba77a70fcac75ee (patch)
tree626b5c026f23b0c8ec4dab155faf86d55cd9d94e /libAACenc/src/aacenc_lib.cpp
parent20e8db77ff09cefbe191f1e50815ff8f971a3353 (diff)
parent125815b0ed558c72bb019a2d36c662e5e7f7c030 (diff)
downloadfdk-aac-4a5a256a01c0f6aa0ebd1b94bba77a70fcac75ee.tar.gz
fdk-aac-4a5a256a01c0f6aa0ebd1b94bba77a70fcac75ee.tar.bz2
fdk-aac-4a5a256a01c0f6aa0ebd1b94bba77a70fcac75ee.zip
AAC/SBR encoder improvements am: 46ba367
am: 125815b * commit '125815b0ed558c72bb019a2d36c662e5e7f7c030': AAC/SBR encoder improvements Change-Id: I4ef0a1959666e21ace6086f184302aed640043f6
Diffstat (limited to 'libAACenc/src/aacenc_lib.cpp')
-rw-r--r--libAACenc/src/aacenc_lib.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index 9a3b214..2845177 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -98,7 +98,7 @@ amm-info@iis.fraunhofer.de
/* Encoder library info */
#define AACENCODER_LIB_VL0 3
#define AACENCODER_LIB_VL1 4
-#define AACENCODER_LIB_VL2 19
+#define AACENCODER_LIB_VL2 22
#define AACENCODER_LIB_TITLE "AAC Encoder"
#ifdef __ANDROID__
#define AACENCODER_LIB_BUILD_DATE ""
@@ -813,11 +813,16 @@ AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
switch ( hAacConfig->audioObjectType ) {
case AOT_ER_AAC_LD:
case AOT_ER_AAC_ELD:
- if (config->userBitrateMode==8) {
- hAacConfig->bitrateMode = 0;
- }
if (config->userBitrateMode==0) {
- hAacConfig->bitreservoir = 100*config->nChannels; /* default, reduced bitreservoir */
+ /* bitreservoir = (maxBitRes-minBitRes)/(maxBitRate-minBitrate)*(bitRate-minBitrate)+minBitRes; */
+ if ( isLowDelay(hAacConfig->audioObjectType) ) {
+ INT bitreservoir;
+ INT brPerChannel = hAacConfig->bitRate/hAacConfig->nChannels;
+ brPerChannel = fMin(BITRATE_MAX_LD, fMax(BITRATE_MIN_LD, brPerChannel));
+ FIXP_DBL slope = fDivNorm((brPerChannel-BITRATE_MIN_LD), BITRATE_MAX_LD-BITRATE_MIN_LD); /* calc slope for interpolation */
+ bitreservoir = fMultI(slope, (INT)(BITRES_MAX_LD-BITRES_MIN_LD)) + BITRES_MIN_LD; /* interpolate */
+ hAacConfig->bitreservoir = bitreservoir & ~7; /* align to bytes */
+ }
}
if (hAacConfig->bitrateMode!=0) {
return AACENC_INVALID_CONFIG;