Commit graph

41 commits

Author SHA1 Message Date
akshayragir833
3dfa708b6e
Loudness leveling support for encoder and decoder (#99)
* Loudness leveling support for encoder and decoder

- Addition of loudness leveling support to encoder and
  decoder as per ISO/IEC 23003-4:2020/Amd.2:2023(E)

Testing:

Encoder: Smoke-test

Decoder: CTS and Conformance for x86, x86_64, armv7 and armv8 are
         passing

* Addressed review comments

* Addressed minor nits in documentation

---------

Co-authored-by: Akshay Ragir <100833@ittiam.com>
2025-07-28 17:40:45 +05:30
Shashank Pathmudi
947ad9f32b Fix for divide-by-zero in impd_parse_dwnmix_instructions
These changes handle the divide-by-zero runtime error reported
while calculating the downmix coefficients because
base channel count was coming zero.

Bug: ossFuzz:63420
Test: poc in bug
2023-10-26 10:17:24 +05:30
Sowmya Sree Reddy G
270720de5e ELDv2 support for EXHEAAC decoder 2022-10-10 10:15:43 +05:30
Sachin
8701172d14 Select Expert and Anchor Loudness measurement.
Changes to switch to  Expert Panel as  measurement system
and Anchor Loudness as measurement method depending on stream.

Bug: 175435457
Test: atest CtsMediaTestCases:DecoderTest
Test: atest CtsMediaTestCases:DecoderTestAacDrc
Test: atest CtsMediaTestCases:DecoderTestXheAac
Test: atest CtsMediaTestCases:DecoderTestAacFormat
Test: atest CtsMediaV2TestCases:CodecDecoderTest
2022-01-20 11:53:40 +05:30
Rajat kumar
794c837036 Fix for array out of bound access in impd_drc_get_gain
Add necessary checks to avoid any possible array
out of bounds operation in the impd_drc_get_gain
function.

Bug: 161820233
Test: poc in bug

Change-Id: Ie55fbbc18c76f224983d1032641de4df4dce3fb3
2020-09-11 21:50:48 +05:30
Rajat Kumar
bcbd383251 Fix to handle missing checks on error returned
Added missing return checks and converted
functions to void which doesn't return anything
other than zero.

Test: Review
Test: atest android.media.cts.DecoderTest
Bug:131183694

Change-Id: Iea7bb9959fffd7a0e4f345f86581a1328e04a38e
Merged-In: Iea7bb9959fffd7a0e4f345f86581a1328e04a38e
2020-09-10 12:48:42 -07:00
Rajat Kumar
f60122a142 Fix for array out of bound in impd_drc_parse_coeff func
Variable num_gain_max_values was used as index in
impd_init_table function without checked
for bounds. Added check to prevent out of bound array
access.

Bug:141524702
Test: poc in bug

Change-Id: Ia902153ef614db6dbd002572cdbdb62421580588
(cherry picked from commit 566b69f066)
2020-03-04 17:23:02 +00:00
TreeHugger Robot
3938795985 Merge "Fix for array bound overflow in ia_gain_set_params_struct." 2020-01-16 01:26:59 +00:00
TreeHugger Robot
da4f7feef2 Merge "Fix for array out of bound in parse drc instruction func" 2020-01-16 00:50:46 +00:00
TreeHugger Robot
3214d04ad9 Merge "Fix for array oob in ia_shape_filter_block_params_struct" 2020-01-15 20:06:21 +00:00
Rajat Kumar
09fd1c3c1f Fix for array out of bound in parse drc instruction func
target_channel_count read from bit stream is being
used as index without bound check. Hence the check
has been added.

Bug:142693847
Test: poc in bug

Change-Id: I9d6c832e75b9cb78fe4989516d13707f1ecf7f91
2020-01-11 19:10:09 -08:00
Rajat kumar
4a19deca5d Fix for array bound overflow in ia_gain_set_params_struct.
Max value of
str_p_loc_drc_coefficients_uni_drc->gain_set_count_plus
is used as index without checking for upper bound.
Hence added a check here.

Bug:144665190
Test:poc in bug

Change-Id: Ibd8dfe91910eb4d7548cf3236065eb38121b60c8
2020-01-11 19:03:43 -08:00
Rajat kumar
7924f0cb44 Fix for array oob in ia_shape_filter_block_params_struct
pstr_gain_modifiers->shape_filter_idx is read from
bitstream and used as an index before been checked
for bound. Hence added a check.

Bug:145043907
Test:poc in bug

Change-Id: I9a46c4227017328f2c3aa6e7d911889c01efef91
2020-01-11 17:22:27 -08:00
Rajat Kumar
86d7dd791e Fix for oob in ia_drc_instructions_struct
drc_config->drc_instructions_uni_drc_count
+ drc_config->dwnmix_instructions_count is
used as index in the function
impd_drc_gen_instructions_for_drc_off,
without checked for bounds.

Hence the check has been added here.

Bug:143517852
Test: poc in bug

Change-Id: I1134236b421d97097a5deb25dbf889f25e7a29ef
2020-01-11 16:50:54 -08:00
Rajat Kumar
c2cb9c2424 Fix to add few bound checks in DRC, based on code review
Added few checks to avoid out of bound access and
and remove few redundant checks based on review.

Bug:130279444
Test: atest android.media.cts.DecoderTestXheAac
Test: atest android.media.cts.DecoderTestAacDrc

Change-Id: If9a7917eea5d68d4c484d02fca4c755ffa6a9123
2019-11-13 14:23:08 -08:00
Rajat Kumar
fb6a48906e Fix for array out of bound in impd_drc_static_payload.c
channel_layout->base_channel_count was not checked
for bounds after it is read from bit stream.
Corresponding check has been added here.

Bug:140979418
Test: poc in bug

Change-Id: I57e6a4ea9a39c64e82c3add0d20a85716ad20cc1
2019-11-02 07:03:49 -07:00
TreeHugger Robot
9b6182fe2e Merge "Fix for oobw in impd_manage_drc_complexity() due to drc_set_id" 2019-01-07 19:28:00 +00:00
TreeHugger Robot
7ec9d127e7 Merge "Fix for global buffer overflow in impd_init_loudness_control function" 2019-01-07 17:55:21 +00:00
Ray Essick
174165dd89 Merge "Fix for oobw in impd_parse_drc_instructions_uni_drc()" into pi-dev am: e0c41aae88
am: f462745e36

Change-Id: I48e9385dcb919b7777545aee8a04960d2461f6e9
2019-01-02 19:42:25 -08:00
TreeHugger Robot
67f9744ec7 Merge "Fix for oobw in impd_drc_parse_coeff() due to gain_seq_idx" 2018-12-29 00:02:11 +00:00
Ramesh Katuri
f7144dfe8f Fix for oobr in impd_manage_drc_complexity function
bs_gain_set_idx is a 6 bit field read from bitstream, which is used
to access gain_set_index_for_channel_group[] whose size is GAIN_SET_COUNT_MAX
which is 24.bs_gain_set_idx value greater than 23 is causing oob access.

As fix for this issue bound check is added for bs_gain_set_idx

Bug:119263784
Test: vendor
Change-Id: I26d3668c54a739016c1102158c73db49cb35f1c4
2018-12-28 11:45:54 -08:00
Ramesh Katuri
ed831abc65 Fix for oobw in impd_parse_drc_instructions_uni_drc()
gain_set_index_for_channel_group[] is any array of size
CHANNEL_GROUP_COUNT_MAX i.e 24. This array is accessed using
str_drc_instruction_str->num_drc_ch_groups as index, whose
value can be more than 24.

Bound check is added for str_drc_instruction_str->num_drc_ch_groups
before accessing gain_set_index_for_channel_group[]

Bug:117832864
Test: vendor
Change-Id: I3799c2de6926f1193a5e0193bc3b5863c478d4ab
2018-12-21 10:59:49 -08:00
Ramesh Katuri
a516b49570 Fix for oobw in impd_drc_parse_coeff() due to gain_seq_idx
gain_seq_idx is a 6 bit value read from the bit stream.
it can get any value between 0 to 63. gain_seq_idx is used
to access gain_set_params_index_for_gain_sequence[] array
whose size is SEQUENCE_COUNT_MAX which is 24. if gain_seq_idx
value is greater than or equal to SEQUENCE_COUNT_MAX cause
oob write.

Bound check on gain_seq_idx is added to prevent oob access.

Bug:119117381
Test: vendor
Change-Id: I571e6e705489ae1c46c651f87491f15428719b30
2018-12-21 10:11:38 -08:00
Ramesh Katuri
ce4e2da628 Fix for oobw in impd_manage_drc_complexity() due to drc_set_id
drc_set_id is a 6 bit filed read from bitstream. This drc_set_id is
used to access drc_set_id_valid_flag[] array whose size is
DRC_INSTRUCTIONS_COUNT_MAX i.e. 36. drc_set_id value greater than or
equal to 36 is causing oob write.

Bound check has been added for drc_set_id

Bug:119261935
Test: vendor
Change-Id: Ib218f4d72d23a2cbf4e74eea6a2d71ae8a735c6d
2018-11-29 16:24:19 -08:00
Ramesh Katuri
4692bee50b Fix for oobw-in-impd_parse_drc_instructions_uni_drc
Bug:117883804
Test: vendor
Change-Id: I9512dbc1d184ea838572218df3db9e91574c1460
2018-11-27 13:58:34 -08:00
Ramesh Katuri
589d21b8a3 Fix for OOB write in mpeg-d drc bit stream parsing by adding bound checks
Added bound checks for all the parameters which are
derived from bit stream.

Bug:116760188
Bug:116019594
Bug:116114402
Test: vendor
Change-Id: I126cd520e7faf2281ab731da559b11c74a9e30b5
2018-11-07 00:55:26 +00:00
Ramesh Katuri
8940746da9 Fix for global buffer overflow in impd_init_loudness_control function
Add bounds check on loudness measurement system.

Bug:112768568
Test: vendor
Change-Id: I84f8baeb9a4fd956dcfa74eee0ac5abe44d1f3fc
2018-11-05 11:21:58 -08:00
Ray Essick
69e7a92ab9 Merge "Fix for OOB write in loudness info set ext" into pi-dev 2018-10-30 21:54:50 +00:00
Ray Essick
402fce8468 Merge "Fix for OOB in parse drc config extension" into pi-dev 2018-10-29 21:19:30 +00:00
Ramesh Katuri
8e1635aaea Fix for OOB in parse drc config extension
Bug:117100617
Test: vendor
Change-Id: I0e6bcbdfb21f40b9687b2d36366112bc67cee88a
2018-10-27 13:32:43 -07:00
Ramesh Katuri
7e8303bbaa Fix for OOB in parsing loud equalizer instruction in drc
Bug:116117112
Test: vendor
Change-Id: I9d69d07dc36e8874d1784b4cf1f1a0a4fc99cee7
2018-10-27 13:23:13 -07:00
Ramesh Katuri
06296604c8 Fix for OOB write in loudness info set ext
Bug:117099943
Bug: 117100484
Test: Vendor
Change-Id: Id657372bde3b0218108c3d8aa7f9f898cde5b583
2018-10-27 10:38:12 -07:00
TreeHugger Robot
a97968adcd Merge "Fix for OOB write in parametric drc instruction parsing" into pi-dev 2018-10-02 23:17:33 +00:00
TreeHugger Robot
cbc35bf28a Merge "Fix of OOB write in drc downmix instruction count parsing" into pi-dev 2018-10-02 23:16:51 +00:00
Ramesh Katuri
599ca4428a Fix for OOB write in split drc characteristic parsing
added bounds check on values parsed from input stream.

Bug: 116619337
Test: vendor
Change-Id: Ia938ce45cb0503c1ddcbeaa5d036c0f57521a38f
2018-10-02 13:18:16 -07:00
Ramesh Katuri
df1030d8b9 Fix of OOB write in drc downmix instruction count parsing
Check bounds of parsed value.

Bug: 116619387
Test: vendor
Change-Id: Iada4937f7d99744594a1d457ae1bddefe961ba4f
2018-10-02 11:21:44 -07:00
Ramesh Katuri
d735e2e329 Fix for OOB write in parametric drc instruction parsing
Bug: 116715245
Test: vendor
Change-Id: I24c7ce7cd8c928d53a9914d116de4c6b408cfb09
2018-10-02 10:08:37 -07:00
Ramesh Katuri
90b76d9431 Fix for OOB write in gain set param's parsing
Check extracted size against array sizing before proceeding.

Bug: 116715937
Test: poc
Change-Id: Ic26b85683342fa5f508b66f4ad71badb06540f17
2018-09-30 19:54:50 -07:00
Ramesh Katuri
b3226ce6f8 Formatting changes
Formatting .c and .h files using clang-format
Formatting .s files

Bug: 80493357
Test: compare object sizes
Change-Id: I38296083c9d2d566a6a2564db2e391e4b2bd43a9
2018-06-07 16:52:19 -07:00
Ray Essick
4908247643 Sanitization fixes from new CTS tests
Updates from vendor to remedy issues exposed by new CTS tests

Bug: 77287124
Test: CTS DecoderTest, DecoderTest{AacDrc,XheAac}

@ Sanitizer fixes in libxaac

Fixes few integer overflow sanitizer errors
Progagate few errors
ENABLE_DRC macro is removed
AMMENDMENT1 macro is removed

Change-Id: Ic61163dfd6318bd4a00ed45e1295c819cb0f637b

@ Add support for audio pre-roll and DRC effect type

Also includes the following
MPEG-D DRC parameters related changes
USAC config switch changes
SBR config switch changes

Bug: 80133175
Change-Id: I0ab25641768cf523b66f7b0fcb4137429c1c4a77

@ Fixed trailing spaces

Change-Id: I32de0c9d3f7237e1fbf8dfef1cac485ef8458173

@ Replaced tabs

Change-Id: Ic741ee13d7b978b37edc27d087903caaa40b8d90
2018-05-25 11:35:52 -07:00
Ray Essick
51aa06e124 Bring xHE-AAC into pi-dev branch
bring the multi-commit integration from master to pi-dev

libxaac multi-arch cleanup

Change-Id: Ibcefa14f439e75f48a54955c9abf1a06c418e41e
Change-Id: Ia7a9b1e4de0add847c136f6f545b81dc8087521d
Change-Id: I12c3f8414dc9971017de223e88f292f8982a5c9b

Fix dependency error in Android.bp
Change-Id: Ic54f688736b3f2a70172676e4cee22aea4cbd705

Localized Android.bp
Change-Id: I68c4fc24fca279104c8ce2129fd4a3ed8d116b9b

Import xHE-AAC decoder from Ittiam
Change-Id: I3c8d124033f967b29d6e384cce5c843ee17a7bb1

Bug: 77287124
Test: build, cts DecoderTest
2018-05-17 14:36:48 -07:00