Commit graph

91 commits

Author SHA1 Message Date
Vivek Jadhav
2f6371b3b8 libavcdec: Add support for 4096x4096 resolution
Bug:
Test: ./avcdec

Change-Id: Ie111f58e04bbd045e94167cdb978c571662567fb
2025-07-21 22:26:42 -07:00
Srujan Vandrangi
72e8241a64 decoder: replace KEEP_THREADS_ACTIVE macro with avc decoder struct variable
Bug: 289097296
Test: Build
2023-07-22 09:51:37 -07:00
Srujan Vandrangi
6685e380b5 decoder: handle error returned by ih264d_decode_gaps_in_frame_num
Bug: oss-fuzz:55598, oss-fuzz:57605, oss-fuzz:55641
Test: avc_dec_fuzzer
2023-06-21 06:51:49 -07:00
Harish Mahendrakar
a7c8d47643 Fix formatting in FGC commit 2023-02-21 12:36:55 -08:00
Shireesh Kadaramandalgi
b6b12cc5f0 libavc: Add support for FGC SEI message
- Decoder: Added support for FGC SEI parsing and exporting
2023-02-21 12:36:55 -08:00
Harish Mahendrakar
eb463e5aa2 cmake: Set C standard to C90 and move few macros to specific targets
- Set CMAKE_C_STANDARD to 90
  Because of this, moved some declarations to start of the block
- Move PROFILE_ENABLE and MD5_DISABLE to specific targets as these
  macros are not used when building libraries

Bug: 242076773
Test: Builds
Change-Id: Icd0b8a48f015a695185ce2220800348f7a7512f1
2022-08-30 20:00:54 +00:00
Harish Mahendrakar
2a238075dc Decoder: In case of no free buffers, release all buffers
When decoding erroneous streams, decoder may run out of all buffers
used to hold reference pictures and MV data. In such cases, ignore
all frames till the next IDR frame and then release all buffers while
decoding the IDR frame.

Bug: 236102268
Test: multiple seek on the clip in bug

Change-Id: I14d107a5fdaf5c8d2133e59f48c2b947a5fee5ff
2022-07-20 04:29:15 +00:00
Shivaansh Agrawal
0033e0fe5e Decoder: add support for QP and block_type map export in library
Bug: 175179303

Test: avcdec -c dec.cfg
Test: atest CtsMediaV2TestCases:CodecDecoderTest
Test: atest VtsHalMediaC2V1_0TargetVideoDecTest

Change-Id: I68f3a85aae1f4bca2c3e1eaad69d8eb7f23481b8
2022-05-17 09:55:20 +05:30
Treehugger Robot
a3721a6a8c Merge "Decoder: add support for KEEP_THREADS_ACTIVE" 2022-02-23 18:52:13 +00:00
Manisha Jajoo
d1e64cc366 Decoder: add support for KEEP_THREADS_ACTIVE
Current design of AVC Decoder creates new threads
to process each frame. This CL adds support to reuse
the threads across frames.

Test: avcdec -c dec.cfg
Bug: 191124963

Change-Id: I087699c4c7ce6aa59a1d8b078ae196a50dcf889c
2022-02-09 17:59:29 +05:30
Harish Mahendrakar
23247c8142 Move slice increments after completing header parsing
Slice increments are now done after completing header parse.
Earlier this was done before validating mmco related parameters
and calculating poc. In case there were errors that were detected
at this stage, slice increments were incorrect.

Bug: 199536974
Bug: 199733300
Bug: 205702093
Bug: oss-fuzz#38387
Bug: oss-fuzz#38482
Bug: oss-fuzz#40851
Test: ossfuzz generated poc in bug

Change-Id: I8569e9369e4ab6f6c69c81b937f111c299b7a134
(cherry picked from commit cd0385dc07)
(cherry picked from commit dc110841d6)
Merged-In:I8569e9369e4ab6f6c69c81b937f111c299b7a134
2021-12-15 00:01:15 +00:00
Bill Yi
75e53c541e Merge RQ3A.210905.001 to aosp-master - DO NOT MERGE
Merged-In: I52a5f915b9bb31f432c4ad55ae4117ff4ddceb54
Merged-In: If80dcc5d1e0a057c965631fc2d33e4e642d7eab9
Merged-In: If80dcc5d1e0a057c965631fc2d33e4e642d7eab9
Change-Id: Ia67df08355cf08f479df3c683a7f981402d27dcd
2021-09-08 17:57:06 -07:00
Rakesh Kumar
fa13b30876 Decoder: Update check for increment u2_cur_slice_num
Increment u2_cur_slice_num only if current slice had atleast
one MB of memory left.

