Commit Graph

1013 Commits

Author SHA1 Message Date
Fraunhofer IIS FDK 0c2c08aef6 Read uniDrcGainExtension element only if all DRC gain sequences are parsed correctly.
Prevent error return during parsing of incomplete uniDrcGain() element. This fixes unnecessary concealment of frames for AAC in case a uniDrcGain() is provided, but the uniDrcConfig() element is not available.

Bug: 176246647
Test: atest android.media.cts.DecoderTestAacFormat android.media.cts.DecoderTestXheAac android.media.cts.DecoderTestAacDrc
Change-Id: I5ae343eaea481774c53240dbce4da0f4ff06cd1d
2021-02-14 12:23:12 -08:00
Fraunhofer IIS FDK 5e031b67ba Consider TNS headroom for complex prediction.
Bug: 176246647
Test: atest android.media.cts.DecoderTestAacFormat android.media.cts.DecoderTestXheAac android.media.cts.DecoderTestAacDrc
Change-Id: I8261106b98d7e7c5a8a2af38585c726285ea8623
2021-02-14 12:23:02 -08:00
Fraunhofer IIS FDK 09e7c40a3a Fix USAC time domain limiter latency at config change.
We have observed quality problems regarding config switching for USAC streams. Crossfading did not consider the USAC time domain limiter latency correctly. The limiter memory still contained the last part of the frame before the config change.
With this patch we were able to improve the quality by moving the limiter processing to the end of the processing chain (crossfade -> DRC -> limiter). By that we don't have to consider the limiter latency at the crossfader anymore and can resolve the quality issue.
Bug: 176246647
Test: atest android.media.cts.DecoderTestAacFormat android.media.cts.DecoderTestXheAac android.media.cts.DecoderTestAacDrc
Change-Id: I0dfd3b76ff2b0daf495ad406283f56a39982ad8f

Change-Id: I26f5da65ef8344602007e180e837820c6a25f173
2021-02-14 12:22:54 -08:00
Fraunhofer IIS FDK 82f6f3dac6 Introduce additional sanity checks to validate program config element.
Bug: 176246647
Test: atest android.media.cts.DecoderTestAacFormat android.media.cts.DecoderTestXheAac android.media.cts.DecoderTestAacDrc
Change-Id: I3e04480ab5a74da1a9d09af5da95afb2000b3117
2021-02-14 12:22:46 -08:00
Fraunhofer IIS FDK baa3203971 Validate DRC compression factor and DRC boost factor value range in aacDecoder_SetParam().
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I1d8534145bcf400c5da58d64d3b7e73a87cb43be
2021-02-14 12:22:34 -08:00
Fraunhofer IIS FDK a7c64ff42f Fix unsigned integer overflow in Hcr_State_BODY_SIGN_ESC__ESC_WORD().
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I5eb0f88a55e856c427f9e4647332070f66e673c5
2021-02-14 12:22:15 -08:00
Fraunhofer IIS FDK 150febcc65 Make sure that alphaValue is correctly initialized in sbrDecoder_drcApplySlot().
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I5bded2e3d29278bb5df561eaa2a46d963ee21df8
2021-02-14 12:22:09 -08:00
Fraunhofer IIS FDK 3ebe6ffe95 Introduce aacDecoder_drcDisable() and always disable legacy DRC for USAC.
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I75edf24b18e1f5392b6eb179d5574cb93fcbc7c2
2021-02-14 12:22:00 -08:00
Fraunhofer IIS FDK 702d914e1a Evaluate and return StoreConfigAsBitstream() error state.
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I025e943e91f9be1a5259a761a8ff88defd8babea
2021-02-14 12:21:52 -08:00
Fraunhofer IIS FDK ef5f44c760 Check transportDec_OutOfBandConfig() input buffer size parameter.
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I60ac86f09a5652c820d60dfdc12212637f888164
2021-02-14 12:21:44 -08:00
Fraunhofer IIS FDK 18758b9fe1 ELD downscale factor 3 is only allowed for framesize 480.
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I9681942ba39761e4f1d66236ad80c2420ca5abe9
2021-02-14 12:21:33 -08:00
Fraunhofer IIS FDK b93f896f37 Improve decoder robustness by storing flags and elFlags temporarily.
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I6aaeef87e1f2ce5d5031f088b8c57e6f5806929d
2021-02-14 12:21:24 -08:00
Fraunhofer IIS FDK a1a8f69b14 Revise bypass mode in SpatialDecApplyParameterSets() to prevent an assert in fDivNorm().
Bug: 176246647
Test: atest android.media.cts.DecoderTestAacFormat android.media.cts.DecoderTestXheAac android.media.cts.DecoderTestAacDrc
Change-Id: I198747688f1677b82f27a17a2fcf40229c92b1da
2021-02-14 12:21:14 -08:00
Fraunhofer IIS FDK 87e01ef1e7 Check number of core channels and SAC decoder input channels to avoid a channel mismatch.
Bug: 176246647
Test: atest android.media.cts.DecoderTestAacFormat android.media.cts.DecoderTestXheAac android.media.cts.DecoderTestAacDrc
Change-Id: Ib8b6973e9c29e13b8ef33d7736be2b977928face
2021-02-14 12:21:04 -08:00
Fraunhofer IIS FDK e916be37f2 Prevent integer overflow in subbandTPApply() energy update.
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I9ed8b33414907706808956cffad252052928c799
2021-02-14 12:20:56 -08:00
Fraunhofer IIS FDK ba54a5c040 Limit smoothedNoise values to avoid integer overflows in adjustTimeSlotHQ() and adjustTimeSlotHQ_GainAndNoise().
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: Ib630d56a626ddd59a9155df38cda2011c3165346
2021-02-14 12:20:35 -08:00
Fraunhofer IIS FDK 19c8cc495e Avoid integer overflow in dct_II().
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I6c30c4dec3f85410c2748eb42d38f5eb72521ec5
2021-02-14 12:20:21 -08:00
Fraunhofer IIS FDK 614b9f005a Prevent integer overflows in dualChannelFiltering() and eightChannelFiltering().
Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: Ic9217bbb3980807036ae6ae121e6ddb7cc1bce35
2021-02-14 12:20:13 -08:00
Fraunhofer IIS FDK f89d1d0a4e 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-02-14 12:20:02 -08:00
Fraunhofer IIS FDK 4a089e4bd9 [automerger skipped] [DO NOT MERGE] Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: 50aa5be388 am: 0468e02e5b am: d20df7ee14 -s ours am: 80ebc985fb -s ours am: 035cf671b8 am: ce38f54339 -s ours am: a3d45a6804
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12088847

