mirror of
https://github.com/LibreELEC/LibreELEC.tv
synced 2025-09-24 19:46:01 +07:00
193 lines
8.5 KiB
Diff
193 lines
8.5 KiB
Diff
From 05f5cd65c1561cc55cf6ec54023f88466d286028 Mon Sep 17 00:00:00 2001
|
|
From: Detlev Casanova <detlev.casanova@collabora.com>
|
|
Date: Thu, 24 Jul 2025 14:10:19 -0400
|
|
Subject: [PATCH 005/110] FROMGIT(6.18): media: v4l2-ctrls: Add
|
|
hevc_ext_sps_[ls]t_rps controls
|
|
|
|
The vdpu381 decoder found on newer Rockchip SoC need the information
|
|
from the long term and short term ref pic sets from the SPS.
|
|
|
|
So far, it wasn't included in the v4l2 API, so add it with new dynamic
|
|
sized controls.
|
|
|
|
Each element of the hevc_ext_sps_lt_rps array contains the long term ref
|
|
pic set at that index.
|
|
Each element of the hevc_ext_sps_st_rps contains the short term ref pic
|
|
set at that index, as the raw data.
|
|
It is the role of the drivers to calculate the reference sets values.
|
|
|
|
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
|
|
---
|
|
drivers/media/v4l2-core/v4l2-ctrls-core.c | 18 +++++++
|
|
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 10 ++++
|
|
include/uapi/linux/v4l2-controls.h | 61 +++++++++++++++++++++++
|
|
include/uapi/linux/videodev2.h | 2 +
|
|
4 files changed, 91 insertions(+)
|
|
|
|
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
|
|
index 98b960775e87..142e26134ef0 100644
|
|
--- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
|
|
+++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
|
|
@@ -418,6 +418,12 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)
|
|
case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
|
|
pr_cont("HEVC_SLICE_PARAMS");
|
|
break;
|
|
+ case V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS:
|
|
+ pr_cont("HEVC_EXT_SPS_ST_RPS");
|
|
+ break;
|
|
+ case V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS:
|
|
+ pr_cont("HEVC_EXT_SPS_LT_RPS");
|
|
+ break;
|
|
case V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX:
|
|
pr_cont("HEVC_SCALING_MATRIX");
|
|
break;
|
|
@@ -1173,6 +1179,12 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
|
|
case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
|
|
break;
|
|
|
|
+ case V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS:
|
|
+ break;
|
|
+
|
|
+ case V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS:
|
|
+ break;
|
|
+
|
|
case V4L2_CTRL_TYPE_HDR10_CLL_INFO:
|
|
break;
|
|
|
|
@@ -1925,6 +1937,12 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
|
|
case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
|
|
elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params);
|
|
break;
|
|
+ case V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS:
|
|
+ elem_size = sizeof(struct v4l2_ctrl_hevc_ext_sps_st_rps);
|
|
+ break;
|
|
+ case V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS:
|
|
+ elem_size = sizeof(struct v4l2_ctrl_hevc_ext_sps_lt_rps);
|
|
+ break;
|
|
case V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX:
|
|
elem_size = sizeof(struct v4l2_ctrl_hevc_scaling_matrix);
|
|
break;
|
|
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
|
|
index 1ea52011247a..86c7ee224b66 100644
|
|
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
|
|
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
|
|
@@ -1233,6 +1233,8 @@ const char *v4l2_ctrl_get_name(u32 id)
|
|
case V4L2_CID_STATELESS_HEVC_DECODE_MODE: return "HEVC Decode Mode";
|
|
case V4L2_CID_STATELESS_HEVC_START_CODE: return "HEVC Start Code";
|
|
case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS: return "HEVC Entry Point Offsets";
|
|
+ case V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS: return "HEVC Short Term Ref Sets";
|
|
+ case V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS: return "HEVC Long Term Ref Sets";
|
|
case V4L2_CID_STATELESS_AV1_SEQUENCE: return "AV1 Sequence Parameters";
|
|
case V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY: return "AV1 Tile Group Entry";
|
|
case V4L2_CID_STATELESS_AV1_FRAME: return "AV1 Frame Parameters";
|
|
@@ -1578,6 +1580,14 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
|
|
*type = V4L2_CTRL_TYPE_U32;
|
|
*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
|
|
break;
|
|
+ case V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS:
|
|
+ *type = V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS;
|
|
+ *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
|
|
+ break;
|
|
+ case V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS:
|
|
+ *type = V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS;
|
|
+ *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
|
|
+ break;
|
|
case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR:
|
|
*type = V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR;
|
|
break;
|
|
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
|
|
index f836512e9deb..08f869124474 100644
|
|
--- a/include/uapi/linux/v4l2-controls.h
|
|
+++ b/include/uapi/linux/v4l2-controls.h
|
|
@@ -2094,6 +2094,8 @@ struct v4l2_ctrl_mpeg2_quantisation {
|
|
#define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_STATELESS_BASE + 405)
|
|
#define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_STATELESS_BASE + 406)
|
|
#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_STATELESS_BASE + 407)
|
|
+#define V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS (V4L2_CID_CODEC_STATELESS_BASE + 408)
|
|
+#define V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS (V4L2_CID_CODEC_STATELESS_BASE + 409)
|
|
|
|
enum v4l2_stateless_hevc_decode_mode {
|
|
V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED,
|
|
@@ -2549,6 +2551,65 @@ struct v4l2_ctrl_hevc_scaling_matrix {
|
|
__u8 scaling_list_dc_coef_32x32[2];
|
|
};
|
|
|
|
+#define V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_INTER_REF_PIC_SET_PRED 0x1
|
|
+
|
|
+/*
|
|
+ * struct v4l2_ctrl_hevc_ext_sps_st_rps - HEVC short term RPS parameters
|
|
+ *
|
|
+ * Dynamic size 1-dimension array for short term RPS. The number of elements
|
|
+ * is v4l2_ctrl_hevc_sps::num_short_term_ref_pic_sets. It can contain up to 65 elements.
|
|
+ *
|
|
+ * @delta_idx_minus1: Specifies the delta compare to the index. See details in section 7.4.8
|
|
+ * "Short-term reference picture set semantics" of the specification.
|
|
+ * @delta_rps_sign: Sign of the delta as specified in section 7.4.8 "Short-term reference picture
|
|
+ * set semantics" of the specification.
|
|
+ * @abs_delta_rps_minus1: Absolute delta RPS as specified in section 7.4.8 "Short-term reference
|
|
+ * picture set semantics" of the specification.
|
|
+ * @num_negative_pics: Number of short-term RPS entries that have picture order count values less
|
|
+ * than the picture order count value of the current picture.
|
|
+ * @num_positive_pics: Number of short-term RPS entries that have picture order count values
|
|
+ * greater than the picture order count value of the current picture.
|
|
+ * @used_by_curr_pic: Bit j specifies if short-term RPS j is used by the current picture.
|
|
+ * @use_delta_flag: Bit j equals to 1 specifies that the j-th entry in the source candidate
|
|
+ * short-term RPS is included in this candidate short-term RPS.
|
|
+ * @delta_poc_s0_minus1: Specifies the negative picture order count delta for the i-th entry in
|
|
+ * the short-term RPS. See details in section 7.4.8 "Short-term reference
|
|
+ * picture set semantics" of the specification.
|
|
+ * @delta_poc_s1_minus1: Specifies the positive picture order count delta for the i-th entry in
|
|
+ * the short-term RPS. See details in section 7.4.8 "Short-term reference
|
|
+ * picture set semantics" of the specification.
|
|
+ * @flags: See V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_{}
|
|
+ */
|
|
+struct v4l2_ctrl_hevc_ext_sps_st_rps {
|
|
+ __u8 delta_idx_minus1;
|
|
+ __u8 delta_rps_sign;
|
|
+ __u16 abs_delta_rps_minus1;
|
|
+ __u8 num_negative_pics;
|
|
+ __u8 num_positive_pics;
|
|
+ __u32 used_by_curr_pic;
|
|
+ __u32 use_delta_flag;
|
|
+ __u16 delta_poc_s0_minus1[16];
|
|
+ __u16 delta_poc_s1_minus1[16];
|
|
+ __u8 flags;
|
|
+};
|
|
+
|
|
+#define V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_USED_LT 0x1
|
|
+
|
|
+/*
|
|
+ * struct v4l2_ctrl_hevc_ext_sps_lt_rps - HEVC long term RPS parameters
|
|
+ *
|
|
+ * Dynamic size 1-dimension array for long term RPS. The number of elements
|
|
+ * is v4l2_ctrl_hevc_sps::num_long_term_ref_pics_sps. It can contain up to 65 elements.
|
|
+ *
|
|
+ * @lt_ref_pic_poc_lsb_sps: picture order count modulo MaxPicOrderCntLsb of the i-th candidate
|
|
+ * long-term reference picture.
|
|
+ * @flags: See V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_{}
|
|
+ */
|
|
+struct v4l2_ctrl_hevc_ext_sps_lt_rps {
|
|
+ __u16 lt_ref_pic_poc_lsb_sps;
|
|
+ __u8 flags;
|
|
+};
|
|
+
|
|
#define V4L2_CID_COLORIMETRY_CLASS_BASE (V4L2_CTRL_CLASS_COLORIMETRY | 0x900)
|
|
#define V4L2_CID_COLORIMETRY_CLASS (V4L2_CTRL_CLASS_COLORIMETRY | 1)
|
|
|
|
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
|
index 3dd9fa45dde1..a3aa1f8c3894 100644
|
|
--- a/include/uapi/linux/videodev2.h
|
|
+++ b/include/uapi/linux/videodev2.h
|
|
@@ -1981,6 +1981,8 @@ enum v4l2_ctrl_type {
|
|
V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS = 0x0272,
|
|
V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX = 0x0273,
|
|
V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS = 0x0274,
|
|
+ V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS = 0x0275,
|
|
+ V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS = 0x0276,
|
|
|
|
V4L2_CTRL_TYPE_AV1_SEQUENCE = 0x280,
|
|
V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY = 0x281,
|
|
--
|
|
2.34.1
|
|
|