[{"id":15267,"web_url":"https://patchwork.libcamera.org/comment/15267/","msgid":"<YDLdrfSAFnj31HAF@pendragon.ideasonboard.com>","date":"2021-02-21T22:24:45","subject":"Re: [libcamera-devel] [PATCH v3 2/4] ipa: raspberrypi: Remove\n\tMdParserRPi","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Thu, Feb 18, 2021 at 05:01:24PM +0000, Naushir Patuck wrote:\n> With the recent change to pass a ControlList to the IPA with exposure\n> and gain values used for a frame, RPiController::MdParserRPi is not\n> needed any more. Remove all traces of it.\n> \n> The derived CamHelper objects now pass nullptr values for the parser to\n> the base CamHelper class when sensors do not use metadata.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/ipa/raspberrypi/cam_helper.cpp        |  9 ++++--\n>  src/ipa/raspberrypi/cam_helper_imx219.cpp |  4 +--\n>  src/ipa/raspberrypi/cam_helper_ov5647.cpp |  3 +-\n>  src/ipa/raspberrypi/md_parser_rpi.cpp     | 37 -----------------------\n>  src/ipa/raspberrypi/md_parser_rpi.hpp     | 32 --------------------\n>  src/ipa/raspberrypi/meson.build           |  1 -\n>  6 files changed, 8 insertions(+), 78 deletions(-)\n>  delete mode 100644 src/ipa/raspberrypi/md_parser_rpi.cpp\n>  delete mode 100644 src/ipa/raspberrypi/md_parser_rpi.hpp\n> \n> diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\n> index 93d1b7b0296a..c9cdc39c5932 100644\n> --- a/src/ipa/raspberrypi/cam_helper.cpp\n> +++ b/src/ipa/raspberrypi/cam_helper.cpp\n> @@ -42,7 +42,8 @@ CamHelper::CamHelper(MdParser *parser, unsigned int frameIntegrationDiff)\n>  \n>  CamHelper::~CamHelper()\n>  {\n> -\tdelete parser_;\n> +\tif (parser_)\n\nYou can drop the check, delete on a null pointer is a no-op.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t\tdelete parser_;\n>  }\n>  \n>  uint32_t CamHelper::ExposureLines(double exposure_us) const\n> @@ -88,8 +89,10 @@ uint32_t CamHelper::GetVBlanking(double &exposure, double minFrameDuration,\n>  void CamHelper::SetCameraMode(const CameraMode &mode)\n>  {\n>  \tmode_ = mode;\n> -\tparser_->SetBitsPerPixel(mode.bitdepth);\n> -\tparser_->SetLineLengthBytes(0); /* We use SetBufferSize. */\n> +\tif (parser_) {\n> +\t\tparser_->SetBitsPerPixel(mode.bitdepth);\n> +\t\tparser_->SetLineLengthBytes(0); /* We use SetBufferSize. */\n> +\t}\n>  \tinitialized_ = true;\n>  }\n>  \n> diff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp\n> index 95b8e698fe3b..0e454d0de2dc 100644\n> --- a/src/ipa/raspberrypi/cam_helper_imx219.cpp\n> +++ b/src/ipa/raspberrypi/cam_helper_imx219.cpp\n> @@ -19,8 +19,6 @@\n>  #include \"cam_helper.hpp\"\n>  #if ENABLE_EMBEDDED_DATA\n>  #include \"md_parser.hpp\"\n> -#else\n> -#include \"md_parser_rpi.hpp\"\n>  #endif\n>  \n>  using namespace RPiController;\n> @@ -62,7 +60,7 @@ CamHelperImx219::CamHelperImx219()\n>  #if ENABLE_EMBEDDED_DATA\n>  \t: CamHelper(new MdParserImx219(), frameIntegrationDiff)\n>  #else\n> -\t: CamHelper(new MdParserRPi(), frameIntegrationDiff)\n> +\t: CamHelper(nullptr, frameIntegrationDiff)\n>  #endif\n>  {\n>  }\n> diff --git a/src/ipa/raspberrypi/cam_helper_ov5647.cpp b/src/ipa/raspberrypi/cam_helper_ov5647.cpp\n> index a7f417324048..75486e900d31 100644\n> --- a/src/ipa/raspberrypi/cam_helper_ov5647.cpp\n> +++ b/src/ipa/raspberrypi/cam_helper_ov5647.cpp\n> @@ -8,7 +8,6 @@\n>  #include <assert.h>\n>  \n>  #include \"cam_helper.hpp\"\n> -#include \"md_parser_rpi.hpp\"\n>  \n>  using namespace RPiController;\n>  \n> @@ -38,7 +37,7 @@ private:\n>   */\n>  \n>  CamHelperOv5647::CamHelperOv5647()\n> -\t: CamHelper(new MdParserRPi(), frameIntegrationDiff)\n> +\t: CamHelper(nullptr, frameIntegrationDiff)\n>  {\n>  }\n>  \n> diff --git a/src/ipa/raspberrypi/md_parser_rpi.cpp b/src/ipa/raspberrypi/md_parser_rpi.cpp\n> deleted file mode 100644\n> index 2b0bcfc5f034..000000000000\n> --- a/src/ipa/raspberrypi/md_parser_rpi.cpp\n> +++ /dev/null\n> @@ -1,37 +0,0 @@\n> -/* SPDX-License-Identifier: BSD-2-Clause */\n> -/*\n> - * Copyright (C) 2020, Raspberry Pi (Trading) Limited\n> - *\n> - * md_parser_rpi.cpp - Metadata parser for generic Raspberry Pi metadata\n> - */\n> -\n> -#include <string.h>\n> -\n> -#include \"md_parser_rpi.hpp\"\n> -\n> -using namespace RPiController;\n> -\n> -MdParserRPi::MdParserRPi()\n> -{\n> -}\n> -\n> -MdParser::Status MdParserRPi::Parse(void *data)\n> -{\n> -\tif (buffer_size_bytes_ < sizeof(rpiMetadata))\n> -\t\treturn ERROR;\n> -\n> -\tmemcpy(&metadata, data, sizeof(rpiMetadata));\n> -\treturn OK;\n> -}\n> -\n> -MdParser::Status MdParserRPi::GetExposureLines(unsigned int &lines)\n> -{\n> -\tlines = metadata.exposure;\n> -\treturn OK;\n> -}\n> -\n> -MdParser::Status MdParserRPi::GetGainCode(unsigned int &gain_code)\n> -{\n> -\tgain_code = metadata.gain;\n> -\treturn OK;\n> -}\n> diff --git a/src/ipa/raspberrypi/md_parser_rpi.hpp b/src/ipa/raspberrypi/md_parser_rpi.hpp\n> deleted file mode 100644\n> index 52f54f008056..000000000000\n> --- a/src/ipa/raspberrypi/md_parser_rpi.hpp\n> +++ /dev/null\n> @@ -1,32 +0,0 @@\n> -/* SPDX-License-Identifier: BSD-2-Clause */\n> -/*\n> - * Copyright (C) 2019, Raspberry Pi (Trading) Limited\n> - *\n> - * md_parser_rpi.hpp - Raspberry Pi metadata parser interface\n> - */\n> -#pragma once\n> -\n> -#include \"md_parser.hpp\"\n> -\n> -namespace RPiController {\n> -\n> -class MdParserRPi : public MdParser\n> -{\n> -public:\n> -\tMdParserRPi();\n> -\tStatus Parse(void *data) override;\n> -\tStatus GetExposureLines(unsigned int &lines) override;\n> -\tStatus GetGainCode(unsigned int &gain_code) override;\n> -\n> -private:\n> -\t// This must be the same struct that is filled into the metadata buffer\n> -\t// in the pipeline handler.\n> -\tstruct rpiMetadata\n> -\t{\n> -\t\tuint32_t exposure;\n> -\t\tuint32_t gain;\n> -\t};\n> -\trpiMetadata metadata;\n> -};\n> -\n> -}\n> diff --git a/src/ipa/raspberrypi/meson.build b/src/ipa/raspberrypi/meson.build\n> index 9af755259747..59e49686bc09 100644\n> --- a/src/ipa/raspberrypi/meson.build\n> +++ b/src/ipa/raspberrypi/meson.build\n> @@ -17,7 +17,6 @@ rpi_ipa_includes = [\n>  rpi_ipa_sources = files([\n>      'raspberrypi.cpp',\n>      'md_parser.cpp',\n> -    'md_parser_rpi.cpp',\n>      'cam_helper.cpp',\n>      'cam_helper_ov5647.cpp',\n>      'cam_helper_imx219.cpp',","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 5D68CBD1F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 21 Feb 2021 22:25:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 26477689ED;\n\tSun, 21 Feb 2021 23:25:12 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B54DA60106\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 21 Feb 2021 23:25:11 +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 4499FE9;\n\tSun, 21 Feb 2021 23:25:11 +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=\"s8oBANuy\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1613946311;\n\tbh=MVh1Of3BdcteaNh1cQZO4xoypeNTitavdcfzu6/BC6w=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=s8oBANuyV/3ykUAcgJsr41Z4oQsiwTflDEprVd/jyHit/eSOTe4Y2sBbjpmZjCnZP\n\tNmmQmtShhyUQJx4JMkhwlR1Vx/qJgP306MbpvudwCfViZ/usPZOIFxZYOTqBn88Z8u\n\t5Rp/Bo8j4heI8uFYu+CPsIj2hETxKU6P5u6XbkFs=","Date":"Mon, 22 Feb 2021 00:24:45 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YDLdrfSAFnj31HAF@pendragon.ideasonboard.com>","References":"<20210218170126.2060783-1-naush@raspberrypi.com>\n\t<20210218170126.2060783-3-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210218170126.2060783-3-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v3 2/4] ipa: raspberrypi: Remove\n\tMdParserRPi","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>"}}]