From: Paul Kocialkowski <paul.kocialkowski-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
To: Ezequiel Garcia
<ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>,
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>,
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: Re: [PATCH v3 6/7] media: Add controls for JPEG quantization tables
Date: Mon, 27 Aug 2018 09:47:20 +0200 [thread overview]
Message-ID: <3a92082b201776bfed0f68facc30577cb7d2a5c1.camel@bootlin.com> (raw)
In-Reply-To: <20180822165937.8700-7-ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 4448 bytes --]
Hi,
On Wed, 2018-08-22 at 13:59 -0300, Ezequiel Garcia wrote:
> From: Shunqian Zheng <zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>
> Add V4L2_CID_JPEG_LUMA/CHROMA_QUANTIZATION controls to allow userspace
> configure the JPEG quantization tables.
How about having a single control for quantization?
In MPEG-2/H.264/H.265, we have a single control exposed as a structure,
which contains the tables for both luma and chroma. In the case of JPEG,
it's not that big a deal, but for advanced video formats, it would be
too much hassle to have one control per table.
In order to keep the interface consistent, I think it'd be best to merge
both matrices into a single control.
What do you think?
Paul
> Signed-off-by: Shunqian Zheng <zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> Signed-off-by: Ezequiel Garcia <ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> ---
> Documentation/media/uapi/v4l/extended-controls.rst | 13 +++++++++++++
> drivers/media/v4l2-core/v4l2-ctrls.c | 13 +++++++++++++
> include/uapi/linux/v4l2-controls.h | 3 +++
> 3 files changed, 29 insertions(+)
>
> diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst
> index 9f7312bf3365..1189750a022c 100644
> --- a/Documentation/media/uapi/v4l/extended-controls.rst
> +++ b/Documentation/media/uapi/v4l/extended-controls.rst
> @@ -3354,6 +3354,19 @@ 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_LUMA_QUANTIZATION (__u8 matrix)``
> + Sets the luma quantization table to be used for encoding
> + or decoding a V4L2_PIX_FMT_JPEG_RAW format buffer. This table is
> + a 8x8-byte matrix, and it's expected to be in JPEG zigzag order,
> + as per the JPEG specification.
> +
> +``V4L2_CID_JPEG_CHROMA_QUANTIZATION (__u8 matrix)``
> + Sets the chroma quantization table to be used for encoding
> + or decoding a V4L2_PIX_FMT_JPEG_RAW format buffer. This table is
> + a 8x8-byte matrix, and it's expected to be in JPEG zigzag order,
> + as per the JPEG specification.
>
>
> .. flat-table::
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 6ab15f4a0fea..677af8069bfc 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -999,6 +999,8 @@ 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_LUMA_QUANTIZATION: return "Luminance Quantization Matrix";
> + case V4L2_CID_JPEG_CHROMA_QUANTIZATION: return "Chrominance Quantization Matrix";
>
> /* Image source controls */
> /* Keep the order of the 'case's the same as in v4l2-controls.h! */
> @@ -1286,6 +1288,17 @@ 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_LUMA_QUANTIZATION:
> + case V4L2_CID_JPEG_CHROMA_QUANTIZATION:
> + *min = *def = 0;
> + *max = 0xff;
> + *step = 1;
> + *type = V4L2_CTRL_TYPE_U8;
> + if (dims) {
> + memset(dims, 0, V4L2_CTRL_MAX_DIMS * sizeof(dims[0]));
> + dims[0] = dims[1] = 8;
> + }
> + break;
> case V4L2_CID_DETECT_MD_THRESHOLD_GRID:
> *type = V4L2_CTRL_TYPE_U16;
> break;
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
> index e4ee10ee917d..a466acf40625 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -987,6 +987,9 @@ 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_LUMA_QUANTIZATION (V4L2_CID_JPEG_CLASS_BASE + 5)
> +#define V4L2_CID_JPEG_CHROMA_QUANTIZATION (V4L2_CID_JPEG_CLASS_BASE + 6)
> +
>
> /* Image source controls */
> #define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900)
--
Paul Kocialkowski, Bootlin (formerly Free Electrons)
Embedded Linux and kernel engineering
https://bootlin.com
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 200 bytes --]
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2018-08-27 7:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-22 16:59 [PATCH v3 0/7] Add Rockchip VPU JPEG encoder Ezequiel Garcia
[not found] ` <20180822165937.8700-1-ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2018-08-22 16:59 ` [PATCH v3 1/7] dt-bindings: Document the Rockchip VPU bindings Ezequiel Garcia
2018-08-22 16:59 ` [PATCH v3 2/7] ARM: dts: rockchip: add VPU device node for RK3288 Ezequiel Garcia
2018-08-22 16:59 ` [PATCH v3 3/7] arm64: dts: rockchip: add VPU device node for RK3399 Ezequiel Garcia
2018-08-22 16:59 ` [PATCH v3 4/7] v4l2-ctrls: Support dimensions override for standard controls Ezequiel Garcia
2018-08-22 16:59 ` [PATCH v3 5/7] media: Add JPEG_RAW format Ezequiel Garcia
2018-08-22 16:59 ` [PATCH v3 6/7] media: Add controls for JPEG quantization tables Ezequiel Garcia
[not found] ` <20180822165937.8700-7-ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2018-08-27 7:47 ` Paul Kocialkowski [this message]
[not found] ` <3a92082b201776bfed0f68facc30577cb7d2a5c1.camel-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-08-29 2:50 ` Ezequiel Garcia
[not found] ` <d55bf57ed63ba82524af1dcae3201a513cec9f48.camel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2018-08-29 3:00 ` Tomasz Figa
2018-08-22 16:59 ` [PATCH v3 7/7] media: add Rockchip VPU JPEG encoder driver 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=3a92082b201776bfed0f68facc30577cb7d2a5c1.camel@bootlin.com \
--to=paul.kocialkowski-ldxbnhwyfcjbdgjk7y7tuq@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).