From patchwork Mon Jun 14 09:53:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12583 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 7721BC3218 for ; Mon, 14 Jun 2021 09:53:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1220568936; Mon, 14 Jun 2021 11:53:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="S93QUUwQ"; dkim-atps=neutral Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 13E066893C for ; Mon, 14 Jun 2021 11:53:49 +0200 (CEST) Received: by mail-wm1-x32d.google.com with SMTP id k5-20020a05600c1c85b02901affeec3ef8so12627537wms.0 for ; Mon, 14 Jun 2021 02:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XejH4KqE96/4XmZzclPo+84OiNylXyKa77noPloxPaY=; b=S93QUUwQfGMkrC746tPlkKvY9rYx0wsdHM1jT1B2upnwvi09QY07a/YTpuiFxPelKB Fs90bmxDeOPwz/t+SiNaxQipXzD2RkF9rjQrXH7VnoA2K5b/swbwqX5NG0iE9jAxIPRI MjJi+8sRYAicVrJExtTDzIpVluMwiceIMKd+v1fePDV0baROhyu18TuQxaJ4CvUyCxEB pGyqPjMTEhVul5MdAp8kY+USbepjjl3MeP2ivZZMcyNs2hVxpDWH3ZaMbrcQIP2aNagV T0vmyq2fQrnLJqKlgxE7Vpm/kltRXOLMZiNqY6Wxm5Dv3CA5tIA8Zep0o2HDKY1/Y8QF tOqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XejH4KqE96/4XmZzclPo+84OiNylXyKa77noPloxPaY=; b=TpbMfFavX+1Mvqd1x3uGJLrGy9Qro6ARIlPgzjmINoEA2pln0rkoVll8UCB9ePrru8 vdezWG/U8b+ryRYKHUUoq5exoCGBcOuGEtj/KLCt47/yMqlZADSYZX6/OfoslsYsrR4M s2keqVwYFsUzs1qqOaO2BPWoSlsut9SxP85z1sH2CHwBdg3NUO0Zrs3aEhJTezjovlxN gnz2754iQWduXGNFzPNRhMh8uC+DNZCF+Q5861bxQz+8y1WI90eUa2janEutIpGzq1fU d4mYI1wvS5IGqENifedb4lA0PwWnb3OLDbvVfpeMJYNO7oBH5x3k0SfY66DosYs2DM/f T6VQ== X-Gm-Message-State: AOAM5325pTJ2p42tXaj26oIBHiW8LSyvj/fxr9ANT+yKPovQ+bxMPG1M 2Kd1o0iNCA8jspAh8UUFI9znzfuDWLQJtw== X-Google-Smtp-Source: ABdhPJyeNmkx8fcd16wzfe4vOYJe4n9BZqAlTqeGXOYqlOTsuAh14tbILgt86T2lSndU5SbSfLM3fw== X-Received: by 2002:a7b:c853:: with SMTP id c19mr32219493wml.30.1623664428547; Mon, 14 Jun 2021 02:53:48 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:fd93:d554:2dff:83ca]) by smtp.gmail.com with ESMTPSA id c2sm19834891wmf.24.2021.06.14.02.53.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 02:53:48 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 14 Jun 2021 10:53:39 +0100 Message-Id: <20210614095340.3051816-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210614095340.3051816-1-naush@raspberrypi.com> References: <20210614095340.3051816-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/6] ipa: raspberrypi: Embed the metadata parser in the sensor CamHelper classes 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" This avoids the need for any dynamic allocations and lifetime management. The base CamHelper class still accesses the parser through a pointer that is setup by the derived class constructor. Signed-off-by: Naushir Patuck --- src/ipa/raspberrypi/cam_helper.cpp | 5 ++--- src/ipa/raspberrypi/cam_helper.hpp | 2 +- src/ipa/raspberrypi/cam_helper_imx219.cpp | 9 +++++---- src/ipa/raspberrypi/cam_helper_imx290.cpp | 2 +- src/ipa/raspberrypi/cam_helper_imx477.cpp | 5 ++++- src/ipa/raspberrypi/cam_helper_ov5647.cpp | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp index 062e94c4fef3..ab66e2ddef3e 100644 --- a/src/ipa/raspberrypi/cam_helper.cpp +++ b/src/ipa/raspberrypi/cam_helper.cpp @@ -40,15 +40,14 @@ CamHelper *CamHelper::Create(std::string const &cam_name) return nullptr; } -CamHelper::CamHelper(MdParser *parser, unsigned int frameIntegrationDiff) - : parser_(parser), initialized_(false), +CamHelper::CamHelper(unsigned int frameIntegrationDiff) + : parser_(nullptr), initialized_(false), frameIntegrationDiff_(frameIntegrationDiff) { } CamHelper::~CamHelper() { - delete parser_; } void CamHelper::Prepare(Span buffer, diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp index f53f5c39b01c..460839079741 100644 --- a/src/ipa/raspberrypi/cam_helper.hpp +++ b/src/ipa/raspberrypi/cam_helper.hpp @@ -67,7 +67,7 @@ class CamHelper { public: static CamHelper *Create(std::string const &cam_name); - CamHelper(MdParser *parser, unsigned int frameIntegrationDiff); + CamHelper(unsigned int frameIntegrationDiff); virtual ~CamHelper(); void SetCameraMode(const CameraMode &mode); virtual void Prepare(libcamera::Span buffer, diff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp index ec218dce5456..36dbe8cd941a 100644 --- a/src/ipa/raspberrypi/cam_helper_imx219.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx219.cpp @@ -54,15 +54,16 @@ private: * in units of lines. */ static constexpr int frameIntegrationDiff = 4; + + MdParserImx219 imx219_parser; }; CamHelperImx219::CamHelperImx219() + : CamHelper(frameIntegrationDiff) +{ #if ENABLE_EMBEDDED_DATA - : CamHelper(new MdParserImx219(), frameIntegrationDiff) -#else - : CamHelper(nullptr, frameIntegrationDiff) + parser_ = &imx219_parser; #endif -{ } uint32_t CamHelperImx219::GainCode(double gain) const diff --git a/src/ipa/raspberrypi/cam_helper_imx290.cpp b/src/ipa/raspberrypi/cam_helper_imx290.cpp index 6f412e403f16..dea57b84bf0b 100644 --- a/src/ipa/raspberrypi/cam_helper_imx290.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx290.cpp @@ -30,7 +30,7 @@ private: }; CamHelperImx290::CamHelperImx290() - : CamHelper(nullptr, frameIntegrationDiff) + : CamHelper(frameIntegrationDiff) { } diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp index 25b36bce0dac..038a8583d311 100644 --- a/src/ipa/raspberrypi/cam_helper_imx477.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp @@ -47,11 +47,14 @@ private: * in units of lines. */ static constexpr int frameIntegrationDiff = 22; + + MdParserImx477 imx477_parser; }; CamHelperImx477::CamHelperImx477() - : CamHelper(new MdParserImx477(), frameIntegrationDiff) + : CamHelper(frameIntegrationDiff) { + parser_ = &imx477_parser; } uint32_t CamHelperImx477::GainCode(double gain) const diff --git a/src/ipa/raspberrypi/cam_helper_ov5647.cpp b/src/ipa/raspberrypi/cam_helper_ov5647.cpp index 12be6bf931a8..fff648279d2a 100644 --- a/src/ipa/raspberrypi/cam_helper_ov5647.cpp +++ b/src/ipa/raspberrypi/cam_helper_ov5647.cpp @@ -38,7 +38,7 @@ private: */ CamHelperOv5647::CamHelperOv5647() - : CamHelper(nullptr, frameIntegrationDiff) + : CamHelper(frameIntegrationDiff) { }