Browse Source

include: Update headers to latest series

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Paul Kocialkowski 6 years ago
parent
commit
b5cee9f480
3 changed files with 39 additions and 28 deletions
  1. 23 16
      include/h264-ctrls.h
  2. 10 6
      include/hevc-ctrls.h
  3. 6 6
      src/h264.c

+ 23 - 16
include/h264-ctrls.h

@@ -11,6 +11,11 @@
 #ifndef _H264_CTRLS_H_
 #ifndef _H264_CTRLS_H_
 #define _H264_CTRLS_H_
 #define _H264_CTRLS_H_
 
 
+#include <linux/videodev2.h>
+
+/* Our pixel format isn't stable at the moment */
+#define V4L2_PIX_FMT_H264_SLICE_RAW v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */
+
 /*
 /*
  * This is put insanely high to avoid conflicting with controls that
  * This is put insanely high to avoid conflicting with controls that
  * would be added during the phase where those controls are not
  * would be added during the phase where those controls are not
@@ -23,11 +28,11 @@
 #define V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS	(V4L2_CID_MPEG_BASE+1004)
 #define V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS	(V4L2_CID_MPEG_BASE+1004)
 
 
 /* enum v4l2_ctrl_type type values */
 /* enum v4l2_ctrl_type type values */
-#define V4L2_CTRL_TYPE_H264_SPS 0x0105
-#define	V4L2_CTRL_TYPE_H264_PPS 0x0106
-#define	V4L2_CTRL_TYPE_H264_SCALING_MATRIX 0x0107
-#define	V4L2_CTRL_TYPE_H264_SLICE_PARAMS 0x0108
-#define	V4L2_CTRL_TYPE_H264_DECODE_PARAMS 0x0109
+#define V4L2_CTRL_TYPE_H264_SPS			0x0110
+#define V4L2_CTRL_TYPE_H264_PPS			0x0111
+#define V4L2_CTRL_TYPE_H264_SCALING_MATRIX	0x0112
+#define V4L2_CTRL_TYPE_H264_SLICE_PARAMS	0x0113
+#define V4L2_CTRL_TYPE_H264_DECODE_PARAMS	0x0114
 
 
 #define V4L2_H264_SPS_CONSTRAINT_SET0_FLAG			0x01
 #define V4L2_H264_SPS_CONSTRAINT_SET0_FLAG			0x01
 #define V4L2_H264_SPS_CONSTRAINT_SET1_FLAG			0x02
 #define V4L2_H264_SPS_CONSTRAINT_SET1_FLAG			0x02