Change-Id: Ibf754e4252ff637e5f8c0ee5073411b33f4af322
2020-09-09 23:17:47 +00:00
Fraunhofer IIS FDK f23ab25e7a [automerger skipped] Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: c516539a20 am: 17dd8dfad9 am: 8336b89345 -s ours am: 971b630c47 -s ours
am skip reason: Change-Id I0150ac6d5a47ffce883010f531928656eebc619e with SHA-1 bb8f983bf3 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12091300

Change-Id: I3b6f0708a5aedd7307ee2ebec7d56eca5b169818
2020-09-09 23:17:41 +00:00
Fraunhofer IIS FDK a3d45a6804 [automerger skipped] [DO NOT MERGE] Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: 50aa5be388 am: 0468e02e5b am: d20df7ee14 -s ours am: 80ebc985fb -s ours am: 035cf671b8 am: ce38f54339 -s ours
am skip reason: subject contains skip directive

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12088847

Change-Id: Ie337579b14a76c90016c6866d58422816d61ea0a
2020-09-09 23:00:01 +00:00
Fraunhofer IIS FDK 971b630c47 [automerger skipped] Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: c516539a20 am: 17dd8dfad9 am: 8336b89345 -s ours
am skip reason: Change-Id I0150ac6d5a47ffce883010f531928656eebc619e with SHA-1 bb8f983bf3 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12091300

Change-Id: I5c2fc3f0ac04e75766a7f7141a6900f167023088
2020-09-09 22:59:55 +00:00
Fraunhofer IIS FDK ce38f54339 [automerger skipped] [DO NOT MERGE] Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: 50aa5be388 am: 0468e02e5b am: d20df7ee14 -s ours am: 80ebc985fb -s ours am: 035cf671b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12088847

Change-Id: I8be6b18443220d62f6f0241003080db5da857e61
2020-09-09 22:32:10 +00:00
Fraunhofer IIS FDK 8336b89345 Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: c516539a20 am: 17dd8dfad9
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12091300

Change-Id: I6162868554166db622bc72fb47a9cc61aaa51881
2020-09-09 22:32:05 +00:00
Fraunhofer IIS FDK 035cf671b8 [automerger skipped] [DO NOT MERGE] Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: 50aa5be388 am: 0468e02e5b am: d20df7ee14 -s ours am: 80ebc985fb -s ours
am skip reason: subject contains skip directive

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12088847

