[PATCH v5 07/17] media: uapi: HEVC: Add SEI pic struct flags

From: Benjamin Gaignard
Date: Thu Apr 07 2022 - 11:30:08 EST


The possible values for field_pic field in v4l2_hevc_dpb_entry
structure are defined table D.2 in HEVC specification section D.3.3.
Add flags and documentation for each of them.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@xxxxxxxxxxxxx>
---
.../media/v4l/ext-ctrls-codec.rst | 54 +++++++++++++++++++
include/media/hevc-ctrls.h | 14 +++++
2 files changed, 68 insertions(+)

diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
index c679b17b4426..b44ea85c6f0e 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
@@ -3193,6 +3193,7 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -
* - __u8
- ``field_pic``
- Whether the reference is a field picture or a frame.
+ See :ref:`HEVC dpb field pic Flags <hevc_dpb_field_pic_flags>`
* - __u16
- ``pic_order_cnt[2]``
- The picture order count of the reference. Only the first element of the
@@ -3206,6 +3207,59 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -

\normalsize

+.. _hevc_dpb_field_pic_flags:
+
+``HEVC dpb field pic Flags``
+
+.. raw:: latex
+
+ \scriptsize
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+ :widths: 1 1 2
+
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_FRAME``
+ - 0
+ - (progressive) Frame
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_TOP_FIELD``
+ - 1
+ - Top field
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_FIELD``
+ - 2
+ - Bottom field
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_TOP_BOTTOM``
+ - 3
+ - Top field, bottom field, in that order
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_TOP``
+ - 4
+ - Bottom field, top field, in that order
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_TOP_BOTTOM_TOP``
+ - 5
+ - Top field, bottom field, top field repeated, in that order
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM``
+ - 6
+ - Bottom field, top field, bottom field repeated, in that order
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING``
+ - 7
+ - Frame doubling
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING``
+ - 8
+ - Frame tripling
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM``
+ - 9
+ - Top field paired with previous bottom field in output order
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP``
+ - 10
+ - Bottom field paired with previous top field in output order
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM``
+ - 11
+ - Top field paired with next bottom field in output order
+ * - ``V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP``
+ - 12
+ - Bottom field paired with next top field in output order
+
.. c:type:: v4l2_hevc_pred_weight_table

.. raw:: latex
diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
index 2812778b41f4..e76a23e22a35 100644
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -132,6 +132,20 @@ struct v4l2_ctrl_hevc_pps {

#define V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE 0x01

+#define V4L2_HEVC_SEI_PIC_STRUCT_FRAME 0
+#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_FIELD 1
+#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_FIELD 2
+#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_BOTTOM 3
+#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_TOP 4
+#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_BOTTOM_TOP 5
+#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM 6
+#define V4L2_HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING 7
+#define V4L2_HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING 8
+#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM 9
+#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP 10
+#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM 11
+#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP 12
+
#define V4L2_HEVC_DPB_ENTRIES_NUM_MAX 16

struct v4l2_hevc_dpb_entry {
--
2.32.0