From: Ezequiel Garcia <ezequiel@collabora.com>
To: Adrian Ratiu <adrian.ratiu@collabora.com>,
Philipp Zabel <p.zabel@pengutronix.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@collabora.com, kernel@pengutronix.de,
Tim Harvey <tharvey@gateworks.com>
Subject: Re: [PATCH 2/2] media: coda: be more flexible wrt jpeg dimensions
Date: Mon, 23 Mar 2020 11:27:15 -0300 [thread overview]
Message-ID: <c1fbc7912187302fdc27d9e333fab43b0c253507.camel@collabora.com> (raw)
In-Reply-To: <20200323130937.3666244-3-adrian.ratiu@collabora.com>
On Mon, 2020-03-23 at 15:09 +0200, Adrian Ratiu wrote:
> Don't require jpeg dimensions to exactly match format dimensions,
> so we are able to decode and display a wider range jpegs instead
> of outright rejecting the ones which don't match.
>
> This is useful in applications which pass jpegs with arbitrary
> dimensions, where buffers can be reused to decode smaller jpegs
> without having to do expensive renegotiations.
>
> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
> ---
> drivers/media/platform/coda/coda-jpeg.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/media/platform/coda/coda-jpeg.c b/drivers/media/platform/coda/coda-jpeg.c
> index 162ba28a6b95..782a78dcaf4d 100644
> --- a/drivers/media/platform/coda/coda-jpeg.c
> +++ b/drivers/media/platform/coda/coda-jpeg.c
> @@ -302,13 +302,6 @@ int coda_jpeg_decode_header(struct coda_ctx *ctx, struct vb2_buffer *vb)
> }
>
> q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
> - if (header.frame.height != q_data_src->height ||
> - header.frame.width != q_data_src->width) {
> - v4l2_err(&dev->v4l2_dev,
> - "dimensions don't match format: %dx%d\n",
> - header.frame.width, header.frame.height);
> - return -EINVAL;
> - }
Since you are dropping this check, and allowing other sizes to be
decoded using, do you have any check to make sure you don't overrun
(in bytes, not in width x height) the CAPTURE (decoded) buffer?
Also, IIUC your application is negotiating W x H, but then
passing a different size: I wonder if this is not an abuse
of the spec?
Thanks,
Ezequiel
>
> if (header.frame.num_components != 3) {
> v4l2_err(&dev->v4l2_dev,
next prev parent reply other threads:[~2020-03-23 14:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 13:09 [PATCH 0/2] media: coda: Add ability to decode wider range of jpegs Adrian Ratiu
2020-03-23 13:09 ` [PATCH 1/2] media: coda: jpeg: support optimized huffman tables Adrian Ratiu
2020-03-24 9:11 ` Philipp Zabel
2020-03-23 13:09 ` [PATCH 2/2] media: coda: be more flexible wrt jpeg dimensions Adrian Ratiu
2020-03-23 14:27 ` Ezequiel Garcia [this message]
2020-03-24 9:21 ` Philipp Zabel
2020-03-24 11:14 ` Adrian Ratiu
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=c1fbc7912187302fdc27d9e333fab43b0c253507.camel@collabora.com \
--to=ezequiel@collabora.com \
--cc=adrian.ratiu@collabora.com \
--cc=kernel@collabora.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=tharvey@gateworks.com \
/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).