Commit graph

170 commits

Author SHA1 Message Date
Harish Mahendrakar
cd1928dca1 Encoder: Fix in returning recon buffers with smaller IDR interval
For every IDR generated after the first one, one recon buffer was not
released from the buffer manager, when recon was enabled. This resulted
in encoder returning with an error after couple of IDRs when recon was
enabled.

This is fixed by calling recon buffer release based on pic_cnt instead
of frm_num. frm_num is reset to 0 for every IDR where as pic_cnt is not.

Bug: 173150684
Test: avcenc -i qcif.yuv -w 176 -h 144 -o out.h264 \
      --bframes 2 --idr_interval 4 --recon_enable 1 \
      --recon recon.yuv

Change-Id: I8b72e5aedc6a460292388e4e46f56c07486db4a6
2020-11-12 23:49:41 +00:00
Automerger Merge Worker
93a6f1db82 Merge "encoder: Return gracefully from entropy encoding errors" am: 94f5d3f0f7 am: 7be9fe31f8 am: 0b545cc625
Change-Id: Ia99a4e1a024310153d372cca66fa97aeb1e5b2bd
2020-01-22 20:37:55 +00:00
Chamarthi Kishore
4bc3e63c30 encoder: Return gracefully from entropy encoding errors
Recent error propagation change in encoder introduced a DoS when
output buffer is not large enough to hold the frame encoded.
This commit fixes the DoS seen.

Test: avcenc -c enc.cfg, avcdec -c dec.cfg
Test: revert fix for b/144928581 to reduce the output buffer size
Test: atest android.media.cts.VideoEncoderTest#testGoogH264FlexMaxMax
Test: atest android.media.cts.VideoEncoderTest#testGoogH264Flex1080p

Bug:145019703

Change-Id: I3b3408153a2cb8541a87547d51dd8bde25a33d6c
2019-12-03 15:30:38 +05:30
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
95a2113e4b libavc: Handling of Error propagation
This commit has changes to Error return propagation to
the caller functions.

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

Change-Id: I015ebe03e753a0edc1bf8bfc167180ead63193e1
2019-10-24 17:54:31 +05:30
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
Dan Willemsen
7e9cf837a5 Stop using __DATE__/__TIME__ on all builds am: d8383dc45e am: 90ca457b95 am: 7c0202abcb am: 368349eeae
am: 2dcff9fd23

Change-Id: Ic02fa909ceb3e34d0826727e0d393efd2f9b7786
2019-08-28 20:08:06 -07:00
Dan Willemsen
90ca457b95 Stop using __DATE__/__TIME__ on all builds
am: d8383dc45e

Change-Id: I58f071c0270bb7d080639f902ff772095ab2c139
2019-08-28 19:32:02 -07:00
Dan Willemsen
d8383dc45e Stop using __DATE__/__TIME__ on all builds
We're beginning to use remote caches with Android builds, so I'm turning
on -Werror=date-time so that host builds are also reproducible.

Test: treehugger
Test: mmma external/libavc
Change-Id: I581f3abf528a7bb5df6ee9963f4d72e2b4bb8a6c
2019-08-27 19:47:33 -07:00
Ram Mohan
5df8183189 libavcenc: Correct placement of sync synchronize
In entropy thread, after a call to __sync_synchronize(), store buffer is
receiving new entries. This is causing entropy threads to go out of sync,
resulting in erroneous bitstreams. The following change corrects this.

Bug: 130554568
Test: run cts -m CtsVideoTestCases -t
      android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual0720x480
      --skip-preconditions

Change-Id: I81a2343f0f80c1e899e60e92fb48bbd3da006eab
2019-08-07 13:11:57 -07:00
Thomala Srinivas
5c3b992b6f libavcenc: Fix B frame incomplete subgop issue
The encoder doesn't return remaining frames if last subgop is
incomplete. This problem is solved by swapping last NULL P frame
(as subgop is incomplete last P frame will be NULL) with the
last valid (non- NULL) B frame. Complete subgop swapping is not done.

Also update MAX_NUM_BFRAMES to 8 and added a separate macro to
define maximum number of pictures in input queue

Bug: 132063959
Test: run cts -m CtsMediaTestCases \
 -t android.media.cts.VideoEncoderTest
Change-Id: I9625c5f5f64ec60032c44dad54f735991921d6dd
2019-05-10 15:06:15 -07:00
Harish Mahendrakar
fabba6afaf Encoder: Increased max supported bitrate
Increased max bitrate to 240mbps
Bug: 116040772
Test: CTS test

