new file mode 100644
@@ -0,0 +1,47 @@
+.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+
+.. _heif-controls:
+
+**********************
+HEIF Control Reference
+**********************
+
+The HEIF (High Efficiency Image File Format) class includes controls for
+common features of HEIF encoders.
+
+.. _heif-control-id:
+
+HEIF Control IDs
+================
+
+``V4L2_CID_HEIF_CLASS (class)``
+ The HEIF class descriptor. Calling :ref:`VIDIOC_QUERYCTRL` for this
+ control will return a description of this control class.
+
+.. _heif-hevc-grid-controls:
+
+The following controls are used to describe the parameters for derived
+image item of type 'grid'. The encoded input image will be divided on
+NxM grids with grid_width by grid_height pixels. The input width and
+height will satisfy the following equation:
+
+grid_width * grid_columns >= input_image_width
+grid_height * grid_rows >= input_image_height
+
+All grids shall have the same grid_width and grid_height.
+
+``V4L2_CID_HEIF_HEVC_GRID_WIDTH (integer)``
+ Specify the grid width in pixels.
+
+``V4L2_CID_HEIF_HEVC_GRID_HEIGHT (integer)``
+ Specify the grid height in pixels.
+
+``V4L2_CID_HEIF_HEVC_GRID_ROWS (integer)``
+ Specify the number of grid rows. If client sets grid rows and columns to 1,
+ no image division will be applied.
+
+``V4L2_CID_HEIF_HEVC_GRID_COLUMNS (integer)``
+ Specify the number of grid columns. If client sets grid rows and columns to 1,
+ no image division will be applied.
+
+For more details about HEIF specification, refer to ISO/IEC 23008-12:2017.
@@ -1186,6 +1186,15 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_COLORIMETRY_CLASS: return "Colorimetry Controls";
case V4L2_CID_COLORIMETRY_HDR10_CLL_INFO: return "HDR10 Content Light Info";
case V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY: return "HDR10 Mastering Display";
+
+ /* HEIF controls */
+ /* Keep the order of the 'case's the same as in v4l2-controls.h! */
+ case V4L2_CID_HEIF_CLASS: return "HEIF Controls";
+ case V4L2_CID_HEIF_HEVC_GRID_WIDTH: return "HEIF HEVC Grid Width";
+ case V4L2_CID_HEIF_HEVC_GRID_HEIGHT: return "HEIF HEVC Grid Height";
+ case V4L2_CID_HEIF_HEVC_GRID_ROWS: return "HEIF HEVC Grid Rows";
+ case V4L2_CID_HEIF_HEVC_GRID_COLUMNS: return "HEIF HEVC Grid Columns";
+
default:
return NULL;
}
@@ -1391,6 +1400,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_DETECT_CLASS:
case V4L2_CID_CODEC_STATELESS_CLASS:
case V4L2_CID_COLORIMETRY_CLASS:
+ case V4L2_CID_HEIF_CLASS:
*type = V4L2_CTRL_TYPE_CTRL_CLASS;
/* You can neither read nor write these */
*flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
@@ -68,6 +68,7 @@
#define V4L2_CTRL_CLASS_DETECT 0x00a30000 /* Detection controls */
#define V4L2_CTRL_CLASS_CODEC_STATELESS 0x00a40000 /* Stateless codecs controls */
#define V4L2_CTRL_CLASS_COLORIMETRY 0x00a50000 /* Colorimetry controls */
+#define V4L2_CTRL_CLASS_HEIF 0x00a60000 /* HEIF controls */
/* User-class control IDs */
@@ -2302,6 +2303,14 @@ struct v4l2_ctrl_vp9_compressed_hdr {
struct v4l2_vp9_mv_probs mv;
};
+#define V4L2_CID_HEIF_CLASS_BASE (V4L2_CTRL_CLASS_HEIF | 0x900)
+#define V4L2_CID_HEIF_CLASS (V4L2_CTRL_CLASS_HEIF | 1)
+
+#define V4L2_CID_HEIF_HEVC_GRID_WIDTH (V4L2_CID_HEIF_CLASS_BASE + 0)
+#define V4L2_CID_HEIF_HEVC_GRID_HEIGHT (V4L2_CID_HEIF_CLASS_BASE + 1)
+#define V4L2_CID_HEIF_HEVC_GRID_ROWS (V4L2_CID_HEIF_CLASS_BASE + 2)
+#define V4L2_CID_HEIF_HEVC_GRID_COLUMNS (V4L2_CID_HEIF_CLASS_BASE + 3)
+
/* MPEG-compression definitions kept for backwards compatibility */
#ifndef __KERNEL__
#define V4L2_CTRL_CLASS_MPEG V4L2_CTRL_CLASS_CODEC
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> --- .../media/v4l/ext-ctrls-heif.rst | 47 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 10 ++++ include/uapi/linux/v4l2-controls.h | 9 ++++ 3 files changed, 66 insertions(+) create mode 100644 Documentation/userspace-api/media/v4l/ext-ctrls-heif.rst