From patchwork Tue Jan 26 18:48:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Fricke X-Patchwork-Id: 11025 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9095FC0F2B for ; Tue, 26 Jan 2021 18:49:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 623A268325; Tue, 26 Jan 2021 19:49:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=posteo.net header.i=@posteo.net header.b="ORVEw45n"; dkim-atps=neutral Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 91E1D68318 for ; Tue, 26 Jan 2021 19:49:11 +0100 (CET) Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 308AF240102 for ; Tue, 26 Jan 2021 19:49:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1611686951; bh=UgHDgb/71kG2zzqdTX3HyhKfUPPnvJv+f1MZXScVXY0=; h=From:To:Cc:Subject:Date:From; b=ORVEw45n5BWWh99XCe7cRU2v+WOQrIzLoZLLQEppmdY3wqXGpPYSgUVYyKz5wLIqH k5vVv4pOyfgL90itXeNkjVDMKOLd7gfD3xNaWa+zTtCd2p/vyh4Ozky7BOB/CpmJiZ 3f2p/Pyyqw71rsSsutmgmlMtmz0sdFRh7FD/Lj8qzQBAmv9EuwE1nyZNOP/gT4PDFV K8wskGcseH2F9gKwtA4joPX2YLL1FGvcOBrkcYBwF42GPqjIYf6mKGKuu3bN6p9OGn KUcKrd1BLOeYT2FA1yscTTTRVovofn7tV2OThzpFaDMT7KhhJ819YDAM0LKYUYTMaQ JoqJ5wEK3QdwQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4DQG3p2JMYz6tmb; Tue, 26 Jan 2021 19:49:10 +0100 (CET) From: Sebastian Fricke To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Jan 2021 19:48:51 +0100 Message-Id: <20210126184854.46156-3-sebastian.fricke@posteo.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210126184854.46156-1-sebastian.fricke@posteo.net> References: <20210126184854.46156-1-sebastian.fricke@posteo.net> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/5] libcamera: Remove unnecessary constructor X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The new `fromV4l2PixelFormat` static member function renders an old BayerFormat constructor useless, remove it together with the `v4l2ToBayer` mapping table. The new function searches for a matching mapped value instead of a matching key, therefore the `bayerToV4l2` table is sufficient. Signed-off-by: Sebastian Fricke Reviewed-by: Laurent Pinchart --- include/libcamera/internal/bayer_format.h | 1 - src/libcamera/bayer_format.cpp | 45 ----------------------- 2 files changed, 46 deletions(-) diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h index 4f338bd7..62814154 100644 --- a/include/libcamera/internal/bayer_format.h +++ b/include/libcamera/internal/bayer_format.h @@ -42,7 +42,6 @@ public: { } - explicit BayerFormat(V4L2PixelFormat v4l2Format); static const BayerFormat &fromMbusCode(unsigned int mbusCode); bool isValid() const { return bitDepth != 0; } diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp index 9eb83898..1acf91d4 100644 --- a/src/libcamera/bayer_format.cpp +++ b/src/libcamera/bayer_format.cpp @@ -61,37 +61,6 @@ namespace libcamera { namespace { -const std::map v4l2ToBayer{ - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), { BayerFormat::BGGR, 8, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), { BayerFormat::GBRG, 8, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), { BayerFormat::GRBG, 8, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), { BayerFormat::RGGB, 8, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), { BayerFormat::BGGR, 10, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), { BayerFormat::GBRG, 10, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), { BayerFormat::GRBG, 10, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), { BayerFormat::RGGB, 10, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P), { BayerFormat::BGGR, 10, BayerFormat::CSI2Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P), { BayerFormat::GBRG, 10, BayerFormat::CSI2Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P), { BayerFormat::GRBG, 10, BayerFormat::CSI2Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P), { BayerFormat::RGGB, 10, BayerFormat::CSI2Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10), { BayerFormat::BGGR, 10, BayerFormat::IPU3Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10), { BayerFormat::GBRG, 10, BayerFormat::IPU3Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10), { BayerFormat::GRBG, 10, BayerFormat::IPU3Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10), { BayerFormat::RGGB, 10, BayerFormat::IPU3Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), { BayerFormat::BGGR, 12, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), { BayerFormat::GBRG, 12, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), { BayerFormat::GRBG, 12, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), { BayerFormat::RGGB, 12, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P), { BayerFormat::BGGR, 12, BayerFormat::CSI2Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), { BayerFormat::GBRG, 12, BayerFormat::CSI2Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), { BayerFormat::GRBG, 12, BayerFormat::CSI2Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), { BayerFormat::RGGB, 12, BayerFormat::CSI2Packed } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16), { BayerFormat::BGGR, 16, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16), { BayerFormat::GBRG, 16, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16), { BayerFormat::GRBG, 16, BayerFormat::None } }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16), { BayerFormat::RGGB, 16, BayerFormat::None } }, -}; - /* Define a slightly arbitrary ordering so that we can use a std::map. */ struct BayerFormatComparator { constexpr bool operator()(const BayerFormat &lhs, const BayerFormat &rhs) const @@ -194,20 +163,6 @@ const std::unordered_map mbusCodeToBayer{ * \param[in] p The type of packing applied to the pixel values */ -/** - * \brief Construct a BayerFormat from a V4L2PixelFormat - * \param[in] v4l2Format The raw format to convert into a BayerFormat - */ -BayerFormat::BayerFormat(V4L2PixelFormat v4l2Format) - : order(BGGR), packing(None) -{ - const auto it = v4l2ToBayer.find(v4l2Format); - if (it == v4l2ToBayer.end()) - bitDepth = 0; - else - *this = it->second; -} - /** * \brief Retrieve the BayerFormat associated with a media bus code * \param[in] mbusCode The media bus code to convert into a BayerFormat