Change-Id: I87d5e2e540e72d3a41a04becf01ff13965361a23
2019-04-15 12:42:48 -07:00
Rakesh Kumar
837aefa3a2 Fix Compiler warnings
Intrinsic _mm_set_epi8 require char input, converting everything to char.
Including log.h from android library instead of cutils.

Bug: 112316276
Test: before/after object comparison for no diff in generated code.
Change-Id: I82b8c48494619b64465eda2476c7c903652c6066
2018-08-10 15:17:08 -07:00
Akshata Jadhav
83edef6949 [automerger] Encoder: Return error for odd resolution am: 9fa58d4db3 am: f56e0c0ed3 am: db53adff11 am: 538e4ed787 am: c8fc4c0206 am: 2e1c177836 am: 353851c307 am: 207d68137f am: 0bc2eef47a am: 1f7f247c05 am: f4ad409786
am: f01457548f

Change-Id: If11d359f1068e414ca4a6fd26efc42ead1d122d0
2018-04-14 16:19:58 -07:00
Android Build Merger (Role)
1f7f247c05 [automerger] Encoder: Return error for odd resolution am: 9fa58d4db3 am: f56e0c0ed3 am: db53adff11 am: 538e4ed787 am: c8fc4c0206 am: 2e1c177836 am: 353851c307 am: 207d68137f am: 0bc2eef47a
Change-Id: I297abfd8a036563e093bdb3100ff7cee48f228c2
2018-04-14 18:39:01 +00:00
Android Build Merger (Role)
2e1c177836 [automerger] Encoder: Return error for odd resolution am: 9fa58d4db3 am: f56e0c0ed3 am: db53adff11 am: 538e4ed787 am: c8fc4c0206
Change-Id: Iafdb9ee561ac366c63959b5b392e37fe81771a9f
2018-04-14 18:38:56 +00:00
Android Build Merger (Role)
c8fc4c0206 [automerger] Encoder: Return error for odd resolution am: 9fa58d4db3 am: f56e0c0ed3 am: db53adff11 am: 538e4ed787
Change-Id: I58ab8312cb0a5a4bd85eedb2ff55f2c82fa5e79d
2018-04-14 18:38:55 +00:00
Android Build Merger (Role)
f56e0c0ed3 [automerger] Encoder: Return error for odd resolution am: 9fa58d4db3
Change-Id: I4b71af182f1d2be051bc831dfe134b4c012048af
2018-04-14 18:38:50 +00:00
Akshata Jadhav
9fa58d4db3 Encoder: Return error for odd resolution
Bug: 73625898
Test: ran POC before/after under ASAN
Change-Id: I9765b57f4afc6a2b6ad9cd19c8c7c5000beb9de9
2018-02-28 15:36:46 -08:00
Ram Mohan
6ecdf603b4 avcenc: Disable SKIP_BIAS
For static content, intra modes and skip mode compete with each
other neck and neck. From bitstream perspective its favourable to
pick skip. But do not over bias towards skip as intra modes
are already being penalized with mode bits * lambda.

Average bdrates improve by 1%

Test: Tested on clips of different resolutions for quality changes

Change-Id: I8ae85e7e807c9810e10b325627c84eec679327a9
2018-01-19 01:31:01 +00:00
Ram Mohan
11b4a7b4f0 avcenc: Move SKIP_BIAS macro definition to enc from me
Skip bias is encoder specific. It is better if it is defined in
encoder headers as opposed to me headers

Test: CL refactoring

Change-Id: I19afb9fcb4fb966c890ed41ab3fe0984e552f57f
2018-01-19 01:30:00 +00:00
Hangyu Kuang
62e0d0c9e2 Merge "avcenc: Disable intra planar evaluation in FASTEST preset" 2018-01-17 19:34:00 +00:00
Hangyu Kuang
7fda0b422a Merge "avcenc: Allow intra mode evaluation during fast skip" 2018-01-17 18:47:12 +00:00
Ram Mohan
9b39261eb2 avcenc: Change default max bitrate from 20mbps to 50mbps
Test: avcenc test.cfg

Change-Id: I48b896321d6706189fee75f5245b3a388ef5b44c
2018-01-10 19:44:56 +00:00
Ram Mohan
91a6cefe9f avcenc: Disable intra planar evaluation in FASTEST preset
Test: avcenc test.cfg

Change-Id: I55b1b5b530925cee4c4c0d9dc1301ae9a1f63257
2017-12-04 12:00:56 +05:30
Ram Mohan
82fb2d30cd avcenc: Allow intra mode evaluation during fast skip
For static content, skip and intra modes often compete with each other
neck and neck during mode evaluation. Upon fast skip detection, instead of
skipping all further mode analysis, disable motion search and allow intra
analysis.

