Merge pull request #5312 from jernejsk/aw-hevc-fi

Allwinner, Rockchip: Fix HEVC decoding and consolidate patches
This commit is contained in:
knaerzche 2021-04-11 23:14:08 +02:00 committed by GitHub
commit 37deedc1df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 469 additions and 262 deletions

View File

@ -1,7 +1,7 @@
From 785728e72dbd513b58d97af2590fafba0f8a24bb Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Mon, 3 Dec 2018 23:48:04 +0100
Subject: [PATCH 01/20] avutil: add av_buffer_pool_flush()
Subject: [PATCH 01/22] avutil: add av_buffer_pool_flush()
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
@ -10,7 +10,7 @@ Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2 files changed, 18 insertions(+)
diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index 38a554208a9..b0fedabc3e7 100644
index 38a554208a90..b0fedabc3e7d 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -273,6 +273,19 @@ static void buffer_pool_free(AVBufferPool *pool)
@ -34,7 +34,7 @@ index 38a554208a9..b0fedabc3e7 100644
{
AVBufferPool *pool;
diff --git a/libavutil/buffer.h b/libavutil/buffer.h
index c0f3f6cc9ab..998beec9ac5 100644
index c0f3f6cc9abe..998beec9ac5b 100644
--- a/libavutil/buffer.h
+++ b/libavutil/buffer.h
@@ -267,6 +267,11 @@ AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
@ -53,7 +53,7 @@ index c0f3f6cc9ab..998beec9ac5 100644
From abd5308771a71ba582155a1665a1c40878232040 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sat, 15 Dec 2018 22:32:16 +0100
Subject: [PATCH 02/20] Add common V4L2 request API code
Subject: [PATCH 02/22] Add common V4L2 request API code
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
@ -67,7 +67,7 @@ Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
create mode 100644 libavcodec/v4l2_request.h
diff --git a/configure b/configure
index 8569a60bf82..9f9909a2369 100755
index 8569a60bf827..9f9909a23696 100755
--- a/configure
+++ b/configure
@@ -274,6 +274,7 @@ External library support:
@ -139,7 +139,7 @@ index 8569a60bf82..9f9909a2369 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 5a6ea59715a..d7422051682 100644
index 5a6ea59715af..d74220516826 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -153,6 +153,7 @@ OBJS-$(CONFIG_VP3DSP) += vp3dsp.o
@ -151,7 +151,7 @@ index 5a6ea59715a..d7422051682 100644
OBJS-$(CONFIG_WMV2DSP) += wmv2dsp.o
diff --git a/libavcodec/hwconfig.h b/libavcodec/hwconfig.h
index f421dc909f4..ee78d8ab8e8 100644
index f421dc909f44..ee78d8ab8e89 100644
--- a/libavcodec/hwconfig.h
+++ b/libavcodec/hwconfig.h
@@ -80,6 +80,8 @@ typedef struct AVCodecHWConfigInternal {
@ -165,7 +165,7 @@ index f421dc909f4..ee78d8ab8e8 100644
&(const AVCodecHWConfigInternal) { \
diff --git a/libavcodec/v4l2_request.c b/libavcodec/v4l2_request.c
new file mode 100644
index 00000000000..5234b5049b0
index 000000000000..5234b5049b0d
--- /dev/null
+++ b/libavcodec/v4l2_request.c
@@ -0,0 +1,984 @@
@ -1155,7 +1155,7 @@ index 00000000000..5234b5049b0
+}
diff --git a/libavcodec/v4l2_request.h b/libavcodec/v4l2_request.h
new file mode 100644
index 00000000000..58d2aa70af8
index 000000000000..58d2aa70af80
--- /dev/null
+++ b/libavcodec/v4l2_request.h
@@ -0,0 +1,77 @@
@ -1240,7 +1240,7 @@ index 00000000000..58d2aa70af8
From e1ae7e32ce4798f3032a04ccb20a1f76834c3bea Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sat, 15 Dec 2018 22:32:16 +0100
Subject: [PATCH 03/20] Add V4L2 request API mpeg2 hwaccel
Subject: [PATCH 03/22] Add V4L2 request API mpeg2 hwaccel
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
@ -1253,7 +1253,7 @@ Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
create mode 100644 libavcodec/v4l2_request_mpeg2.c
diff --git a/configure b/configure
index 9f9909a2369..6b157d6d3ef 100755
index 9f9909a23696..6b157d6d3ef0 100755
--- a/configure
+++ b/configure
@@ -2967,6 +2967,8 @@ mpeg2_dxva2_hwaccel_deps="dxva2"
@ -1274,7 +1274,7 @@ index 9f9909a2369..6b157d6d3ef 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 d7422051682..8963bd3e91c 100644
index d74220516826..8963bd3e91cf 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -922,6 +922,7 @@ OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL) += dxva2_mpeg2.o
@ -1286,7 +1286,7 @@ index d7422051682..8963bd3e91c 100644
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 6109c89bd63..172a546bb28 100644
index 6109c89bd63c..172a546bb283 100644
--- a/libavcodec/hwaccels.h
+++ b/libavcodec/hwaccels.h
@@ -47,6 +47,7 @@ extern const AVHWAccel ff_mpeg2_d3d11va_hwaccel;
@ -1298,7 +1298,7 @@ index 6109c89bd63..172a546bb28 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 99e56532a59..15aaf97a34c 100644
index 99e56532a59e..15aaf97a34c7 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1154,6 +1154,9 @@ static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = {
@ -1323,7 +1323,7 @@ index 99e56532a59..15aaf97a34c 100644
},
diff --git a/libavcodec/v4l2_request_mpeg2.c b/libavcodec/v4l2_request_mpeg2.c
new file mode 100644
index 00000000000..88d86cc4c23
index 000000000000..88d86cc4c23f
--- /dev/null
+++ b/libavcodec/v4l2_request_mpeg2.c
@@ -0,0 +1,154 @@
@ -1485,7 +1485,7 @@ index 00000000000..88d86cc4c23
From 8a728ea300aee2fab7a181cab06c2c3cfdd0b705 Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Sat, 15 Dec 2018 22:32:16 +0100
Subject: [PATCH 04/20] Add V4L2 request API h264 hwaccel
Subject: [PATCH 04/22] Add V4L2 request API h264 hwaccel
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
@ -1500,7 +1500,7 @@ Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
create mode 100644 libavcodec/v4l2_request_h264.c
diff --git a/configure b/configure
index 6b157d6d3ef..1a7720ebe3b 100755
index 6b157d6d3ef0..1a7720ebe3be 100755
--- a/configure
+++ b/configure
@@ -2925,6 +2925,8 @@ h264_dxva2_hwaccel_deps="dxva2"
@ -1521,7 +1521,7 @@ index 6b157d6d3ef..1a7720ebe3b 100755
check_headers sys/videoio.h
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 8963bd3e91c..9a10a292e37 100644
index 8963bd3e91cf..9a10a292e377 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -903,6 +903,7 @@ OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o
@ -1533,7 +1533,7 @@ index 8963bd3e91c..9a10a292e37 100644
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 db8363e4cc9..3ae11ac8a71 100644
index db8363e4cc98..3ae11ac8a711 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)
@ -1555,7 +1555,7 @@ index db8363e4cc9..3ae11ac8a71 100644
if (h->avctx->codec->pix_fmts)
choices = h->avctx->codec->pix_fmts;
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 5eedeb3c275..a504c89565c 100644
index 5eedeb3c275d..a504c89565c7 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -1102,6 +1102,9 @@ AVCodec ff_h264_decoder = {
@ -1569,7 +1569,7 @@ index 5eedeb3c275..a504c89565c 100644
NULL
},
diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h
index 172a546bb28..44e00e79b51 100644
index 172a546bb283..44e00e79b515 100644
--- a/libavcodec/hwaccels.h
+++ b/libavcodec/hwaccels.h
@@ -27,6 +27,7 @@ extern const AVHWAccel ff_h264_d3d11va_hwaccel;
@ -1582,7 +1582,7 @@ index 172a546bb28..44e00e79b51 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 00000000000..94b9aca8ad4
index 000000000000..94b9aca8ad45
--- /dev/null
+++ b/libavcodec/v4l2_request_h264.c
@@ -0,0 +1,460 @@
@ -2050,7 +2050,7 @@ index 00000000000..94b9aca8ad4
From 72758190a3d062b64db756c60761187a2b9ce1c9 Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Sat, 15 Dec 2018 22:32:16 +0100
Subject: [PATCH 05/20] Add V4L2 request API hevc hwaccel
Subject: [PATCH 05/22] Add V4L2 request API hevc hwaccel
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
@ -2064,7 +2064,7 @@ Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
create mode 100644 libavcodec/v4l2_request_hevc.c
diff --git a/configure b/configure
index 1a7720ebe3b..58abd99335b 100755
index 1a7720ebe3be..58abd99335b5 100755
--- a/configure
+++ b/configure
@@ -2941,6 +2941,8 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
@ -2085,7 +2085,7 @@ index 1a7720ebe3b..58abd99335b 100755
check_headers sys/videoio.h
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 9a10a292e37..5d0e1d7dae7 100644
index 9a10a292e377..5d0e1d7dae77 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -911,6 +911,7 @@ OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o
@ -2097,7 +2097,7 @@ index 9a10a292e37..5d0e1d7dae7 100644
OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o
OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL) += nvdec_mjpeg.o
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 0772608a30e..d01b7b34bce 100644
index 0772608a30e0..d01b7b34bcee 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -372,6 +372,7 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
@ -2139,7 +2139,7 @@ index 0772608a30e..d01b7b34bce 100644
NULL
},
diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h
index 44e00e79b51..e2f90a5fdd5 100644
index 44e00e79b515..e2f90a5fdd58 100644
--- a/libavcodec/hwaccels.h
+++ b/libavcodec/hwaccels.h
@@ -35,6 +35,7 @@ extern const AVHWAccel ff_hevc_d3d11va_hwaccel;
@ -2152,7 +2152,7 @@ index 44e00e79b51..e2f90a5fdd5 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 00000000000..f7249095465
index 000000000000..f72490954653
--- /dev/null
+++ b/libavcodec/v4l2_request_hevc.c
@@ -0,0 +1,533 @@
@ -2693,7 +2693,7 @@ index 00000000000..f7249095465
From ebc06b180bfc3c4c6e02cfe2f559e140ce0020e8 Mon Sep 17 00:00:00 2001
From: Boris Brezillon <boris.brezillon@collabora.com>
Date: Wed, 22 May 2019 14:46:58 +0200
Subject: [PATCH 06/20] Add V4L2 request API vp8 hwaccel
Subject: [PATCH 06/22] Add V4L2 request API vp8 hwaccel
Need to fix the STREAMOFF/STREAMON issue in a proper way.
@ -2709,7 +2709,7 @@ Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
create mode 100644 libavcodec/v4l2_request_vp8.c
diff --git a/configure b/configure
index 58abd99335b..cbb91c2bca4 100755
index 58abd99335b5..cbb91c2bca43 100755
--- a/configure
+++ b/configure
@@ -3003,6 +3003,8 @@ vc1_vdpau_hwaccel_deps="vdpau"
@ -2730,7 +2730,7 @@ index 58abd99335b..cbb91c2bca4 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 5d0e1d7dae7..d6af854daaa 100644
index 5d0e1d7dae77..d6af854daaa6 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -940,6 +940,7 @@ OBJS-$(CONFIG_VC1_QSV_HWACCEL) += qsvdec_other.o
@ -2742,7 +2742,7 @@ index 5d0e1d7dae7..d6af854daaa 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 e2f90a5fdd5..bd75e94f4ca 100644
index e2f90a5fdd58..bd75e94f4cae 100644
--- a/libavcodec/hwaccels.h
+++ b/libavcodec/hwaccels.h
@@ -65,6 +65,7 @@ extern const AVHWAccel ff_vc1_nvdec_hwaccel;
@ -2755,7 +2755,7 @@ index e2f90a5fdd5..bd75e94f4ca 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 00000000000..7e75ee398a2
index 000000000000..7e75ee398a2e
--- /dev/null
+++ b/libavcodec/v4l2_request_vp8.c
@@ -0,0 +1,180 @@
@ -2940,7 +2940,7 @@ index 00000000000..7e75ee398a2
+ .caps_internal = HWACCEL_CAP_ASYNC_SAFE,
+};
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index bab4223aca1..0e1edb46fb2 100644
index bab4223aca11..0e1edb46fb20 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -175,6 +175,9 @@ static enum AVPixelFormat get_pixel_format(VP8Context *s)
@ -2976,7 +2976,7 @@ index bab4223aca1..0e1edb46fb2 100644
From cf21ba63945bf6a0a60616ceb0a000e42d02f044 Mon Sep 17 00:00:00 2001
From: Ezequiel Garcia <ezequiel@collabora.com>
Date: Wed, 20 Feb 2019 11:18:00 -0300
Subject: [PATCH 07/20] avcodec/h264: parse idr_pic_id
Subject: [PATCH 07/22] avcodec/h264: parse idr_pic_id
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
@ -2986,7 +2986,7 @@ Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 3ae11ac8a71..96e8edd1028 100644
index 3ae11ac8a711..96e8edd10289 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1822,7 +1822,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl,
@ -2999,7 +2999,7 @@ index 3ae11ac8a71..96e8edd1028 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 a419615124b..aebc5ed2f61 100644
index a419615124b2..aebc5ed2f613 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -190,6 +190,8 @@ typedef struct H264SliceContext {
@ -3012,7 +3012,7 @@ index a419615124b..aebc5ed2f61 100644
int chroma_qp[2]; // QPc
int qp_thresh; ///< QP threshold to skip loopfilter
diff --git a/libavcodec/v4l2_request_h264.c b/libavcodec/v4l2_request_h264.c
index 94b9aca8ad4..9382e573b40 100644
index 94b9aca8ad45..9382e573b40b 100644
--- a/libavcodec/v4l2_request_h264.c
+++ b/libavcodec/v4l2_request_h264.c
@@ -303,7 +303,7 @@ static int v4l2_request_h264_decode_slice(AVCodecContext *avctx, const uint8_t *
@ -3028,7 +3028,7 @@ index 94b9aca8ad4..9382e573b40 100644
From 13d2f3430db4d83ce30c921bf2b3ee44e1d6ec55 Mon Sep 17 00:00:00 2001
From: Boris Brezillon <boris.brezillon@collabora.com>
Date: Wed, 22 May 2019 14:44:22 +0200
Subject: [PATCH 08/20] avcodec/h264: parse ref_pic_marking_size_in_bits and
Subject: [PATCH 08/22] avcodec/h264: parse ref_pic_marking_size_in_bits and
pic_order_cnt_bit_size
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
@ -3039,7 +3039,7 @@ Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 96e8edd1028..c3896cfd90a 100644
index 96e8edd10289..c3896cfd90ab 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1740,7 +1740,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl,
@ -3080,7 +3080,7 @@ index 96e8edd1028..c3896cfd90a 100644
if (sl->slice_type_nos != AV_PICTURE_TYPE_I && pps->cabac) {
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index aebc5ed2f61..b3dcd6e7da3 100644
index aebc5ed2f613..b3dcd6e7da30 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -330,11 +330,13 @@ typedef struct H264SliceContext {
@ -3098,7 +3098,7 @@ index aebc5ed2f61..b3dcd6e7da3 100644
int max_pic_num;
} H264SliceContext;
diff --git a/libavcodec/v4l2_request_h264.c b/libavcodec/v4l2_request_h264.c
index 9382e573b40..bdaeb67d261 100644
index 9382e573b40b..bdaeb67d2618 100644
--- a/libavcodec/v4l2_request_h264.c
+++ b/libavcodec/v4l2_request_h264.c
@@ -311,9 +311,9 @@ static int v4l2_request_h264_decode_slice(AVCodecContext *avctx, const uint8_t *
@ -3117,7 +3117,7 @@ index 9382e573b40..bdaeb67d261 100644
From 5ba945f011277dee7b4fb36af60810fd9b401f79 Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Thu, 14 Feb 2019 23:20:05 +0100
Subject: [PATCH 09/20] Add and use private linux headers for V4L2 request API
Subject: [PATCH 09/22] Add and use private linux headers for V4L2 request API
ctrls
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
@ -3138,7 +3138,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
create mode 100644 libavcodec/vp8-ctrls.h
diff --git a/configure b/configure
index cbb91c2bca4..623012757c6 100755
index cbb91c2bca43..623012757c60 100755
--- a/configure
+++ b/configure
@@ -2925,7 +2925,7 @@ h264_dxva2_hwaccel_deps="dxva2"
@ -3170,7 +3170,7 @@ index cbb91c2bca4..623012757c6 100755
vp8_vaapi_hwaccel_select="vp8_decoder"
diff --git a/libavcodec/h264-ctrls.h b/libavcodec/h264-ctrls.h
new file mode 100644
index 00000000000..e877bf1d537
index 000000000000..e877bf1d537c
--- /dev/null
+++ b/libavcodec/h264-ctrls.h
@@ -0,0 +1,210 @@
@ -3386,7 +3386,7 @@ index 00000000000..e877bf1d537
+#endif
diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h
new file mode 100644
index 00000000000..1009cf0891c
index 000000000000..1009cf0891cc
--- /dev/null
+++ b/libavcodec/hevc-ctrls.h
@@ -0,0 +1,212 @@
@ -3604,7 +3604,7 @@ index 00000000000..1009cf0891c
+#endif
diff --git a/libavcodec/mpeg2-ctrls.h b/libavcodec/mpeg2-ctrls.h
new file mode 100644
index 00000000000..6601455b3d5
index 000000000000..6601455b3d5e
--- /dev/null
+++ b/libavcodec/mpeg2-ctrls.h
@@ -0,0 +1,82 @@
@ -3691,7 +3691,7 @@ index 00000000000..6601455b3d5
+
+#endif
diff --git a/libavcodec/v4l2_request_h264.c b/libavcodec/v4l2_request_h264.c
index bdaeb67d261..0254716e523 100644
index bdaeb67d2618..0254716e5239 100644
--- a/libavcodec/v4l2_request_h264.c
+++ b/libavcodec/v4l2_request_h264.c
@@ -19,6 +19,7 @@
@ -3703,7 +3703,7 @@ index bdaeb67d261..0254716e523 100644
typedef struct V4L2RequestControlsH264 {
struct v4l2_ctrl_h264_sps sps;
diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c
index f7249095465..c16f8a868e3 100644
index f72490954653..c16f8a868e38 100644
--- a/libavcodec/v4l2_request_hevc.c
+++ b/libavcodec/v4l2_request_hevc.c
@@ -19,6 +19,7 @@
@ -3715,7 +3715,7 @@ index f7249095465..c16f8a868e3 100644
#define MAX_SLICES 16
diff --git a/libavcodec/v4l2_request_mpeg2.c b/libavcodec/v4l2_request_mpeg2.c
index 88d86cc4c23..bc251a6fd2c 100644
index 88d86cc4c23f..bc251a6fd2c4 100644
--- a/libavcodec/v4l2_request_mpeg2.c
+++ b/libavcodec/v4l2_request_mpeg2.c
@@ -19,6 +19,7 @@
@ -3727,7 +3727,7 @@ index 88d86cc4c23..bc251a6fd2c 100644
typedef struct V4L2RequestControlsMPEG2 {
struct v4l2_ctrl_mpeg2_slice_params slice_params;
diff --git a/libavcodec/v4l2_request_vp8.c b/libavcodec/v4l2_request_vp8.c
index 7e75ee398a2..ea2c55fa2f5 100644
index 7e75ee398a2e..ea2c55fa2f53 100644
--- a/libavcodec/v4l2_request_vp8.c
+++ b/libavcodec/v4l2_request_vp8.c
@@ -19,6 +19,7 @@
@ -3740,7 +3740,7 @@ index 7e75ee398a2..ea2c55fa2f5 100644
struct v4l2_ctrl_vp8_frame_header ctrl;
diff --git a/libavcodec/vp8-ctrls.h b/libavcodec/vp8-ctrls.h
new file mode 100644
index 00000000000..53cba826e48
index 000000000000..53cba826e482
--- /dev/null
+++ b/libavcodec/vp8-ctrls.h
@@ -0,0 +1,112 @@
@ -3860,7 +3860,7 @@ index 00000000000..53cba826e48
From 77c91a97c87424c1d6bff888bc8562a9b6697aa2 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sat, 2 May 2020 11:00:26 +0000
Subject: [PATCH 10/20] Update to v5.7 private linux headers
Subject: [PATCH 10/22] Update to v5.7 private linux headers
---
libavcodec/h264-ctrls.h | 2 ++
@ -3868,7 +3868,7 @@ Subject: [PATCH 10/20] Update to v5.7 private linux headers
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/libavcodec/h264-ctrls.h b/libavcodec/h264-ctrls.h
index e877bf1d537..1c6ff7d63bc 100644
index e877bf1d537c..1c6ff7d63bca 100644
--- a/libavcodec/h264-ctrls.h
+++ b/libavcodec/h264-ctrls.h
@@ -185,6 +185,8 @@ struct v4l2_ctrl_h264_slice_params {
@ -3881,7 +3881,7 @@ index e877bf1d537..1c6ff7d63bc 100644
struct v4l2_h264_dpb_entry {
__u64 reference_ts;
diff --git a/libavcodec/v4l2_request_h264.c b/libavcodec/v4l2_request_h264.c
index 0254716e523..d28ed07da3b 100644
index 0254716e5239..d28ed07da3b4 100644
--- a/libavcodec/v4l2_request_h264.c
+++ b/libavcodec/v4l2_request_h264.c
@@ -67,8 +67,14 @@ static void fill_dpb_entry(struct v4l2_h264_dpb_entry *entry, const H264Picture
@ -3904,14 +3904,14 @@ index 0254716e523..d28ed07da3b 100644
From 40407184ac1cd48d35acc6b0d8bdec48a98c74fb Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sat, 2 May 2020 22:03:42 +0000
Subject: [PATCH 11/20] Update to v5.8 private linux headers
Subject: [PATCH 11/22] Update to v5.8 private linux headers
---
libavcodec/h264-ctrls.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavcodec/h264-ctrls.h b/libavcodec/h264-ctrls.h
index 1c6ff7d63bc..080fd1293c4 100644
index 1c6ff7d63bca..080fd1293c42 100644
--- a/libavcodec/h264-ctrls.h
+++ b/libavcodec/h264-ctrls.h
@@ -13,6 +13,12 @@
@ -3940,15 +3940,15 @@ index 1c6ff7d63bc..080fd1293c4 100644
From 6a151e35d99c430030709b49a6abd36349a65887 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sun, 6 Sep 2020 16:07:13 +0000
Subject: [PATCH 12/20] Update to v5.10 private linux headers
Subject: [PATCH 12/22] Update to v5.10 private linux headers
---
libavcodec/h264-ctrls.h | 87 +++++++++-------
libavcodec/v4l2_request_h264.c | 182 ++++++++++++++++-----------------
2 files changed, 136 insertions(+), 133 deletions(-)
libavcodec/h264-ctrls.h | 89 +++++++++-------
libavcodec/v4l2_request_h264.c | 184 ++++++++++++++++-----------------
2 files changed, 138 insertions(+), 135 deletions(-)
diff --git a/libavcodec/h264-ctrls.h b/libavcodec/h264-ctrls.h
index 080fd1293c4..ec479915443 100644
index 080fd1293c42..ec4799154438 100644
--- a/libavcodec/h264-ctrls.h
+++ b/libavcodec/h264-ctrls.h
@@ -19,6 +19,8 @@
@ -4011,16 +4011,11 @@ index 080fd1293c4..ec479915443 100644
-#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH 0x08
+#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x01
+#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH 0x02
-struct v4l2_ctrl_h264_slice_params {
- /* Size in bytes, including header */
- __u32 size;
+
+#define V4L2_H264_TOP_FIELD_REF 0x1
+#define V4L2_H264_BOTTOM_FIELD_REF 0x2
+#define V4L2_H264_FRAME_REF 0x3
- /* Offset in bytes to the start of slice in the OUTPUT buffer. */
- __u32 start_byte_offset;
+
+struct v4l2_h264_reference {
+ __u8 fields;
+
@ -4028,7 +4023,13 @@ index 080fd1293c4..ec479915443 100644
+ __u8 index;
+};
+struct v4l2_ctrl_h264_slice_params {
struct v4l2_ctrl_h264_slice_params {
- /* Size in bytes, including header */
- __u32 size;
-
- /* Offset in bytes to the start of slice in the OUTPUT buffer. */
- __u32 start_byte_offset;
-
/* Offset in bits to slice_data() from the beginning of this slice. */
__u32 header_bit_size;
@ -4121,7 +4122,7 @@ index 080fd1293c4..ec479915443 100644
};
diff --git a/libavcodec/v4l2_request_h264.c b/libavcodec/v4l2_request_h264.c
index d28ed07da3b..c9dbaf8c3e3 100644
index d28ed07da3b4..c9dbaf8c3e34 100644
--- a/libavcodec/v4l2_request_h264.c
+++ b/libavcodec/v4l2_request_h264.c
@@ -26,15 +26,17 @@ typedef struct V4L2RequestControlsH264 {
@ -4274,25 +4275,26 @@ index d28ed07da3b..c9dbaf8c3e3 100644
.ptr = &controls->scaling_matrix,
.size = sizeof(controls->scaling_matrix),
},
+ {
+ .id = V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS,
+ .ptr = &controls->decode_params,
+ .size = sizeof(controls->decode_params),
+ },
{
.id = V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS,
.ptr = &controls->slice_params,
- {
- .id = V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS,
- .ptr = &controls->slice_params,
- .size = sizeof(controls->slice_params[0]) * FFMAX(FFMIN(controls->decode_params.num_slices, MAX_SLICES), ctx->max_slices),
+ .size = sizeof(controls->slice_params),
},
- },
{
- .id = V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS,
- .ptr = &controls->decode_params,
- .size = sizeof(controls->decode_params),
.id = V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS,
.ptr = &controls->decode_params,
.size = sizeof(controls->decode_params),
},
+ {
+ .id = V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS,
+ .ptr = &controls->slice_params,
+ .size = sizeof(controls->slice_params),
+ },
+ {
+ .id = V4L2_CID_MPEG_VIDEO_H264_PRED_WEIGHTS,
+ .ptr = &controls->pred_weights,
+ .size = sizeof(controls->pred_weights),
},
+ },
};
- if (ctx->decode_mode == V4L2_MPEG_VIDEO_H264_DECODE_MODE_SLICE_BASED)
@ -4410,16 +4412,16 @@ index d28ed07da3b..c9dbaf8c3e3 100644
- controls->slice_params[slice].ref_pic_list1[i] = get_dpb_index(&controls->decode_params, &sl->ref_list[1][i]);
- if (count)
- fill_weight_factors(&controls->slice_params[slice].pred_weight_table.weight_factors[1], 1, sl);
-
+ fill_ref_list(&controls->slice_params.ref_pic_list1[i], &controls->decode_params, &sl->ref_list[1][i]);
+ if (count && controls->pred_weights_required)
+ fill_weight_factors(&controls->pred_weights.weight_factors[1], 1, sl);
- if (ctx->start_code == V4L2_MPEG_VIDEO_H264_START_CODE_ANNEX_B) {
- ret = ff_v4l2_request_append_output_buffer(avctx, h->cur_pic_ptr->f, nalu_slice_start_code, 3);
- if (ret)
- return ret;
- }
+ fill_ref_list(&controls->slice_params.ref_pic_list1[i], &controls->decode_params, &sl->ref_list[1][i]);
+ if (count && controls->pred_weights_required)
+ fill_weight_factors(&controls->pred_weights.weight_factors[1], 1, sl);
-
- ret = ff_v4l2_request_append_output_buffer(avctx, h->cur_pic_ptr->f, buffer, size);
- if (ret)
- return ret;
@ -4491,7 +4493,7 @@ index d28ed07da3b..c9dbaf8c3e3 100644
From f9f4a89058a6fac25712cc385eab72f70e9ac4c8 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Mon, 29 Apr 2019 22:08:59 +0000
Subject: [PATCH 13/20] HACK: hwcontext_drm: do not require drm device
Subject: [PATCH 13/22] HACK: hwcontext_drm: do not require drm device
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
@ -4499,7 +4501,7 @@ Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
1 file changed, 5 insertions(+)
diff --git a/libavutil/hwcontext_drm.c b/libavutil/hwcontext_drm.c
index 32cbde82ebf..aa4794c5e66 100644
index 32cbde82ebfa..aa4794c5e665 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,
@ -4518,7 +4520,7 @@ index 32cbde82ebf..aa4794c5e66 100644
From 027f8c90ec25c42899b24d96b434e6ed1a1a8c40 Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Sat, 15 Dec 2018 22:32:16 +0100
Subject: [PATCH 14/20] WIP: hevc scaling matrix
Subject: [PATCH 14/22] WIP: hevc scaling matrix
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---
@ -4527,7 +4529,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
2 files changed, 33 insertions(+)
diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h
index 1009cf0891c..1592e52c361 100644
index 1009cf0891cc..1592e52c3614 100644
--- a/libavcodec/hevc-ctrls.h
+++ b/libavcodec/hevc-ctrls.h
@@ -19,6 +19,7 @@
@ -4561,7 +4563,7 @@ index 1009cf0891c..1592e52c361 100644
+
#endif
diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c
index c16f8a868e3..f400bf4f3c8 100644
index c16f8a868e38..f400bf4f3c82 100644
--- a/libavcodec/v4l2_request_hevc.c
+++ b/libavcodec/v4l2_request_hevc.c
@@ -26,6 +26,7 @@
@ -4611,7 +4613,7 @@ index c16f8a868e3..f400bf4f3c8 100644
From 9c4a66cca0df6fd0976f907f1e315a715e5ffd87 Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Sat, 15 Dec 2018 22:32:16 +0100
Subject: [PATCH 15/20] WIP: hevc segment address
Subject: [PATCH 15/22] WIP: hevc segment address
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---
@ -4620,7 +4622,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h
index 1592e52c361..3e2e3209831 100644
index 1592e52c3614..3e2e32098312 100644
--- a/libavcodec/hevc-ctrls.h
+++ b/libavcodec/hevc-ctrls.h
@@ -167,6 +167,9 @@ struct v4l2_ctrl_hevc_slice_params {
@ -4643,7 +4645,7 @@ index 1592e52c361..3e2e3209831 100644
/* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */
struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c
index f400bf4f3c8..98222fc74c3 100644
index f400bf4f3c82..98222fc74c36 100644
--- a/libavcodec/v4l2_request_hevc.c
+++ b/libavcodec/v4l2_request_hevc.c
@@ -138,6 +138,9 @@ static void v4l2_request_hevc_fill_slice_params(const HEVCContext *h,
@ -4660,7 +4662,7 @@ index f400bf4f3c8..98222fc74c3 100644
From 62795e555cfcccfc29c144f0ed5acae5336479c7 Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Sat, 15 Dec 2018 22:32:16 +0100
Subject: [PATCH 16/20] WIP: hevc entry point offsets
Subject: [PATCH 16/22] WIP: hevc entry point offsets
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---
@ -4669,7 +4671,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h
index 3e2e3209831..d1b094c8aae 100644
index 3e2e32098312..d1b094c8aaeb 100644
--- a/libavcodec/hevc-ctrls.h
+++ b/libavcodec/hevc-ctrls.h
@@ -169,6 +169,7 @@ struct v4l2_ctrl_hevc_slice_params {
@ -4692,7 +4694,7 @@ index 3e2e3209831..d1b094c8aae 100644
/* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */
struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c
index 98222fc74c3..7e77c83e4e4 100644
index 98222fc74c36..7e77c83e4e4b 100644
--- a/libavcodec/v4l2_request_hevc.c
+++ b/libavcodec/v4l2_request_hevc.c
@@ -225,6 +225,15 @@ static void v4l2_request_hevc_fill_slice_params(const HEVCContext *h,
@ -4715,7 +4717,7 @@ index 98222fc74c3..7e77c83e4e4 100644
From edaaede001e7fbae26a0a668ea1db2b642896322 Mon Sep 17 00:00:00 2001
From: Boris Brezillon <boris.brezillon@collabora.com>
Date: Thu, 12 Dec 2019 16:13:55 +0100
Subject: [PATCH 17/20] WIP: Add V4L2 request API vp9 hwaccel
Subject: [PATCH 17/22] WIP: Add V4L2 request API vp9 hwaccel
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
@ -4729,7 +4731,7 @@ Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
create mode 100644 libavcodec/v4l2_request_vp9.c
diff --git a/configure b/configure
index 623012757c6..2b723df55ae 100755
index 623012757c60..2b723df55aed 100755
--- a/configure
+++ b/configure
@@ -3015,6 +3015,8 @@ vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
@ -4750,7 +4752,7 @@ index 623012757c6..2b723df55ae 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 d6af854daaa..2f0e0a0976f 100644
index d6af854daaa6..2f0e0a0976f6 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -945,6 +945,7 @@ OBJS-$(CONFIG_VP8_VAAPI_HWACCEL) += vaapi_vp8.o
@ -4762,7 +4764,7 @@ index d6af854daaa..2f0e0a0976f 100644
OBJS-$(CONFIG_VP9_VDPAU_HWACCEL) += vdpau_vp9.o
OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec_other.o
diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h
index bd75e94f4ca..03a1aefe09b 100644
index bd75e94f4cae..03a1aefe09bc 100644
--- a/libavcodec/hwaccels.h
+++ b/libavcodec/hwaccels.h
@@ -71,6 +71,7 @@ extern const AVHWAccel ff_vp9_d3d11va_hwaccel;
@ -4775,7 +4777,7 @@ index bd75e94f4ca..03a1aefe09b 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 00000000000..4074c7fe4b8
index 000000000000..4074c7fe4b8e
--- /dev/null
+++ b/libavcodec/v4l2_request_vp9.c
@@ -0,0 +1,352 @@
@ -5132,7 +5134,7 @@ index 00000000000..4074c7fe4b8
+ .caps_internal = HWACCEL_CAP_ASYNC_SAFE,
+};
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index fd0bab14a23..434f905c62c 100644
index fd0bab14a239..434f905c62c5 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -191,6 +191,7 @@ static int update_size(AVCodecContext *avctx, int w, int h)
@ -5184,7 +5186,7 @@ index fd0bab14a23..434f905c62c 100644
NULL
},
diff --git a/libavcodec/vp9shared.h b/libavcodec/vp9shared.h
index 54726df742f..fee3568736f 100644
index 54726df742f9..fee3568736f7 100644
--- a/libavcodec/vp9shared.h
+++ b/libavcodec/vp9shared.h
@@ -131,6 +131,7 @@ typedef struct VP9BitstreamHeader {
@ -5199,7 +5201,7 @@ index 54726df742f..fee3568736f 100644
From ef82ae9fffba44e88d59a3fa4b958a38d1b5cd9e Mon Sep 17 00:00:00 2001
From: Boris Brezillon <boris.brezillon@collabora.com>
Date: Thu, 12 Dec 2019 16:13:55 +0100
Subject: [PATCH 18/20] WIP: Add and use vp9 private linux header
Subject: [PATCH 18/22] WIP: Add and use vp9 private linux header
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
@ -5210,7 +5212,7 @@ Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
create mode 100644 libavcodec/vp9-ctrls.h
diff --git a/configure b/configure
index 2b723df55ae..87c6836af27 100755
index 2b723df55aed..87c6836af275 100755
--- a/configure
+++ b/configure
@@ -3015,7 +3015,7 @@ vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
@ -5223,7 +5225,7 @@ index 2b723df55ae..87c6836af27 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 4074c7fe4b8..2e10b7ad1ac 100644
index 4074c7fe4b8e..2e10b7ad1acb 100644
--- a/libavcodec/v4l2_request_vp9.c
+++ b/libavcodec/v4l2_request_vp9.c
@@ -19,6 +19,7 @@
@ -5236,7 +5238,7 @@ index 4074c7fe4b8..2e10b7ad1ac 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 00000000000..0cdea8a18b7
index 000000000000..0cdea8a18b72
--- /dev/null
+++ b/libavcodec/vp9-ctrls.h
@@ -0,0 +1,485 @@
@ -5729,7 +5731,7 @@ index 00000000000..0cdea8a18b7
From 4b268a93e5945dc7863a8dc953a12fa157b4f8e6 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Fri, 15 May 2020 16:54:05 +0000
Subject: [PATCH 19/20] WIP: add NV15 and NV20 support
Subject: [PATCH 19/22] WIP: add NV15 and NV20 support
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
@ -5738,7 +5740,7 @@ Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index c3896cfd90a..39ae8fabfd3 100644
index c3896cfd90ab..39ae8fabfd3b 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)
@ -5772,7 +5774,7 @@ index c3896cfd90a..39ae8fabfd3 100644
*fmt++ = AV_PIX_FMT_YUVJ422P;
else
diff --git a/libavcodec/v4l2_request.c b/libavcodec/v4l2_request.c
index 5234b5049b0..0b294feff2e 100644
index 5234b5049b0d..0b294feff2eb 100644
--- a/libavcodec/v4l2_request.c
+++ b/libavcodec/v4l2_request.c
@@ -188,6 +188,13 @@ const uint32_t v4l2_request_capture_pixelformats[] = {
@ -5816,14 +5818,14 @@ index 5234b5049b0..0b294feff2e 100644
From fa7165e391287bf970569e36b0b19bff947b084f Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Mon, 27 Jul 2020 23:15:45 +0000
Subject: [PATCH 20/20] HACK: define drm NV15 and NV20 format
Subject: [PATCH 20/22] HACK: define drm NV15 and NV20 format
---
libavcodec/v4l2_request.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavcodec/v4l2_request.c b/libavcodec/v4l2_request.c
index 0b294feff2e..a8f0ee79eee 100644
index 0b294feff2eb..a8f0ee79eeef 100644
--- a/libavcodec/v4l2_request.c
+++ b/libavcodec/v4l2_request.c
@@ -30,6 +30,14 @@
@ -5841,3 +5843,164 @@ index 0b294feff2e..a8f0ee79eee 100644
uint64_t ff_v4l2_request_get_capture_timestamp(AVFrame *frame)
{
V4L2RequestDescriptor *req = (V4L2RequestDescriptor*)frame->data[0];
From 4ee9ede28d912637e64a7472acd3e8ab5272f41b Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Sun, 11 Apr 2021 08:40:57 +0000
Subject: [PATCH 21/22] WIP: hevc: slice dependent flag
---
libavcodec/hevc-ctrls.h | 1 +
libavcodec/v4l2_request_hevc.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h
index d1b094c8aaeb..9c976b3cf092 100644
--- a/libavcodec/hevc-ctrls.h
+++ b/libavcodec/hevc-ctrls.h
@@ -162,6 +162,7 @@ struct v4l2_hevc_pred_weight_table {
#define V4L2_HEVC_SLICE_PARAMS_FLAG_USE_INTEGER_MV (1ULL << 6)
#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_DEBLOCKING_FILTER_DISABLED (1ULL << 7)
#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 8)
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT (1ULL << 9)
struct v4l2_ctrl_hevc_slice_params {
__u32 bit_size;
diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c
index 7e77c83e4e4b..116a69340af3 100644
--- a/libavcodec/v4l2_request_hevc.c
+++ b/libavcodec/v4l2_request_hevc.c
@@ -195,6 +195,9 @@ static void v4l2_request_hevc_fill_slice_params(const HEVCContext *h,
if (sh->slice_loop_filter_across_slices_enabled_flag)
slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED;
+ if (sh->dependent_slice_segment_flag)
+ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT;
+
for (i = 0; i < FF_ARRAY_ELEMS(h->DPB); i++) {
const HEVCFrame *frame = &h->DPB[i];
if (frame != pic && (frame->flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) {
From a327aa791645517b031ac8d89a720b1907cfb96a Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Wed, 13 May 2020 22:51:21 +0000
Subject: [PATCH 22/22] WIP: hevc rkvdec fields
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
libavcodec/hevc-ctrls.h | 17 +++++++++++++----
libavcodec/v4l2_request_hevc.c | 12 ++++++++++++
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h
index 9c976b3cf092..c54687bfe658 100644
--- a/libavcodec/hevc-ctrls.h
+++ b/libavcodec/hevc-ctrls.h
@@ -56,6 +56,9 @@ enum v4l2_mpeg_video_hevc_start_code {
/* The controls are not stable at the moment and will likely be reworked. */
struct v4l2_ctrl_hevc_sps {
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
+ __u8 video_parameter_set_id;
+ __u8 seq_parameter_set_id;
+ __u8 chroma_format_idc;
__u16 pic_width_in_luma_samples;
__u16 pic_height_in_luma_samples;
__u8 bit_depth_luma_minus8;
@@ -76,9 +79,9 @@ struct v4l2_ctrl_hevc_sps {
__u8 log2_diff_max_min_pcm_luma_coding_block_size;
__u8 num_short_term_ref_pic_sets;
__u8 num_long_term_ref_pics_sps;
- __u8 chroma_format_idc;
- __u8 padding;
+ __u8 num_slices;
+ __u8 padding[6];
__u64 flags;
};
@@ -105,7 +108,10 @@ struct v4l2_ctrl_hevc_sps {
struct v4l2_ctrl_hevc_pps {
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */
+ __u8 pic_parameter_set_id;
__u8 num_extra_slice_header_bits;
+ __u8 num_ref_idx_l0_default_active_minus1;
+ __u8 num_ref_idx_l1_default_active_minus1;
__s8 init_qp_minus26;
__u8 diff_cu_qp_delta_depth;
__s8 pps_cb_qp_offset;
@@ -118,7 +124,7 @@ struct v4l2_ctrl_hevc_pps {
__s8 pps_tc_offset_div2;
__u8 log2_parallel_merge_level_minus2;
- __u8 padding[4];
+ __u8 padding;
__u64 flags;
};
@@ -205,7 +211,10 @@ struct v4l2_ctrl_hevc_slice_params {
__u8 num_rps_poc_st_curr_after;
__u8 num_rps_poc_lt_curr;
- __u8 padding;
+ __u16 short_term_ref_pic_set_size;
+ __u16 long_term_ref_pic_set_size;
+
+ __u8 padding[5];
__u32 entry_point_offset_minus1[256];
diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c
index 116a69340af3..eb493b309fe9 100644
--- a/libavcodec/v4l2_request_hevc.c
+++ b/libavcodec/v4l2_request_hevc.c
@@ -169,6 +169,9 @@ static void v4l2_request_hevc_fill_slice_params(const HEVCContext *h,
.num_rps_poc_st_curr_before = h->rps[ST_CURR_BEF].nb_refs,
.num_rps_poc_st_curr_after = h->rps[ST_CURR_AFT].nb_refs,
.num_rps_poc_lt_curr = h->rps[LT_CURR].nb_refs,
+
+ .short_term_ref_pic_set_size = sh->short_term_ref_pic_set_size,
+ .long_term_ref_pic_set_size = sh->long_term_ref_pic_set_size,
};
if (sh->slice_sample_adaptive_offset_flag[0])
@@ -242,9 +245,12 @@ static void v4l2_request_hevc_fill_slice_params(const HEVCContext *h,
static void fill_sps(struct v4l2_ctrl_hevc_sps *ctrl, const HEVCContext *h)
{
const HEVCSPS *sps = h->ps.sps;
+ const HEVCPPS *pps = h->ps.pps;
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
*ctrl = (struct v4l2_ctrl_hevc_sps) {
+ .video_parameter_set_id = sps->vps_id,
+ .seq_parameter_set_id = pps->sps_id,
.chroma_format_idc = sps->chroma_format_idc,
.pic_width_in_luma_samples = sps->width,
.pic_height_in_luma_samples = sps->height,
@@ -303,6 +309,7 @@ static int v4l2_request_hevc_start_frame(AVCodecContext *avctx,
const HEVCContext *h = avctx->priv_data;
const HEVCSPS *sps = h->ps.sps;
const HEVCPPS *pps = h->ps.pps;
+ const SliceHeader *sh = &h->sh;
const ScalingList *sl = pps->scaling_list_data_present_flag ?
&pps->scaling_list :
sps->scaling_list_enable_flag ?
@@ -329,6 +336,9 @@ static int v4l2_request_hevc_start_frame(AVCodecContext *avctx,
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */
controls->pps = (struct v4l2_ctrl_hevc_pps) {
+ .pic_parameter_set_id = sh->pps_id,
+ .num_ref_idx_l0_default_active_minus1 = pps->num_ref_idx_l0_default_active - 1,
+ .num_ref_idx_l1_default_active_minus1 = pps->num_ref_idx_l1_default_active - 1,
.num_extra_slice_header_bits = pps->num_extra_slice_header_bits,
.init_qp_minus26 = pps->pic_init_qp_minus26,
.diff_cu_qp_delta_depth = pps->diff_cu_qp_delta_depth,
@@ -445,6 +455,8 @@ static int v4l2_request_hevc_queue_decode(AVCodecContext *avctx, int last_slice)
if (ctx->decode_mode == V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED)
return ff_v4l2_request_decode_slice(avctx, h->ref->frame, control, FF_ARRAY_ELEMS(control), controls->first_slice, last_slice);
+ controls->sps.num_slices = controls->num_slices;
+
return ff_v4l2_request_decode_frame(avctx, h->ref->frame, control, FF_ARRAY_ELEMS(control));
}

View File

@ -172,24 +172,3 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
}
static void cedrus_h265_trigger(struct cedrus_ctx *ctx)
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -169,6 +169,7 @@ struct v4l2_ctrl_hevc_slice_params {
/* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */
__u32 slice_segment_addr;
+ __u32 num_entry_point_offsets;
/* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
__u8 nal_unit_type;
@@ -203,7 +204,9 @@ struct v4l2_ctrl_hevc_slice_params {
__u8 num_rps_poc_st_curr_after;
__u8 num_rps_poc_lt_curr;
- __u8 padding[5];
+ __u8 padding;
+
+ __u32 entry_point_offset_minus1[256];
/* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */
struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];

View File

@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Sat, 10 Apr 2021 18:55:09 +0200
Subject: [PATCH] media: cedrus: Fix HEVC status macros
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---
.../staging/media/sunxi/cedrus/cedrus_regs.h | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
index 6cb1c279790f..7ab3a2b0aa10 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
@@ -443,16 +443,17 @@
#define VE_DEC_H265_STATUS_STCD_BUSY BIT(21)
#define VE_DEC_H265_STATUS_WB_BUSY BIT(20)
#define VE_DEC_H265_STATUS_BS_DMA_BUSY BIT(19)
-#define VE_DEC_H265_STATUS_IQIT_BUSY BIT(18)
+#define VE_DEC_H265_STATUS_IT_BUSY BIT(18)
#define VE_DEC_H265_STATUS_INTER_BUSY BIT(17)
#define VE_DEC_H265_STATUS_MORE_DATA BIT(16)
-#define VE_DEC_H265_STATUS_VLD_BUSY BIT(14)
-#define VE_DEC_H265_STATUS_DEBLOCKING_BUSY BIT(13)
-#define VE_DEC_H265_STATUS_DEBLOCKING_DRAM_BUSY BIT(12)
-#define VE_DEC_H265_STATUS_INTRA_BUSY BIT(11)
-#define VE_DEC_H265_STATUS_SAO_BUSY BIT(10)
-#define VE_DEC_H265_STATUS_MVP_BUSY BIT(9)
-#define VE_DEC_H265_STATUS_SWDEC_BUSY BIT(8)
+#define VE_DEC_H265_STATUS_DBLK_BUSY BIT(15)
+#define VE_DEC_H265_STATUS_IREC_BUSY BIT(14)
+#define VE_DEC_H265_STATUS_INTRA_BUSY BIT(13)
+#define VE_DEC_H265_STATUS_MCRI_BUSY BIT(12)
+#define VE_DEC_H265_STATUS_IQIT_BUSY BIT(11)
+#define VE_DEC_H265_STATUS_MVP_BUSY BIT(10)
+#define VE_DEC_H265_STATUS_IS_BUSY BIT(9)
+#define VE_DEC_H265_STATUS_VLD_BUSY BIT(8)
#define VE_DEC_H265_STATUS_OVER_TIME BIT(3)
#define VE_DEC_H265_STATUS_VLD_DATA_REQ BIT(2)
#define VE_DEC_H265_STATUS_ERROR BIT(1)

View File

@ -0,0 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Sun, 11 Apr 2021 10:45:50 +0200
Subject: [PATCH] media: cedrus: wip: hevc: dependent flag
---
drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 4 ++--
include/media/hevc-ctrls.h | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
index 8861e1535886..ab6fc857a477 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
@@ -634,8 +634,8 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
slice_params->flags);
reg |= VE_DEC_H265_FLAG(VE_DEC_H265_DEC_SLICE_HDR_INFO0_FLAG_DEPENDENT_SLICE_SEGMENT,
- V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT,
- pps->flags);
+ V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT,
+ slice_params->flags);
if (ctx->fh.m2m_ctx->new_frame)
reg |= VE_DEC_H265_DEC_SLICE_HDR_INFO0_FLAG_FIRST_SLICE_SEGMENT_IN_PIC;
diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
index eb83c1d61b8d..cd51fb6df1f0 100644
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -162,6 +162,7 @@ struct v4l2_hevc_pred_weight_table {
#define V4L2_HEVC_SLICE_PARAMS_FLAG_USE_INTEGER_MV (1ULL << 6)
#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_DEBLOCKING_FILTER_DISABLED (1ULL << 7)
#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 8)
+#define V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT (1ULL << 9)
struct v4l2_ctrl_hevc_slice_params {
__u32 bit_size;

View File

@ -0,0 +1,69 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sat, 23 May 2020 15:03:46 +0000
Subject: [PATCH] WIP: media: uapi: hevc: add fields needed for rkvdec
NOTE: these fields are used by rkvdec hevc backend
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
include/media/hevc-ctrls.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
index 6e881b7896bc..46936bae7c30 100644
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -56,6 +56,9 @@ enum v4l2_mpeg_video_hevc_start_code {
/* The controls are not stable at the moment and will likely be reworked. */
struct v4l2_ctrl_hevc_sps {
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
+ __u8 video_parameter_set_id;
+ __u8 seq_parameter_set_id;
+ __u8 chroma_format_idc;
__u16 pic_width_in_luma_samples;
__u16 pic_height_in_luma_samples;
__u8 bit_depth_luma_minus8;
@@ -76,9 +79,8 @@ struct v4l2_ctrl_hevc_sps {
__u8 log2_diff_max_min_pcm_luma_coding_block_size;
__u8 num_short_term_ref_pic_sets;
__u8 num_long_term_ref_pics_sps;
- __u8 chroma_format_idc;
- __u8 padding;
+ __u8 padding[7];
__u64 flags;
};
@@ -105,7 +107,10 @@ struct v4l2_ctrl_hevc_sps {
struct v4l2_ctrl_hevc_pps {
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */
+ __u8 pic_parameter_set_id;
__u8 num_extra_slice_header_bits;
+ __u8 num_ref_idx_l0_default_active_minus1;
+ __u8 num_ref_idx_l1_default_active_minus1;
__s8 init_qp_minus26;
__u8 diff_cu_qp_delta_depth;
__s8 pps_cb_qp_offset;
@@ -118,7 +123,7 @@ struct v4l2_ctrl_hevc_pps {
__s8 pps_tc_offset_div2;
__u8 log2_parallel_merge_level_minus2;
- __u8 padding[4];
+ __u8 padding;
__u64 flags;
};
@@ -204,7 +209,10 @@ struct v4l2_ctrl_hevc_slice_params {
__u8 num_rps_poc_st_curr_after;
__u8 num_rps_poc_lt_curr;
- __u8 padding[5];
+ __u16 short_term_ref_pic_set_size;
+ __u16 long_term_ref_pic_set_size;
+
+ __u8 padding;
/* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */
struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];

View File

@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sat, 23 May 2020 15:07:15 +0000
Subject: [PATCH] HACK: media: uapi: hevc: tiles and num_slices
---
include/media/hevc-ctrls.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
index 46936bae7c30..4d51c148d0ba 100644
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -80,7 +80,8 @@ struct v4l2_ctrl_hevc_sps {
__u8 num_short_term_ref_pic_sets;
__u8 num_long_term_ref_pics_sps;
- __u8 padding[7];
+ __u8 num_slices;
+ __u8 padding[6];
__u64 flags;
};
@@ -175,6 +176,7 @@ struct v4l2_ctrl_hevc_slice_params {
/* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */
__u32 slice_segment_addr;
+ __u32 num_entry_point_offsets;
/* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
__u8 nal_unit_type;
@@ -212,7 +214,9 @@ struct v4l2_ctrl_hevc_slice_params {
__u16 short_term_ref_pic_set_size;
__u16 long_term_ref_pic_set_size;
- __u8 padding;
+ __u8 padding[5];
+
+ __u32 entry_point_offset_minus1[256];
/* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */
struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];

View File

@ -1,123 +0,0 @@
From 5e9575a822a94139bdcfe6a7fa78e4ef771ccb39 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Wed, 13 May 2020 22:51:21 +0000
Subject: [PATCH] WIP: hevc rkvdec fields
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
libavcodec/hevc-ctrls.h | 17 +++++++++++++----
libavcodec/v4l2_request_hevc.c | 12 ++++++++++++
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/libavcodec/hevc-ctrls.h b/libavcodec/hevc-ctrls.h
index d1b094c8aaeb..b33e1a8141e1 100644
--- a/libavcodec/hevc-ctrls.h
+++ b/libavcodec/hevc-ctrls.h
@@ -56,6 +56,9 @@ enum v4l2_mpeg_video_hevc_start_code {
/* The controls are not stable at the moment and will likely be reworked. */
struct v4l2_ctrl_hevc_sps {
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
+ __u8 video_parameter_set_id;
+ __u8 seq_parameter_set_id;
+ __u8 chroma_format_idc;
__u16 pic_width_in_luma_samples;
__u16 pic_height_in_luma_samples;
__u8 bit_depth_luma_minus8;
@@ -76,9 +79,9 @@ struct v4l2_ctrl_hevc_sps {
__u8 log2_diff_max_min_pcm_luma_coding_block_size;
__u8 num_short_term_ref_pic_sets;
__u8 num_long_term_ref_pics_sps;
- __u8 chroma_format_idc;
- __u8 padding;
+ __u8 num_slices;
+ __u8 padding[6];
__u64 flags;
};
@@ -105,7 +108,10 @@ struct v4l2_ctrl_hevc_sps {
struct v4l2_ctrl_hevc_pps {
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */
+ __u8 pic_parameter_set_id;
__u8 num_extra_slice_header_bits;
+ __u8 num_ref_idx_l0_default_active_minus1;
+ __u8 num_ref_idx_l1_default_active_minus1;
__s8 init_qp_minus26;
__u8 diff_cu_qp_delta_depth;
__s8 pps_cb_qp_offset;
@@ -118,7 +124,7 @@ struct v4l2_ctrl_hevc_pps {
__s8 pps_tc_offset_div2;
__u8 log2_parallel_merge_level_minus2;
- __u8 padding[4];
+ __u8 padding;
__u64 flags;
};
@@ -204,7 +210,10 @@ struct v4l2_ctrl_hevc_slice_params {
__u8 num_rps_poc_st_curr_after;
__u8 num_rps_poc_lt_curr;
- __u8 padding;
+ __u16 short_term_ref_pic_set_size;
+ __u16 long_term_ref_pic_set_size;
+
+ __u8 padding[5];
__u32 entry_point_offset_minus1[256];
diff --git a/libavcodec/v4l2_request_hevc.c b/libavcodec/v4l2_request_hevc.c
index 7e77c83e4e4b..9c6916bcb453 100644
--- a/libavcodec/v4l2_request_hevc.c
+++ b/libavcodec/v4l2_request_hevc.c
@@ -169,6 +169,9 @@ static void v4l2_request_hevc_fill_slice_params(const HEVCContext *h,
.num_rps_poc_st_curr_before = h->rps[ST_CURR_BEF].nb_refs,
.num_rps_poc_st_curr_after = h->rps[ST_CURR_AFT].nb_refs,
.num_rps_poc_lt_curr = h->rps[LT_CURR].nb_refs,
+
+ .short_term_ref_pic_set_size = sh->short_term_ref_pic_set_size,
+ .long_term_ref_pic_set_size = sh->long_term_ref_pic_set_size,
};
if (sh->slice_sample_adaptive_offset_flag[0])
@@ -239,9 +242,12 @@ static void v4l2_request_hevc_fill_slice_params(const HEVCContext *h,
static void fill_sps(struct v4l2_ctrl_hevc_sps *ctrl, const HEVCContext *h)
{
const HEVCSPS *sps = h->ps.sps;
+ const HEVCPPS *pps = h->ps.pps;
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
*ctrl = (struct v4l2_ctrl_hevc_sps) {
+ .video_parameter_set_id = sps->vps_id,
+ .seq_parameter_set_id = pps->sps_id,
.chroma_format_idc = sps->chroma_format_idc,
.pic_width_in_luma_samples = sps->width,
.pic_height_in_luma_samples = sps->height,
@@ -300,6 +306,7 @@ static int v4l2_request_hevc_start_frame(AVCodecContext *avctx,
const HEVCContext *h = avctx->priv_data;
const HEVCSPS *sps = h->ps.sps;
const HEVCPPS *pps = h->ps.pps;
+ const SliceHeader *sh = &h->sh;
const ScalingList *sl = pps->scaling_list_data_present_flag ?
&pps->scaling_list :
sps->scaling_list_enable_flag ?
@@ -326,6 +333,9 @@ static int v4l2_request_hevc_start_frame(AVCodecContext *avctx,
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */
controls->pps = (struct v4l2_ctrl_hevc_pps) {
+ .pic_parameter_set_id = sh->pps_id,
+ .num_ref_idx_l0_default_active_minus1 = pps->num_ref_idx_l0_default_active - 1,
+ .num_ref_idx_l1_default_active_minus1 = pps->num_ref_idx_l1_default_active - 1,
.num_extra_slice_header_bits = pps->num_extra_slice_header_bits,
.init_qp_minus26 = pps->pic_init_qp_minus26,
.diff_cu_qp_delta_depth = pps->diff_cu_qp_delta_depth,
@@ -442,6 +452,8 @@ static int v4l2_request_hevc_queue_decode(AVCodecContext *avctx, int last_slice)
if (ctx->decode_mode == V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED)
return ff_v4l2_request_decode_slice(avctx, h->ref->frame, control, FF_ARRAY_ELEMS(control), controls->first_slice, last_slice);
+ controls->sps.num_slices = controls->num_slices;
+
return ff_v4l2_request_decode_frame(avctx, h->ref->frame, control, FF_ARRAY_ELEMS(control));
}

View File

@ -28,7 +28,7 @@ create_patch() {
REFSPEC="v4l2-drmprime-v5"
;;
v4l2-request)
REPO="https://github.com/Kwiboo/FFmpeg"
REPO="https://github.com/jernejsk/FFmpeg"
REFSPEC="v4l2-request-hwaccel-4.3.1"
;;
libreelec)