Commit graph

122 commits

Author SHA1 Message Date
Harish Mahendrakar
634b546f34 Decoder: Initialize slice parameters before concealing error MBs am: 33db7a0f4e am: 129a6006b4
am: fc855de43f

* commit 'fc855de43f':
  Decoder: Initialize slice parameters before concealing error MBs

Change-Id: I9ca7fb14c3edbbe68902cbe3b3d75931016e2b9d
2016-05-23 18:45:41 +00:00
Harish Mahendrakar
fc855de43f Decoder: Initialize slice parameters before concealing error MBs am: 33db7a0f4e
am: 129a6006b4

* commit '129a6006b4':
  Decoder: Initialize slice parameters before concealing error MBs

Change-Id: I554b9bfc98cee10c6766a879b74c18fb6a85a6a2
2016-05-23 18:42:24 +00:00
Harish Mahendrakar
129a6006b4 Decoder: Initialize slice parameters before concealing error MBs
am: 33db7a0f4e

* commit '33db7a0f4e':
  Decoder: Initialize slice parameters before concealing error MBs

Change-Id: I91b5e507d6871e523add85ed774c5de2b85fcf18
2016-05-23 18:34:43 +00:00
Harish Mahendrakar
33db7a0f4e Decoder: Initialize slice parameters before concealing error MBs
Also memset ps_dec_op structure to zero.
For error input, this ensures dimensions are initialized to zero

Bug: 28165661
Change-Id: I66eb2ddc5e02e74b7ff04da5f749443920f37141
2016-05-20 15:27:35 -07:00
Harish Mahendrakar
a2199594ae Merge "Decoder: Fix for handling invalid intra mode" into mnc-dev am: 37579218eb am: af63f6f357
am: 2d0ff948ac

* commit '2d0ff948ac':
  Decoder: Fix for handling invalid intra mode

Change-Id: I558305b0c1d24157a2ac5bb1f1087ae2cac461cd
2016-05-13 22:36:20 +00:00
Marco Nelissen
2d0ff948ac Merge "Decoder: Fix for handling invalid intra mode" into mnc-dev am: 37579218eb
am: af63f6f357

* commit 'af63f6f357':
  Decoder: Fix for handling invalid intra mode

Change-Id: I63b7f6c6eacfd8997bbf9e4e51a4ce497af20ef2
2016-05-13 22:33:47 +00:00
Harish Mahendrakar
af63f6f357 Merge "Decoder: Fix for handling invalid intra mode" into mnc-dev
am: 37579218eb

* commit '37579218eb':
  Decoder: Fix for handling invalid intra mode

Change-Id: Ia41f2b0c19b83d3508044487469176894ba898d4
2016-05-13 22:31:11 +00:00
Marco Nelissen
37579218eb Merge "Decoder: Fix for handling invalid intra mode" into mnc-dev 2016-05-13 22:20:17 +00:00
Harish Mahendrakar
42432034ca DO NOT MERGE. AVC decoder: init structures am: 43a1cf620f -s ours am: 68cdfcb381
am: 88819c7054

* commit '88819c7054':
  DO NOT MERGE. AVC decoder: init structures

Change-Id: Ife2f36f338f4346b1fdb7349ad96a19bc58c5074
2016-05-13 19:51:35 +00:00
Harish Mahendrakar
88819c7054 DO NOT MERGE. AVC decoder: init structures am: 43a1cf620f -s ours
am: 68cdfcb381

* commit '68cdfcb381':
  DO NOT MERGE. AVC decoder: init structures

Change-Id: Id63a624b5728415815ba9df2986171f4596fca81
2016-05-13 19:48:55 +00:00
Harish Mahendrakar
a17f3104aa Decoder: Memset few structures to zero to handle error clips am: 370bd8625d
am: 3fa6dfb504

* commit '3fa6dfb504':
  Decoder: Memset few structures to zero to handle error clips

Change-Id: I466a1bea95cb6b89a12ffd8530a533817263432b
2016-05-13 19:48:55 +00:00
Harish Mahendrakar
3fa6dfb504 Decoder: Memset few structures to zero to handle error clips
am: 370bd8625d

* commit '370bd8625d':
  Decoder: Memset few structures to zero to handle error clips