Test: clusterfuzz generated poc in bug
Bug: b/182152757
Bug: b/179938345
Bug: b/185112718

Change-Id: Ic5eb07e961bccb7fde954bcfd791fd879804e335
(cherry picked from commit a88e0683a4)
2021-06-30 23:58:27 +00:00
Rakesh Kumar
4a22b5d105 Decoder: Update check for increment u2_cur_slice_num
Increment u2_cur_slice_num only if current slice had atleast
one MB of memory left.

Test: clusterfuzz generated poc in bug
Bug: b/182152757
Bug: b/179938345
Bug: b/185112718

Change-Id: Ic5eb07e961bccb7fde954bcfd791fd879804e335
2021-05-06 16:41:46 -07:00
Bill Yi
65f4f4a371 Merge RQ1A.210205.004 to stage-aosp-master - DO NOT MERGE
Merged-In: I0acf75c92b04a2f83301410f2001f63c25ecf3c9
Change-Id: I91cbfe74165d1a8f7b7d95edabb10be208ec54a2
2021-02-02 09:44:08 -08:00
Harish Mahendrakar
fd7e28588f decoder: Update check for first mb in slice
first_mb_in_slice shouldn't be >= mbs in the picture.

Test: poc in bugs
Bug: b/174238784
Bug: b/174507022
Bug: oss-fuzz:27856
Bug: oss-fuzz:28039
Change-Id: Id3a41c8c2ddf814910fc2d5dd4f57bdd84d28fec
(cherry picked from commit 7e06940dce)
2020-12-15 21:45:29 +00:00
Harish Mahendrakar
4f4a5f8c25 decoder: Update check for first mb in slice am: 7e06940dce am: 4fb26568a9 am: 2bf6790f63 am: 5f4f6e2ecf am: 640eda280b am: c74dab7a5a
Original change: 13171299

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic44a332c169f2e25f8239acc10fd166e3fcacc33
2020-12-09 03:15:03 +00:00
Harish Mahendrakar
c74dab7a5a decoder: Update check for first mb in slice am: 7e06940dce am: 4fb26568a9 am: 2bf6790f63 am: 5f4f6e2ecf am: 640eda280b
Original change: 13171299

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia0b4bb57e604986789246f960db871c3178ebed3
2020-12-09 02:53:44 +00:00
Harish Mahendrakar
640eda280b decoder: Update check for first mb in slice am: 7e06940dce am: 4fb26568a9 am: 2bf6790f63 am: 5f4f6e2ecf
Original change: 13171299

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I255ad3b9709afceb4cc8b31298bf3a9071ef4b3a
2020-12-09 02:21:19 +00:00
Harish Mahendrakar
5f4f6e2ecf decoder: Update check for first mb in slice am: 7e06940dce am: 4fb26568a9 am: 2bf6790f63
Original change: 13171299

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I99b30e4b2ac5f7b0fdeac9adbce15e92d2b36c8f
2020-12-09 01:48:37 +00:00
Harish Mahendrakar
2bf6790f63 decoder: Update check for first mb in slice am: 7e06940dce am: 4fb26568a9
Original change: 13171299

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I062c47998e23df0fe4d9c18ad9622aa55eb7ec96
2020-12-09 01:33:06 +00:00
Harish Mahendrakar
7e06940dce decoder: Update check for first mb in slice
first_mb_in_slice shouldn't be >= mbs in the picture.

Test: poc in bugs
Bug: b/174238784
Bug: b/174507022
Bug: oss-fuzz:27856
Bug: oss-fuzz:28039
Change-Id: Id3a41c8c2ddf814910fc2d5dd4f57bdd84d28fec
2020-12-04 16:09:10 -08:00
Shivaansh Agrawal
6efeedf063 Decoder: Fix integer overflow in parse slice
Bug: 165976727
Test: POC in bug description
Change-Id: Ia2c8ad5fe6e212d3910a9c91cda52c19f3fac120
2020-11-17 23:34:54 +05:30
Shivaansh Agrawal
793a1f374f decoder: fix integer overflow when setting i4_prev_max_display_seq
reset ps_dec->i4_prev_max_display_seq if out of int32 range
to avoid overflow

Bug: 143791121
Bug: 143791161
Bug: 170737173
Test: POC in bug description
Merged-In: I3d8df556b003a7c739716bb33262ab3a6ca7b2d9
Change-Id: I3d8df556b003a7c739716bb33262ab3a6ca7b2d9
2020-10-30 21:56:07 +00:00
Shivaansh Agrawal
358b09305a decoder: fix integer overflow when setting i4_prev_max_display_seq
reset ps_dec->i4_prev_max_display_seq if out of int32 range
to avoid overflow

