All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
To: Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/wNWPw@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
Subject: Re: [PATCH v6 0/6] Add Rockchip VPU JPEG encoder
Date: Mon, 01 Oct 2018 14:54:09 -0300	[thread overview]
Message-ID: <faca3960d0478610b73071b471acfa26df987985.camel@collabora.com> (raw)
In-Reply-To: <7bd9573e-e0c6-71a6-84ed-deb0904593fd-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>

On Fri, 2018-09-28 at 14:33 +0200, Hans Verkuil wrote:
> On 09/17/2018 07:30 PM, Ezequiel Garcia wrote:
> > This series adds support for JPEG encoding via the VPU block
> > present in Rockchip platforms. Currently, support for RK3288
> > and RK3399 is included.
> > 
> > Please, see the previous versions of this cover letter for
> > more information.
> > 
> > Compared to v5, the only change is in the V4L2_CID_JPEG_QUANTIZATION
> > control. We've decided to support only baseline profile,
> > and only add 8-bit luma and chroma tables.
> > 
> > struct v4l2_ctrl_jpeg_quantization {
> >        __u8    luma_quantization_matrix[64];
> >        __u8    chroma_quantization_matrix[64];
> > };
> > 
> > By doing this, it's clear that we don't currently support anything
> > but baseline.
> > 
> > This series should apply cleanly on top of
> > 
> >   git://linuxtv.org/hverkuil/media_tree.git br-cedrus tag.
> > 
> > If everyone is happy with this series, I'd like to route the devicetree
> > changes through the rockchip tree, and the rest via the media subsystem.
> 
> OK, so I have what is no doubt an annoying question: do we really need
> a JPEG_RAW format?
> 

Not annoying, as it helps clarify a few things :-)
I think we do need the JPEG_RAW format. The way I see it, using
JPEG opens a can of worms...

> The JPEG header is really easy to parse for a decoder and really easy to
> prepend to the compressed image for the encoder.
> 
> The only reason I can see for a JPEG_RAW is if the image must start at
> some specific address alignment. Although even then you can just pad the
> JPEG header that you will add according to the alignment requirements.
> 
> I know I am very late with this question, but I never looked all that
> closely at what a JPEG header looks like. But this helped:
> 
> https://en.wikipedia.org/wiki/JPEG_File_Interchange_Format
> 
> and it doesn't seem difficult at all to parse or create the header.
> 
> 

... I think that having JPEG_RAW as the compressed format
is much more clear for userspace, as it explicitly specifies
what is expected.

This way, for a stateless encoder, applications are required
to set quantization and/or entropy tables, and are then in
charge of using the compressed JPEG_RAW payload in whatever form
they want. Stupid simple.

On the other side, if the stateless encoder driver supports
JPEG (creating headers in-kernel), it means that:

*) applications should pass a quality control, if supported,
and the driver will use hardcoded tables or...

*) applications pass quantization control and, if supported,
entropy control. The kernel uses them to create the JPEG frame.
But also, some drivers (e.g. Rockchip), use default entropy
tables, which should now be in the kernel.

So the application would have to query controls to find out
what to do. Not exactly hard, but I think having the JPEG_RAW
is much simpler and more clear.

Now, for stateless decoders, supporting JPEG_RAW means
the application has to pass quantization and entropy
controls, probably using the Request API.
Given the application has parsed the JPEG,
it knows the width and height and can request
buffers accordingly.

The hardware is stateless, and so is the driver.

On the other hand, supporting JPEG would mean that
drivers will have to parse the image, extracting
the quantization and entropy tables.

Format negotiation is now more complex,
either we follow the stateful spec, introducing a little
state machine in the driver... or we use the Request API,
but that means parsing on both sides kernel and application.

Either way, using JPEG_RAW is just waaay simpler and puts
things where they belong. 

> I also think there are more drivers (solo6x10) that
> manipulate the JPEG header.

Well, I've always thought this was kind of suboptimal.

Thanks,
Ezequiel

WARNING: multiple messages have this Message-ID (diff)
From: Ezequiel Garcia <ezequiel@collabora.com>
To: Hans Verkuil <hverkuil@xs4all.nl>,
	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>