@@ -94,10 +99,10 @@ struct v4l2_ctrl_h264_scaling_matrix {
 };
 };
 
 
 struct v4l2_h264_weight_factors {
 struct v4l2_h264_weight_factors {
-	__s8 luma_weight[32];
-	__s8 luma_offset[32];
-	__s8 chroma_weight[32][2];
-	__s8 chroma_offset[32][2];
+	__s16 luma_weight[32];
+	__s16 luma_offset[32];
+	__s16 chroma_weight[32][2];
+	__s16 chroma_offset[32][2];
 };
 };
 
 
 struct v4l2_h264_pred_weight_table {
 struct v4l2_h264_pred_weight_table {
@@ -117,7 +122,7 @@ struct v4l2_h264_pred_weight_table {
 #define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED	0x04
 #define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED	0x04
 #define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH		0x08
 #define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH		0x08
 
 
-struct v4l2_ctrl_h264_slice_param {
+struct v4l2_ctrl_h264_slice_params {
 	/* Size in bytes, including header */
 	/* Size in bytes, including header */
 	__u32 size;
 	__u32 size;
 	/* Offset in bits to slice_data() from the beginning of this slice. */
 	/* Offset in bits to slice_data() from the beginning of this slice. */
@@ -153,7 +158,7 @@ struct v4l2_ctrl_h264_slice_param {
 
 
 	/*
 	/*
 	 * Entries on each list are indices into
 	 * Entries on each list are indices into
-	 * v4l2_ctrl_h264_decode_param.dpb[].
+	 * v4l2_ctrl_h264_decode_params.dpb[].
 	 */
 	 */
 	__u8 ref_pic_list0[32];
 	__u8 ref_pic_list0[32];
 	__u8 ref_pic_list1[32];
 	__u8 ref_pic_list1[32];
@@ -166,7 +171,7 @@ struct v4l2_ctrl_h264_slice_param {
 #define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM	0x04
 #define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM	0x04
 
 
 struct v4l2_h264_dpb_entry {
 struct v4l2_h264_dpb_entry {
-	__u64 timestamp;
+	__u64 reference_ts;
 	__u16 frame_num;
 	__u16 frame_num;
 	__u16 pic_num;
 	__u16 pic_num;
 	/* Note that field is indicated by v4l2_buffer.field */
 	/* Note that field is indicated by v4l2_buffer.field */
@@ -175,16 +180,18 @@ struct v4l2_h264_dpb_entry {
 	__u32 flags; /* V4L2_H264_DPB_ENTRY_FLAG_* */
 	__u32 flags; /* V4L2_H264_DPB_ENTRY_FLAG_* */
 };
 };
 
 
-struct v4l2_ctrl_h264_decode_param {
-	__u32 num_slices;
-	__u16 idr_pic_flag;
+#define V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC	0x01
+
+struct v4l2_ctrl_h264_decode_params {
+	struct v4l2_h264_dpb_entry dpb[16];
+	__u16 num_slices;
 	__u16 nal_ref_idc;
 	__u16 nal_ref_idc;
 	__u8 ref_pic_list_p0[32];
 	__u8 ref_pic_list_p0[32];
 	__u8 ref_pic_list_b0[32];
 	__u8 ref_pic_list_b0[32];
 	__u8 ref_pic_list_b1[32];
 	__u8 ref_pic_list_b1[32];
 	__s32 top_field_order_cnt;
 	__s32 top_field_order_cnt;
 	__s32 bottom_field_order_cnt;
 	__s32 bottom_field_order_cnt;
-	struct v4l2_h264_dpb_entry dpb[16];
+	__u32 flags; /* V4L2_H264_DECODE_PARAM_FLAG_* */
 };
 };
 
 
 #endif
 #endif

+ 10 - 6
include/hevc-ctrls.h

@@ -11,19 +11,23 @@
 #ifndef _HEVC_CTRLS_H_
 #ifndef _HEVC_CTRLS_H_
 #define _HEVC_CTRLS_H_
 #define _HEVC_CTRLS_H_
 
 
-#define V4L2_CID_MPEG_VIDEO_HEVC_SPS		(V4L2_CID_MPEG_BASE + 645)
-#define V4L2_CID_MPEG_VIDEO_HEVC_PPS		(V4L2_CID_MPEG_BASE + 646)
-#define V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS	(V4L2_CID_MPEG_BASE + 647)
+/* The pixel format isn't stable at the moment and will likely be renamed. */
+#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */
+
+#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_SLICE_PARAMS	(V4L2_CID_MPEG_BASE + 1010)
 
 
 /* enum v4l2_ctrl_type type values */
 /* enum v4l2_ctrl_type type values */
-#define V4L2_CTRL_TYPE_HEVC_SPS 0x0110
-#define V4L2_CTRL_TYPE_HEVC_PPS 0x0111
-#define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0112
+#define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
+#define V4L2_CTRL_TYPE_HEVC_PPS 0x0121
+#define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0122
 
 
 #define V4L2_HEVC_SLICE_TYPE_B	0
 #define V4L2_HEVC_SLICE_TYPE_B	0
 #define V4L2_HEVC_SLICE_TYPE_P	1
 #define V4L2_HEVC_SLICE_TYPE_P	1
 #define V4L2_HEVC_SLICE_TYPE_I	2
 #define V4L2_HEVC_SLICE_TYPE_I	2
 
 
+/* The controls are not stable at the moment and will likely be reworked. */
 struct v4l2_ctrl_hevc_sps {
 struct v4l2_ctrl_hevc_sps {
 	/* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
 	/* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
 	__u8	chroma_format_idc;
 	__u8	chroma_format_idc;

+ 6 - 6
src/h264.c

@@ -177,7 +177,7 @@ static void dpb_update(struct object_context *context,
 
 
 static void h264_fill_dpb(struct request_data *data,
 static void h264_fill_dpb(struct request_data *data,
 			  struct object_context *context,
 			  struct object_context *context,
-			  struct v4l2_ctrl_h264_decode_param *decode)
+			  struct v4l2_ctrl_h264_decode_params *decode)
 {
 {
 	int i;
 	int i;
 
 
@@ -193,7 +193,7 @@ static void h264_fill_dpb(struct request_data *data,
 
 
 		if (surface) {
 		if (surface) {
 			timestamp = v4l2_timeval_to_ns(&surface->timestamp);
 			timestamp = v4l2_timeval_to_ns(&surface->timestamp);
-			dpb->timestamp = timestamp;
+			dpb->reference_ts = timestamp;
 		}
 		}
 
 
 		dpb->frame_num = entry->pic.frame_idx;
 		dpb->frame_num = entry->pic.frame_idx;
@@ -214,7 +214,7 @@ static void h264_va_picture_to_v4l2(struct request_data *driver_data,
 				    struct object_context *context,
 				    struct object_context *context,
 				    struct object_surface *surface,
 				    struct object_surface *surface,
 				    VAPictureParameterBufferH264 *VAPicture,
 				    VAPictureParameterBufferH264 *VAPicture,
-				    struct v4l2_ctrl_h264_decode_param *decode,
+				    struct v4l2_ctrl_h264_decode_params *decode,
 				    struct v4l2_ctrl_h264_pps *pps,
 				    struct v4l2_ctrl_h264_pps *pps,
 				    struct v4l2_ctrl_h264_sps *sps)
 				    struct v4l2_ctrl_h264_sps *sps)
 {
 {
@@ -327,7 +327,7 @@ static void h264_va_slice_to_v4l2(struct request_data *driver_data,
 				  struct object_context *context,
 				  struct object_context *context,
 				  VASliceParameterBufferH264 *VASlice,
 				  VASliceParameterBufferH264 *VASlice,
 				  VAPictureParameterBufferH264 *VAPicture,
 				  VAPictureParameterBufferH264 *VAPicture,
-				  struct v4l2_ctrl_h264_slice_param *slice)
+				  struct v4l2_ctrl_h264_slice_params *slice)
 {
 {
 	slice->size = VASlice->slice_data_size;
 	slice->size = VASlice->slice_data_size;
 	slice->header_bit_size = VASlice->slice_data_bit_offset;
 	slice->header_bit_size = VASlice->slice_data_bit_offset;
@@ -410,8 +410,8 @@ int h264_set_controls(struct request_data *driver_data,
 		      struct object_surface *surface)
 		      struct object_surface *surface)
 {
 {
 	struct v4l2_ctrl_h264_scaling_matrix matrix = { 0 };
 	struct v4l2_ctrl_h264_scaling_matrix matrix = { 0 };
-	struct v4l2_ctrl_h264_decode_param decode = { 0 };
-	struct v4l2_ctrl_h264_slice_param slice = { 0 };
+	struct v4l2_ctrl_h264_decode_params decode = { 0 };
+	struct v4l2_ctrl_h264_slice_params slice = { 0 };
 	struct v4l2_ctrl_h264_pps pps = { 0 };
 	struct v4l2_ctrl_h264_pps pps = { 0 };
 	struct v4l2_ctrl_h264_sps sps = { 0 };
 	struct v4l2_ctrl_h264_sps sps = { 0 };
 	struct h264_dpb_entry *output;
 	struct h264_dpb_entry *output;