All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
To: linux-media@vger.kernel.org
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Nicolas Dufresne <nicolas@ndufresne.ca>,
	Stanimir Varbanov <stanimir.varbanov@linaro.org>
Subject: [RFC/WIP v2 2/6] v4l: Add HEIF control class and control IDs
Date: Thu,  3 Mar 2022 16:10:06 +0200	[thread overview]
Message-ID: <20220303141010.573408-3-stanimir.varbanov@linaro.org> (raw)
In-Reply-To: <20220303141010.573408-1-stanimir.varbanov@linaro.org>

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

diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-heif.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-heif.rst
new file mode 100644
index 000000000000..e2a7f45a3821
--- /dev/null
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-heif.rst
@@ -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.
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
index 54ca4e6b820b..31d05fac9dac 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
@@ -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;
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index c8e0f84d204d..45a3b399272c 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -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
-- 
2.25.1


  parent reply	other threads:[~2022-03-03 14:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03 14:10 [RFC/WIP v2 0/6] HEIC image encoder Stanimir Varbanov
2022-03-03 14:10 ` [RFC/WIP v2 1/6] media: Add HEIF HEVC compressed pixel format Stanimir Varbanov
2022-03-03 14:10 ` Stanimir Varbanov [this message]
2022-03-03 14:10 ` [RFC/WIP v2 3/6] docs: dev-encoder: Add additional steps for image encoding Stanimir Varbanov
2022-03-03 14:10 ` [RFC/WIP v2 4/6] venus: helpers: Add a new helper for buffer processing Stanimir Varbanov
2022-03-03 14:10 ` [RFC/WIP v2 5/6] venus: hfi: Add hfi property for enable grid Stanimir Varbanov
2022-03-03 14:10 ` [RFC/WIP v2 6/6] venus: Add HEIC image encoder Stanimir Varbanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220303141010.573408-3-stanimir.varbanov@linaro.org \
    --to=stanimir.varbanov@linaro.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=nicolas@ndufresne.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.