Change-Id: I9a57636513443249a25c6789ed2eb975cf91b45c
2020-09-09 22:02:20 +00:00
Fraunhofer IIS FDK 17dd8dfad9 Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: c516539a20
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12091300

Change-Id: I41058bf1a076509c564defa70247dcbfa91c64d0
2020-09-09 22:02:14 +00:00
Fraunhofer IIS FDK 80ebc985fb [automerger skipped] [DO NOT MERGE] Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: 50aa5be388 am: 0468e02e5b am: d20df7ee14 -s ours
am skip reason: subject contains skip directive

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12088847

Change-Id: Iad32917ed1a93b0a8749e6cad3555481a570943d
2020-09-09 21:55:03 +00:00
Fraunhofer IIS FDK d20df7ee14 [DO NOT MERGE] Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: 50aa5be388 am: 0468e02e5b
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12088847

Change-Id: I0f5863139bc848401b905625fdc572793755b8cf
2020-09-09 21:44:15 +00:00
Fraunhofer IIS FDK 0468e02e5b [DO NOT MERGE] Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: 50aa5be388
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12088847

Change-Id: I40c07a02e1528540b24a5380cff1249ed5076193
2020-09-09 21:29:48 +00:00
Fraunhofer IIS FDK f142fe0030 Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels(). am: bb8f983bf3
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/12087395

Change-Id: I503c23a0a9313ee7303927781211c23690c239bd
2020-09-09 21:10:24 +00:00
Fraunhofer IIS FDK bb8f983bf3 Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels().
In the bug the SBR decoder has already set up 9 channels and tries to
allocate one more channel. The assignment of the QMF channels to SBR
channels fails since the QMF domain manages only 8+1 channels instead
of 10 channels as reqeusted by SBR.
Here we have added a check in sbrDecoder_InitElement() which will
return with a parse error in case additional SBR channels would exceed
the maximum number of SBR channels. This solves the potential heap
buffer overflow.

Bug: 158762825
Test: atest DecoderTestAacDrc DecoderTestAacFormat DecoderTestXheAac
Change-Id: I0150ac6d5a47ffce883010f531928656eebc619e
Merged-In: I0150ac6d5a47ffce883010f531928656eebc619e
2020-09-09 19:01:09 +00:00
Fraunhofer IIS FDK c516539a20 Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels().
In the bug the SBR decoder has already set up 9 channels and tries to
allocate one more channel. The assignment of the QMF channels to SBR
channels fails since the QMF domain manages only 8+1 channels instead
of 10 channels as reqeusted by SBR.
Here we have added a check in sbrDecoder_InitElement() which will
return with a parse error in case additional SBR channels would exceed
the maximum number of SBR channels. This solves the potential heap
buffer overflow.

Bug: 158762825
Test: atest DecoderTestAacDrc DecoderTestAacFormat DecoderTestXheAac
Merged-In: I0150ac6d5a47ffce883010f531928656eebc619e
Change-Id: I8569a15214707ab622e986b34b4b917251495662
2020-07-09 08:56:14 -07:00
Fraunhofer IIS FDK 50aa5be388 [DO NOT MERGE] Fix heap buffer overflow in sbrDecoder_AssignQmfChannels2SbrChannels().
In the bug the SBR decoder has already set up 9 channels and tries to
allocate one more channel. The assignment of the QMF channels to SBR
channels fails since the QMF domain manages only 8+1 channels instead
of 10 channels as reqeusted by SBR.
Here we have added a check in sbrDecoder_InitElement() which will
return with a parse error in case additional SBR channels would exceed
the maximum number of SBR channels. This solves the potential heap
buffer overflow.

Bug: 158762825
Test: atest DecoderTestAacDrc DecoderTestXheAac
Change-Id: I741f49ab3b675fa3d3217ee72e1db66b0114f7ee
2020-07-06 21:42:07 +00:00
Ray Essick 3f829aa0e1 point to new repo hooks for mainline uploads am: ebc1030f65
Change-Id: I4a628b1146f9e9cc4cbbfeb3a5b1b4aba0fd8ce3
2020-05-29 23:49:48 +00:00
Ray Essick ebc1030f65 point to new repo hooks for mainline uploads
Bug: 157501573
Test: upload
Change-Id: I0e4764db6516d17a81dc5a31bf9d9427b2c570d6
2020-05-26 16:29:58 -07:00
Jooyung Han fbd4db0365 Set min_sdk_version to be part of mainline modules am: 71c477bae4
Change-Id: I2fce92c77e6583c6662636a66e8a0e85c9fbbec4
2020-05-11 08:21:35 +00:00
Jooyung Han 71c477bae4 Set min_sdk_version to be part of mainline modules
Modules contributing mainline modules (APK/APEX) should set
min_sdk_version as well as apex_available.