Bug: 143791121
Bug: 143791161
Test: POC in bug description
Change-Id: I3d8df556b003a7c739716bb33262ab3a6ca7b2d9
2020-07-29 04:39:31 +00:00
Harish Mahendrakar
e0ad0016f0 Revert "decoder: set u4_frame_decoded to true only after both fields are decoded"
This reverts commit f76370c671.

Reason: This breaks interlaced clips which are sent one field at a time

C2 plugin for avc decoder is now updated to appropriately handle both
types of interlaced content, i.e. sent as one field per one input buffer
and sent as two fields per one input

Bug: 135146280
Bug: 152087140
Test: poc in bugs
Test: atest android.media.cts.DecoderTest

Change-Id: Ic79d13a4bd93573767c86ed31264e8780da8d9a5
2020-04-06 15:33:53 -07:00
TreeHugger Robot
66556bc9a3 Merge "decoder: Fix lt_ref increment in ih264d_fix_error_in_dpb" into qt-qpr1-dev am: 280902e61f
Change-Id: I3a0e050d5e7f17f8233dd7203d0a382c86a70971
2020-03-20 02:39:03 +00:00
Harish Mahendrakar
c0215b1b3d decoder: Fix in detecting dangling fields am: 6dd54b9e18
Change-Id: I61076f4526feeb891a5f866d6f965211e9e65edc
2020-03-20 02:38:56 +00:00
TreeHugger Robot
7286f5f021 Merge "decoder: Fix lt_ref increment in ih264d_fix_error_in_dpb" into qt-qpr1-dev am: 280902e61f
Change-Id: I3f9e5f1019b7759e83a2cc7f2848766f52bcdfed
2020-03-20 02:38:53 +00:00
Harish Mahendrakar
7e44189621 decoder: Fix in detecting dangling fields am: 6dd54b9e18
Change-Id: Ia546016131ba894365e90089a6644383c76bf325
2020-03-20 02:38:43 +00:00
TreeHugger Robot
280902e61f Merge "decoder: Fix lt_ref increment in ih264d_fix_error_in_dpb" into qt-qpr1-dev 2020-03-20 02:24:36 +00:00
Harish Mahendrakar
f80afe5b98 decoder: Fix lt_ref increment in ih264d_fix_error_in_dpb
When removing common nodes from short term list if it present in long
term reference list, number of long term buffers was wrongly
incremented. Only decrement of short term buffer count is needed in
such a case.

Bug: 140561484
Bug: 140566606
Bug: 140699853
Bug: 144980954
Bug: 145859214

Test: poc in bug
Change-Id: Iebf7ee7ed65e7b2097a899577982806b03fc6e5d
2020-02-11 16:29:24 -08:00
Harish Mahendrakar
6dd54b9e18 decoder: Fix in detecting dangling fields
When decoder is expecting to decode a field, ensure current slice
being decoded is a field and frame number matches with previous slice's
frame number.

Bug: 144687080
Test: poc in bug
Change-Id: I89d9d7b6fc26797de0420ecb0ca7e66b066aa908
2020-02-11 16:03:29 -08:00
Chamarthi Kishore
68dce05ea6 Merge changes I015ebe03,Idc0b0db5 am: 00fa4b6490 am: 7684b467b4
am: d49fffd5f4

Change-Id: I0da6b5b695adb949b28ca9d29f806cd11625d2eb
2019-10-31 19:11:43 -07:00
Chamarthi Kishore
ad2eaf8c7d libavc: Add MDCV, CLL, CCV and AVE SEI messages
This commit add support for encoding and decoding of MDCV, CLL, CCV and
AVE SEI messages

Test: avcenc -c enc.cfg, avcdec -c dec.cfg
Bug: 141931623

Change-Id: Idc0b0db5291482ae2bc19cdff65669c32374b02a
2019-10-24 17:20:00 +05:30
Harish Mahendrakar
41ea72e48f Fix integer overflows in computing poc and pic numbers am: 1d672d2bea am: f2157c2dc1 am: 684b6687dc
am: 59b642608e

Change-Id: I94747dc0574d94ebbde3b071efb267eeb53799c3
2019-09-30 16:50:38 -07:00
Harish Mahendrakar
1d672d2bea Fix integer overflows in computing poc and pic numbers
Test: poc in bug
Bug: 135303936
Bug: 136568141

Change-Id: Ie426c678b60f2d078d0b39e73a44d42d931d7fe3
2019-09-30 18:25:07 +00:00
Harish Mahendrakar
f76370c671 decoder: set u4_frame_decoded to true only after both fields are decoded
Currently frame_decoded was set to 1 after first field was decoded
This field in output wasn't used so far, hence no issue was seen till
now.

