From: Mirela Rabulea <mirela.rabulea@nxp.com>
To: Laurentiu Palcu <laurentiu.palcu@nxp.com>,
"Mirela Rabulea (OSS)" <mirela.rabulea@oss.nxp.com>
Cc: dl-linux-imx <linux-imx@nxp.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
Aisheng Dong <aisheng.dong@nxp.com>,
"laurent.pinchart+renesas@ideasonboard.com"
<laurent.pinchart+renesas@ideasonboard.com>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"paul.kocialkowski@bootlin.com" <paul.kocialkowski@bootlin.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Robert Chiras <robert.chiras@nxp.com>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"niklas.soderlund+renesas@ragnatech.se"
<niklas.soderlund+renesas@ragnatech.se>,
"shawnguo@kernel.org" <shawnguo@kernel.org>,
"hverkuil-cisco@xs4all.nl" <hverkuil-cisco@xs4all.nl>,
Daniel Baluta <daniel.baluta@nxp.com>,
"dafna.hirschfeld@collabora.com" <dafna.hirschfeld@collabora.com>,
"ezequiel@collabora.com" <ezequiel@collabora.com>,
"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>
Subject: Re: [PATCH v4 04/11] media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder
Date: Fri, 6 Nov 2020 01:05:43 +0000 [thread overview]
Message-ID: <3a8e31ae6014495791e0a175b3b98463f4622a29.camel@nxp.com> (raw)
In-Reply-To: <20201102162022.upkgqipa725fhtce@fsr-ub1864-141>
Hi Laurentiu,
On Mon, 2020-11-02 at 18:20 +0200, Laurentiu Palcu wrote:
> Hi Mirela,
>
> I wanted to give it a more in-depth look but I then saw that patch 11
> deletes a lot of code from this file. So, the review on the deleted
> parts would be pointless... :/
>
> I suggest you squash 4 and 11 together.
Sorry about that, I refrained from squashing 4 & 11 for 2 reasons:
1. On patch 4 I did not make significant changes since previous version
(just enough to keep it compiling) I hoped it will be easier to review
like this, tried to explain in cover letter.
2. After using the jpeg helpers, the mxc_jpeg_parse() is somewhere
between 2-8% slower, depending on the measuring method, so I was
thinking it would be nice to have the previous method in the history,
as a reference. Now, I have done more measurements on the overall
impact, an it is insignificant, ~0.01% for a streaming case (1 1080p
RGB24 buffer enqueued 1000 times).
I can definitely squash patch 7 into 4, together with other changes
from this version review. I'm waiting for more opinions about squashing
11 into 4.
>
> > v4l2-compliance tests are passing, including the
> > streaming tests, "v4l2-compliance -s"
> >
> > V3 Replaced GRABBER
>
> What does this mean?
Removed, my bad, that info was added in cover letter.
> + *
> > + * A module parameter is available for debug purpose
> > (jpeg_tracing), to enable
> > + * it, enable dynamic debug for this module and:
> > + * echo 1 > /sys/module/mxc_jpeg_encdec/parameters/jpeg_tracing
>
> It looks like this it's trying to achieve the same thing that's
> already
> offered by v4l2_dbg() and the 'debug' module parameter. The advantage
> of
> the latter is that you don't need to recompile the kernel to enable
> dynamic debug... Maybe it's worth reusing it?
I replaced jpeg_tracing module parameter with debug module parameter in
the next version, so, it will be shared with what v4l2_dbg is using.
> > +0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4,
> > +0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2,
> > +0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9,
> > +0xDA, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
> > +0xE8, 0xE9, 0xEA, 0xF2, 0xF3, 0xF4, 0xF5,
> > +0xF6, 0xF7, 0xF8, 0xF9, 0xFA};
> > +static const unsigned char jpeg_dri[] = {0xFF, 0xDD,
> > +0x00, 0x04, 0x00, 0x20};
> > +static const unsigned char jpeg_sos_maximal[] = {0xFF, 0xDA,
> > +0x00, 0x0C, 0x04, 0x01, 0x00, 0x02, 0x11, 0x03,
> > +0x11, 0x04, 0x11, 0x00, 0x3F, 0x00,};
> > +static const unsigned char jpeg_eoi[] = {0xFF, 0xD9};
>
> These data blocks above should be properly indented, one tab to the
> right.
Done, for the next version.
> > +/* Print Four-character-code (FOURCC) */
> > +static char *fourcc_to_str(u32 format)
> > +{
> > + char *buf = kmalloc(32, GFP_KERNEL);
>
> I'm not sure this is worth it. Either you make it a static array:
>
> static char buf[5];
>
> And return a pointer to it, unless this is called from different
> contexts. Or you could make the caller pass a pointer to the buffer.
> Using kmalloc() every time you want to print 4 characters might
> introduce some unnecessary overhead if this is called too often.
>
> However, my sugestion is to get rid of this fourcc_to_str() helper
> completely and print the format directly where you need it. Here's a
> list of places where this is done, in case you have second thoughts:
>
> git grep "\(v4l2_dbg\|pr_cont\|dev_\).*%c%c%c%c"
>
Removed fourcc_to_str(), used %c%c%c%c instead, the amount of lines of
code is similar, so, it's ok, no loss.
> > + struct mxc_jpeg_sof sof, *psof = 0;
> > + struct mxc_jpeg_sos *psos = 0;
> > + u8 byte, *next = 0;
>
> Don't use 0 for NULL pointers. Use NULL. :)
Done, it will be in the next version.
>
> > + enum mxc_jpeg_image_format img_fmt;
> > + u32 fourcc;
> > +
> > + memset(&sof, 0, sizeof(struct mxc_jpeg_sof));
> > + stream.addr = src_addr;
> > + stream.end = size;
> > + stream.loc = 0;
> > + *dht_needed = true;
> > + while (notfound) {
> > + byte = get_byte(&stream);
> > + if (byte == -1)
>
> byte is u8. The above doesn't make much sense.
This is handled differently now in the upstream jpeg helpers
(v4l2_jpeg_parse_header() and jpeg_next_marker()).
However, in the above, there is a problem, the end of the stream is not
detected properly. I'll modify get_byte to return int, not u8, because
-1 is for the end of stream, and 0xFF is
for markers (in u8 representation both were 0xFF). This passed
undetected because, for a valid jpeg the parsing was done only up to
SOS. So, a problematic case would be a corrupted jpeg, with SOI, but
without SOS. I'll try to add some corrupted jpegs in my testsuite.
Thanks,
Mirela
next prev parent reply other threads:[~2020-11-06 1:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 3:08 [PATCH v4 00/11] Add V4L2 driver for i.MX8 JPEG Encoder/Decoder Mirela Rabulea (OSS)
2020-11-02 3:08 ` [PATCH v4 01/11] media: v4l: Add packed YUV444 24bpp pixel format Mirela Rabulea (OSS)
2020-11-02 3:08 ` [PATCH v4 02/11] firmware: imx: scu-pd: Add power domains for imx-jpeg Mirela Rabulea (OSS)
2020-11-02 3:08 ` [PATCH v4 03/11] media: dt-bindings: Add bindings for i.MX8QXP/QM JPEG driver Mirela Rabulea (OSS)
2020-11-04 22:38 ` Rob Herring
2020-11-09 21:59 ` [EXT] " Mirela Rabulea
2020-11-02 3:08 ` [PATCH v4 04/11] media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder Mirela Rabulea (OSS)
2020-11-02 16:20 ` Laurentiu Palcu
2020-11-06 1:05 ` Mirela Rabulea [this message]
2020-11-02 3:08 ` [PATCH v4 05/11] arm64: dts: imx8qxp: Add jpeg encoder/decoder nodes Mirela Rabulea (OSS)
2020-11-02 3:08 ` [PATCH v4 06/11] Add maintainer for IMX jpeg v4l2 driver Mirela Rabulea (OSS)
2020-11-02 16:25 ` Laurentiu Palcu
2020-11-02 3:08 ` [PATCH v4 07/11] media: imx-jpeg: Fix v4l2-compliance streaming tests on decoder Mirela Rabulea (OSS)
2020-11-02 3:08 ` [PATCH v4 08/11] media: Add parsing for APP14 data segment in jpeg helpers Mirela Rabulea (OSS)
2020-11-02 3:08 ` [PATCH v4 09/11] media: Quit parsing stream if doesn't start with SOI Mirela Rabulea (OSS)
2020-11-02 3:08 ` [PATCH v4 10/11] media: Avoid parsing quantization and huffman tables Mirela Rabulea (OSS)
2020-11-02 3:08 ` [PATCH v4 11/11] media: imx-jpeg: Use v4l2 jpeg helpers in mxc-jpeg Mirela Rabulea (OSS)
2020-11-04 11:52 ` [PATCH v4 00/11] Add V4L2 driver for i.MX8 JPEG Encoder/Decoder Hans Verkuil
2020-11-04 11:55 ` Hans Verkuil
2020-11-04 13:27 ` [EXT] " Mirela Rabulea
2020-11-04 14:08 ` Hans Verkuil
2020-11-06 1:04 ` Mirela Rabulea
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=3a8e31ae6014495791e0a175b3b98463f4622a29.camel@nxp.com \
--to=mirela.rabulea@nxp.com \
--cc=aisheng.dong@nxp.com \
--cc=dafna.hirschfeld@collabora.com \
--cc=daniel.baluta@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=ezequiel@collabora.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=laurentiu.palcu@nxp.com \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mchehab@kernel.org \
--cc=mirela.rabulea@oss.nxp.com \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=p.zabel@pengutronix.de \
--cc=paul.kocialkowski@bootlin.com \
--cc=robert.chiras@nxp.com \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.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).