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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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