Commit graph

452 commits

Author SHA1 Message Date
Nikhil Bhavikatti
a857637600 Fix for Out of bound access issue reported by fuzzer 2022-07-29 17:24:54 +05:30
Rajat Kumar
c9614b8df9 Fix for write null dereferencing in AAC frame decode
Audio Object type(AOT) should be same across init and
execute calls. This check was missing when AOT is
not SBR and PS and hence added as fix for this bug.
For AOTs, SBR and PS since this value is re-read at
a later point, check already present would be fine.

Bug: 196308693
Test: poc in bug
2022-07-27 14:26:18 +05:30
Sushanth Patil
3551482d1d Optimisation changes in mps dec module
Added changes to reduce processing loops in cases of
residual bands, pre mix req and phase coding in mps
module.
2022-07-24 11:44:37 +05:30
Sushanth Patil
ec016c95b1 Optimisation changes in ixheaacd_mps_temp_process
ixheaacd_mps_subbandtp() was not required for all mps
configurations. Hence, added checks so its called only
when required.
Also, reduced loop counts when res_bands are present.
2022-07-24 11:34:29 +05:30
Sushanth Patil
acab7bd76a Optimisation changes in ixheaacd_generate_hf
Updated loop count based on number of
qmf channels when MPS is present.
2022-07-24 11:15:54 +05:30
Sushanth Patil
8330107b30 Optimisation changes in mps synt calc module
Converted the mps synt calc module to float module and
reimplemented mps synthesis function.
2022-07-24 11:10:54 +05:30
Sushanth Patil
2aebc58a73 Optimisation changes in ixheaacd_samples_sat
Changed 64-bit operations used for saturating the
output pcm to 32 bit operations targeted towards
32-bit/armv7 architecture.
2022-07-24 11:09:13 +05:30
Sushanth Patil
4d002366a8 Optimisation changes in mps apply pre-matrix and mix-matrix modules
Converted all the computations in these modules to float and
removed all float to int conversion overheads.
2022-07-24 11:05:23 +05:30
Sushanth Patil
1b703a5eea Optimisation changes in mps apply function
Added changes to remove redundant computation
loops in ixheaacd_mps_synt_calc,mps hybrid
analysis & synthesis functions based on number
of non-zero qmf bands.
2022-07-23 21:15:48 +05:30
Sushanth Patil
e73da2db71 Optimisation changes in ixheaacd_mps_upmix_interp
Removed float conversion overheads for
ixheaacd_mps_upmix_interp() function.
2022-07-23 21:01:51 +05:30
Sushanth Patil
7cf8017dd2 Optimisation changes in mps angle & phase interpolation functions
Reduced multiplications using mathematical rearrangement.
2022-07-23 20:59:49 +05:30
Sushanth Patil
d9c6a98804 Optimisation changes in mps hybrid filter functions
Converted the mps hybrid filt module to float
and reduced the number of multiplications in
ixheaacd_mps_hybrid_filt_type1 & type2 functions
using mathematical rearrangement and look-up table
symmetries.
2022-07-23 20:58:14 +05:30
Sachin
4c72471cdb Changes to move output sample path from 16bit to 32 bit
AAC Core coder changes to take the output samples as 32 bit
and subject to peak limiter to avoid any clipping , at the
same time maintaining precision.

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:54:35 +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
Sachin
e8771b7d14 Update configuration parameter's based on change in values.
Check configuration data obtained after audio Pre-Roll
parsing against current configuration. Update only when
configurations are different.

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:05 +05:30
Sachin
a281ecf0cd Update Boost and attenuation values for MPEG-D DRC
Extend API Support to change MPEG-D DRC values for boost
and attenuation from plugin.

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:52:31 +05:30
Sachin
ebe61f8ba1 Extend API support for Album Mode.
To extend API support to handle album
mode configuration.

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:51:19 +05:30
Sachin
f7ec92a2c9 Obtain Loudness Info from MPEG-4/MPEG-D DRC stream
Extend API support to query loudness Info
obtained from MPEG-4/MPEG-D DRC 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:50:10 +05:30
Rajat Kumar
117d5bda52 Removal of pointer arithmetic code sections.
Code changes to replace  sections that work on pointer
arithmetic logic to avoid undefined behavior.

Bug:Based on manual review
Test:xaacdec

Change-Id: I02bcb356d76b11cd2912478c4263d5918c37e1a6
2020-10-08 20:31:21 +05:30
Rajat Kumar
6398ab8de5 Fix for infinite loop in drc selection process
DRC should not permit the configurations that
exceed the total supported complexity.

Bug: 167279883
Test: poc in bug

