From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: linux-media@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-staging@lists.linux.dev
Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Adam Pigg <adam@piggz.co.uk>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: [PATCH 4/9] media: v4l2: Add JPEG pixel format to v4l2 format info
Date: Fri, 24 Mar 2023 16:12:23 +0100 [thread overview]
Message-ID: <20230324151228.2778112-5-paul.kocialkowski@bootlin.com> (raw)
In-Reply-To: <20230324151228.2778112-1-paul.kocialkowski@bootlin.com>
Represent the JPEG pixel format in the v4l2 format info table.
Note that the bpp is set to 1 which is not a proper way to estimate
the needed buffer size for a given JPEG image. However the compression
ratios of JPEG typically allow fitting the image in a smaller size,
even though extra metadata could increase the total size by an
arbitrary amount. Thus it is not a perfectly safe way to calculate the
size of a JPEG buffer for given dimensions but it still provides a
reasonable approach.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
drivers/media/v4l2-core/v4l2-common.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
index 5101989716aa..8b2f201a8918 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -317,6 +317,9 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
{ .format = V4L2_PIX_FMT_SGBRG12, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
{ .format = V4L2_PIX_FMT_SGRBG12, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
{ .format = V4L2_PIX_FMT_SRGGB12, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
+
+ /* Compressed formats */
+ { .format = V4L2_PIX_FMT_JPEG, .pixel_enc = V4L2_PIXEL_ENC_COMPRESSED, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
};
unsigned int i;
--
2.39.2
next prev parent reply other threads:[~2023-03-24 15:12 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 15:12 [PATCH 0/9] media: sun6i-csi/isp: Implement MC I/O support Paul Kocialkowski
2023-03-24 15:12 ` [PATCH 1/9] media: v4l2: Add RGB565X pixel format to v4l2 format info Paul Kocialkowski
2023-03-25 7:06 ` Jernej Škrabec
2023-03-25 20:59 ` Laurent Pinchart
2023-03-24 15:12 ` [PATCH 2/9] media: v4l2: Add NV12_16L16 " Paul Kocialkowski
2023-03-25 7:06 ` Jernej Škrabec
2023-03-25 21:01 ` Laurent Pinchart
2023-03-31 18:54 ` Nicolas Dufresne
2023-04-05 4:21 ` Laurent Pinchart
2023-04-11 13:03 ` Nicolas Dufresne
2023-04-11 15:30 ` Nicolas Dufresne
2023-03-24 15:12 ` [PATCH 3/9] media: v4l2: Introduce compressed pixel encoding definition and helper Paul Kocialkowski
2023-03-25 7:07 ` Jernej Škrabec
2023-03-24 15:12 ` Paul Kocialkowski [this message]
2023-03-25 7:08 ` [PATCH 4/9] media: v4l2: Add JPEG pixel format to v4l2 format info Jernej Škrabec
2023-03-31 19:07 ` Nicolas Dufresne
2023-03-24 15:12 ` [PATCH 5/9] media: sun6i-csi: capture: Rework and separate format validation Paul Kocialkowski
2023-03-25 7:09 ` Jernej Škrabec
2023-03-25 21:24 ` Laurent Pinchart
2023-03-24 15:12 ` [PATCH 6/9] media: sun6i-csi: capture: Implement MC I/O with extended enum_fmt Paul Kocialkowski
2023-03-25 7:13 ` Jernej Škrabec
2023-03-25 21:29 ` Laurent Pinchart
2023-03-24 15:12 ` [PATCH 7/9] media: sun6i-csi: capture: Implement enum_framesizes Paul Kocialkowski
2023-03-25 7:13 ` Jernej Škrabec
2023-03-25 21:33 ` Laurent Pinchart
2023-03-24 15:12 ` [PATCH 8/9] media: sun6i-isp: capture: Implement MC I/O with extended enum_fmt Paul Kocialkowski
2023-03-25 7:14 ` Jernej Škrabec
2023-03-25 21:42 ` Laurent Pinchart
2023-03-24 15:12 ` [PATCH 9/9] media: sun6i-isp: capture: Implement enum_framesizes Paul Kocialkowski
2023-03-25 7:14 ` Jernej Škrabec
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=20230324151228.2778112-5-paul.kocialkowski@bootlin.com \
--to=paul.kocialkowski@bootlin.com \
--cc=adam@piggz.co.uk \
--cc=jernej.skrabec@gmail.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-sunxi@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=samuel@sholland.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=wens@csie.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).