From: Ezequiel Garcia <ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org> To: linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>, Nicolas Dufresne <nicolas.dufresne-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>, Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>, Ezequiel Garcia <ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>, Tomasz Figa <tfiga-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>, Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, Hans Verkuil <hans.verkuil-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>, Miouyouyou <myy-tmjzNUIc0P1+EYZtW95mkQ@public.gmane.org>, kernel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org, Shunqian Zheng <zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org> Subject: [PATCH v6 5/6] media: Add controls for JPEG quantization tables Date: Mon, 17 Sep 2018 14:30:20 -0300 [thread overview] Message-ID: <20180917173022.9338-6-ezequiel@collabora.com> (raw) In-Reply-To: <20180917173022.9338-1-ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org> From: Shunqian Zheng <zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org> Add V4L2_CID_JPEG_QUANTIZATION compound control to allow userspace configure the JPEG quantization tables. Signed-off-by: Shunqian Zheng <zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org> Signed-off-by: Ezequiel Garcia <ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org> --- .../media/uapi/v4l/extended-controls.rst | 25 +++++++++++++++++++ .../media/videodev2.h.rst.exceptions | 1 + drivers/media/v4l2-core/v4l2-ctrls.c | 8 ++++++ include/uapi/linux/v4l2-controls.h | 10 ++++++++ include/uapi/linux/videodev2.h | 1 + 5 files changed, 45 insertions(+) diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index 65a1d873196b..6effae175be1 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -3530,7 +3530,32 @@ JPEG Control IDs Specify which JPEG markers are included in compressed stream. This control is valid only for encoders. +.. _jpeg-quant-tables-control: +``V4L2_CID_JPEG_QUANTIZATION (struct)`` + Specifies the luma and chroma quantization matrices for encoding + or decoding a V4L2_PIX_FMT_JPEG_RAW format buffer. + This control supports 8-bit quantization coefficients, for + the baseline profile, as specified by :ref:`itu-t81`. + Coefficients must be set in JPEG zigzag scan order. + + +.. c:type:: struct v4l2_ctrl_jpeg_quantization + +.. cssclass:: longtable + +.. flat-table:: struct v4l2_ctrl_jpeg_quantization + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __u8 + - ``luma_quantization_matrix[64]`` + - Sets the luma quantization table. + + * - __u8 + - ``chroma_quantization_matrix[64]`` + - Sets the chroma quantization table. .. flat-table:: :header-rows: 0 diff --git a/Documentation/media/videodev2.h.rst.exceptions b/Documentation/media/videodev2.h.rst.exceptions index 1c043d552313..fbdd827e4229 100644 --- a/Documentation/media/videodev2.h.rst.exceptions +++ b/Documentation/media/videodev2.h.rst.exceptions @@ -131,6 +131,7 @@ replace symbol V4L2_CTRL_TYPE_U32 :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_U8 :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_MPEG2_QUANTIZATION :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_JPEG_QUANTIZATION :c:type:`v4l2_ctrl_type` # V4L2 capability defines replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index dfdc31edb1dd..7b913a461b2e 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1001,6 +1001,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_JPEG_RESTART_INTERVAL: return "Restart Interval"; case V4L2_CID_JPEG_COMPRESSION_QUALITY: return "Compression Quality"; case V4L2_CID_JPEG_ACTIVE_MARKER: return "Active Markers"; + case V4L2_CID_JPEG_QUANTIZATION: return "JPEG Quantization Tables"; /* Image source controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1288,6 +1289,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_DETECT_MD_REGION_GRID: *type = V4L2_CTRL_TYPE_U8; break; + case V4L2_CID_JPEG_QUANTIZATION: + *type = V4L2_CTRL_TYPE_JPEG_QUANTIZATION; + break; case V4L2_CID_DETECT_MD_THRESHOLD_GRID: *type = V4L2_CTRL_TYPE_U16; break; @@ -1667,6 +1671,7 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx, return 0; case V4L2_CTRL_TYPE_MPEG2_QUANTIZATION: + case V4L2_CTRL_TYPE_JPEG_QUANTIZATION: return 0; default: @@ -2249,6 +2254,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_MPEG2_QUANTIZATION: elem_size = sizeof(struct v4l2_ctrl_mpeg2_quantization); break; + case V4L2_CTRL_TYPE_JPEG_QUANTIZATION: + elem_size = sizeof(struct v4l2_ctrl_jpeg_quantization); + break; default: if (type < V4L2_CTRL_COMPOUND_TYPES) elem_size = sizeof(s32); diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 51b095898f4b..5a8bdb732cfe 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -990,6 +990,16 @@ enum v4l2_jpeg_chroma_subsampling { #define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) #define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) +#define V4L2_CID_JPEG_QUANTIZATION (V4L2_CID_JPEG_CLASS_BASE + 5) +struct v4l2_ctrl_jpeg_quantization { + /* ITU-T.81 specifies two quantization coefficient precisions: + * 8-bit for baseline profile, + * 8-bit or 16-bit for extended profile. + * This control only supports the former, for the baseline profile. + */ + __u8 luma_quantization_matrix[64]; + __u8 chroma_quantization_matrix[64]; +}; /* Image source controls */ #define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 4c979886e8b2..8481a8ea8262 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1661,6 +1661,7 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_U32 = 0x0102, V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS = 0x0103, V4L2_CTRL_TYPE_MPEG2_QUANTIZATION = 0x0104, + V4L2_CTRL_TYPE_JPEG_QUANTIZATION = 0x0105, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ -- 2.19.0.rc2
WARNING: multiple messages have this Message-ID (diff)
From: Ezequiel Garcia <ezequiel@collabora.com> To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org Cc: Hans Verkuil <hans.verkuil@cisco.com>, kernel@collabora.com, Nicolas Dufresne <nicolas.dufresne@collabora.com>, Tomasz Figa <tfiga@chromium.org>, Heiko Stuebner <heiko@sntech.de>, Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Miouyouyou <myy@miouyouyou.fr>, Shunqian Zheng <zhengsq@rock-chips.com>, Ezequiel Garcia <ezequiel@collabora.com> Subject: [PATCH v6 5/6] media: Add controls for JPEG quantization tables Date: Mon, 17 Sep 2018 14:30:20 -0300 [thread overview] Message-ID: <20180917173022.9338-6-ezequiel@collabora.com> (raw) In-Reply-To: <20180917173022.9338-1-ezequiel@collabora.com> From: Shunqian Zheng <zhengsq@rock-chips.com> Add V4L2_CID_JPEG_QUANTIZATION compound control to allow userspace configure the JPEG quantization tables. Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> --- .../media/uapi/v4l/extended-controls.rst | 25 +++++++++++++++++++ .../media/videodev2.h.rst.exceptions | 1 + drivers/media/v4l2-core/v4l2-ctrls.c | 8 ++++++ include/uapi/linux/v4l2-controls.h | 10 ++++++++ include/uapi/linux/videodev2.h | 1 + 5 files changed, 45 insertions(+) diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index 65a1d873196b..6effae175be1 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -3530,7 +3530,32 @@ JPEG Control IDs Specify which JPEG markers are included in compressed stream. This control is valid only for encoders. +.. _jpeg-quant-tables-control: +``V4L2_CID_JPEG_QUANTIZATION (struct)`` + Specifies the luma and chroma quantization matrices for encoding + or decoding a V4L2_PIX_FMT_JPEG_RAW format buffer. + This control supports 8-bit quantization coefficients, for + the baseline profile, as specified by :ref:`itu-t81`. + Coefficients must be set in JPEG zigzag scan order. + + +.. c:type:: struct v4l2_ctrl_jpeg_quantization + +.. cssclass:: longtable + +.. flat-table:: struct v4l2_ctrl_jpeg_quantization + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __u8 + - ``luma_quantization_matrix[64]`` + - Sets the luma quantization table. + + * - __u8 + - ``chroma_quantization_matrix[64]`` + - Sets the chroma quantization table. .. flat-table:: :header-rows: 0 diff --git a/Documentation/media/videodev2.h.rst.exceptions b/Documentation/media/videodev2.h.rst.exceptions index 1c043d552313..fbdd827e4229 100644 --- a/Documentation/media/videodev2.h.rst.exceptions +++ b/Documentation/media/videodev2.h.rst.exceptions @@ -131,6 +131,7 @@ replace symbol V4L2_CTRL_TYPE_U32 :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_U8 :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_MPEG2_QUANTIZATION :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_JPEG_QUANTIZATION :c:type:`v4l2_ctrl_type` # V4L2 capability defines replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index dfdc31edb1dd..7b913a461b2e 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1001,6 +1001,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_JPEG_RESTART_INTERVAL: return "Restart Interval"; case V4L2_CID_JPEG_COMPRESSION_QUALITY: return "Compression Quality"; case V4L2_CID_JPEG_ACTIVE_MARKER: return "Active Markers"; + case V4L2_CID_JPEG_QUANTIZATION: return "JPEG Quantization Tables"; /* Image source controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1288,6 +1289,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_DETECT_MD_REGION_GRID: *type = V4L2_CTRL_TYPE_U8; break; + case V4L2_CID_JPEG_QUANTIZATION: + *type = V4L2_CTRL_TYPE_JPEG_QUANTIZATION; + break; case V4L2_CID_DETECT_MD_THRESHOLD_GRID: *type = V4L2_CTRL_TYPE_U16; break; @@ -1667,6 +1671,7 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx, return 0; case V4L2_CTRL_TYPE_MPEG2_QUANTIZATION: + case V4L2_CTRL_TYPE_JPEG_QUANTIZATION: return 0; default: @@ -2249,6 +2254,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_MPEG2_QUANTIZATION: elem_size = sizeof(struct v4l2_ctrl_mpeg2_quantization); break; + case V4L2_CTRL_TYPE_JPEG_QUANTIZATION: + elem_size = sizeof(struct v4l2_ctrl_jpeg_quantization); + break; default: if (type < V4L2_CTRL_COMPOUND_TYPES) elem_size = sizeof(s32); diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 51b095898f4b..5a8bdb732cfe 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -990,6 +990,16 @@ enum v4l2_jpeg_chroma_subsampling { #define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) #define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) +#define V4L2_CID_JPEG_QUANTIZATION (V4L2_CID_JPEG_CLASS_BASE + 5) +struct v4l2_ctrl_jpeg_quantization { + /* ITU-T.81 specifies two quantization coefficient precisions: + * 8-bit for baseline profile, + * 8-bit or 16-bit for extended profile. + * This control only supports the former, for the baseline profile. + */ + __u8 luma_quantization_matrix[64]; + __u8 chroma_quantization_matrix[64]; +}; /* Image source controls */ #define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 4c979886e8b2..8481a8ea8262 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1661,6 +1661,7 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_U32 = 0x0102, V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS = 0x0103, V4L2_CTRL_TYPE_MPEG2_QUANTIZATION = 0x0104, + V4L2_CTRL_TYPE_JPEG_QUANTIZATION = 0x0105, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ -- 2.19.0.rc2
next prev parent reply other threads:[~2018-09-17 17:30 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-09-17 17:30 [PATCH v6 0/6] Add Rockchip VPU JPEG encoder Ezequiel Garcia 2018-09-17 17:30 ` Ezequiel Garcia [not found] ` <20180917173022.9338-1-ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org> 2018-09-17 17:30 ` [PATCH v6 1/6] dt-bindings: Document the Rockchip VPU bindings Ezequiel Garcia 2018-09-17 17:30 ` Ezequiel Garcia [not found] ` <20180917173022.9338-2-ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org> 2018-09-28 11:53 ` Hans Verkuil 2018-09-28 11:53 ` Hans Verkuil [not found] ` <2184b772-2b40-289f-5537-7ebb693479fd-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org> 2018-10-04 22:24 ` Ezequiel Garcia 2018-10-04 22:24 ` Ezequiel Garcia 2018-09-17 17:30 ` [PATCH v6 2/6] ARM: dts: rockchip: add VPU device node for RK3288 Ezequiel Garcia 2018-09-17 17:30 ` Ezequiel Garcia 2018-09-17 17:30 ` [PATCH v6 3/6] arm64: dts: rockchip: add VPU device node for RK3399 Ezequiel Garcia 2018-09-17 17:30 ` Ezequiel Garcia 2018-09-17 17:30 ` [PATCH v6 4/6] media: Add JPEG_RAW format Ezequiel Garcia 2018-09-17 17:30 ` Ezequiel Garcia 2018-09-17 17:30 ` Ezequiel Garcia [this message] 2018-09-17 17:30 ` [PATCH v6 5/6] media: Add controls for JPEG quantization tables Ezequiel Garcia 2018-09-17 17:30 ` [PATCH v6 6/6] media: add Rockchip VPU JPEG encoder driver Ezequiel Garcia 2018-09-17 17:30 ` Ezequiel Garcia [not found] ` <20180917173022.9338-7-ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org> 2018-09-28 11:58 ` Hans Verkuil 2018-09-28 11:58 ` Hans Verkuil 2018-09-28 12:33 ` [PATCH v6 0/6] Add Rockchip VPU JPEG encoder Hans Verkuil 2018-09-28 12:33 ` Hans Verkuil [not found] ` <7bd9573e-e0c6-71a6-84ed-deb0904593fd-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org> 2018-10-01 17:54 ` Ezequiel Garcia 2018-10-01 17:54 ` Ezequiel Garcia [not found] ` <faca3960d0478610b73071b471acfa26df987985.camel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org> 2018-10-04 23:39 ` Ezequiel Garcia 2018-10-04 23:39 ` Ezequiel Garcia [not found] ` <5ce82f591ab9bd1a9a0a476f01bbf4f0fe4ab0e2.camel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org> 2018-10-05 12:10 ` Mauro Carvalho Chehab 2018-10-05 12:10 ` Mauro Carvalho Chehab [not found] ` <20181005091034.7d8399ed-qA1ZUp+OV9c@public.gmane.org> 2018-10-05 15:37 ` Ezequiel Garcia 2018-10-05 15:37 ` Ezequiel Garcia [not found] ` <25d61645856120ad010b604ec4c14b0677ab9197.camel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org> 2018-10-05 16:49 ` Mauro Carvalho Chehab 2018-10-05 16:49 ` Mauro Carvalho Chehab [not found] ` <20181005134914.4947841d-qA1ZUp+OV9c@public.gmane.org> 2018-10-05 17:39 ` Ezequiel Garcia 2018-10-05 17:39 ` Ezequiel Garcia
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=20180917173022.9338-6-ezequiel@collabora.com \ --to=ezequiel-zgy8ohtn/8qb+jhodadfcq@public.gmane.org \ --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=hans.verkuil-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \ --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \ --cc=kernel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org \ --cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \ --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \ --cc=myy-tmjzNUIc0P1+EYZtW95mkQ@public.gmane.org \ --cc=nicolas.dufresne-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org \ --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \ --cc=tfiga-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \ --cc=zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org \ /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: linkBe 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.