This change applies to all presets except FASTEST.

Average bdrate improves by 1%.

Test: Tested on clips of different resolutions.

Change-Id: Ia0aabca5c1dcad03359bebaf071b7be27898e735
2017-12-04 11:55:54 +05:30
Harish Mahendrakar
14187ea720 Encoder: Update scene cut detection logic
Encoder detects scene cut based on number of Intra MBs in the current
frame. For frames which contain plane areas which are different from
reference frames, encoder might encode these MBs as intra because of
lower SAD when compared with inter SAD.
Such cases were detected as scene cuts and RC model was being reset.

To fix this, scene cut is rejected if the current picture did not consume
all the bits that were allocated to it. In an actual scene cut where RC
needs to be reset, current frame consumes more than what is allocated to it.

Bug: 36814430
Change-Id: Ifa904fbaf28481f4762a23bb63e013fd37ec8942
2017-05-01 10:42:57 -07:00
Ray Essick
98764ebb77 Merge "Encoder: Defined structures for accessing MB header data" am: 8aa140b8a5 am: fef5e9e203 am: eba0a08cdd
am: 2ebe889e3f

Change-Id: I3267957cccb5927afa25bb5c266974c8ee96a529
2016-11-29 14:46:59 +00:00
Ray Essick
fef5e9e203 Merge "Encoder: Defined structures for accessing MB header data"
am: 8aa140b8a5

Change-Id: Ib3e9cad8eb8ddbd5c941ff4d4c96a12e0f309831
2016-11-29 14:33:27 +00:00
Harish Mahendrakar
ff291d3b55 Encoder: Fixed unaligned access of i1_ref_idx and u1_mv in cabac context am: 0a69e08c39 am: c812fef1e2 am: 6841513a26
am: a6723af7d7

Change-Id: I4be6289792cc5fba23e1ef77988ffb5503f2b133
2016-11-29 00:10:35 +00:00
Harish Mahendrakar
c812fef1e2 Encoder: Fixed unaligned access of i1_ref_idx and u1_mv in cabac context
am: 0a69e08c39

Change-Id: I5b6c330440b5219da31bf5f7e07b01fb65d8804a
2016-11-28 23:56:33 +00:00
Harish Mahendrakar
c7d9c91417 Encoder: Defined structures for accessing MB header data
Instead of using hard coded address offsets,
defined structures to access MB Header for each MB type
This improves readability of the code

Also helps in maintaining required alignment for MV
MV elements need to be aligned to 2 byte boundary
Unaligned accesses result in undefined behavior

Bug: 33073518
Test: Tested with -fsanitize=alignment enabled on avcenc
Change-Id: I51c009b7deded76315a4bf2880444d21ae7d517f
2016-11-24 12:25:49 +05:30
Harish Mahendrakar
0a69e08c39 Encoder: Fixed unaligned access of i1_ref_idx and u1_mv in cabac context
i1_ref_idx and u1_mv in cabac context are defined as char,
but were typecasted to int and were accessed, and were not
aligned to 4 byte boundary.
This results in an undefined behaviour

Bug: 33073518
Test: Tested with -fsanitize=alignment enabled on avcenc
Change-Id: Ie4a73de076a9239f2d8707af68b7d2cd796aa803
2016-11-24 12:22:25 +05:30
Martin Storsjo
139b00ec62 armv8: Fix ime_calculate_sad3_prog_av8 am: e17ec6c736 am: 6b6d0367bd
am: 7a0ad00205

Change-Id: I2eaaf4228bae126fd12db937ab44dc4ebb1b99f2
2016-10-15 00:01:00 +00:00
Martin Storsjo
8c00fcbbb8 armv8: Add missing sign extension for WORD32 parameters am: d91f49ad65 am: e1caaaa797
am: 04f62e56bc

Change-Id: Ic3e1bbd84755fd6c4d7c6e6e5625aed2a64e6b8e
2016-10-15 00:00:59 +00:00
Martin Storsjo
3e70522f6d armv8: Remove duplicated, incorrect function argument declarations am: 545b474453 am: 00c7db0c96
am: 04671f8f87

Change-Id: I3314bf58c8ee3fdfb25308e11fbfba682a4d642b
2016-10-15 00:00:57 +00:00
Martin Storsjo
6b6d0367bd armv8: Fix ime_calculate_sad3_prog_av8
am: e17ec6c736

