diff --git a/packages/multimedia/ffmpeg/patches/v4l2-request/ffmpeg-001-v4l2-request.patch b/packages/multimedia/ffmpeg/patches/v4l2-request/ffmpeg-001-v4l2-request.patch index a09da010de..7f72e1aeb9 100644 --- a/packages/multimedia/ffmpeg/patches/v4l2-request/ffmpeg-001-v4l2-request.patch +++ b/packages/multimedia/ffmpeg/patches/v4l2-request/ffmpeg-001-v4l2-request.patch @@ -1,4 +1,4 @@ -From fd7c38d6a87d92faaf3b7f18df5cb19918aca3a7 Mon Sep 17 00:00:00 2001 +From 904af26693095364851bbc6c6557fca9b3437b69 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Mon, 3 Dec 2018 23:48:04 +0100 Subject: [PATCH 01/18] avutil: add av_buffer_pool_flush() @@ -12,10 +12,10 @@ Signed-off-by: Jonas Karlman 2 files changed, 18 insertions(+) diff --git a/libavutil/buffer.c b/libavutil/buffer.c -index 38a554208a90..b0fedabc3e7d 100644 +index 858633e8c7..41555d9982 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c -@@ -273,6 +273,19 @@ static void buffer_pool_free(AVBufferPool *pool) +@@ -305,6 +305,19 @@ static void buffer_pool_free(AVBufferPool *pool) av_freep(&pool); } @@ -36,11 +36,11 @@ index 38a554208a90..b0fedabc3e7d 100644 { AVBufferPool *pool; diff --git a/libavutil/buffer.h b/libavutil/buffer.h -index c0f3f6cc9abe..998beec9ac5b 100644 +index 241a80ed67..f41363faf1 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h -@@ -267,6 +267,11 @@ AVBufferPool *av_buffer_pool_init2(int size, void *opaque, - AVBufferRef* (*alloc)(void *opaque, int size), +@@ -315,6 +315,11 @@ AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque, + #endif void (*pool_free)(void *opaque)); +/** @@ -52,7 +52,7 @@ index c0f3f6cc9abe..998beec9ac5b 100644 * Mark the pool as being available for freeing. It will actually be freed only * once all the allocated buffers associated with the pool are released. Thus it -From 73677b0d323aca461e88c9ee287afb4d6744a0bc Mon Sep 17 00:00:00 2001 +From ec84dc22e99f544e4de7c43e7f8ef9ab7ee8e19b Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Sat, 15 Dec 2018 22:32:16 +0100 Subject: [PATCH 02/18] Add common V4L2 request API code @@ -69,18 +69,18 @@ Signed-off-by: Jonas Karlman create mode 100644 libavcodec/v4l2_request.h diff --git a/configure b/configure -index 36713ab658f9..81ee0e740498 100755 +index d7a3f507e8..f2e203d134 100755 --- a/configure +++ b/configure -@@ -274,6 +274,7 @@ External library support: - --enable-libtls enable LibreSSL (via libtls), needed for https support +@@ -279,6 +279,7 @@ External library support: if openssl, gnutls or mbedtls is not used [no] --enable-libtwolame enable MP2 encoding via libtwolame [no] + --enable-libuavs3d enable AVS3 decoding via libuavs3d [no] + --enable-libudev enable libudev [no] --enable-libv4l2 enable libv4l2/v4l-utils [no] --enable-libvidstab enable video stabilization using vid.stab [no] --enable-libvmaf enable vmaf filter via libvmaf [no] -@@ -342,6 +343,7 @@ External library support: +@@ -346,6 +347,7 @@ External library support: --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no] --enable-rkmpp enable Rockchip Media Process Platform code [no] --disable-v4l2-m2m disable V4L2 mem2mem code [autodetect] @@ -88,15 +88,15 @@ index 36713ab658f9..81ee0e740498 100755 --disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect] --disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect] --disable-videotoolbox disable VideoToolbox code [autodetect] -@@ -1807,6 +1809,7 @@ EXTERNAL_LIBRARY_LIST=" - libtesseract +@@ -1814,6 +1816,7 @@ EXTERNAL_LIBRARY_LIST=" libtheora libtwolame + libuavs3d + libudev libv4l2 + libvmaf libvorbis - libvpx -@@ -1861,6 +1864,7 @@ HWACCEL_LIBRARY_LIST=" +@@ -1868,6 +1871,7 @@ HWACCEL_LIBRARY_LIST=" mmal omx opencl @@ -104,7 +104,7 @@ index 36713ab658f9..81ee0e740498 100755 vulkan " -@@ -2903,6 +2907,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext" +@@ -2919,6 +2923,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext" dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32" ffnvcodec_deps_any="libdl LoadLibrary" nvdec_deps="ffnvcodec" @@ -112,15 +112,15 @@ index 36713ab658f9..81ee0e740498 100755 vaapi_x11_deps="xlib" videotoolbox_hwaccel_deps="videotoolbox pthreads" videotoolbox_hwaccel_extralibs="-framework QuartzCore" -@@ -6376,6 +6381,7 @@ enabled libtls && require_pkg_config libtls libtls tls.h tls_configur - enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame && +@@ -6438,6 +6443,7 @@ enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame || die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; } + enabled libuavs3d && require_pkg_config libuavs3d "uavs3d >= 1.1.41" uavs3d.h uavs3d_decode +enabled libudev && require_pkg_config libudev libudev libudev.h udev_new enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit - enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 1.3.9" libvmaf.h compute_vmaf -@@ -6475,6 +6481,10 @@ enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/r + enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 1.5.2" libvmaf.h compute_vmaf +@@ -6536,6 +6542,10 @@ enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/r { enabled libdrm || die "ERROR: rkmpp requires --enable-libdrm"; } } @@ -131,7 +131,7 @@ index 36713ab658f9..81ee0e740498 100755 enabled vapoursynth && require_pkg_config vapoursynth "vapoursynth-script >= 42" VSScript.h vsscript_init -@@ -6556,6 +6566,8 @@ if enabled v4l2_m2m; then +@@ -6617,6 +6627,8 @@ if enabled v4l2_m2m; then check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" fi @@ -141,10 +141,10 @@ index 36713ab658f9..81ee0e740498 100755 test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 5a6ea59715af..d74220516826 100644 +index 33a280cf69..90dfffcb20 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -153,6 +153,7 @@ OBJS-$(CONFIG_VP3DSP) += vp3dsp.o +@@ -155,6 +155,7 @@ OBJS-$(CONFIG_VP3DSP) += vp3dsp.o OBJS-$(CONFIG_VP56DSP) += vp56dsp.o OBJS-$(CONFIG_VP8DSP) += vp8dsp.o OBJS-$(CONFIG_V4L2_M2M) += v4l2_m2m.o v4l2_context.o v4l2_buffers.o v4l2_fmt.o @@ -153,7 +153,7 @@ index 5a6ea59715af..d74220516826 100644 OBJS-$(CONFIG_WMV2DSP) += wmv2dsp.o diff --git a/libavcodec/hwconfig.h b/libavcodec/hwconfig.h -index f421dc909f44..ee78d8ab8e89 100644 +index f421dc909f..ee78d8ab8e 100644 --- a/libavcodec/hwconfig.h +++ b/libavcodec/hwconfig.h @@ -80,6 +80,8 @@ typedef struct AVCodecHWConfigInternal { @@ -167,7 +167,7 @@ index f421dc909f44..ee78d8ab8e89 100644 &(const AVCodecHWConfigInternal) { \ diff --git a/libavcodec/v4l2_request.c b/libavcodec/v4l2_request.c new file mode 100644 -index 000000000000..5234b5049b0d +index 0000000000..5234b5049b --- /dev/null +++ b/libavcodec/v4l2_request.c @@ -0,0 +1,984 @@ @@ -1157,7 +1157,7 @@ index 000000000000..5234b5049b0d +} diff --git a/libavcodec/v4l2_request.h b/libavcodec/v4l2_request.h new file mode 100644 -index 000000000000..58d2aa70af80 +index 0000000000..58d2aa70af --- /dev/null +++ b/libavcodec/v4l2_request.h @@ -0,0 +1,77 @@ @@ -1239,7 +1239,7 @@ index 000000000000..58d2aa70af80 + +#endif /* AVCODEC_V4L2_REQUEST_H */ -From 4b5bc3f75955694bfe7af15a323f0c902e53acf1 Mon Sep 17 00:00:00 2001 +From e432d3151f4c5507e40fb1fe8b3c3fb7c7a0a08c Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Wed, 20 Feb 2019 11:18:00 -0300 Subject: [PATCH 03/18] h264dec: add idr_pic_id to slice context @@ -1254,10 +1254,10 @@ Signed-off-by: Jonas Karlman 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c -index 111e1dfe7fa1..81f9a74cb629 100644 +index 2d0605c7f4..c3a7338a70 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c -@@ -1818,7 +1818,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, +@@ -1830,7 +1830,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, } if (nal->type == H264_NAL_IDR_SLICE) @@ -1267,10 +1267,10 @@ index 111e1dfe7fa1..81f9a74cb629 100644 if (sps->poc_type == 0) { sl->poc_lsb = get_bits(&sl->gb, sps->log2_max_poc_lsb); diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h -index a419615124b2..316dc6a2c890 100644 +index b7b19ba4f1..0698ab95ba 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h -@@ -335,6 +335,7 @@ typedef struct H264SliceContext { +@@ -336,6 +336,7 @@ typedef struct H264SliceContext { int delta_poc[2]; int curr_pic_num; int max_pic_num; @@ -1279,7 +1279,7 @@ index a419615124b2..316dc6a2c890 100644 /** -From 89a05a843c5ecef72b37e5381d2169027e3450b0 Mon Sep 17 00:00:00 2001 +From 84564d13ec0ec40f408622ff6b0d900723bbab5b Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 22 May 2019 14:44:22 +0200 Subject: [PATCH 04/18] h264dec: add ref_pic_marking and pic_order_cnt bit_size @@ -1295,10 +1295,10 @@ Signed-off-by: Jonas Karlman 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c -index 81f9a74cb629..2b370d18e82d 100644 +index c3a7338a70..c28b58cd5d 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c -@@ -1736,7 +1736,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, +@@ -1748,7 +1748,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, unsigned int slice_type, tmp, i; int field_pic_flag, bottom_field_flag; int first_slice = sl == h->slice_ctx && !h->current_slice; @@ -1307,7 +1307,7 @@ index 81f9a74cb629..2b370d18e82d 100644 if (first_slice) av_assert0(!h->setup_finished); -@@ -1820,6 +1820,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, +@@ -1832,6 +1832,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, if (nal->type == H264_NAL_IDR_SLICE) sl->idr_pic_id = get_ue_golomb_long(&sl->gb); @@ -1315,7 +1315,7 @@ index 81f9a74cb629..2b370d18e82d 100644 if (sps->poc_type == 0) { sl->poc_lsb = get_bits(&sl->gb, sps->log2_max_poc_lsb); -@@ -1833,6 +1834,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, +@@ -1845,6 +1846,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME) sl->delta_poc[1] = get_se_golomb(&sl->gb); } @@ -1323,7 +1323,7 @@ index 81f9a74cb629..2b370d18e82d 100644 sl->redundant_pic_count = 0; if (pps->redundant_pic_cnt_present) -@@ -1872,9 +1874,11 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, +@@ -1884,9 +1886,11 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, sl->explicit_ref_marking = 0; if (nal->ref_idc) { @@ -1336,10 +1336,10 @@ index 81f9a74cb629..2b370d18e82d 100644 if (sl->slice_type_nos != AV_PICTURE_TYPE_I && pps->cabac) { diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h -index 316dc6a2c890..f2cabac468d0 100644 +index 0698ab95ba..2b39e82c3b 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h -@@ -328,6 +328,7 @@ typedef struct H264SliceContext { +@@ -329,6 +329,7 @@ typedef struct H264SliceContext { MMCO mmco[MAX_MMCO_COUNT]; int nb_mmco; int explicit_ref_marking; @@ -1347,7 +1347,7 @@ index 316dc6a2c890..f2cabac468d0 100644 int frame_num; int poc_lsb; -@@ -336,6 +337,7 @@ typedef struct H264SliceContext { +@@ -337,6 +338,7 @@ typedef struct H264SliceContext { int curr_pic_num; int max_pic_num; int idr_pic_id; @@ -1356,7 +1356,7 @@ index 316dc6a2c890..f2cabac468d0 100644 /** -From bd9786a78eb4c44325caef40305f86b2856ecad4 Mon Sep 17 00:00:00 2001 +From 5a8628cf6368fe18457d02bf551d5935609efab5 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Sat, 15 Dec 2018 22:32:16 +0100 Subject: [PATCH 05/18] Add V4L2 request API h264 hwaccel @@ -1374,10 +1374,10 @@ Signed-off-by: Jonas Karlman create mode 100644 libavcodec/v4l2_request_h264.c diff --git a/configure b/configure -index 81ee0e740498..0f5b8e355950 100755 +index f2e203d134..b17e4108c1 100755 --- a/configure +++ b/configure -@@ -2925,6 +2925,8 @@ h264_dxva2_hwaccel_deps="dxva2" +@@ -2951,6 +2951,8 @@ h264_dxva2_hwaccel_deps="dxva2" h264_dxva2_hwaccel_select="h264_decoder" h264_nvdec_hwaccel_deps="nvdec" h264_nvdec_hwaccel_select="h264_decoder" @@ -1386,7 +1386,7 @@ index 81ee0e740498..0f5b8e355950 100755 h264_vaapi_hwaccel_deps="vaapi" h264_vaapi_hwaccel_select="h264_decoder" h264_vdpau_hwaccel_deps="vdpau" -@@ -6567,6 +6569,7 @@ if enabled v4l2_m2m; then +@@ -6628,6 +6630,7 @@ if enabled v4l2_m2m; then fi check_func_headers "linux/media.h linux/videodev2.h" v4l2_timeval_to_ns @@ -1395,22 +1395,22 @@ index 81ee0e740498..0f5b8e355950 100755 check_headers sys/videoio.h test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index d74220516826..4f6e7fc2515c 100644 +index 90dfffcb20..426c7528e9 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -903,6 +903,7 @@ OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o +@@ -935,6 +935,7 @@ OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o OBJS-$(CONFIG_H264_NVDEC_HWACCEL) += nvdec_h264.o - OBJS-$(CONFIG_H264_QSV_HWACCEL) += qsvdec_h2645.o + OBJS-$(CONFIG_H264_QSV_HWACCEL) += qsvdec.o +OBJS-$(CONFIG_H264_V4L2REQUEST_HWACCEL) += v4l2_request_h264.o OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o OBJS-$(CONFIG_H264_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c -index 2b370d18e82d..dd5ba98a02cb 100644 +index c28b58cd5d..0a10d00aad 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c -@@ -759,6 +759,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) +@@ -768,6 +768,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) #define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \ (CONFIG_H264_D3D11VA_HWACCEL * 2) + \ CONFIG_H264_NVDEC_HWACCEL + \ @@ -1418,7 +1418,7 @@ index 2b370d18e82d..dd5ba98a02cb 100644 CONFIG_H264_VAAPI_HWACCEL + \ CONFIG_H264_VIDEOTOOLBOX_HWACCEL + \ CONFIG_H264_VDPAU_HWACCEL) -@@ -843,6 +844,9 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) +@@ -852,6 +853,9 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) #endif #if CONFIG_H264_VIDEOTOOLBOX_HWACCEL *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX; @@ -1429,10 +1429,10 @@ index 2b370d18e82d..dd5ba98a02cb 100644 if (h->avctx->codec->pix_fmts) choices = h->avctx->codec->pix_fmts; diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c -index 5eedeb3c275d..a504c89565c7 100644 +index 0a999bef43..d78e3eaee3 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c -@@ -1102,6 +1102,9 @@ AVCodec ff_h264_decoder = { +@@ -1076,6 +1076,9 @@ AVCodec ff_h264_decoder = { #endif #if CONFIG_H264_VIDEOTOOLBOX_HWACCEL HWACCEL_VIDEOTOOLBOX(h264), @@ -1443,10 +1443,10 @@ index 5eedeb3c275d..a504c89565c7 100644 NULL }, diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h -index 6109c89bd63c..f758c34ddcf9 100644 +index 8e54cf73f9..969a1da0f4 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h -@@ -27,6 +27,7 @@ extern const AVHWAccel ff_h264_d3d11va_hwaccel; +@@ -32,6 +32,7 @@ extern const AVHWAccel ff_h264_d3d11va_hwaccel; extern const AVHWAccel ff_h264_d3d11va2_hwaccel; extern const AVHWAccel ff_h264_dxva2_hwaccel; extern const AVHWAccel ff_h264_nvdec_hwaccel; @@ -1456,7 +1456,7 @@ index 6109c89bd63c..f758c34ddcf9 100644 extern const AVHWAccel ff_h264_videotoolbox_hwaccel; diff --git a/libavcodec/v4l2_request_h264.c b/libavcodec/v4l2_request_h264.c new file mode 100644 -index 000000000000..88da8f0a2db0 +index 0000000000..88da8f0a2d --- /dev/null +++ b/libavcodec/v4l2_request_h264.c @@ -0,0 +1,456 @@ @@ -1917,7 +1917,7 @@ index 000000000000..88da8f0a2db0 + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, +}; -From e36de603c7c9daa8e1a833539c7311438eb1dc0c Mon Sep 17 00:00:00 2001 +From 02b8fb17c2a019463dcab4baa1cb0bec63353183 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Sat, 15 Dec 2018 22:32:16 +0100 Subject: [PATCH 06/18] Add V4L2 request API mpeg2 hwaccel @@ -1933,10 +1933,10 @@ Signed-off-by: Jonas Karlman create mode 100644 libavcodec/v4l2_request_mpeg2.c diff --git a/configure b/configure -index 0f5b8e355950..6ed48234dd25 100755 +index b17e4108c1..ec141fabbd 100755 --- a/configure +++ b/configure -@@ -2969,6 +2969,8 @@ mpeg2_dxva2_hwaccel_deps="dxva2" +@@ -2995,6 +2995,8 @@ mpeg2_dxva2_hwaccel_deps="dxva2" mpeg2_dxva2_hwaccel_select="mpeg2video_decoder" mpeg2_nvdec_hwaccel_deps="nvdec" mpeg2_nvdec_hwaccel_select="mpeg2video_decoder" @@ -1945,7 +1945,7 @@ index 0f5b8e355950..6ed48234dd25 100755 mpeg2_vaapi_hwaccel_deps="vaapi" mpeg2_vaapi_hwaccel_select="mpeg2video_decoder" mpeg2_vdpau_hwaccel_deps="vdpau" -@@ -6570,6 +6572,7 @@ fi +@@ -6631,6 +6633,7 @@ fi check_func_headers "linux/media.h linux/videodev2.h" v4l2_timeval_to_ns check_cc h264_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_H264_SLICE;" @@ -1954,22 +1954,22 @@ index 0f5b8e355950..6ed48234dd25 100755 check_headers sys/videoio.h test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 4f6e7fc2515c..9a10a292e377 100644 +index 426c7528e9..02c023a447 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -923,6 +923,7 @@ OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL) += dxva2_mpeg2.o +@@ -955,6 +955,7 @@ OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL) += dxva2_mpeg2.o OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o OBJS-$(CONFIG_MPEG2_NVDEC_HWACCEL) += nvdec_mpeg12.o - OBJS-$(CONFIG_MPEG2_QSV_HWACCEL) += qsvdec_other.o + OBJS-$(CONFIG_MPEG2_QSV_HWACCEL) += qsvdec.o +OBJS-$(CONFIG_MPEG2_V4L2REQUEST_HWACCEL) += v4l2_request_mpeg2.o OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL) += vdpau_mpeg12.o OBJS-$(CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h -index f758c34ddcf9..44e00e79b515 100644 +index 969a1da0f4..a8ae1483d8 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h -@@ -48,6 +48,7 @@ extern const AVHWAccel ff_mpeg2_d3d11va_hwaccel; +@@ -53,6 +53,7 @@ extern const AVHWAccel ff_mpeg2_d3d11va_hwaccel; extern const AVHWAccel ff_mpeg2_d3d11va2_hwaccel; extern const AVHWAccel ff_mpeg2_nvdec_hwaccel; extern const AVHWAccel ff_mpeg2_dxva2_hwaccel; @@ -1978,10 +1978,10 @@ index f758c34ddcf9..44e00e79b515 100644 extern const AVHWAccel ff_mpeg2_vdpau_hwaccel; extern const AVHWAccel ff_mpeg2_videotoolbox_hwaccel; diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c -index 99e56532a59e..15aaf97a34c7 100644 +index 94221da2c1..4b0176f6cb 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c -@@ -1154,6 +1154,9 @@ static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = { +@@ -1147,6 +1147,9 @@ static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = { #endif #if CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL AV_PIX_FMT_VIDEOTOOLBOX, @@ -1991,7 +1991,7 @@ index 99e56532a59e..15aaf97a34c7 100644 #endif AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE -@@ -2952,6 +2955,9 @@ AVCodec ff_mpeg2video_decoder = { +@@ -2961,6 +2964,9 @@ AVCodec ff_mpeg2video_decoder = { #endif #if CONFIG_MPEG2_XVMC_HWACCEL HWACCEL_XVMC(mpeg2), @@ -2003,7 +2003,7 @@ index 99e56532a59e..15aaf97a34c7 100644 }, diff --git a/libavcodec/v4l2_request_mpeg2.c b/libavcodec/v4l2_request_mpeg2.c new file mode 100644 -index 000000000000..84d53209c79d +index 0000000000..84d53209c7 --- /dev/null +++ b/libavcodec/v4l2_request_mpeg2.c @@ -0,0 +1,159 @@ @@ -2167,7 +2167,7 @@ index 000000000000..84d53209c79d + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, +}; -From 8fedb1c1d5c232936ec7ddff71e72dd27dbace6d Mon Sep 17 00:00:00 2001 +From 1cd61e5730acc12c39c964bcf13c73a54203a390 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 22 May 2019 14:46:58 +0200 Subject: [PATCH 07/18] Add V4L2 request API vp8 hwaccel @@ -2180,15 +2180,15 @@ Signed-off-by: Jonas Karlman libavcodec/Makefile | 1 + libavcodec/hwaccels.h | 1 + libavcodec/v4l2_request_vp8.c | 180 ++++++++++++++++++++++++++++++++++ - libavcodec/vp8.c | 8 +- - 5 files changed, 192 insertions(+), 1 deletion(-) + libavcodec/vp8.c | 6 ++ + 5 files changed, 191 insertions(+) create mode 100644 libavcodec/v4l2_request_vp8.c diff --git a/configure b/configure -index 6ed48234dd25..a3c724861caa 100755 +index ec141fabbd..f16bed65a3 100755 --- a/configure +++ b/configure -@@ -3001,6 +3001,8 @@ vc1_vdpau_hwaccel_deps="vdpau" +@@ -3027,6 +3027,8 @@ vc1_vdpau_hwaccel_deps="vdpau" vc1_vdpau_hwaccel_select="vc1_decoder" vp8_nvdec_hwaccel_deps="nvdec" vp8_nvdec_hwaccel_select="vp8_decoder" @@ -2197,7 +2197,7 @@ index 6ed48234dd25..a3c724861caa 100755 vp8_vaapi_hwaccel_deps="vaapi" vp8_vaapi_hwaccel_select="vp8_decoder" vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9" -@@ -6573,6 +6575,7 @@ fi +@@ -6634,6 +6636,7 @@ fi check_func_headers "linux/media.h linux/videodev2.h" v4l2_timeval_to_ns check_cc h264_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_H264_SLICE;" check_cc mpeg2_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2_SLICE;" @@ -2206,10 +2206,10 @@ index 6ed48234dd25..a3c724861caa 100755 check_headers sys/videoio.h test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 9a10a292e377..c74d2ebfdd23 100644 +index 02c023a447..c79d678eb3 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -939,6 +939,7 @@ OBJS-$(CONFIG_VC1_QSV_HWACCEL) += qsvdec_other.o +@@ -971,6 +971,7 @@ OBJS-$(CONFIG_VC1_QSV_HWACCEL) += qsvdec.o OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o OBJS-$(CONFIG_VC1_VDPAU_HWACCEL) += vdpau_vc1.o OBJS-$(CONFIG_VP8_NVDEC_HWACCEL) += nvdec_vp8.o @@ -2218,10 +2218,10 @@ index 9a10a292e377..c74d2ebfdd23 100644 OBJS-$(CONFIG_VP9_D3D11VA_HWACCEL) += dxva2_vp9.o OBJS-$(CONFIG_VP9_DXVA2_HWACCEL) += dxva2_vp9.o diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h -index 44e00e79b515..14838083ec36 100644 +index a8ae1483d8..9f8d41e367 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h -@@ -64,6 +64,7 @@ extern const AVHWAccel ff_vc1_nvdec_hwaccel; +@@ -69,6 +69,7 @@ extern const AVHWAccel ff_vc1_nvdec_hwaccel; extern const AVHWAccel ff_vc1_vaapi_hwaccel; extern const AVHWAccel ff_vc1_vdpau_hwaccel; extern const AVHWAccel ff_vp8_nvdec_hwaccel; @@ -2231,7 +2231,7 @@ index 44e00e79b515..14838083ec36 100644 extern const AVHWAccel ff_vp9_d3d11va2_hwaccel; diff --git a/libavcodec/v4l2_request_vp8.c b/libavcodec/v4l2_request_vp8.c new file mode 100644 -index 000000000000..bc0fc400727a +index 0000000000..bc0fc40072 --- /dev/null +++ b/libavcodec/v4l2_request_vp8.c @@ -0,0 +1,180 @@ @@ -2416,10 +2416,10 @@ index 000000000000..bc0fc400727a + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, +}; diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c -index e84fcdeaa1e7..0608d9e4e165 100644 +index d16e7b6aa3..8ee768d875 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c -@@ -175,6 +175,9 @@ static enum AVPixelFormat get_pixel_format(VP8Context *s) +@@ -176,6 +176,9 @@ static enum AVPixelFormat get_pixel_format(VP8Context *s) #endif #if CONFIG_VP8_NVDEC_HWACCEL AV_PIX_FMT_CUDA, @@ -2429,16 +2429,7 @@ index e84fcdeaa1e7..0608d9e4e165 100644 #endif AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE, -@@ -198,7 +201,7 @@ int update_dimensions(VP8Context *s, int width, int height, int is_vp7) - return ret; - } - -- if (!s->actually_webp && !is_vp7) { -+ if (!s->actually_webp && !is_vp7 && s->pix_fmt == AV_PIX_FMT_NONE) { - s->pix_fmt = get_pixel_format(s); - if (s->pix_fmt < 0) - return AVERROR(EINVAL); -@@ -2968,6 +2971,9 @@ AVCodec ff_vp8_decoder = { +@@ -2972,6 +2975,9 @@ AVCodec ff_vp8_decoder = { #endif #if CONFIG_VP8_NVDEC_HWACCEL HWACCEL_NVDEC(vp8), @@ -2449,7 +2440,7 @@ index e84fcdeaa1e7..0608d9e4e165 100644 NULL }, -From aba2a109c8191b8e914522c7504f78385e1da3ed Mon Sep 17 00:00:00 2001 +From 0065c180f7345bef065e5704ddb9827dc18b2f4b Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Sat, 15 Dec 2018 22:32:16 +0100 Subject: [PATCH 08/18] Add V4L2 request API hevc hwaccel @@ -2466,10 +2457,10 @@ Signed-off-by: Jonas Karlman create mode 100644 libavcodec/v4l2_request_hevc.c diff --git a/configure b/configure -index a3c724861caa..94476afd5df1 100755 +index f16bed65a3..02a80cf27f 100755 --- a/configure +++ b/configure -@@ -2941,6 +2941,8 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" +@@ -2967,6 +2967,8 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" hevc_dxva2_hwaccel_select="hevc_decoder" hevc_nvdec_hwaccel_deps="nvdec" hevc_nvdec_hwaccel_select="hevc_decoder" @@ -2478,7 +2469,7 @@ index a3c724861caa..94476afd5df1 100755 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC" hevc_vaapi_hwaccel_select="hevc_decoder" hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" -@@ -6574,6 +6576,7 @@ fi +@@ -6635,6 +6637,7 @@ fi check_func_headers "linux/media.h linux/videodev2.h" v4l2_timeval_to_ns check_cc h264_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_H264_SLICE;" @@ -2487,22 +2478,22 @@ index a3c724861caa..94476afd5df1 100755 check_cc vp8_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_VP8_FRAME;" diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index c74d2ebfdd23..d6af854daaa6 100644 +index c79d678eb3..0059074530 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -911,6 +911,7 @@ OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o +@@ -943,6 +943,7 @@ OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o - OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o + OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec.o +OBJS-$(CONFIG_HEVC_V4L2REQUEST_HWACCEL) += v4l2_request_hevc.o OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o h265_profile_level.o - OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o + OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o h265_profile_level.o OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL) += nvdec_mjpeg.o diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c -index 1eaeaf72f145..7e47bd7177e1 100644 +index 2231aed259..7507966d71 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c -@@ -372,6 +372,7 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) +@@ -392,6 +392,7 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + \ CONFIG_HEVC_D3D11VA_HWACCEL * 2 + \ CONFIG_HEVC_NVDEC_HWACCEL + \ @@ -2510,7 +2501,7 @@ index 1eaeaf72f145..7e47bd7177e1 100644 CONFIG_HEVC_VAAPI_HWACCEL + \ CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL + \ CONFIG_HEVC_VDPAU_HWACCEL) -@@ -398,6 +399,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) +@@ -418,6 +419,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) #endif #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX; @@ -2520,7 +2511,7 @@ index 1eaeaf72f145..7e47bd7177e1 100644 #endif break; case AV_PIX_FMT_YUV420P10: -@@ -416,6 +420,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) +@@ -439,6 +443,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) #endif #if CONFIG_HEVC_NVDEC_HWACCEL *fmt++ = AV_PIX_FMT_CUDA; @@ -2530,7 +2521,7 @@ index 1eaeaf72f145..7e47bd7177e1 100644 #endif break; case AV_PIX_FMT_YUV444P: -@@ -3593,6 +3600,9 @@ AVCodec ff_hevc_decoder = { +@@ -3705,6 +3712,9 @@ AVCodec ff_hevc_decoder = { #endif #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL HWACCEL_VIDEOTOOLBOX(hevc), @@ -2541,10 +2532,10 @@ index 1eaeaf72f145..7e47bd7177e1 100644 NULL }, diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h -index 14838083ec36..bd75e94f4cae 100644 +index 9f8d41e367..ffb9fa5087 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h -@@ -35,6 +35,7 @@ extern const AVHWAccel ff_hevc_d3d11va_hwaccel; +@@ -40,6 +40,7 @@ extern const AVHWAccel ff_hevc_d3d11va_hwaccel; extern const AVHWAccel ff_hevc_d3d11va2_hwaccel; extern const AVHWAccel ff_hevc_dxva2_hwaccel; extern const AVHWAccel ff_hevc_nvdec_hwaccel; @@ -2554,7 +2545,7 @@ index 14838083ec36..bd75e94f4cae 100644 extern const AVHWAccel ff_hevc_videotoolbox_hwaccel; diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c new file mode 100644 -index 000000000000..d385c2f03615 +index 0000000000..d385c2f036 --- /dev/null +++ b/libavcodec/v4l2_request_hevc.c @@ -0,0 +1,574 @@ @@ -3133,7 +3124,7 @@ index 000000000000..d385c2f03615 + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, +}; -From 7f7d8dd75d175f9f6944ed334c67380b6b4c8cbf Mon Sep 17 00:00:00 2001 +From 5877cc36995d4cdf012bcee11a36e9f4543d35fe Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Thu, 14 Feb 2019 23:20:05 +0100 Subject: [PATCH 09/18] Add and use private linux v5.14 headers for V4L2 @@ -3149,10 +3140,10 @@ Signed-off-by: Jonas Karlman create mode 100644 libavcodec/hevc-ctrls.h diff --git a/configure b/configure -index 94476afd5df1..e90c9b913dcb 100755 +index 02a80cf27f..30ee788711 100755 --- a/configure +++ b/configure -@@ -2941,7 +2941,7 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" +@@ -2967,7 +2967,7 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" hevc_dxva2_hwaccel_select="hevc_decoder" hevc_nvdec_hwaccel_deps="nvdec" hevc_nvdec_hwaccel_select="hevc_decoder" @@ -3163,7 +3154,7 @@ index 94476afd5df1..e90c9b913dcb 100755 hevc_vaapi_hwaccel_select="hevc_decoder" diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h new file mode 100644 -index 000000000000..53c0038c792b +index 0000000000..53c0038c79 --- /dev/null +++ b/libavcodec/hevc-ctrls.h @@ -0,0 +1,240 @@ @@ -3408,7 +3399,7 @@ index 000000000000..53c0038c792b + +#endif diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c -index d385c2f03615..ad555c3bb836 100644 +index d385c2f036..ad555c3bb8 100644 --- a/libavcodec/v4l2_request_hevc.c +++ b/libavcodec/v4l2_request_hevc.c @@ -19,6 +19,7 @@ @@ -3420,7 +3411,7 @@ index d385c2f03615..ad555c3bb836 100644 #define MAX_SLICES 16 -From 838ed5b6317f13d17b5890d769df325a3aaf0c98 Mon Sep 17 00:00:00 2001 +From 2cdf67404bf52fb684d1857442331f302d3a35d8 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Mon, 29 Apr 2019 22:08:59 +0000 Subject: [PATCH 10/18] HACK: hwcontext_drm: do not require drm device @@ -3431,10 +3422,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 5 insertions(+) diff --git a/libavutil/hwcontext_drm.c b/libavutil/hwcontext_drm.c -index 32cbde82ebfa..aa4794c5e665 100644 +index 7a9fdbd263..6297d1f9b6 100644 --- a/libavutil/hwcontext_drm.c +++ b/libavutil/hwcontext_drm.c -@@ -43,6 +43,11 @@ static int drm_device_create(AVHWDeviceContext *hwdev, const char *device, +@@ -53,6 +53,11 @@ static int drm_device_create(AVHWDeviceContext *hwdev, const char *device, AVDRMDeviceContext *hwctx = hwdev->hwctx; drmVersionPtr version; @@ -3447,7 +3438,7 @@ index 32cbde82ebfa..aa4794c5e665 100644 if (hwctx->fd < 0) return AVERROR(errno); -From 72db468e754b14ea76ad00fea2deaf55f47fac26 Mon Sep 17 00:00:00 2001 +From 37cbcb6ca05cea82e896e661a185dbf32da0702b Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Sat, 15 Dec 2018 22:32:16 +0100 Subject: [PATCH 11/18] WIP: hevc scaling matrix @@ -3459,7 +3450,7 @@ Signed-off-by: Jernej Skrabec 2 files changed, 38 insertions(+) diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h -index 53c0038c792b..0e5c4a2eecff 100644 +index 53c0038c79..0e5c4a2eec 100644 --- a/libavcodec/hevc-ctrls.h +++ b/libavcodec/hevc-ctrls.h @@ -19,6 +19,7 @@ @@ -3495,7 +3486,7 @@ index 53c0038c792b..0e5c4a2eecff 100644 #define V4L2_CID_CODEC_HANTRO_BASE (V4L2_CTRL_CLASS_CODEC | 0x1200) /* diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c -index ad555c3bb836..b6c191120e44 100644 +index ad555c3bb8..b6c191120e 100644 --- a/libavcodec/v4l2_request_hevc.c +++ b/libavcodec/v4l2_request_hevc.c @@ -27,6 +27,7 @@ typedef struct V4L2RequestControlsHEVC { @@ -3552,7 +3543,7 @@ index ad555c3bb836..b6c191120e44 100644 .id = V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS, .ptr = &controls->slice_params, -From fb279e99271bed8ba6bb3a01fad6cf9232567ff8 Mon Sep 17 00:00:00 2001 +From ddf97421cbb8583af0f96fa53a0d7f12d9f4ed21 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Sat, 15 Dec 2018 22:32:16 +0100 Subject: [PATCH 12/18] WIP: hevc segment address @@ -3564,7 +3555,7 @@ Signed-off-by: Jernej Skrabec 2 files changed, 4 insertions(+) diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h -index 0e5c4a2eecff..42ad0fe81e66 100644 +index 0e5c4a2eec..42ad0fe81e 100644 --- a/libavcodec/hevc-ctrls.h +++ b/libavcodec/hevc-ctrls.h @@ -198,6 +198,7 @@ struct v4l2_ctrl_hevc_slice_params { @@ -3576,7 +3567,7 @@ index 0e5c4a2eecff..42ad0fe81e66 100644 __u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c -index b6c191120e44..f645c538c25c 100644 +index b6c191120e..f645c538c2 100644 --- a/libavcodec/v4l2_request_hevc.c +++ b/libavcodec/v4l2_request_hevc.c @@ -188,6 +188,9 @@ static void v4l2_request_hevc_fill_slice_params(const HEVCContext *h, @@ -3590,7 +3581,7 @@ index b6c191120e44..f645c538c25c 100644 .nal_unit_type = h->nal_unit_type, .nuh_temporal_id_plus1 = h->temporal_id + 1, -From 55a85bb6be2b1661c4830b5d085e5657579436a4 Mon Sep 17 00:00:00 2001 +From 1bc89a4553c4c4f7cf4654fe1a7e39de16531126 Mon Sep 17 00:00:00 2001 From: Jernej Skrabec Date: Sat, 15 Dec 2018 22:32:16 +0100 Subject: [PATCH 13/18] WIP: hevc entry point offsets @@ -3602,7 +3593,7 @@ Signed-off-by: Jernej Skrabec 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h -index 42ad0fe81e66..a24916603017 100644 +index 42ad0fe81e..a249166030 100644 --- a/libavcodec/hevc-ctrls.h +++ b/libavcodec/hevc-ctrls.h @@ -202,7 +202,9 @@ struct v4l2_ctrl_hevc_slice_params { @@ -3617,7 +3608,7 @@ index 42ad0fe81e66..a24916603017 100644 /* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */ struct v4l2_hevc_pred_weight_table pred_weight_table; diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c -index f645c538c25c..601202a77d7a 100644 +index f645c538c2..601202a77d 100644 --- a/libavcodec/v4l2_request_hevc.c +++ b/libavcodec/v4l2_request_hevc.c @@ -256,6 +256,15 @@ static void v4l2_request_hevc_fill_slice_params(const HEVCContext *h, @@ -3637,7 +3628,7 @@ index f645c538c25c..601202a77d7a 100644 static void fill_sps(struct v4l2_ctrl_hevc_sps *ctrl, const HEVCContext *h) -From 4c1dd736399c6c4f0dbc5510616b16773b892832 Mon Sep 17 00:00:00 2001 +From 79118d89a57da6fe3fa9b065207e4959c56eff76 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 12 Dec 2019 16:13:55 +0100 Subject: [PATCH 14/18] WIP: Add V4L2 request API vp9 hwaccel @@ -3654,10 +3645,10 @@ Signed-off-by: Boris Brezillon create mode 100644 libavcodec/v4l2_request_vp9.c diff --git a/configure b/configure -index e90c9b913dcb..33c8ed54679a 100755 +index 30ee788711..4e3e868d7a 100755 --- a/configure +++ b/configure -@@ -3015,6 +3015,8 @@ vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9" +@@ -3041,6 +3041,8 @@ vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9" vp9_dxva2_hwaccel_select="vp9_decoder" vp9_nvdec_hwaccel_deps="nvdec" vp9_nvdec_hwaccel_select="vp9_decoder" @@ -3666,7 +3657,7 @@ index e90c9b913dcb..33c8ed54679a 100755 vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth" vp9_vaapi_hwaccel_select="vp9_decoder" vp9_vdpau_hwaccel_deps="vdpau VdpPictureInfoVP9" -@@ -6579,6 +6581,7 @@ check_cc h264_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_H264_SLICE;" +@@ -6640,6 +6642,7 @@ check_cc h264_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_H264_SLICE;" check_cc hevc_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC_SLICE;" check_cc mpeg2_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2_SLICE;" check_cc vp8_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_VP8_FRAME;" @@ -3675,22 +3666,22 @@ index e90c9b913dcb..33c8ed54679a 100755 check_headers sys/videoio.h test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index d6af854daaa6..2f0e0a0976f6 100644 +index 0059074530..38edf1cfe5 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -945,6 +945,7 @@ OBJS-$(CONFIG_VP8_VAAPI_HWACCEL) += vaapi_vp8.o +@@ -977,6 +977,7 @@ OBJS-$(CONFIG_VP8_VAAPI_HWACCEL) += vaapi_vp8.o OBJS-$(CONFIG_VP9_D3D11VA_HWACCEL) += dxva2_vp9.o OBJS-$(CONFIG_VP9_DXVA2_HWACCEL) += dxva2_vp9.o OBJS-$(CONFIG_VP9_NVDEC_HWACCEL) += nvdec_vp9.o +OBJS-$(CONFIG_VP9_V4L2REQUEST_HWACCEL) += v4l2_request_vp9.o OBJS-$(CONFIG_VP9_VAAPI_HWACCEL) += vaapi_vp9.o OBJS-$(CONFIG_VP9_VDPAU_HWACCEL) += vdpau_vp9.o - OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec_other.o + OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h -index bd75e94f4cae..03a1aefe09bc 100644 +index ffb9fa5087..fc5d0b0479 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h -@@ -71,6 +71,7 @@ extern const AVHWAccel ff_vp9_d3d11va_hwaccel; +@@ -76,6 +76,7 @@ extern const AVHWAccel ff_vp9_d3d11va_hwaccel; extern const AVHWAccel ff_vp9_d3d11va2_hwaccel; extern const AVHWAccel ff_vp9_dxva2_hwaccel; extern const AVHWAccel ff_vp9_nvdec_hwaccel; @@ -3700,7 +3691,7 @@ index bd75e94f4cae..03a1aefe09bc 100644 extern const AVHWAccel ff_wmv3_d3d11va_hwaccel; diff --git a/libavcodec/v4l2_request_vp9.c b/libavcodec/v4l2_request_vp9.c new file mode 100644 -index 000000000000..4074c7fe4b8e +index 0000000000..4074c7fe4b --- /dev/null +++ b/libavcodec/v4l2_request_vp9.c @@ -0,0 +1,352 @@ @@ -4057,7 +4048,7 @@ index 000000000000..4074c7fe4b8e + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, +}; diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c -index fd0bab14a239..434f905c62c5 100644 +index 4659f94ee8..47340c3875 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -191,6 +191,7 @@ static int update_size(AVCodecContext *avctx, int w, int h) @@ -4070,25 +4061,25 @@ index fd0bab14a239..434f905c62c5 100644 enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts; @@ -223,6 +224,9 @@ static int update_size(AVCodecContext *avctx, int w, int h) #endif - #if CONFIG_VP9_VAAPI_HWACCEL - *fmtp++ = AV_PIX_FMT_VAAPI; + #if CONFIG_VP9_VDPAU_HWACCEL + *fmtp++ = AV_PIX_FMT_VDPAU; +#endif +#if CONFIG_VP9_V4L2REQUEST_HWACCEL + *fmtp++ = AV_PIX_FMT_DRM_PRIME; #endif break; case AV_PIX_FMT_YUV420P12: -@@ -231,6 +235,9 @@ static int update_size(AVCodecContext *avctx, int w, int h) +@@ -234,6 +238,9 @@ static int update_size(AVCodecContext *avctx, int w, int h) #endif - #if CONFIG_VP9_VAAPI_HWACCEL - *fmtp++ = AV_PIX_FMT_VAAPI; + #if CONFIG_VP9_VDPAU_HWACCEL + *fmtp++ = AV_PIX_FMT_VDPAU; +#endif +#if CONFIG_VP9_V4L2REQUEST_HWACCEL + *fmtp++ = AV_PIX_FMT_DRM_PRIME; #endif break; } -@@ -700,7 +707,8 @@ static int decode_frame_header(AVCodecContext *avctx, +@@ -703,7 +710,8 @@ static int decode_frame_header(AVCodecContext *avctx, get_bits(&s->gb, 8) : 255; } @@ -4098,7 +4089,7 @@ index fd0bab14a239..434f905c62c5 100644 s->s.h.segmentation.absolute_vals = get_bits1(&s->gb); for (i = 0; i < 8; i++) { if ((s->s.h.segmentation.feat[i].q_enabled = get_bits1(&s->gb))) -@@ -1909,6 +1917,9 @@ AVCodec ff_vp9_decoder = { +@@ -1912,6 +1920,9 @@ AVCodec ff_vp9_decoder = { #endif #if CONFIG_VP9_VDPAU_HWACCEL HWACCEL_VDPAU(vp9), @@ -4109,7 +4100,7 @@ index fd0bab14a239..434f905c62c5 100644 NULL }, diff --git a/libavcodec/vp9shared.h b/libavcodec/vp9shared.h -index 54726df742f9..fee3568736f7 100644 +index 54726df742..fee3568736 100644 --- a/libavcodec/vp9shared.h +++ b/libavcodec/vp9shared.h @@ -131,6 +131,7 @@ typedef struct VP9BitstreamHeader { @@ -4121,7 +4112,7 @@ index 54726df742f9..fee3568736f7 100644 uint8_t pred_prob[3]; struct { -From b4ce2068a1ba8723908fd39c1b2099b286715dde Mon Sep 17 00:00:00 2001 +From 189a3278e21e4d6ff06d1f1fe4c7430357499471 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 12 Dec 2019 16:13:55 +0100 Subject: [PATCH 15/18] WIP: Add and use vp9 private linux header @@ -4135,10 +4126,10 @@ Signed-off-by: Boris Brezillon create mode 100644 libavcodec/vp9-ctrls.h diff --git a/configure b/configure -index 33c8ed54679a..921e74470145 100755 +index 4e3e868d7a..1c1929d2c2 100755 --- a/configure +++ b/configure -@@ -3015,7 +3015,7 @@ vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9" +@@ -3041,7 +3041,7 @@ vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9" vp9_dxva2_hwaccel_select="vp9_decoder" vp9_nvdec_hwaccel_deps="nvdec" vp9_nvdec_hwaccel_select="vp9_decoder" @@ -4148,7 +4139,7 @@ index 33c8ed54679a..921e74470145 100755 vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth" vp9_vaapi_hwaccel_select="vp9_decoder" diff --git a/libavcodec/v4l2_request_vp9.c b/libavcodec/v4l2_request_vp9.c -index 4074c7fe4b8e..2e10b7ad1acb 100644 +index 4074c7fe4b..2e10b7ad1a 100644 --- a/libavcodec/v4l2_request_vp9.c +++ b/libavcodec/v4l2_request_vp9.c @@ -19,6 +19,7 @@ @@ -4161,7 +4152,7 @@ index 4074c7fe4b8e..2e10b7ad1acb 100644 struct v4l2_ctrl_vp9_frame_decode_params decode_params; diff --git a/libavcodec/vp9-ctrls.h b/libavcodec/vp9-ctrls.h new file mode 100644 -index 000000000000..0cdea8a18b72 +index 0000000000..0cdea8a18b --- /dev/null +++ b/libavcodec/vp9-ctrls.h @@ -0,0 +1,485 @@ @@ -4651,7 +4642,7 @@ index 000000000000..0cdea8a18b72 + +#endif /* _VP9_CTRLS_H_ */ -From 5ba520963c60bb72e9e418a4392724c619e95f89 Mon Sep 17 00:00:00 2001 +From 8fde9d49bf9fbf0a1a9fdf242753c2b1b6ae377c Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Fri, 15 May 2020 16:54:05 +0000 Subject: [PATCH 16/18] WIP: add NV15 and NV20 support @@ -4663,10 +4654,10 @@ Signed-off-by: Jonas Karlman 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c -index dd5ba98a02cb..c952997d685d 100644 +index 0a10d00aad..45057fd049 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c -@@ -785,10 +785,17 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) +@@ -794,10 +794,17 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) *fmt++ = AV_PIX_FMT_GBRP10; } else *fmt++ = AV_PIX_FMT_YUV444P10; @@ -4686,7 +4677,7 @@ index dd5ba98a02cb..c952997d685d 100644 break; case 12: if (CHROMA444(h)) { -@@ -827,6 +834,9 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) +@@ -836,6 +843,9 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) else *fmt++ = AV_PIX_FMT_YUV444P; } else if (CHROMA422(h)) { @@ -4697,7 +4688,7 @@ index dd5ba98a02cb..c952997d685d 100644 *fmt++ = AV_PIX_FMT_YUVJ422P; else diff --git a/libavcodec/v4l2_request.c b/libavcodec/v4l2_request.c -index 5234b5049b0d..0b294feff2eb 100644 +index 5234b5049b..0b294feff2 100644 --- a/libavcodec/v4l2_request.c +++ b/libavcodec/v4l2_request.c @@ -188,6 +188,13 @@ const uint32_t v4l2_request_capture_pixelformats[] = { @@ -4738,7 +4729,7 @@ index 5234b5049b0d..0b294feff2eb 100644 default: return -1; -From ea35c24c6c19e90e8a33bf9415cf3b90143221f7 Mon Sep 17 00:00:00 2001 +From e60693f9f34d717a53b54768e56ccbbdda375abe Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Mon, 27 Jul 2020 23:15:45 +0000 Subject: [PATCH 17/18] HACK: define drm NV15 and NV20 format @@ -4748,7 +4739,7 @@ Subject: [PATCH 17/18] HACK: define drm NV15 and NV20 format 1 file changed, 8 insertions(+) diff --git a/libavcodec/v4l2_request.c b/libavcodec/v4l2_request.c -index 0b294feff2eb..a8f0ee79eeef 100644 +index 0b294feff2..a8f0ee79ee 100644 --- a/libavcodec/v4l2_request.c +++ b/libavcodec/v4l2_request.c @@ -30,6 +30,14 @@ @@ -4767,7 +4758,7 @@ index 0b294feff2eb..a8f0ee79eeef 100644 { V4L2RequestDescriptor *req = (V4L2RequestDescriptor*)frame->data[0]; -From 36dbf222487a459156f1752436530b3fae39d35c Mon Sep 17 00:00:00 2001 +From 688bb66bf9715c02565b63446b75933282d41805 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Wed, 13 May 2020 22:51:21 +0000 Subject: [PATCH 18/18] WIP: hevc rkvdec fields @@ -4779,7 +4770,7 @@ Signed-off-by: Jonas Karlman 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h -index a24916603017..cd143526685f 100644 +index a249166030..cd14352668 100644 --- a/libavcodec/hevc-ctrls.h +++ b/libavcodec/hevc-ctrls.h @@ -58,6 +58,8 @@ enum v4l2_mpeg_video_hevc_start_code { @@ -4829,7 +4820,7 @@ index a24916603017..cd143526685f 100644 __u32 entry_point_offset_minus1[256]; __u8 padding[8]; diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c -index 601202a77d7a..be7838244447 100644 +index 601202a77d..be78382444 100644 --- a/libavcodec/v4l2_request_hevc.c +++ b/libavcodec/v4l2_request_hevc.c @@ -214,6 +214,9 @@ static void v4l2_request_hevc_fill_slice_params(const HEVCContext *h,