Change-Id: Icffa42cdcd9184d434b7a0bfa1b11ebd5ec4af71
2020-10-05 22:57:31 +05:30
Ray Essick
e5c5475c98 Merge "Fix to handle segv in impd_filter_banks_process" 2020-09-30 16:54:42 +00:00
Treehugger Robot
bf603c488f Merge "Fix for integer overflow in ixheaacd_cplx_synt_qmffilt" 2020-09-30 02:15:07 +00:00
Treehugger Robot
d5111468cd Merge "Fix for NPD in ixheaacd_init_sbr" 2020-09-30 02:11:08 +00:00
Ray Essick
7d0fd974c9 Merge "Fix for array out of bound access in impd_drc_get_gain" 2020-09-30 01:57:47 +00:00
Rajat Kumar
2f905017d6 Fix for NPD in ixheaacd_init_sbr
Added check for AOT(read from bit stream) mismatch,
between two consecutive execute calls while decoding
LATM header.

Bug: 168429291
Test: poc in bug

Change-Id: I64b3e38c97499b1103c9cc5594742b804e0a3965
2020-09-29 18:11:57 +05:30
Rajat kumar
f2d380ca2e Fix to handle segv in impd_filter_banks_process
Added check to ensure array size of
buf_interpolation->lpcm_gains does not
exceed allotted size.

Bug: 161819862
Test: poc in bug

Change-Id: I7e554d70ada8d92ee3496c0fbdfc78cee55e4697
2020-09-12 01:21:42 +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
a741e1d5de Fix for Null-dereference read in ixheaacd_init_sbr
Header decode is done with AOT 2 (AAC-LC profile),
but due to corrupted nature of input file AOT is read
as 42 (USAC profile) after few memory/table initializations.

As fix, modified the check to prevent an attempt
to change AOT in mid file.

Bug: 160389683
Test: poc in bug

Change-Id: Id95aa74b0833321b29b602d97b14c5a5580ef7fc
2020-09-11 21:41:49 +05:30
Rajat Kumar
8ba7e99fb3 Fix for integer overflow in ixheaacd_cplx_synt_qmffilt
Added saturation checks to avoid integer overflow.

Bug: 158398386
Test: poc in bug

Change-Id: Ib4f10e07a4c6069452d38e87413fac755c056bae
2020-09-11 21:27:53 +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
Xin Li
386b47b4b1 Merge "Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)" into stage-aosp-master 2020-09-01 20:03:58 +00:00
Stephen Hines
331810f057 Properly mark the type for ARM assembly functions.
These functions may be called by either ARM or Thumb, and LLD has gotten
more strict. The global symbols must be marked with the proper type
annotations in order for the relocations to be correct.

ld.lld: error: external/libxaac/decoder/armv7/ixheaacd_qmf_dec_armv7.c:353:(.text.ixheaacd_esbr_cos_sin_mod+0x3A0): branch and link relocation: R_ARM_THM_CALL to non STT_FUNC symbol: ixheaacd_esbr_cos_sin_mod_loop2 interworking not performed; consider using directive '.type ixheaacd_esbr_cos_sin_mod_loop2, %function' to give symbol type STT_FUNC if interworking between ARM and Thumb is required

Bug: 155835175
Test: mm for ARM based build
Change-Id: I063cd9716402aaaebbd4273776eadb70314bf5f9
2020-08-27 19:47:23 -07:00
Rajat Kumar
514510a33c Fix for build errors with -Wunreachable-code-loop-increment flag am: 750dd58c8d am: ce1b551e99
Change-Id: I0bfff50cf05734d3033f9ac9581807f44c05b6e4
2020-05-15 02:56:25 +00:00
Rajat Kumar
750dd58c8d Fix for build errors with -Wunreachable-code-loop-increment flag
For loop was redundant as the execution
was being done for once. Hence removed in the
present fix.

Bug: 156359506
Test: Build with -Wunreachable-code-loop-increment flag added
Test: xaacdec

Change-Id: I252551cff09fa9b033ef715127ee153645e3055f
2020-05-14 23:34:56 +05:30
Sushanth Patil
92bec05d2d Optimisation changes in ixheaacd_samples_sat
Changed 64-bit operations used for saturating the
output pcm to 32 bit operations targeted towards
32-bit/armv7 architecture.

Bug: 154143053
Test: xaacdec

Change-Id: I3914f5a92feee592626fb53ca7e24b60dda59db4
2020-04-18 08:15:56 -07:00
Sushanth Patil
05c7402a06 Optimisation changes in esbr synthesis filter block
Some computation were not required when mps and sbr are present.
Added a check to remove them.

Bug: 154143053
Test: xaacdec