Change-Id: Id2892ab521dfa71cfdba6536a19a6308b29e3088
2016-05-13 19:46:19 +00:00
Harish Mahendrakar
68cdfcb381 DO NOT MERGE. AVC decoder: init structures
am: 43a1cf620f  -s ours

* commit '43a1cf620f':
  DO NOT MERGE. AVC decoder: init structures

Change-Id: Ib356f9813d69d9ac4166c8a8c9c714c410d8bcd9
2016-05-13 19:46:18 +00:00
Harish Mahendrakar
370bd8625d Decoder: Memset few structures to zero to handle error clips
Bug: 27907656
Change-Id: I671d135dd5c324c39b4ede990b7225d52ba882cd
2016-05-11 09:20:48 -07:00
Harish Mahendrakar
43a1cf620f DO NOT MERGE. AVC decoder: init structures
Memset few structures to zero to handle error clips

Bug: 27907656
Change-Id: I517841fc8b6d674f7e4e3ebaf60dd2e42f1152ae
2016-05-11 08:18:59 -07:00
Harish Mahendrakar
f38d14c5d9 Decoder: Fix for handling invalid intra mode
Bug: 28165659
Change-Id: I2291a287c27291695f4f3d6e753b6bbd7dfd9e42
2016-05-10 10:35:27 -07:00
Harish Mahendrakar
0c20244073 Decoder: Fix stack underflow in CAVLC 4x4 parse functions
am: ef3da4e699

* commit 'ef3da4e699':
  Decoder: Fix stack underflow in CAVLC 4x4 parse functions
2016-02-23 02:25:42 +00:00
Harish Mahendrakar
1284f0c297 Ensure ih264d_start_of_pic() is not repeated in ih264d_mark_err_slice_skip()
am: c7a1cf4e0b

* commit 'c7a1cf4e0b':
  Ensure ih264d_start_of_pic() is not repeated in ih264d_mark_err_slice_skip()
2016-02-23 02:25:36 +00:00
Harish Mahendrakar
ef3da4e699 Decoder: Fix stack underflow in CAVLC 4x4 parse functions
Bug: 26399350
Change-Id: Id768751672a7b093ab6e53d4fc0b3188d470920e
2016-02-22 14:54:08 -08:00
Harish Mahendrakar
c7a1cf4e0b Ensure ih264d_start_of_pic() is not repeated in ih264d_mark_err_slice_skip()
In case of error in handling MMCO commpands/reference list creation,
ih264d_start_of_pic() was called again in ih264d_mark_err_slice_skip() resulting in
leaking a picture or an MV buffer in buffer manager.

To fix this, ensure prev_slice_err is set to 1 only if u4_pic_buf_got is zero, before
calling ih264d_mark_err_slice_skip() at the end of picture decode.
This will ensure ih264d_start_of_pic() is not repeated

Bug: 25818142

Change-Id: I7d5a9179533581eec663bc6a19a2901e7cce6af3
2016-02-22 14:27:52 -08:00
Naveen Kumar Ponnusamy
64112d21e3 Return error when there are more mmco params than allocated size
am: 943323f1d9

* commit '943323f1d9':
  Return error when there are more mmco params than allocated size
2016-01-15 02:10:55 +00:00
Naveen Kumar Ponnusamy
943323f1d9 Return error when there are more mmco params than allocated size
Bug: 25818142

Change-Id: I5c1b23985eeca5192b42703c627ca3d060e4e13d
2016-01-13 21:18:46 +00:00
Harish Mahendrakar
608fc7f4ae Decoder Update mb count after mb map is set.
am: 4a524d3a8a

* commit '4a524d3a8a':
  Decoder Update mb count after mb map is set.
2016-01-07 21:07:40 +00:00
Harish Mahendrakar
4a524d3a8a Decoder Update mb count after mb map is set.
Bug: 25928803

Change-Id: Iccc58a7dd1c5c6ea656dfca332cfb8dddba4de37
2016-01-07 11:08:06 -08:00
Dan Willemsen
1c01bc10a9 Remove __DATE__/__TIME__ from Android builds
This removes unnecessary changes from build to build.

