From patchwork Tue Jun 29 10:44:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12744 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 0FDDCC3220 for ; Tue, 29 Jun 2021 10:45:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AFCC1684F1; Tue, 29 Jun 2021 12:45:14 +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="ZTBPlv/L"; dkim-atps=neutral Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B747C684CB for ; Tue, 29 Jun 2021 12:45:10 +0200 (CEST) Received: by mail-wr1-x430.google.com with SMTP id j1so25195855wrn.9 for ; Tue, 29 Jun 2021 03:45:10 -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=ByU0tPnr2bUEFQTfwUWtu++AJuNRXu6bhgu6LjppJcU=; b=ZTBPlv/LaRG8n6QhiMM0VgShSF83bJhDQGdHw0oY9nhLGp7Agp+gxfXBsTMnFJPPm0 7ln9bBw3L7CwZz+YiP/IpP/p926BEaPk/t9mj/dKax82VA8tRRM/o9C6+CoCSLICZ25c i8VaSBJ+FaIRdQ51umBzBnn0qrW1HSL25rbgDxQJFGYSOTUGnPsjx0rk5gN6I6zTCoRd 7aFz/JjxZ8B1ByirF8IPhDOvMoXb4IToZ0QNiR3aPO7celAfnNFPibvh6KXHc4H2HEs5 cFI/GAxtYZ1XTzgdC/dLHBvoKzBUg/djGM/S6gmQarWYHjmOCIflUFsL4E4wgykLNwVH MMiA== 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=ByU0tPnr2bUEFQTfwUWtu++AJuNRXu6bhgu6LjppJcU=; b=ZJcO1smbrwqWuQEVcQTFgpyTFCw9tUE5jxj7xsvRLEuEy5px0NnVb77pqhwHntfGzv BrVJGpbCRGwM3/77lsVMNmCTDBHObqDSkAAjWtAMyLhDskaPNnM8/b1oE9Gcky3skcKn 0SbBvaL1DWNQN+eIdWFTYpj0zFycoJ+HFmLIRW0tpFJSOgdtTUCH1WJkBMpb6zyqUY3E Ec811fq6Kajfc5wpM35+VuizMYuf+Li5HFaPkjBUWlul268jRyi96025VUZEfG1VFW9l ENgIivoFHC/2qpvFqInLMrDBkeHKm5nekGxXHzQ2cfZgduj7PV6pNJdrp0hR3k+ShuWO 8kNQ== X-Gm-Message-State: AOAM530S/U2hI19pavdNE2thtkbQCgf/3cJ1cA3dKhl1Y7LGCJHWWpLK MxlOclpb4BtR+pIasEaAoZuReWLJdSg3Vg== X-Google-Smtp-Source: ABdhPJyxE4eYd2jbB/0VFV6HBXc+FGd0ybMBhkZyXYXch2UEDhe4zsT9qTm/ZIfl59gbBmJmQmZ4Nw== X-Received: by 2002:adf:f907:: with SMTP id b7mr32715778wrr.357.1624963510283; Tue, 29 Jun 2021 03:45:10 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:d9cf:b3d0:bdee:72b2]) by smtp.gmail.com with ESMTPSA id l20sm16669930wmq.3.2021.06.29.03.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 03:45:09 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 29 Jun 2021 11:44:59 +0100 Message-Id: <20210629104500.51672-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629104500.51672-1-naush@raspberrypi.com> References: <20210629104500.51672-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/2] ipa: raspberrypi: Use a unique_ptr for the metadata parser 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 derived CamHelper class now allocates a metadata parser object through a unique_ptr that is passed to the base class constructor. This automates the lifetime management of the parser object. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/cam_helper.cpp | 5 ++--- src/ipa/raspberrypi/cam_helper.hpp | 5 +++-- src/ipa/raspberrypi/cam_helper_imx219.cpp | 4 ++-- src/ipa/raspberrypi/cam_helper_imx290.cpp | 2 +- src/ipa/raspberrypi/cam_helper_imx477.cpp | 2 +- src/ipa/raspberrypi/cam_helper_ov5647.cpp | 2 +- src/ipa/raspberrypi/cam_helper_ov9281.cpp | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp index 062e94c4fef3..90498c37af98 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(std::unique_ptr parser, unsigned int frameIntegrationDiff) + : parser_(std::move(parser)), 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 b19c95f67453..fc3139e22be0 100644 --- a/src/ipa/raspberrypi/cam_helper.hpp +++ b/src/ipa/raspberrypi/cam_helper.hpp @@ -6,6 +6,7 @@ */ #pragma once +#include #include #include @@ -67,7 +68,7 @@ class CamHelper { public: static CamHelper *Create(std::string const &cam_name); - CamHelper(MdParser *parser, unsigned int frameIntegrationDiff); + CamHelper(std::unique_ptr parser, unsigned int frameIntegrationDiff); virtual ~CamHelper(); void SetCameraMode(const CameraMode &mode); virtual void Prepare(libcamera::Span buffer, @@ -92,7 +93,7 @@ protected: void parseEmbeddedData(libcamera::Span buffer, Metadata &metadata); - MdParser *parser_; + std::unique_ptr parser_; CameraMode mode_; private: diff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp index ec218dce5456..c85044a5fa6d 100644 --- a/src/ipa/raspberrypi/cam_helper_imx219.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx219.cpp @@ -58,9 +58,9 @@ private: CamHelperImx219::CamHelperImx219() #if ENABLE_EMBEDDED_DATA - : CamHelper(new MdParserImx219(), frameIntegrationDiff) + : CamHelper(std::make_unique(), frameIntegrationDiff) #else - : CamHelper(nullptr, frameIntegrationDiff) + : CamHelper({}, frameIntegrationDiff) #endif { } diff --git a/src/ipa/raspberrypi/cam_helper_imx290.cpp b/src/ipa/raspberrypi/cam_helper_imx290.cpp index 6f412e403f16..871c1f8eaec4 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..d72a9be0438e 100644 --- a/src/ipa/raspberrypi/cam_helper_imx477.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp @@ -50,7 +50,7 @@ private: }; CamHelperImx477::CamHelperImx477() - : CamHelper(new MdParserImx477(), frameIntegrationDiff) + : CamHelper(std::make_unique(), frameIntegrationDiff) { } diff --git a/src/ipa/raspberrypi/cam_helper_ov5647.cpp b/src/ipa/raspberrypi/cam_helper_ov5647.cpp index 12be6bf931a8..702c2d07f73a 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) { } diff --git a/src/ipa/raspberrypi/cam_helper_ov9281.cpp b/src/ipa/raspberrypi/cam_helper_ov9281.cpp index 54091f835565..9de868c31dc0 100644 --- a/src/ipa/raspberrypi/cam_helper_ov9281.cpp +++ b/src/ipa/raspberrypi/cam_helper_ov9281.cpp @@ -34,7 +34,7 @@ private: */ CamHelperOv9281::CamHelperOv9281() - : CamHelper(nullptr, frameIntegrationDiff) + : CamHelper({}, frameIntegrationDiff) { }