Change-Id: If12aa8dbbaee8df609d09d12df035598864a2152
2016-10-14 23:52:59 +00:00
Martin Storsjo
e1caaaa797 armv8: Add missing sign extension for WORD32 parameters
am: d91f49ad65

Change-Id: I7ec90a993752a3bf0d4dd72a358d776b5eca13b5
2016-10-14 23:52:58 +00:00
Martin Storsjo
00c7db0c96 armv8: Remove duplicated, incorrect function argument declarations
am: 545b474453

Change-Id: I8918db5761a5cf22fb0895a31bddd57cd63135d1
2016-10-14 23:52:56 +00:00
Martin Storsjo
e17ec6c736 armv8: Fix ime_calculate_sad3_prog_av8
Previously, this used x5 (which is a stride parameter)
as destination pointer, and overwrote the destination in x6
with a counter, and looped to a label in another function.

In practice, this function is never used, which is why this
hasn't been noticed before.

Change-Id: Iab87a2960c36b7dc4de4216b1d4bbbe4e9f03578
2016-10-06 10:29:43 +03:00
Martin Storsjo
d91f49ad65 armv8: Add missing sign extension for WORD32 parameters
For WORD32 parameters, the upper half of the parameter
registers is undefined (even though it is zero in most cases).

When easily doable, use the 'w' register names for such
parameters instead of doing the sign extension with a
separate instruction.

This fixes crashes in some configurations, when built with
clang, which can pass nonzero bits in the high half of registers
more aggressively than GCC.

Also fix the parameter/register mappings; use wN register
names where applicable, and fix incorrect parameter
placement. (Some functions still were documented to have
only 4 parameters in registers.)

Change-Id: Icedf6503b064149d1a651ff1c6a76de5c01722ea
2016-10-06 10:29:43 +03:00
Martin Storsjo
545b474453 armv8: Remove duplicated, incorrect function argument declarations
Having incorrect comments is only misleading and confusing.

Change-Id: I7560e152194c8d50d6218b0b2144a9628218b7c3
2016-10-05 14:24:53 +03:00
Ryan Haining
72ba34b131 Increases max screen height and width to 2560.
This is the Nexus 6P screen size. Our initial testing seems to indicate
this works.

Change-Id: Ia4abf22917d32d178c63e36148cfd541a2dab3e0
2016-08-22 12:09:12 -07:00
Harish Mahendrakar
c6d69ce363 Encoder: Fix in signalling direct_8x8_inference_flag in SPS am: 7f1e3b7b07 am: 3f977fc6db
am: 7fc983fad7

Change-Id: I6c09521cfa378ce816ab492c52ac03233a7b2654
2016-08-09 20:52:19 +00:00
Harish Mahendrakar
3f977fc6db Encoder: Fix in signalling direct_8x8_inference_flag in SPS
am: 7f1e3b7b07

Change-Id: I4e723a5dfcd290069df1ad78716db4d9723690af
2016-08-09 20:46:48 +00:00
Doney Alex
983e1aecd4 Encoder: Added support for configuring VUI parameters.
Bug: 27442922

Change-Id: I781195e78c480e7449f49467abb1df71902e568d
2016-07-12 14:41:59 -07:00
Harish Mahendrakar
7f1e3b7b07 Encoder: Fix in signalling direct_8x8_inference_flag in SPS
For level 3.0 and above this value should be set to 1 as per spec

Change-Id: I6930e4e5165e4c5012997f009cbe05397303d650
2016-07-01 05:59:22 +00:00
Doney Alex
6581cbf841 DO NOT MERGE Encoder: Fixed adaptive intra refresh.
Earlier if an MB was coded as intra in the previous frame,
corresponding MB in the current frame will not be coded as intra
even though it was supposed to be intra according to adaptive intra refresh.
Now the MB will honour adaptive intra refresh irrespective of its type
in previous frame.

Change-Id: Icc84ddf962dad6f7d1f4d11e9cb2a37bcda567b8
2016-03-12 00:11:40 +00:00
Doney Alex
dfe686ad4a DO NOT MERGE Encoder: Added support for Constrained intra prediction.
Change-Id: I674746047b2b007ca4bc52fad1a2cd9b177cd7bb
2016-03-11 22:10:12 +00:00
Doney Alex
c8eb4561bd Merge "Encoder: Fixed adaptive intra refresh." am: cb9903952b
am: dbcbd3567f

* commit 'dbcbd3567f':
  Encoder: Fixed adaptive intra refresh.
2016-02-26 15:30:24 +00:00