The Lambda tables for intra and inter(P) slices are slightly
modified. Lambda tables for B slices is completely replaced
wih new set.
This change is done in accordance with JVT-O079.doc
This commit does not introduce any new functionality w.r.t previous
commit. But it fixes few things. They are listed below:
1. Guard Bands in header files are fixed
2. Header files contains function definition comments. These are same
as in source file. Maintaining same comment at two locations is
unnecessary. These are removed.
3. Improved consistency and code indentation
4. Removed comments that dont align with implementation
5. Grouped headers of a workspace together
When IDR frame is skipped due to VBV constraints, the frame
number should not be reset. Since it was reset earlier, it
was leading to bistream being not decodable in such a case.
Restore frame_num during idr skip.
During bitstream overflow errors, it is possible that update post
enc gets skipped as last row might never have to be entropy coded
as we have already consumed the buffer. This can be fatal for
encoding further frames. Move this update to a location where it
is guaranteed to be updated
Bug: oss-fuzz-62378
Test: ./avc_enc_fuzzer
Change-Id: I279deb1f30c15c057c0b6e909834313a1df4fdac
At the end of encoding of a frame, the entropy thread communicates
the encoded bit stream size to rc module for update. After this
update, if rc decides to skip the frame due to vbv overflow, the
bitstream context is reset and frame is marked for skip.
Due to an oversight, if entropy encoding sees an error, then this
update is happening at the end of each row. Now rc has decided to
skip the frame and the context is reset. As the bitstream context is
reset, other threads are unaware of this problem and continue encoding.
This is causing issues.
Restrict the rc update to the thread that entropy code the last row.
Bug: oss-fuzz:59543
Bug: 285891354
Test: avc_enc_fuzzer
Change-Id: If45a5f34abb59ece812733af8f54f72ae5474d03
During encoding, if encoder encounters an error, the library returns the
same. If the application ignores it and feeds further input, library
while processing the new input is facing a null dereference.
1. Added a error check in encode API call before processing input
2. Made entropy bitstream buffer overflow errors non-fatal.
Bug: 187499509
Test: POC in bug descriptions
atest VtsHalMediaC2V1_0TargetVideoEncTest
atest -c CtsMediaV2TestCases:CodecEncoderTest
Using incorrect stride during copy from source buffer to intermediate buffer. This is corrected
Bug: 242379731
Bug: 242386193
Test: avcenc -c enc.cfg
Change-Id: I307525906ee6f6df5d8e114ebbafa40d6442662d
(cherry picked from commit 0a87a34fccffe15c2cc80670cf1058e7a3313c6a)
Merged-In: I307525906ee6f6df5d8e114ebbafa40d6442662d
- Add SII flag and SII parameters for the encoder and decoder.
- Encoder: Added support for SII SEI
- Decoder: Added support for SII SEI parsing and exporting
This CL adds support to report PSNR between incoming and resulting
encoded frames. Eventually be reported upstream as part of a feedback
mechanism.
Test: avcenc -c enc.cfg
Bug: b/235899898
Change-Id: Id520913ca5964965b5a86bc520240ccd1b28176c
few SIMD modules read few more bytes from the input buffer
at the end of frame. To avoid OOB read, intermediate buffer
is used while processing last MB row.
Bug: 180505809
Test: poc in bug
Test: atest CtsMediaTestCases:VideoEncoderTest
Test: atest CtsMediaV2TestCases:CodecEncoderTest
Test: atest VtsHalMediaC2V1_0TargetVideoEncTest
Change-Id: I11ca65937c7dfaf623f3535c02158ceec0dcc6ee
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
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
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
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
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
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
When qp goes less than 10, all I16x16 mode evaluations
are disabled and I4x4 evaluations are enabled irrespective
of preset. This will ensure that the residual will not
exceed the supported range of entropy
Minimum Qp cannot be set less than 4 now. When QP goes lesser,
the residual may exceed the supported range even with I4x4 enabled.
Change-Id: I25b404fcd9c9e9dbdd77679280968635ee047eb3
Buffer allocation is based on minimum level required for the
input resolution rather than the input max level.
Number of maximum context sets can be set to 1 to reduce
memory usage.
Added a macro ENC_MIN_PU_SIZE for minimum size of
inter prediction unit supported by encoder.
Changed the maximum constraint on number of MBs for NMB
processing to width in Mbs.
Change-Id: I5a9255e93935d90c13262681aafc772aedf8ae81
If horizontal padding is needed, copy the data to avoid having to try
to write into the input buffer.
If vertical padding is needed, we could get away with only copying
the last MB row (as previously was done), but then one extra row of
pixels are needed for intra pred. Thus always copy all of the picture,
for simplicity, if padding is needed.
Change-Id: I6b456a12956120d64e7c6b86d7b571e159f4566b
If the data is read directly from the input buffer, set the stride
values to those of the input buffer. If the data is copied, set the
stride to the value of the local buffer instead.
This fixes handling of cases where the input buffer stride is
(significantly) larger than the maxwidth of the video.
This also effectively makes the parameter
ive_ctl_set_dimensions_ip_t.u4_strd useless - nothing needs to
know the stride until you actually encode a frame, and at that point,
we can either use the stride of the input buffer, or of the local
pu1_y_csc_buf_base where the copied content is stored.
Change-Id: Icde400b4a0867d25855e621e143454e608748aa3
When both luma and chroma are copied to the local buffer (either
due to yuv format conversion, or due to padding), they have got
the same stride, but if chroma is copied while luma is used directly
from the input buffer, they might have different strides.
Therefore add a separate field for chroma stride.
This commit only adds the field, while it still has got the same
value as before.
Change-Id: I0dce97ad4d91cd1d9aba4b4472c6a0de45a314bc
Added support for CABAC entropy coding.
Added support for B slices.
Fixed an issue in rate control constant QP mode.
Change-Id: Ib759d35e8e943f941aa9b8bbff0362d92c619994
Handled non-multiple of 16 dimensions for 420 semiplanar input
Modified test code to remove alignment of width and height
Change-Id: I83ff8165364a863d577fcac81e711b07eec9c004
Added support for encoding non-multiple of 16 dimensions
Added support for encoding dimensions smaller than 64x64
Aligned coeff data to 4 byte boundary
Change-Id: I111093950f94698296d8499a2845cfe2db6c557b