Since, this repo provides support for av1 HW decoding using v4l2_requests api. Including libdav1d in the codec list would cause the codec2 service to pick it up whenever any av1 video is played and this would leave us with software decoding and would leave out
hw decoding.
Signed-off-by: Venkata Atchuta Bheemeswara Sarma Darbha <vdarbha0473@gmail.com>
Some of the files need to be integrated in the Android.bp to build successfully.
Signed-off-by: Venkata Atchuta Bheemeswara Sarma Darbha <vdarbha0473@gmail.com>
This function is missing from header files of aosp. hence, adding it here as it is only used by v4l2_requests.
Signed-off-by: Venkata Atchuta Bheemeswara Sarma Darbha <vdarbha0473@gmail.com>
android: Adding ext_sps_s(l)t_rps for v4l2_request_hevc
This adds Short & Long term ref pic set parameters which are currently used on hevc driver of vdpu381 (rk3588's Hardware Video Decoder). This needs to be removed in future, in both the kernel rkvdec driver and Userspace's FFMPEG.
The flag -Wbool-operation only triggers a build error at 1 specific
place in ffmpeg. As the flag is marked non-overridable in build/soong,
it's easier to disable the warning locally with pragma than patching the
soong repo (which would lead to possible forks in android-x86).
This avoid conflicts with libc's time.h. Using "-I bionic/libc/include"
is not working anymore, because bionic now exports the same directory
with -isystem, which supersedes the -I version (as stated in GCC doc).
This means the version of time.h in libavutil will now be found first,
via "-I external/ffmpeg/libavutil" (-I dirs are searched first, before
the -isystem ones).
Change-Id: I0d1e4276fbd0ea79d448ca96577528b296a4d462
Add a V4L2 Request API hwaccel for AV1.
Support for AV1 is enabled when Linux kernel headers declare the
control id V4L2_CID_STATELESS_AV1_FRAME, added in v6.5.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Add a V4L2 Request API hwaccel for VP9.
Support for VP9 is enabled when Linux kernel headers declare the
control id V4L2_CID_STATELESS_VP9_FRAME, added in v5.17.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Co-developed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Co-developed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Add a V4L2 Request API hwaccel for VP8.
Support for VP8 is enabled when Linux kernel headers declare the
control id V4L2_CID_STATELESS_VP8_FRAME, added in v5.13.
Co-developed-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Co-developed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Add a V4L2 Request API hwaccel for HEVC, supporting both slice and
frame decoding modes.
Support for HEVC is enabled when Linux kernel headers declare the
control id V4L2_CID_STATELESS_HEVC_SPS, added in v6.0.
Co-developed-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Co-developed-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Co-developed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Add a V4L2 Request API hwaccel for H.264, supporting both slice and
frame decoding modes.
Support for H.264 is enabled when Linux kernel headers declare the
control id V4L2_CID_STATELESS_H264_DECODE_MODE, added in v5.11.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Co-developed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
The V4L2_CID_STATELESS_H264_DECODE_PARAMS control require following:
- dec_ref_pic_marking_bit_size
Size in bits of the dec_ref_pic_marking() syntax element.
- pic_order_cnt_bit_size
Combined size in bits of the picture order count related syntax
elements: pic_order_cnt_lsb, delta_pic_order_cnt_bottom,
delta_pic_order_cnt0, and delta_pic_order_cnt1.
Save the bit sizes while parsing for later use in hwaccel, similar to
short/long_term_ref_pic_set_size in hevcdec.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Add a V4L2 Request API hwaccel for MPEG2.
Support for MPEG2 is enabled when Linux kernel headers declare the
control id V4L2_CID_STATELESS_MPEG2_SEQUENCE, added in v5.14.
This also change v4l2_request hwaccel to use autodetect in configure.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Add common support for decoding using the V4L2 Request API.
Basic flow for decoding follows the kernel Memory-to-memory Stateless
Video Decoder Interface > Decoding [1].
A codec hwaccel typically handle decoding as follow:
In start_frame next OUTPUT buffer and its related request object is
picked from a circular queue and any codec specific CONTROLs are
prepared.
In decode_slice the slice bitstream data is appended to the OUTPUT
buffer.
In end_frame a CAPTURE buffer tied to the AVFrame is queued, it will be
used as the decoding target by the driver / hw decoder. The prepared
codec specific CONTROLs are queued as part of the request object.
Finally, the request object is submitted for decoding.
In post_process the AVFrame is only returned once the CAPTURE buffer
tied to the AVFrame has been made available for dequeuing by the driver.
For slice based hw decoders only the request for the final slice of the
frame is submitted in end_frame, remaining is submitted in decode_slice.
[1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/dev-stateless-decoder.html#decoding
Co-developed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Co-developed-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Add initial helpers for supporting V4L2 Request API hwaccels.
Basic flow for initialization follows the kernel Memory-to-memory
Stateless Video Decoder Interface > Initialization [1].
In init a hw frame ctx is created and initialized to start a new V4L2
video decoding session, initial CAPTURE buffers is pre-allocated,
OUTPUT buffers and request objects are allocated for a circular queue.
In frame_params the codec pixel format and optional codec-specific
extended controls is configured before the hw frame ctx is initialized.
In uninit any pending request is flushed before resources are released.
[1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/dev-stateless-decoder.html#initialization
Co-developed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Co-developed-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Probe all media devices and its linked video devices to locate a video
device that support stateless decoding of the specific codec using the
V4L2 Request API.
A video device is deemed capable when all tests pass, e.g. kernel
drivers support the coded pixel format and the frame size is supported.
Basic flow for initialization follows the kernel Memory-to-memory
Stateless Video Decoder Interface > Initialization [1].
[1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/dev-stateless-decoder.html#initialization
Co-developed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Co-developed-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Add a hwdevice type for use with V4L2 Request API stateless decoding.
AVV4L2RequestFramesContext is expected to be filled with a V4L2 coded
pixel format and optional codec-specific extended controls before an
AVHWFramesContext is initialized.
Once initialized AVV4L2RequestFramesContextInternal describe the opened
V4L2 stateless decoder session, with details about media/video file
descriptors, formats of CAPTURE/OUTPUT queues and buffer pools for
creating CAPTURE/OUTPUT buffers.
AVHWFramesContext.pool defaults to create frame descriptors around a
CAPTURE buffer, and frames are returned with AVFrame.data[0] pointing
to a AVDRMFrameDescriptor and AVFrame.data[1] the CAPTURE buffer index.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Most EXIF metadata is in IFD0 and most EXIF payloads only contain
one IFD, but it is possible for there to be more IFDs after the
existing trailing one. exiftool and similar software report these IFDs
as IFD1, IFD2, etc. This commit reads those additional IFDs and attaches
them as dummy entries in the top-level IFD ranging from 0xFFFC down to
0xFFED, which are unused by the EXIF spec. The EXIF API is only able to
return and work with a single IFD, so by attaching it as a subdirectory
this metadata can be preserved.
This is done transparently through the read/write process. Upon parsing
an additional IFD1, it will be attached, but it will be written with
av_exif_write after IFD0 rather than as a subdirectory, as intended.
Existing files without more than one IFD, i.e. most files, will be unaffected
by this change, as well as API clients looking to parse specific fields, but
now more metadata is parsed and written, rather than simply being discarded
as trailing data.
Signed-off-by: Leo Izen <leo.izen@gmail.com>
Before this commit, exif_parse_ifd_list didn't free *ifd upon failure,
relying on the caller to do so instead. We only guarded some of the
calls against this function, not all of them, so sometimes it leaked.
This commit fixes this, so exif_parse_ifd_list freeds *ifd upon failure
so callers do not have to guard its invocation with a free wrapper.
Fixes: ossfuzz 440747118: Integer-overflow in av_strerror
Signed-off-by: Leo Izen <leo.izen@gmail.com>