Go to file
Fraunhofer IIS FDK e499f9485e Adjust VBR mode depending on given peak bitrate and fix crash recovery usage.
Operating the FDK encoder in A2DP with variable bitrate mode
configuration resulted in unexpected encoder return value AACENC_ENCODE_ERROR.

Due to peak bitrate restriction the encoder quite often runs into requantization.
In case the bitrate constraint is not fulfilled, the so-called crash recovery is
used as final emergency step. The crash recovery reduces the overall bit
consumption considering the given number of bits to be saved. The bit difference
is extracted from audio element structures. In VBR mode the element wise bit
consumption state was not updated since there is typically no bitrate limitation
required.

The patch solves the choppy audio problems and increases audio quality for
AAC VBR encoding.

The changes in FDKaacEnc_QCMain() ensure that audio element bit info is always
updated. This is achieved by always calling FDKaacEnc_BitResRedistribution()
and FDKaacEnc_prepareBitDistribution() with maxBitsPerFrame variable as total
bits parameter.
Furthermore, VBR assumes a certain target bitrate which is used for internal
configuration and limitations. In case the peak bitrate parameter is less than
the VBR mode target bitrate the maximum of both bitrate configurations was used.

The function FDKaacEnc_AdjustVBRBitrateMode() is added to adjust the encoder
internal VBR mode to a desired target bitrate less than given peak bitrate.
It is possible that the peak bitrate is very close to the desired target bitrate.
The virtual available bitreservoir is quite low and the encoder would run quite
often into requantization with needless audio quality reduction. In such a
configuration, it is a better choice to use the CBR targeted threshold adaption
to avoid audio quality reduction.

In FDKaacEnc_Initialize(), there was already a bitResMode selection depending
on available bitreservoir for CBR. This selection will now also be used for VBR.
In case the bitResMode is AACENC_BR_MODE_FULL and VBR mode is selected, the VBR
threshold adaption is used. Otherwise, CBR threshold adaption strategy is used
and therefore, no unnecessary fill bits are written.

Bug: 161400526
Test: see bug
Change-Id: I1865f817180150da6add2623a64f1a102622784a
2021-01-08 10:52:53 +08:00
documentation Avoid decoder internal clipping by converting the whole audio sample data path from 16 to 32 bit data width (FDKdec v3.2.0). 2020-02-14 10:53:51 -08:00
fuzzer Improve code coverage for aac_dec_fuzzer 2020-06-19 10:57:18 +05:30
libAACdec Merge changes Iad37ae76,I4870251b,Icd937cad am: 662d974400 am: 0b8c6e731f 2020-04-09 16:47:26 +00:00
libAACenc Adjust VBR mode depending on given peak bitrate and fix crash recovery usage. 2021-01-08 10:52:53 +08:00
libArithCoding Improve error robustness in arithmetic decoder 2018-12-26 19:34:16 -05:00
libDRCdec Merge changes Iad37ae76,I4870251b,Icd937cad am: 662d974400 am: 0b8c6e731f 2020-04-09 16:47:26 +00:00
libFDK Merge changes Iad37ae76,I4870251b,Icd937cad am: 662d974400 am: 0b8c6e731f 2020-04-09 16:47:26 +00:00
libMpegTPDec Merge changes Iad37ae76,I4870251b,Icd937cad am: 662d974400 am: 0b8c6e731f 2020-04-09 16:47:26 +00:00
libMpegTPEnc Stop using __DATE__/__TIME__ on all builds 2020-03-27 10:43:38 +05:30
libPCMutils Merge changes Iad37ae76,I4870251b,Icd937cad am: 662d974400 am: 0b8c6e731f 2020-04-09 16:47:26 +00:00
libSACdec Merge changes Iad37ae76,I4870251b,Icd937cad am: 662d974400 am: 0b8c6e731f 2020-04-09 16:47:26 +00:00
libSACenc Stop using __DATE__/__TIME__ on all builds 2020-03-27 10:43:38 +05:30
libSBRdec Merge rvc-release RP1A.201105.002 to stage-aosp-master - DO NOT MERGE 2020-11-03 22:27:17 -08:00
libSBRenc Stop using __DATE__/__TIME__ on all builds 2020-03-27 10:43:38 +05:30
libSYS Add FDK_FALLTHROUGH macro to prevent implicit-fallthrough compiler warnings 2018-12-27 14:17:51 -05:00
.clang-format Upgrade to FDKv2 2018-04-19 11:21:15 -07:00
Android.bp Set min_sdk_version to be part of mainline modules 2020-05-11 07:01:25 +00:00
METADATA Fix license type s/b BY_EXCEPTION_ONLY 2020-05-21 12:49:18 -07:00
MODULE_LICENSE_FRAUNHOFER Snapshot 2bda038c16 2012-07-11 10:15:24 -07:00
NOTICE Upgrade to FDKv2 2018-04-19 11:21:15 -07:00
OWNERS Add OWNERS in external/aac 2017-06-05 10:10:15 -07:00
PREUPLOAD.cfg point to new repo hooks for mainline uploads 2020-05-26 16:29:58 -07:00