[FFmpeg-devel] [RFC 0/6] Add V4L2 request API hwaccels

Jonas Karlman jonas at kwiboo.se
Mon Apr 8 23:09:59 EEST 2019


Hello,

This is a request for comments on a new hwaccel using the V4L2 request API
that was created in collaboration with Jernej Skrabec.

The V4L2 ctrls needed for statless decoding is not yet stable and reside in
private kernel headers. This patchset adds a copy of the kernel private headers
needed for the hwaccel to compile.

Patch 1 contains a new buffer pool function av_buffer_pool_reclaim() that will
free all available buffers in a buffer pool. This can be used to save memory
when seeking in e.g. H264 where a new hwaccel instance may get init:ed before
the current one is uninit. VAAPI may alloc 20+20 buffers during such overlap.

Patch 2 adds common code used in the hwaccels, libudev is used to enumerate
media and video devices to locate devices that supports stateless decoding.

Patch 3-5 adds hwaccels for MPEG-2, H264 and HEVC.

Patch 6 adds private linux headers for V4L2 ctrls. These headers will not be
needed once stable ctrls is moved to linux uapi headers.

Use --enable-v4l2-request --enable-libdrm --enable-libudev to enable hwaccels.

Playback can be tested using mpv patched with [1] or kodi-gbm on
Allwinner (H3, H6, A64) devices using the cedrus driver running linux v5.0.x
with patches from [2].

This hwaccel has in one form or another been used in Jernej Skrabec's
LibreELEC community images for Allwinner at [4] since Dec 20th 2018.

Latest work-in-progress version of this patchset can be found at [3].

Any feedback is welcomed, thanks.

[1] https://github.com/mpv-player/mpv/pull/6461
[2] https://github.com/LibreELEC/LibreELEC.tv/tree/allwinner/projects/Allwinner/patches/linux
[3] https://github.com/Kwiboo/FFmpeg/commits/v4l2-request-hwaccel
[4] https://forum.libreelec.tv/thread/13228-early-community-images-for-h3-h6-and-a64/?postID=99416#post99416

Regards,
Jonas

---

Jernej Skrabec (3):
  Add V4L2 request API h264 hwaccel
  Add V4L2 request API hevc hwaccel
  Add and use private linux headers for V4L2 request API ctrls

Jonas Karlman (3):
  avutil: add av_buffer_pool_reclaim()
  Add common V4L2 request API code
  Add V4L2 request API mpeg2 hwaccel

 configure                       |  17 +
 libavcodec/Makefile             |   4 +
 libavcodec/h264-ctrls.h         | 192 +++++++
 libavcodec/h264_slice.c         |   4 +
 libavcodec/h264dec.c            |   3 +
 libavcodec/hevc-ctrls.h         | 197 +++++++
 libavcodec/hevcdec.c            |  10 +
 libavcodec/hwaccel.h            |   2 +
 libavcodec/hwaccels.h           |   3 +
 libavcodec/mpeg12dec.c          |   6 +
 libavcodec/mpeg2-ctrls.h        |  82 +++
 libavcodec/v4l2_request.c       | 885 ++++++++++++++++++++++++++++++++
 libavcodec/v4l2_request.h       |  65 +++
 libavcodec/v4l2_request_h264.c  | 369 +++++++++++++
 libavcodec/v4l2_request_hevc.c  | 392 ++++++++++++++
 libavcodec/v4l2_request_mpeg2.c | 155 ++++++
 libavutil/buffer.c              |  13 +
 libavutil/buffer.h              |   5 +
 18 files changed, 2404 insertions(+)
 create mode 100644 libavcodec/h264-ctrls.h
 create mode 100644 libavcodec/hevc-ctrls.h
 create mode 100644 libavcodec/mpeg2-ctrls.h
 create mode 100644 libavcodec/v4l2_request.c
 create mode 100644 libavcodec/v4l2_request.h
 create mode 100644 libavcodec/v4l2_request_h264.c
 create mode 100644 libavcodec/v4l2_request_hevc.c
 create mode 100644 libavcodec/v4l2_request_mpeg2.c

-- 
2.17.1



More information about the ffmpeg-devel mailing list