Change-Id: I5f7722b6e045031df0f37279441946f014953443
2020-04-18 08:10:37 -07:00
Sushanth Patil
0708a5228b Optimisation changes in saturation functions
Changed saturation logic in ixheaacd_add32_sat()
and ixheaacd_sub32_sat() functions.

Bug: 154143053
Test: xaacdec

Change-Id: I2281954a18487c05894b8f5e9b76d1290c943b82
2020-04-15 13:06:33 -07:00
Ray Essick
45895b998a Typos: persistant -> persistent
Bug: 141290162
Test: build
Change-Id: I204e2a069cc306736f2a6e2dbc92b132a5c919ef
2020-04-02 09:04:46 -07:00
Tripti Tiwari
72b91f378a Fix for Segv in impd_down_mix function in xaac.
Enough size was not allocated for DRC payload.
Added appropriate size to persistence memory to accommodate maximum
length of DRC payload data. Also added reset for bit-handler elements
after execute call.

Bug:141290162
Test: poc in bug

Change-Id: I61176076056899310a3306818cd5ad4624a4bab0
2020-04-02 09:00:29 -07:00
TreeHugger Robot
dd0c4f77d0 Merge "Fix for infinite loop in impd_apply_gains_and_add function" into rvc-dev 2020-04-02 03:45:45 +00:00
Rajat Kumar
57b4f3eac4 Fix for OOB in external libxaac
Codec initialization is done with AOT 2 (AAC-LC profile),
but AOT changes abruptly to 42 (USAC profile) in execution
leading to access of uninitialized tables. Hence Added a
check for mismatch in AOT during initialization and
AOT during execution.

Bug:150400335
Test: poc in bug

Change-Id: I73ca2bf0f963df7982c1a8371a8fc0c2e3c7cd82
2020-03-29 17:16:45 -07:00
Rajat Kumar
fdeb26a3f5 Fix for infinite loop in impd_apply_gains_and_add function
if (iEnd == iStart) is true until end line of loop,
and (drc_gain_last == shape_filter_block[g].drc_gain_last)
is also true, this make iEnd unchanged for ever
and the while loop will go into infinite iterations.
Hence added a check to break for the same.

Bug:148433653
Bug:151817831
Test:poc in bug

Change-Id: I2a59cde98abee0f28510a5b50ef44b3efd02c079
2020-03-29 17:08:20 -07:00
TreeHugger Robot
7862de4bd2 Merge "Fix for array out of bound in decoder/drc_src/impd_drc_eq.c" into rvc-dev 2020-03-19 19:07:47 +00:00
Sushanth Patil
40fb6f798f Fix for array out of bound in decoder/drc_src/impd_drc_eq.c
Error return check was missing, which caused an
unchecked value to propagate and lead to array OOB.

Bug: 151407605
Test: poc in bug

Change-Id: I0ab9ced7504314e0a31fbe7138c0b95ecbc8cd84
2020-03-18 20:56:48 +00:00
Rajat Kumar
ed2dbffd88 Fix for array out of bound for type 'ia_filt_cascade_td_struct[4]'
Value is read from the bit stream and used as index
before checking for bounds, added the same as fix here.

Bug: 151412914
Test: poc in bug

Change-Id: I2f484398d87bee0a525e4f31b4f0da4c1b13bb1d
2020-03-18 09:09:45 -07:00
TreeHugger Robot
418325e543 Merge "Fix for missing bound check in MPS bit parsing" into rvc-dev 2020-03-10 04:51:59 +00:00
TreeHugger Robot
4bbb59d953 Merge "Fix for SEGV in ixheaacd_aacdec_decodeframe function." into rvc-dev 2020-03-09 22:30:23 +00:00
TreeHugger Robot
3eb739ab1d Merge "Fix for read buffer overflow in impd_filter_banks_process" into rvc-dev 2020-03-09 22:27:29 +00:00
Tripti Tiwari
f034dda6d2 Fix for SEGV in ixheaacd_aacdec_decodeframe function.
For erroneous stream, coupling channel initialization memory
was overlapping with SBR scratch memory usage, causing unwanted
reset of the some of the pointers.
All initialization should take place in persistent memory.
As a fix, replaced scratch with persistent memory for initialization.

Bug:145264510
Test:poc in bug

Change-Id: Iaa757d0e87fd3a0b2f75c5288cfe662f556c871f
2020-03-07 15:07:54 -08:00
Rajat Kumar
5426a0bf19 Fix for read buffer overflow in impd_filter_banks_process
str_node[k].time is used as index later, added a check
where its calculated.

Bug:146948608
Test:poc in bug

Change-Id: I35ca08ad19045deca44b5b5c55532a84f5a58ed3
2020-03-07 15:00:27 -08:00