For now setting min_sdk_version doesn't change build outputs.
But build-time checks will be added soon.

Exempt-From-Owner-Approval: cherry-pick from aosp

Bug: 152655956
Test: m
Merged-In: I662ad951a3221f967b53e7af65cb203a4b4a5e5d
Change-Id: I662ad951a3221f967b53e7af65cb203a4b4a5e5d
(cherry picked from commit d40f05a618)
2020-05-11 07:01:25 +00:00
Fraunhofer IIS FDK 261fadc3a2 Remove outdated apply_normalization parameter from legacy DRC module.
Bug: 149514474
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I9b894007fc9d80da6aaee09d84c2b356f2c06ff7
2020-02-14 10:56:10 -08:00
Fraunhofer IIS FDK e016635f0d Avoid decoder internal clipping by converting the whole audio sample data path from 16 to 32 bit data width (FDKdec v3.2.0).
Bug: 149514474
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I8a504ab709e42e27a61fe29840212953742283a5
2020-02-14 10:53:51 -08:00
Fraunhofer IIS FDK 57c9355de0 Create new applyDrcLevelNormalization() function for subsequent usage.
Bug: 149514474
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I23cc3081ff71830bc96766a31131594499dbdd04
2020-02-14 10:47:19 -08:00
Fraunhofer IIS FDK 90c29e0808 Revise memory overlay usage and remove deprecated buffers and overlay tags.
Bug: 149514474
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I7aea2898a3c49e06209fae89d734939c100e1184
2020-02-14 10:44:10 -08:00
Fraunhofer IIS FDK 5482443193 Restructure QMF implementation and provide 16/32 bit implementation in parallel.
Bug: 149514474
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I2c6b332a0b5c4966a3f680d7a4d562d9bf18752c
2020-02-14 08:51:24 -08:00
Fraunhofer IIS FDK 443d38963e Enhance encoder audio quality for vbr (FDKenc v4.0.1).
Bug: 149489652
Test: atest android.media.cts.EncoderTest#testAACEncoders
Change-Id: I4af82bd104a94710d1977eaa0bd086aa743d3adf
2020-02-13 14:58:49 -08:00
Fraunhofer IIS FDK 79305e068e Improve encoder audio quality for low bitreservoir configuration.
Bug: 149489652
Test: atest android.media.cts.EncoderTest#testAACEncoders
Change-Id: I87d5695a93b1f130b95b45d48157e6aaf947709d
2020-02-13 14:48:27 -08:00
Fraunhofer IIS FDK 6b0aab087d Fix SBR encoder element mapping for channel configurations with more than one layer
Bug: 149489652
Test: atest android.media.cts.EncoderTest#testAACEncoders
Change-Id: I8cd9e7f9aaeb62629f916f8d0dba7422d9a5e878
2020-02-13 14:41:18 -08:00
Fraunhofer IIS FDK 7b5389e63f Ensure that QC_OUT_CHANNEL struct in encoder always uses aligned memory
Bug: 149489652
Test: atest android.media.cts.EncoderTest#testAACEncoders
Change-Id: Ifc513ef20639f04c7252ade5519cc8e8c2fdbd50
2020-02-13 14:39:47 -08:00
Fraunhofer IIS FDK 925092e8fc Revise and straighten out pointless description from encoder documentation
Bug: 149481606
Test: header doc update, so just make
Change-Id: If5c7fcf96f97a3a1e8ee06bd24fb247c094508bd
2020-02-13 09:07:40 -08:00
Fraunhofer IIS FDK 1d451971ca Revise and straighten out useless references from decoder documentation.
Bug: 149481606
Test: doc update in header, so just make
Change-Id: I656e76762ee336931d4f1938e5c39c8ad7f65954
2020-02-13 08:59:36 -08:00
Fraunhofer IIS FDK 31f66f6d3f Extend decoder API with audio output loudness info (FDKdec v3.1.3).
Bug: 148385721
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I68b09883def21baef259c9ab914922567ab8cee3
2020-02-11 16:02:32 -08:00