[{"id":14799,"web_url":"https://patchwork.libcamera.org/comment/14799/","msgid":"<YBCe9q0sx2ap4zMH@pendragon.ideasonboard.com>","date":"2021-01-26T23:00:06","subject":"Re: [libcamera-devel] [PATCH v3 2/5] libcamera: Remove unnecessary\n\tconstructor","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Sebastian,\n\nThank you for the patch.\n\nOn Tue, Jan 26, 2021 at 07:48:51PM +0100, Sebastian Fricke wrote:\n> The new `fromV4l2PixelFormat` static member function renders\n> an old BayerFormat constructor useless, remove it together\n> with the `v4l2ToBayer` mapping table.\n> The new function searches for a matching mapped value instead\n> of a matching key, therefore the `bayerToV4l2` table is sufficient.\n> \n> Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/internal/bayer_format.h |  1 -\n>  src/libcamera/bayer_format.cpp            | 45 -----------------------\n>  2 files changed, 46 deletions(-)\n> \n> diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\n> index 4f338bd7..62814154 100644\n> --- a/include/libcamera/internal/bayer_format.h\n> +++ b/include/libcamera/internal/bayer_format.h\n> @@ -42,7 +42,6 @@ public:\n>  \t{\n>  \t}\n>  \n> -\texplicit BayerFormat(V4L2PixelFormat v4l2Format);\n>  \tstatic const BayerFormat &fromMbusCode(unsigned int mbusCode);\n>  \tbool isValid() const { return bitDepth != 0; }\n>  \n> diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\n> index 9eb83898..1acf91d4 100644\n> --- a/src/libcamera/bayer_format.cpp\n> +++ b/src/libcamera/bayer_format.cpp\n> @@ -61,37 +61,6 @@ namespace libcamera {\n>  \n>  namespace {\n>  \n> -const std::map<V4L2PixelFormat, BayerFormat> v4l2ToBayer{\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), { BayerFormat::BGGR, 8, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), { BayerFormat::GBRG, 8, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), { BayerFormat::GRBG, 8, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), { BayerFormat::RGGB, 8, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), { BayerFormat::BGGR, 10, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), { BayerFormat::GBRG, 10, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), { BayerFormat::GRBG, 10, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), { BayerFormat::RGGB, 10, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P), { BayerFormat::BGGR, 10, BayerFormat::CSI2Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P), { BayerFormat::GBRG, 10, BayerFormat::CSI2Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P), { BayerFormat::GRBG, 10, BayerFormat::CSI2Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P), { BayerFormat::RGGB, 10, BayerFormat::CSI2Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10), { BayerFormat::BGGR, 10, BayerFormat::IPU3Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10), { BayerFormat::GBRG, 10, BayerFormat::IPU3Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10), { BayerFormat::GRBG, 10, BayerFormat::IPU3Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10), { BayerFormat::RGGB, 10, BayerFormat::IPU3Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), { BayerFormat::BGGR, 12, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), { BayerFormat::GBRG, 12, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), { BayerFormat::GRBG, 12, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), { BayerFormat::RGGB, 12, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P), { BayerFormat::BGGR, 12, BayerFormat::CSI2Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), { BayerFormat::GBRG, 12, BayerFormat::CSI2Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), { BayerFormat::GRBG, 12, BayerFormat::CSI2Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), { BayerFormat::RGGB, 12, BayerFormat::CSI2Packed } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16), { BayerFormat::BGGR, 16, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16), { BayerFormat::GBRG, 16, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16), { BayerFormat::GRBG, 16, BayerFormat::None } },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16), { BayerFormat::RGGB, 16, BayerFormat::None } },\n> -};\n> -\n>  /* Define a slightly arbitrary ordering so that we can use a std::map. */\n>  struct BayerFormatComparator {\n>  \tconstexpr bool operator()(const BayerFormat &lhs, const BayerFormat &rhs) const\n> @@ -194,20 +163,6 @@ const std::unordered_map<unsigned int, BayerFormat> mbusCodeToBayer{\n>   * \\param[in] p The type of packing applied to the pixel values\n>   */\n>  \n> -/**\n> - * \\brief Construct a BayerFormat from a V4L2PixelFormat\n> - * \\param[in] v4l2Format The raw format to convert into a BayerFormat\n> - */\n> -BayerFormat::BayerFormat(V4L2PixelFormat v4l2Format)\n> -\t: order(BGGR), packing(None)\n> -{\n> -\tconst auto it = v4l2ToBayer.find(v4l2Format);\n> -\tif (it == v4l2ToBayer.end())\n> -\t\tbitDepth = 0;\n> -\telse\n> -\t\t*this = it->second;\n> -}\n> -\n>  /**\n>   * \\brief Retrieve the BayerFormat associated with a media bus code\n>   * \\param[in] mbusCode The media bus code to convert into a BayerFormat","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3272AC0F2B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jan 2021 23:00:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A63276832E;\n\tWed, 27 Jan 2021 00:00:28 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B9CE4682D2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Jan 2021 00:00:26 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2EC8A2C1;\n\tWed, 27 Jan 2021 00:00:26 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Kj67U8VT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1611702026;\n\tbh=47p9/foHwtjRsuOT/gbqUDEMwjdR68bx2T8qKrx3rlg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Kj67U8VTbXiZzX7lA6telJkTzO+sNh31QqWaQTY70mNB5AZ3gLx0rnC0AcHDJ91NW\n\t1WIGGI/Rvu6ct7UGLvmqa5UAeduwRzPQ+9ocmDU+7R6jqmhcRya2VlXaqB/7OMi8PG\n\t0hHP5vFo3Sve4jInltkVTgXgEACKILSP59hnvTQc=","Date":"Wed, 27 Jan 2021 01:00:06 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Sebastian Fricke <sebastian.fricke@posteo.net>","Message-ID":"<YBCe9q0sx2ap4zMH@pendragon.ideasonboard.com>","References":"<20210126184854.46156-1-sebastian.fricke@posteo.net>\n\t<20210126184854.46156-3-sebastian.fricke@posteo.net>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210126184854.46156-3-sebastian.fricke@posteo.net>","Subject":"Re: [libcamera-devel] [PATCH v3 2/5] libcamera: Remove unnecessary\n\tconstructor","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]