Bug: 135146280
Test: poc in bug
Change-Id: I90e20134258d828107adf43b5b3e37d4bd375cbd
2019-06-19 15:13:03 -07:00
Rakesh Kumar
75cd59e45b [automerger] Decoder: Delete node from st if lt and st point to same am: f312a1d305 am: f82a1f8d7f am: ae2c8cfdc1 am: 8332d0bfa2 am: 1e6ef7fee5 am: b1734142ff am: 9460fbd521 am: 224bcf4592
am: d406f08816

Change-Id: I1351851c15384868d9ab579857e4fc46076f5942
2019-05-29 14:31:32 -07:00
Rakesh Kumar
f312a1d305 Decoder: Delete node from st if lt and st point to same
If lt_list and st_list point to same node then delete it from st.
If there is error while adding a node in bottom field of lt_list (top is
already added) then this node will be pointed by st_list also. So we need
to remove it from st_list

bug: 73552574
Test: poc before/after on Android N security branch
Change-Id: I95304c242c5854b18c5c7220d114ce6215760124
2019-05-08 11:44:40 -07:00
Harish Mahendrakar
4f95fc0b9c decoder: Remove skip picture support
SKIP_P and SKIP_PB support was experimental and is not used
in libstagefright

Bug: 130541597
Test: poc in bug
Change-Id: If13b435e80d13d57de2fee0aa07ea7e6abca481b
2019-05-01 13:18:27 -07:00
S Hamsalekha
f28de0366c Decoder: Add null check for scaling matrix.
Also void->word32 return type so failure can be signaled to caller.

Bug: 115743419
Test: vendor + poc
Change-Id: I0a07ac11255c2c672803aab7085824c417bde282
2019-01-08 11:37:37 -08:00
Thomala Srinivas
2286dbb91f Decoder: Initialize some array and structure to zero
In intra_pred_ref_filtering function, initialize the values
of array au1_ngbr_pels to zero and in ih264d_parse_decode_slice
function, initialize the values of struct s_tmp_poc to zero.

Bug: 111762686
Test: vendor
Change-Id: Iac67f5e7d24f821627de64c8570f4be648c296c8
2018-11-01 14:35:05 -07:00
Ritu Baldwa
49afc8f344 Fix signed integer overflow in prev_max_display_seq
Prev_max_display_seq accumulates max_poc, which results in integer overflow.
Resetting it to zero whenever overflow occurs.

Bug: 73337834
Test: boot
Change-Id: Ia3f6d30f1a6e7fac05d073e30e38ce2ca4e4f52a
2018-04-16 10:08:46 -07:00
Android Build Merger (Role)
65db3cc9a3 [automerger] Decoder: Set prev slice type for I slice. am: aecdfd1aff
Change-Id: I5397b5635a304040fa8bcbd2999be4b07fcbdc0d
2018-01-29 23:19:09 +00:00
Ritu Baldwa
aecdfd1aff Decoder: Set prev slice type for I slice.
Fixed initialization of u1_pr_sl_type for I slice.

Bug: 70897454
Test: ran PoC before/after patch
Change-Id: I0c37317513b72236be98c2b25482a67bf2b56052
2018-01-29 15:17:19 -08:00
Ritu Baldwa
3bde3e435c Merge "Decoder: Fixed incorrect use of mmco parameters." into mnc-dev
am: 4d0407c0bb

Change-Id: Iad247fb8d10d2610fe5f8d6bb064fc52b20952ba
2017-11-02 23:36:53 +00:00
Ritu Baldwa
3c70b9a190 Decoder: Fixed incorrect use of mmco parameters.
Added extra structure to read mmco values and copied only once per
picture.

Bug: 65735716

Change-Id: I25b08a37bc78342042c52957774b089abce1a54b
2017-10-12 13:41:43 -07:00
Hamsalekha S
1b1e6d3ec9 Merge "Decoder: Fixed hang in the case of dangling field" into mnc-dev
am: 2f1ca945b1

Change-Id: I203d518ad9dc60ea41dfdc88c1903b47398246ba
2017-10-03 17:34:44 +00:00
Hamsalekha S
252628cffb Decoder: Fixed hang in the case of dangling field
The u1_top_bottom_decoded  flag in the decoder context has been fixed
to be updated correctly in the case of dangling field

Bug: 63315932
Test: ran POC after patching
Change-Id: I8db4ebeb94fba735ba45f365c37e52a202ea84cd
2017-09-29 10:25:21 -07:00