From: Atanas Filipov <atanas.filipov@oss.qualcomm.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: linux-media@vger.kernel.org, bod@kernel.org, mchehab@kernel.org,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
andersson@kernel.org, konradybcio@kernel.org,
loic.poulain@linaro.org, gjorgji.rosikopulos@oss.qualcomm.com,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, atanas.filipov@oss.qualcomm.com
Subject: Re: [PATCH v8 3/8] media: v4l2-jpeg: Add a baseline JPEG header writer
Date: Wed, 11 Nov 2026 17:40:14 +0200 [thread overview]
Message-ID: <20261111154014.654617-1-atanas.filipov@oss.qualcomm.com> (raw)
In-Reply-To: <qb6mqteoxdk7xb7qhgiruncdamptf7m62m3y4zrccs4cesxr4t@q3oukzsd6qyr>
On Wed, Nov 11, 2026 at 03:30:57PM +0200, Dmitry Baryshkov wrote:
> > +/* Writes past the end only advance pos; v4l2_jpeg_write_header() checks it */
> > +static void jpeg_put_bytes(struct jpeg_hdr_buf *b, const void *src, size_t n)
> > +{
> > + if (b->pos + n <= b->len) {
> > + if (src)
> > + memcpy(b->buf + b->pos, src, n);
> > + else
> > + memset(b->buf + b->pos, 0, n);
> > + }
> > + b->pos += n;
>
> Now b->pos has advanced past the b->len. Is it expected?
Yes. Nothing is written past the end, and the final check returns
-ENOSPC. I agree it is not clear. I will use an explicit overflow flag
in the next version.
> > + jpeg_put_u8(&b, nc);
> > + for (i = 0; i < nc; i++) {
> > + jpeg_put_u8(&b, i + 1);
> > + jpeg_put_u8(&b, i ? JPEG_SAMPLING_H1V1 : params->luma_sampling);
> > + jpeg_put_u8(&b, i ? JPEG_QTABLE_CHROMA : JPEG_QTABLE_LUMA);
> > + }
>
> I think it might be better to write explicitly:
>
> jpeg_put_u8(&b, 1);
> jpeg_put_u8(&b, params->luma_sampling);
> jpeg_put_u8(&b, JPEG_QTABLE_LUMA);
>
> if (params->num_components != JPEG_COMP_MONO) {
> jpeg_put_u8(&b, 2);
> jpeg_put_u8(&b, JPEG_SAMPLING_H1V1);
> jpeg_put_u8(&b, JPEG_QTABLE_CHROMA);
> }
Ok, I will write them explicitly in the next version.
> > + jpeg_put_u8(&b, nc);
> > + for (i = 0; i < nc; i++) {
> > + jpeg_put_u8(&b, i + 1);
> > + jpeg_put_u8(&b, i ? JPEG_TABLE_SEL_CHROMA : JPEG_TABLE_SEL_LUMA);
> > + }
>
> The same.
Ok, the same for SOS.
--
Best regards,
Atanas
next prev parent reply other threads:[~2026-11-11 15:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 16:39 [PATCH v8 0/8] Add Qualcomm JPEG V4L2 encoder for SM8250 and SC7280 Atanas Filipov
2026-11-10 16:39 ` [PATCH v8 1/8] dt-bindings: media: qcom: Add JPEG encoder binding Atanas Filipov
2026-11-12 8:41 ` Loic Poulain
2026-11-12 10:02 ` Krzysztof Kozlowski
2026-11-10 16:39 ` [PATCH v8 2/8] media: jpeg: Add JPEG baseline and JFIF APP0 constants Atanas Filipov
2026-11-10 16:39 ` [PATCH v8 3/8] media: v4l2-jpeg: Add a baseline JPEG header writer Atanas Filipov
2026-11-11 13:30 ` Dmitry Baryshkov
2026-11-11 15:40 ` Atanas Filipov [this message]
2026-11-10 16:39 ` [PATCH v8 4/8] media: qcom: jpeg: Add Qualcomm JPEG V4L2 encoder Atanas Filipov
2026-11-11 9:02 ` kernel test robot
2026-11-11 11:55 ` kernel test robot
2026-11-10 16:39 ` [PATCH v8 5/8] arm64: dts: qcom: sm8250: Add JPEG encoder node Atanas Filipov
2026-11-11 13:14 ` Dmitry Baryshkov
2026-11-11 15:40 ` Atanas Filipov
2026-11-10 16:39 ` [PATCH v8 6/8] arm64: dts: qcom: qrb5165-rb5: Enable JPEG encoder Atanas Filipov
2026-11-10 16:39 ` [PATCH v8 7/8] arm64: dts: qcom: kodiak: Add JPEG encoder node Atanas Filipov
2026-11-11 13:17 ` Dmitry Baryshkov
2026-11-11 15:40 ` Atanas Filipov
2026-11-10 16:39 ` [PATCH v8 8/8] arm64: dts: qcom: qcs6490-rb3gen2: Enable JPEG encoder Atanas Filipov
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=20261111154014.654617-1-atanas.filipov@oss.qualcomm.com \
--to=atanas.filipov@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=bod@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=gjorgji.rosikopulos@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=mchehab@kernel.org \
--cc=robh@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
all inboxes | Powered by JetHome®