Bug: 24204119
Change-Id: I25258314fe56ea186d38d756fb5fb04aa689a812
(cherry picked from commit f197ccb756)
2015-10-30 21:54:53 +00:00
Marco Nelissen
66be90d7a0 Reconcile branch with master after mass cherrypicks
Change-Id: Ib017480389cb9f5204e5437716653016da348dba
2015-10-16 20:23:10 +00:00
Harish Mahendrakar
7ba9f34a49 Decoder: Memset 8 extra bytes at the end of internal bitstream buffer
Decoder may read 8 extra bytes at the end of this buffer, though it will never be used
Setting it to zero will ensure unitialized reads are avoided

Change-Id: I724239861cb9fa64f3a70cb5450e094cb3afa20c
2015-10-16 20:12:42 +00:00
Harish Mahendrakar
e023fbb28c Decoder: Once all the MBs in a picture are decoded ignore remaining bytes
Once all the MBs are decoded, simply break from decode loops and do not signal an error
This will handle cases where there may be extra bytes at the end of picture data

Change-Id: I6d8ec918df5375f135e60f85b9a56ab2a5313a64
2015-10-16 20:09:34 +00:00
Harish Mahendrakar
e027a11e31 Decoder: Exit gracefully in case of allocation failure
Skip error concealment when allocation fails for decoder buffers

Change-Id: I785f31cad5dca52c8c67cba78cdd330b7b4539e1
2015-10-16 19:29:43 +00:00
Harish Mahendrakar
5351d3a403 Decoder: Added a check for unsupported resolutions
Decoder now returns an error for resolutions greater than 3840x2176

Bug: 24542936

Change-Id: I38be0e4c5cf2a980bfd4c781f3b49171f73b5ccb
2015-10-13 23:28:19 +00:00
Hamsalekha S
126d84e0d3 Encoder added support for VUI params
SPS will now include vui params
Removed a trailing space in ih264e_api.c

Change-Id: I67a57741689206e571e9a83f7e3360149f87e06a
2015-10-09 11:35:29 -07:00
Hamsalekha S
9d04b13b62 Moved check for level after check for resolution change.
This is required for DRC tests in CTS .

Change-Id: Icd0fe10d97c6ee55f8358682a578bddb58590de4
2015-10-09 11:35:26 -07:00
Martin Storsjo
0ddd967709 Fix a typo in gai4_ih264_max_luma_pic_size 2015-10-09 11:35:25 -07:00
Harish Mahendrakar
59348127de Decoder: Fixed an issue in handling flush
Fixed a NULL pointer reference, when flush is called before
decoding any pictures.

This was seen in following CTS test,
android.media.cts.DecoderTest#testCodecResetsH264WithSurface

Fixed code formatting issues in ih264d_set_flush_mode
Updated the testbench to call flush before decoding starts

Bug: 24405410

Change-Id: Ib04e0b15573b2482c9d5b43c8bc7dd30d8f8efdd
2015-09-25 22:24:55 +00:00
Harish Mahendrakar
07ae78bd27 Decoder: Fixed an out of bound read in intra pred buffers
Bug: 23453762
Change-Id: I129e5a2ac8b9a28f3c894ebca0aef7063ca5934e
(cherry picked from commit 040ec939c6)
2015-09-25 16:47:27 +00:00
Harish Mahendrakar
251b007ecc Decoder: Reduced memory requirements
Memory allocations are now done based on contents of SPS
API changed to move allocations inside the library

Also changed strlen to strnlen

Bug: 24221026

Change-Id: I9130457f564cddb4da7ec6399cc9fe88ee871217
2015-09-23 18:35:27 +00:00
Harish Mahendrakar
2ee0c1bced Return error in SPS/PPS parsing when extra bytes are read from input
Bug: 24157524

Change-Id: I4b319ef8e23e1ba5f84f52b92f40ba7fb1429101
2015-09-18 14:12:13 -07:00
Ronghua Wu
374e7a8984 Merge "Encoder: Fixed an issue in handling FPS greater than 60" into mnc-dev 2015-08-03 18:07:01 +00:00
Harish Mahendrakar
bb1543bd85 Encoder: Fixed an issue in handling FPS greater than 60
FPS > 60 was resulting in an integer overflow, so using float now.

Bug: 22504214
Change-Id: I4626ba6a43167c00c42dd6440df37bd1eb1f151a
2015-08-03 09:45:14 -07:00
Hamsalekha S
8a50328131 Support for level greater than level at init in Decoder
Added support to check num_ref_frames  in SPS
and num_reorder_frames in VUI before returning error for level

Bug: 22860270

