Commit 1f0545d3 authored by Pawel Osciak's avatar Pawel Osciak Committed by Mauro Carvalho Chehab

media: uapi: Add H264 low-level decoder API compound controls.

Stateless video codecs will require both the H264 metadata and slices in
order to be able to decode frames.

This introduces the definitions for the structures used to pass the
metadata from the userspace to the kernel.

[hverkuil-cisco@xs4all.nl: add space after . in ".For"]
[hverkuil-cisco@xs4all.nl: sync v4l2_ctrl_h264_decode_params struct layout with header]
Co-developed-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: default avatarTomasz Figa <tfiga@chromium.org>
Signed-off-by: default avatarPawel Osciak <posciak@chromium.org>
Signed-off-by: default avatarGuenter Roeck <groeck@chromium.org>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 9d7a1bed
......@@ -122,6 +122,15 @@ ITU BT.1119
:author: International Telecommunication Union (http://www.itu.ch)
.. _h264:
ITU-T Rec. H.264 Specification (04/2017 Edition)
================================================
:title: ITU-T Recommendation H.264 "Advanced Video Coding for Generic Audiovisual Services"
:author: International Telecommunication Union (http://www.itu.ch)
.. _jfif:
JFIF
......
......@@ -443,6 +443,36 @@ See also the examples in :ref:`control`.
- n/a
- A struct :c:type:`v4l2_ctrl_mpeg2_quantization`, containing MPEG-2
quantization matrices for stateless video decoders.
* - ``V4L2_CTRL_TYPE_H264_SPS``
- n/a
- n/a
- n/a
- A struct :c:type:`v4l2_ctrl_h264_sps`, containing H264
sequence parameters for stateless video decoders.
* - ``V4L2_CTRL_TYPE_H264_PPS``
- n/a
- n/a
- n/a
- A struct :c:type:`v4l2_ctrl_h264_pps`, containing H264
picture parameters for stateless video decoders.
* - ``V4L2_CTRL_TYPE_H264_SCALING_MATRIX``
- n/a
- n/a
- n/a
- A struct :c:type:`v4l2_ctrl_h264_scaling_matrix`, containing H264
scaling matrices for stateless video decoders.
* - ``V4L2_CTRL_TYPE_H264_SLICE_PARAMS``
- n/a
- n/a
- n/a
- A struct :c:type:`v4l2_ctrl_h264_slice_params`, containing H264
slice parameters for stateless video decoders.
* - ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``
- n/a
- n/a
- n/a
- A struct :c:type:`v4l2_ctrl_h264_decode_params`, containing H264
decode parameters for stateless video decoders.
.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
......
......@@ -136,6 +136,11 @@ replace symbol V4L2_CTRL_TYPE_U32 :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_U8 :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_MPEG2_QUANTIZATION :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_H264_SPS :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_H264_PPS :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_H264_SCALING_MATRIX :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_H264_SLICE_PARAMS :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_H264_DECODE_PARAMS :c:type:`v4l2_ctrl_type`
# V4L2 capability defines
replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities
......
......@@ -851,6 +851,11 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP: return "H264 I-Frame Maximum QP Value";
case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP: return "H264 P-Frame Minimum QP Value";
case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP: return "H264 P-Frame Maximum QP Value";
case V4L2_CID_MPEG_VIDEO_H264_SPS: return "H264 Sequence Parameter Set";
case V4L2_CID_MPEG_VIDEO_H264_PPS: return "H264 Picture Parameter Set";
case V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX: return "H264 Scaling Matrix";
case V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS: return "H264 Slice Parameters";
case V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS: return "H264 Decode Parameters";
case V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL: return "MPEG2 Level";
case V4L2_CID_MPEG_VIDEO_MPEG2_PROFILE: return "MPEG2 Profile";
case V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP: return "MPEG4 I-Frame QP Value";
......@@ -1337,6 +1342,21 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_FWHT_PARAMS:
*type = V4L2_CTRL_TYPE_FWHT_PARAMS;
break;
case V4L2_CID_MPEG_VIDEO_H264_SPS:
*type = V4L2_CTRL_TYPE_H264_SPS;
break;
case V4L2_CID_MPEG_VIDEO_H264_PPS:
*type = V4L2_CTRL_TYPE_H264_PPS;
break;
case V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX:
*type = V4L2_CTRL_TYPE_H264_SCALING_MATRIX;
break;
case V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS:
*type = V4L2_CTRL_TYPE_H264_SLICE_PARAMS;
break;
case V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS:
*type = V4L2_CTRL_TYPE_H264_DECODE_PARAMS;
break;
default:
*type = V4L2_CTRL_TYPE_INTEGER;
break;
......@@ -1724,6 +1744,13 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
case V4L2_CTRL_TYPE_FWHT_PARAMS:
return 0;
case V4L2_CTRL_TYPE_H264_SPS:
case V4L2_CTRL_TYPE_H264_PPS:
case V4L2_CTRL_TYPE_H264_SCALING_MATRIX:
case V4L2_CTRL_TYPE_H264_SLICE_PARAMS:
case V4L2_CTRL_TYPE_H264_DECODE_PARAMS:
return 0;
default:
return -EINVAL;
}
......@@ -2307,6 +2334,21 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
case V4L2_CTRL_TYPE_FWHT_PARAMS:
elem_size = sizeof(struct v4l2_ctrl_fwht_params);
break;
case V4L2_CTRL_TYPE_H264_SPS:
elem_size = sizeof(struct v4l2_ctrl_h264_sps);
break;
case V4L2_CTRL_TYPE_H264_PPS:
elem_size = sizeof(struct v4l2_ctrl_h264_pps);
break;
case V4L2_CTRL_TYPE_H264_SCALING_MATRIX:
elem_size = sizeof(struct v4l2_ctrl_h264_scaling_matrix);
break;
case V4L2_CTRL_TYPE_H264_SLICE_PARAMS:
elem_size = sizeof(struct v4l2_ctrl_h264_slice_params);
break;
case V4L2_CTRL_TYPE_H264_DECODE_PARAMS:
elem_size = sizeof(struct v4l2_ctrl_h264_decode_params);
break;
default:
if (type < V4L2_CTRL_COMPOUND_TYPES)
elem_size = sizeof(s32);
......
......@@ -23,11 +23,12 @@
#include <media/media-request.h>
/*
* Include the mpeg2 and fwht stateless codec compound control definitions.
* Include the stateless codec compound control definitions.
* This will move to the public headers once this API is fully stable.
*/
#include <media/mpeg2-ctrls.h>
#include <media/fwht-ctrls.h>
#include <media/h264-ctrls.h>
/* forward references */
struct file;
......@@ -51,6 +52,11 @@ struct poll_table_struct;
* @p_mpeg2_slice_params: Pointer to a MPEG2 slice parameters structure.
* @p_mpeg2_quantization: Pointer to a MPEG2 quantization data structure.
* @p_fwht_params: Pointer to a FWHT stateless parameters structure.
* @p_h264_sps: Pointer to a struct v4l2_ctrl_h264_sps.
* @p_h264_pps: Pointer to a struct v4l2_ctrl_h264_pps.
* @p_h264_scaling_matrix: Pointer to a struct v4l2_ctrl_h264_scaling_matrix.
* @p_h264_slice_params: Pointer to a struct v4l2_ctrl_h264_slice_params.
* @p_h264_decode_params: Pointer to a struct v4l2_ctrl_h264_decode_params.
* @p: Pointer to a compound value.
*/
union v4l2_ctrl_ptr {
......@@ -63,6 +69,11 @@ union v4l2_ctrl_ptr {
struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params;
struct v4l2_ctrl_mpeg2_quantization *p_mpeg2_quantization;
struct v4l2_ctrl_fwht_params *p_fwht_params;
struct v4l2_ctrl_h264_sps *p_h264_sps;
struct v4l2_ctrl_h264_pps *p_h264_pps;
struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix;
struct v4l2_ctrl_h264_slice_params *p_h264_slice_params;
struct v4l2_ctrl_h264_decode_params *p_h264_decode_params;
void *p;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment