提交 5e361837 编写于 作者: J Jernej Skrabec 提交者: Zheng Zengkai

media: uapi: hevc: Add scaling matrix control

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

Taken from https://patchwork.linuxtv.org/patch/60728/
Changes (mainly documentation) have been requested.

HEVC has a scaling matrix concept. Add support for it.
Signed-off-by: NJernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 190be495
...@@ -4316,6 +4316,47 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - ...@@ -4316,6 +4316,47 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
- ``padding[6]`` - ``padding[6]``
- Applications and drivers must set this to zero. - Applications and drivers must set this to zero.
``V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX (struct)``
Specifies the scaling matrix (as extracted from the bitstream) for
the associated HEVC slice data. The bitstream parameters are
defined according to :ref:`hevc`, section 7.4.5 "Scaling list
data semantics". For further documentation, refer to the above
specification, unless there is an explicit comment stating
otherwise.
.. note::
This compound control is not yet part of the public kernel API and
it is expected to change.
.. c:type:: v4l2_ctrl_hevc_scaling_matrix
.. cssclass:: longtable
.. flat-table:: struct v4l2_ctrl_hevc_scaling_matrix
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u8
- ``scaling_list_4x4[6][16]``
-
* - __u8
- ``scaling_list_8x8[6][64]``
-
* - __u8
- ``scaling_list_16x16[6][64]``
-
* - __u8
- ``scaling_list_32x32[2][64]``
-
* - __u8
- ``scaling_list_dc_coef_16x16[6]``
-
* - __u8
- ``scaling_list_dc_coef_32x32[2]``
-
``V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE (enum)`` ``V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE (enum)``
Specifies the decoding mode to use. Currently exposes slice-based and Specifies the decoding mode to use. Currently exposes slice-based and
frame-based decoding but new modes might be added later on. frame-based decoding but new modes might be added later on.
......
...@@ -200,6 +200,7 @@ Compressed Formats ...@@ -200,6 +200,7 @@ Compressed Formats
* ``V4L2_CID_MPEG_VIDEO_HEVC_SPS`` * ``V4L2_CID_MPEG_VIDEO_HEVC_SPS``
* ``V4L2_CID_MPEG_VIDEO_HEVC_PPS`` * ``V4L2_CID_MPEG_VIDEO_HEVC_PPS``
* ``V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS`` * ``V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS``
* ``V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX``
See the :ref:`associated Codec Control IDs <v4l2-mpeg-hevc>`. See the :ref:`associated Codec Control IDs <v4l2-mpeg-hevc>`.
Buffers associated with this pixel format must contain the appropriate Buffers associated with this pixel format must contain the appropriate
number of macroblocks to decode a full corresponding frame. number of macroblocks to decode a full corresponding frame.
......
...@@ -1022,6 +1022,7 @@ const char *v4l2_ctrl_get_name(u32 id) ...@@ -1022,6 +1022,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_HEVC_SPS: return "HEVC Sequence Parameter Set"; case V4L2_CID_MPEG_VIDEO_HEVC_SPS: return "HEVC Sequence Parameter Set";
case V4L2_CID_MPEG_VIDEO_HEVC_PPS: return "HEVC Picture Parameter Set"; case V4L2_CID_MPEG_VIDEO_HEVC_PPS: return "HEVC Picture Parameter Set";
case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: return "HEVC Slice Parameters"; case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: return "HEVC Slice Parameters";
case V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX: return "HEVC Scaling Matrix";
case V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE: return "HEVC Decode Mode"; case V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE: return "HEVC Decode Mode";
case V4L2_CID_MPEG_VIDEO_HEVC_START_CODE: return "HEVC Start Code"; case V4L2_CID_MPEG_VIDEO_HEVC_START_CODE: return "HEVC Start Code";
...@@ -1462,6 +1463,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, ...@@ -1462,6 +1463,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS:
*type = V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS; *type = V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS;
break; break;
case V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX:
*type = V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX;
break;
case V4L2_CID_UNIT_CELL_SIZE: case V4L2_CID_UNIT_CELL_SIZE:
*type = V4L2_CTRL_TYPE_AREA; *type = V4L2_CTRL_TYPE_AREA;
*flags |= V4L2_CTRL_FLAG_READ_ONLY; *flags |= V4L2_CTRL_FLAG_READ_ONLY;
...@@ -1935,6 +1939,9 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, ...@@ -1935,6 +1939,9 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
zero_padding(*p_hevc_slice_params); zero_padding(*p_hevc_slice_params);
break; break;
case V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX:
break;
case V4L2_CTRL_TYPE_AREA: case V4L2_CTRL_TYPE_AREA:
area = p; area = p;
if (!area->width || !area->height) if (!area->width || !area->height)
...@@ -2627,6 +2634,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, ...@@ -2627,6 +2634,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS: case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params); elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params);
break; break;
case V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX:
elem_size = sizeof(struct v4l2_ctrl_hevc_scaling_matrix);
break;
case V4L2_CTRL_TYPE_AREA: case V4L2_CTRL_TYPE_AREA:
elem_size = sizeof(struct v4l2_area); elem_size = sizeof(struct v4l2_area);
break; break;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define V4L2_CID_MPEG_VIDEO_HEVC_SPS (V4L2_CID_MPEG_BASE + 1008) #define V4L2_CID_MPEG_VIDEO_HEVC_SPS (V4L2_CID_MPEG_BASE + 1008)
#define V4L2_CID_MPEG_VIDEO_HEVC_PPS (V4L2_CID_MPEG_BASE + 1009) #define V4L2_CID_MPEG_VIDEO_HEVC_PPS (V4L2_CID_MPEG_BASE + 1009)
#define V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS (V4L2_CID_MPEG_BASE + 1010) #define V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS (V4L2_CID_MPEG_BASE + 1010)
#define V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX (V4L2_CID_MPEG_BASE + 1011)
#define V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE (V4L2_CID_MPEG_BASE + 1015) #define V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE (V4L2_CID_MPEG_BASE + 1015)
#define V4L2_CID_MPEG_VIDEO_HEVC_START_CODE (V4L2_CID_MPEG_BASE + 1016) #define V4L2_CID_MPEG_VIDEO_HEVC_START_CODE (V4L2_CID_MPEG_BASE + 1016)
...@@ -26,6 +27,7 @@ ...@@ -26,6 +27,7 @@
#define V4L2_CTRL_TYPE_HEVC_SPS 0x0120 #define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
#define V4L2_CTRL_TYPE_HEVC_PPS 0x0121 #define V4L2_CTRL_TYPE_HEVC_PPS 0x0121
#define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0122 #define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0122
#define V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX 0x0123
enum v4l2_mpeg_video_hevc_decode_mode { enum v4l2_mpeg_video_hevc_decode_mode {
V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED, V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED,
...@@ -209,4 +211,13 @@ struct v4l2_ctrl_hevc_slice_params { ...@@ -209,4 +211,13 @@ struct v4l2_ctrl_hevc_slice_params {
__u64 flags; __u64 flags;
}; };
struct v4l2_ctrl_hevc_scaling_matrix {
__u8 scaling_list_4x4[6][16];
__u8 scaling_list_8x8[6][64];
__u8 scaling_list_16x16[6][64];
__u8 scaling_list_32x32[2][64];
__u8 scaling_list_dc_coef_16x16[6];
__u8 scaling_list_dc_coef_32x32[2];
};
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册