Message ID | 20230324151228.2778112-5-paul.kocialkowski@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp711948vqo; Fri, 24 Mar 2023 08:28:55 -0700 (PDT) X-Google-Smtp-Source: AKy350Z6J4O6xy4SZgJ6UtRQvZdX6pwZSKkV9uAugBHKB5zQg3X2PDuYdGIL9Q6QR/Ze2dJObvdi X-Received: by 2002:a17:902:ec8f:b0:19c:eaab:653d with SMTP id x15-20020a170902ec8f00b0019ceaab653dmr8643269plg.15.1679671735571; Fri, 24 Mar 2023 08:28:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679671735; cv=none; d=google.com; s=arc-20160816; b=FpOP5YjR76I0P7tuR44l2uP6Ee40ORVESwvsO/wboKQNnM0bkGPxrGJ7UEQS3f04q4 S2ik/WDGeQ6NaQIoSerCghYLT3zNeZtmcgjVDCabPqNH3lcP+fcA7DNVdDD92tCxXy7Y mJQze9vdnrg5bxJ2EovIPTuIwBqFP10jGsVPZDsmgTdQzausIpvjhIr+swe9f9RsONHN SP9aA2oBOt+mBDXnd48Pj7agq7KVMCIiSExXUk+SmlqkSPmSX/KmYp4wG8sjnH7324uS mulUzmZSGlFdrzH3+ELzZ+nKbce+RuEyttGvsVGNB+kK4u15ub9ja8PmVH/zTQvFzVzO lccA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=P0SoD3SIFdJN2ETvwmYpRhGM53wgfEmd1zIDvKZ41MI=; b=u0uJiGuo0YFWwNeyjGEHzSfssS7Ifb1AuncISBMWQAseRG6G00tzZGU9NwqJ+r4Gbv NzPyRjwdkoqISiY7n4UXwzBCGZY3C3m1P8Rz59kiGs001R5jh8yyE208ExTQQSaq/eix wulbUA9r1sVpurRBJgwgFn28b+B392teWuTtrpGp+yEcZ5V+gSwSWLNG6WU18z5pyWuD B7sH/zLtUFZjxQTnibUsCPPK6H5RByMi4gIHKsr0/OmCKXZLVxpjTrxg3Z8z8YFBN6FH jZVVkrVXX0YnL+p8csV+ZCMY+WCmCBLXvFd6ksU30sQUg7EUpJns8MmnowstDAfFkjDz H3aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=RXXqYT16; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h15-20020a170902f54f00b001a04ed06ea0si21982287plf.419.2023.03.24.08.28.41; Fri, 24 Mar 2023 08:28:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=RXXqYT16; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232334AbjCXPNS (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Fri, 24 Mar 2023 11:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232400AbjCXPNF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 24 Mar 2023 11:13:05 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83013231D3; Fri, 24 Mar 2023 08:12:48 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 5C5DFE000C; Fri, 24 Mar 2023 15:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1679670767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P0SoD3SIFdJN2ETvwmYpRhGM53wgfEmd1zIDvKZ41MI=; b=RXXqYT16dg0xiL/C6DkElG3MssGV6/wUL7QteAqOstGSrdTfoXiSqXhpSy3J5xlGrwqsyv 5P3Mh4QCrbjsxtam0Q0ezKDykqM8xxBthXPpY0qLCwwRgcLFoefZWK1F+rPnKwGlAuJcq7 na924dK4iN0em6zSOTKBVPkOFJ7Cw88te/omkn4AKmtfyQa9i2UlV1oTnVbACQNLZxSYCu F2kcn+gLQlzXEwyJe4idHgxZslC06IbDW8o6VCl7EwJofgnJ5dmfr0cMLz53Jw0iFiXa/9 Q8YUMkA914R4QYD4nOlXu204Wwe6a/nZQtnNaPlUls0H9NO6rDKzay5nTKphBQ== 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 Message-Id: <20230324151228.2778112-5-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230324151228.2778112-1-paul.kocialkowski@bootlin.com> References: <20230324151228.2778112-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761263469731672650?= X-GMAIL-MSGID: =?utf-8?q?1761263469731672650?= |
Series |
media: sun6i-csi/isp: Implement MC I/O support
|
|
Commit Message
Paul Kocialkowski
March 24, 2023, 3:12 p.m. UTC
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(+)
Comments
Dne petek, 24. marec 2023 ob 16:12:23 CET je Paul Kocialkowski napisal(a): > 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> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Best regards, Jernej
Le vendredi 24 mars 2023 à 16:12 +0100, Paul Kocialkowski a écrit : > 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 }, This is ackward, at best. Guesstimating the compressed buffer size is a valid use case, but this table and the related helper function seems badly suited. When I look at the stateless decoders that do that, they take into account the fact that the compression can handle different bit depth, and difference subsampling (choma idc). In this implementation, JPEG is reduce to 4:4:4, 8bit. I'd like to reject this change, and recommand coming back with a suitable integration, so that it can be special cased and the driver can communicate the required information to narrow down the estimate. And this way, you are actually making it usable for other compressed format like H.264, HEVC, VP8, VP9 AV1 etc. Nicolas Nacked in that form. > > }; > unsigned int i; >
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;