Skip to contentSkip to conversation

media: v4l2-ctrl: Add base layer priority id control.

PATCH Superseded Dikshita Agarwal 2 participants 2 messages Oct 15, 2020 – Nov 17, 2020

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 media: v4l2-ctrl: Add base layer priority id control.

This control indicates the priority id to be applied to base layer.

---
 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 9 +++++++++
 drivers/media/v4l2-core/v4l2-ctrls.c                      | 1 +
 include/uapi/linux/v4l2-controls.h                        | 1 +
 3 files changed, 11 insertions(+)
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +9 -0
index 6e9240a..aac1ea3 100644
@@ -4407,3 +4407,12 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
        to the LTR index max LTR count-1.
        This is applicable to H264 and HEVC encoder and can be applied using
        request api.
+
+``V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITYID (integer)``
+       Specifies a priority identifier for the NAL unit,
+       which will be applied to base layer.
+       By default this value is set to 0 for base layer.
+       And the next layer will have priority ID assigned as 1,2,3 and so on.
+       Video encode can't decide the priority id to be applied to a layer
+       so this has to come from client.
+       Valid Range: from 0 to 63
drivers/media/v4l2-core/v4l2-ctrls.c +1 -0
index 046198f..c973058 100644
@@ -952,6 +952,7 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_MPEG_VIDEO_LTR_COUNT:			return "LTR Count";
 	case V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX:		return "Mark LTR frame index";
 	case V4L2_CID_MPEG_VIDEO_USE_LTR_FRAME:			return "Use LTR Frame";
+	case V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITYID:		return "Base Layer Priority ID";
 	case V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS:		return "MPEG-2 Slice Parameters";
 	case V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION:		return "MPEG-2 Quantization Matrices";
 	case V4L2_CID_MPEG_VIDEO_FWHT_PARAMS:			return "FWHT Stateless Parameters";
include/uapi/linux/v4l2-controls.h +1 -0
index 3801372..433e119 100644
@@ -418,6 +418,7 @@ enum v4l2_mpeg_video_multi_slice_mode {
 #define V4L2_CID_MPEG_VIDEO_LTR_COUNT                  (V4L2_CID_MPEG_BASE+230)
 #define V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX            (V4L2_CID_MPEG_BASE+231)
 #define V4L2_CID_MPEG_VIDEO_USE_LTR_FRAME              (V4L2_CID_MPEG_BASE+232)
+#define V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITYID       (V4L2_CID_MPEG_BASE+233)
 
 /* CIDs for the MPEG-2 Part 2 (H.262) codec */
 #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL			(V4L2_CID_MPEG_BASE+270)
Signature · 1 line
1.9.1
#1 lore raw

Nicolas, can you take a look at this with your codec knowledge?

Some other review comments below:

Quoted 15 lines · Dikshita Agarwal

This control indicates the priority id to be applied to base layer.

---
 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 9 +++++++++
 drivers/media/v4l2-core/v4l2-ctrls.c                      | 1 +
 include/uapi/linux/v4l2-controls.h                        | 1 +
 3 files changed, 11 insertions(+)
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +0 -0
index 6e9240a..aac1ea3 100644

Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst enum v4l2_mpeg_video_hevc_size_of_length_field - · line 4411

Quoted 5 lines
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +2 -0
@@ -4407,3 +4407,12 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
        to the LTR index max LTR count-1.
        This is applicable to H264 and HEVC encoder and can be applied using
        request api.
+
+``V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITYID (integer)``

I'd add a_ before the ID, so: V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID.

Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst enum v4l2_mpeg_video_hevc_size_of_length_field - · line 4418

Quoted 7 lines
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +7 -0
+       Specifies a priority identifier for the NAL unit,
+       which will be applied to base layer.
+       By default this value is set to 0 for base layer.
+       And the next layer will have priority ID assigned as 1,2,3 and so on.
+       Video encode can't decide the priority id to be applied to a layer
+       so this has to come from client.
+       Valid Range: from 0 to 63

I'm slightly rephrasing the text above:

Specifies a priority identifier for the NAL unit, which will be applied to the base layer. By default this value is set to 0 for the base layer, and the next layer will have the priority ID assigned as 1, 2, 3 and so on. The video encoder can't decide the priority id to be applied to a layer, so this has to come from client.
Valid Range: from 0 to 63.

For which codecs is this applicable? H264 and HEVC? That should be stated. If you have a reference to the corresponding sections that describe this, then that would be nice to add.

Quoted 18 lines
drivers/media/v4l2-core/v4l2-ctrls.c +1 -0
index 046198f..c973058 100644
@@ -952,6 +952,7 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_MPEG_VIDEO_LTR_COUNT:			return "LTR Count";
 	case V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX:		return "Mark LTR frame index";
 	case V4L2_CID_MPEG_VIDEO_USE_LTR_FRAME:			return "Use LTR Frame";
+	case V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITYID:		return "Base Layer Priority ID";
 	case V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS:		return "MPEG-2 Slice Parameters";
 	case V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION:		return "MPEG-2 Quantization Matrices";
 	case V4L2_CID_MPEG_VIDEO_FWHT_PARAMS:			return "FWHT Stateless Parameters";
include/uapi/linux/v4l2-controls.h +0 -0
index 3801372..433e119 100644

include/uapi/linux/v4l2-controls.h enum v4l2_mpeg_video_multi_slice_mode { · line 424

Quoted 7 lines
include/uapi/linux/v4l2-controls.h +1 -0
@@ -418,6 +418,7 @@ enum v4l2_mpeg_video_multi_slice_mode {
 #define V4L2_CID_MPEG_VIDEO_LTR_COUNT                  (V4L2_CID_MPEG_BASE+230)
 #define V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX            (V4L2_CID_MPEG_BASE+231)
 #define V4L2_CID_MPEG_VIDEO_USE_LTR_FRAME              (V4L2_CID_MPEG_BASE+232)
+#define V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITYID       (V4L2_CID_MPEG_BASE+233)
 
 /* CIDs for the MPEG-2 Part 2 (H.262) codec */
 #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL			(V4L2_CID_MPEG_BASE+270)

Regards,

Hans