Currently avc encoder creates desired number of threads at
the start of every frame and joins after frame is processed.
This change modifies the thread creation part. Now the threads
are created at the start of the sequence. Kept alive through
out the sequence and joined at the end of the sequence. This
helps in reduction of thread creation and deletion overhead.
This change does not effect the encoded bitstream. That is,
encoded output with this change is same as encoded output
without this change.
Bug: 288998933
Test: avcenc -c enc.cfg
Change-Id: I98784169052a5f05c109aaf1de97a5e46d7a773d
Before applying the config params (dimensions), the api is validating
the input buffer dimensions. This causes encode fails wrongly. This is
corrected.
If the encoder receives inputs that are empty or frames
that have to be skipped due to frame rate pull down,
do not increment picture count.
Bug: oss-fuzz-62827
Test: ./avc-enc-fuzzer
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
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
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
In some cases, s_inp_buf and s_out_buf on stack in ih264e_encode()
can be accessed unininitialized. This is fixed by initializing these
two structures.
Bug: oss-fuzz:57333
Bug: 274906999
Test: avc_enc_fuzzer
- 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
Last recon frame wasn't being saved in some cases, it is now fixed.
Bug: 242104774
Test: avcenc -c enc.cfg
Change-Id: I50fcd6709988b7126a36cc88d8abdb75e871a37a
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
Return current input buffer as buffer to be freed in case
of errors that are seen before picking up the input buffer
to be from the input queue.
Once a buffer is picked up from the queue, that is returned
as the buffer to be freed.
There is no need to return a buffer from ps_proc context
Bug: 180643802
Test: poc in the bug description
Test: atest CtsMediaV2TestCases:CodecEncoderTest
Test: atest VtsHalMediaC2V1_0TargetVideoEncTest
Change-Id: I1671ca1e82f522004d1f070df89b256b856f75b8
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
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
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.
Change-Id: I87e677acd00baf4f732ca7d35ee192e7f1f73994
This fixes building with compilers that are strict about the pre-C99
rule about having all variable declarations before statements.
(The previous version of this commit was originally made before
the commit adding support for main profile, which added a bunch
more similar issues.)
Change-Id: I0a927deb2ef4125f79429d108439e249fa531607
When header mode is enabled, the SPS is populated before this
field was initialized in ih264e_pic_init.
Change-Id: I7e38828e12bee15bd3a53562b4e4d0d65354326a
Changed macro specifying the minimum size required for output buffer.
Added an error check on the size allocated for output buffer.
Change-Id: I98e4f46e62ffc974df760f2633689de079ca3e5e
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
Added support for CABAC entropy coding.
Added support for B slices.
Fixed an issue in rate control constant QP mode.
Change-Id: Ib759d35e8e943f941aa9b8bbff0362d92c619994
If i4_header_mode is set (without the caller explicitly requesting it),
the next frame to be encoded will be missed altogether (when only
a header is output).
Instead force a header to be generated prepended to the next frame.
If the caller explicitly requests header mode, it will be output
in a separate call.
Change-Id: If475717edf980bccb2076f880c60c9dd7dede904