Change-Id: I392bab419385ca239836d200f9f2b064915a8a46
2015-07-31 18:53:17 +00:00
Hamsalekha S
e789d1d2e2 Decoder: Fixed issues shown by Valgrind
The slice header structure has now been initialized to 0
Fixed bug in closing of threads in the case of error.

Bug: 22860270

Change-Id: I777e0b73ad2f083c72be179984f5c1cb00ededb6
2015-07-31 18:52:32 +00:00
Martin Storsjo
bbc83b16b9 Don't use side effects in the macro PUT_BITS_SEV parameters
If ENTROPY_TRACE is defined, the value parameter gets evaluated
twice. Since this parameter includes ++, the pointer gets incremented
twice.

This fixes encoding with trace enabled.

Bug: 22860270

Change-Id: I3d71ac33d007301e488d264a33c7b5c4d4ff2b56
2015-07-31 18:51:33 +00:00
Harinarayanan K K
dbe9ac8936 Made gops closed
Now no picture in a gop will depend on any picture in the previous gop

All calls to force an IDR are respected as soon as possible

Bug: 22860270

Change-Id: Id2bcd5687c3fb786336a01894c1b9228d67a87a6
2015-07-31 18:51:20 +00:00
Martin Storsjo
860f75203e Always do recon of 4x4 intra blocks
Even if this 4x4 block isn't at the bottom or right border,
the other 4x4 intra blocks within the same macroblock may
use it for intra prediction.

This fixes intra coded macroblocks in b-frames.

Bug: 22860270

Change-Id: Ifdf48c1b2bbf232e785d6d5b8244aacba1ad3dd6
2015-07-31 18:51:09 +00:00
Martin Storsjo
33134b2617 Validate the u4_entropy_coding_mode field
Previously, if this field wasn't set, the invalid coding mode
could lead to crashes later.

Bug: 22860270

Change-Id: If8dd2f8d5f2fbdd6bb76772344f959df23159167
2015-07-31 18:51:00 +00:00
Harinarayanan K K
8ce82804ab Fixed issue in cost computation for BIPRED ME
BIPRED ME was discarding the halfpel motion vector components
in cost computation. That is fixed now.

Bug: 22860270

Change-Id: If6c77096d701a258920b14134ff120fd1540f254
2015-07-31 18:50:48 +00:00
Doney Alex
0574be65f4 Cabac optimizations
Optimized cabac functions for writing bypass bins.
Removed unused return from cabac flush function.
Removed the macro REV_NBITS.

Bug: 22860270

Change-Id: Iece82797f2f45a35281817a2b77a7c7fe4e02bd1
2015-07-31 18:50:37 +00:00
Martin Storsjo
eddf6a33fe Use INT_MAX as i4_max_sad in ih264e_evaluate_bipred
The stored i4_mb_distortion that was used as i4_max_sad previously
might come from a different coding mode - even if
pf_ime_compute_sad_16x16 returns early when i4_mb_distortion is
larger than ps_mb_ctxt_bi->i4_mb_distortion, the calculated i4_mb_cost
can still end up smaller than ps_mb_ctxt_bi->i4_mb_cost.

Therefore, set i4_max_sad to INT_MAX to avoid the early exit in
pf_ime_compute_sad_16x16 here, since it can't be used reliably (and
returning early can end up choosing a suboptimal mode).

This makes sure that the encoded output is identical when the SIMD
optimized routines are disabled, when using B-frames.

Bug: 22860270

Change-Id: I9b8d524f88020e557541700133c7a0b48fe6a3b8
2015-07-31 18:50:26 +00:00
Martin Storsjo
6fb90f8fec Make sure that apv_bufs[0] and u4_is_last always are set
When encoding in header mode, the s_inp_buf struct that was written
to ps_video_encode_op->s_ive_op.s_inp_buf was completely uninitialized.

In ih264e_input_queue_update, make sure to initialize u4_is_last
when skipping frames.

Bug: 22860270

Change-Id: I87e677acd00baf4f732ca7d35ee192e7f1f73994
2015-07-31 18:50:12 +00:00
Martin Storsjo
dc4c6140a9 avcenc: Initialize avg_time
This fixes valgrind warnings when encoding with b-frames.

Bug: 22860270

Change-Id: I922314e5e6fd09db3ba60e60863e2611309886d5
2015-07-31 18:50:02 +00:00