Subject: Re: [PATCH v6 0/6] Add Rockchip VPU JPEG encoder
Date: Mon, 01 Oct 2018 14:54:09 -0300	[thread overview]
Message-ID: <faca3960d0478610b73071b471acfa26df987985.camel@collabora.com> (raw)
In-Reply-To: <7bd9573e-e0c6-71a6-84ed-deb0904593fd@xs4all.nl>

On Fri, 2018-09-28 at 14:33 +0200, Hans Verkuil wrote:
> On 09/17/2018 07:30 PM, Ezequiel Garcia wrote:
> > This series adds support for JPEG encoding via the VPU block
> > present in Rockchip platforms. Currently, support for RK3288
> > and RK3399 is included.
> > 
> > Please, see the previous versions of this cover letter for
> > more information.
> > 
> > Compared to v5, the only change is in the V4L2_CID_JPEG_QUANTIZATION
> > control. We've decided to support only baseline profile,
> > and only add 8-bit luma and chroma tables.
> > 
> > struct v4l2_ctrl_jpeg_quantization {
> >        __u8    luma_quantization_matrix[64];
> >        __u8    chroma_quantization_matrix[64];
> > };
> > 
> > By doing this, it's clear that we don't currently support anything
> > but baseline.
> > 
> > This series should apply cleanly on top of
> > 
> >   git://linuxtv.org/hverkuil/media_tree.git br-cedrus tag.
> > 
> > If everyone is happy with this series, I'd like to route the devicetree
> > changes through the rockchip tree, and the rest via the media subsystem.
> 
> OK, so I have what is no doubt an annoying question: do we really need
> a JPEG_RAW format?
> 

Not annoying, as it helps clarify a few things :-)
I think we do need the JPEG_RAW format. The way I see it, using
JPEG opens a can of worms...

> The JPEG header is really easy to parse for a decoder and really easy to
> prepend to the compressed image for the encoder.
> 
> The only reason I can see for a JPEG_RAW is if the image must start at
> some specific address alignment. Although even then you can just pad the
> JPEG header that you will add according to the alignment requirements.
> 
> I know I am very late with this question, but I never looked all that
> closely at what a JPEG header looks like. But this helped:
> 
> https://en.wikipedia.org/wiki/JPEG_File_Interchange_Format
> 
> and it doesn't seem difficult at all to parse or create the header.
> 
> 

... I think that having JPEG_RAW as the compressed format
is much more clear for userspace, as it explicitly specifies
what is expected.

This way, for a stateless encoder, applications are required
to set quantization and/or entropy tables, and are then in
charge of using the compressed JPEG_RAW payload in whatever form
they want. Stupid simple.

On the other side, if the stateless encoder driver supports
JPEG (creating headers in-kernel), it means that:

*) applications should pass a quality control, if supported,
and the driver will use hardcoded tables or...

*) applications pass quantization control and, if supported,
entropy control. The kernel uses them to create the JPEG frame.
But also, some drivers (e.g. Rockchip), use default entropy
tables, which should now be in the kernel.

So the application would have to query controls to find out
what to do. Not exactly hard, but I think having the JPEG_RAW
is much simpler and more clear.

Now, for stateless decoders, supporting JPEG_RAW means
the application has to pass quantization and entropy
controls, probably using the Request API.
Given the application has parsed the JPEG,
it knows the width and height and can request
buffers accordingly.

The hardware is stateless, and so is the driver.

On the other hand, supporting JPEG would mean that
drivers will have to parse the image, extracting
the quantization and entropy tables.

Format negotiation is now more complex,
either we follow the stateful spec, introducing a little
state machine in the driver... or we use the Request API,
but that means parsing on both sides kernel and application.

Either way, using JPEG_RAW is just waaay simpler and puts
things where they belong. 

> I also think there are more drivers (solo6x10) that
> manipulate the JPEG header.

Well, I've always thought this was kind of suboptimal.

Thanks,
Ezequiel

  parent reply	other threads:[~2018-10-01 17:54 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   ` [PATCH v6 5/6] media: Add controls for JPEG quantization tables Ezequiel Garcia
2018-09-17 17:30     ` 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 [this message]
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=faca3960d0478610b73071b471acfa26df987985.camel@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=hverkuil-qWit8jRvyhVmR6Xm/wNWPw@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 \
    /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.