{"id":12682,"url":"https://patchwork.libcamera.org/api/patches/12682/?format=json","web_url":"https://patchwork.libcamera.org/patch/12682/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210622132014.949961-2-naush@raspberrypi.com>","date":"2021-06-22T13:20:13","name":"[libcamera-devel,v2,1/2] ipa: raspberrypi: Use a unique_ptr for the metadata parser","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"6dda8d750a55f8427a73248724da2b718a87971f","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12682/mbox/","series":[{"id":2167,"url":"https://patchwork.libcamera.org/api/series/2167/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2167","date":"2021-06-22T13:20:12","name":"Raspberry Pi: Metadata parsing improvements (II)","version":2,"mbox":"https://patchwork.libcamera.org/series/2167/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12682/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12682/checks/","tags":{},"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 11162C321B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Jun 2021 13:20:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 417096893F;\n\tTue, 22 Jun 2021 15:20:23 +0200 (CEST)","from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9591760292\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jun 2021 15:20:21 +0200 (CEST)","by mail-wm1-x32b.google.com with SMTP id\n\tp8-20020a7bcc880000b02901dbb595a9f1so2245193wma.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jun 2021 06:20:21 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:28d:3aa5:c82:cbf1])\n\tby smtp.gmail.com with ESMTPSA id\n\tk5sm2632213wmk.11.2021.06.22.06.20.20\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Jun 2021 06:20:20 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"cv+cNML+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=ZWWXxzkpiXhFeZsiVPLzjKg4oAmn09mNEBwBkvPqi0o=;\n\tb=cv+cNML+3Ql2PIk6/MtCGW4R3rRfO2ihqd7Mt6Tb+A/IPel/Q5jB65havmMwV95p7I\n\tBgjmpYBie1l0BYjz7N7x2fByukDCsawTdWQ87XFySo/ydt8ngzEWauyoV/xDC70gG8xQ\n\tFT3m40AvSjBdomBD3qjIGTxK0h1zPG+XKDIHZ+t+z0RT/D8cikEkp4O47nWAdfZn0CJk\n\t+VLWwnbXLBcgM9OkT1E/U0rDeb4GpPjdfGX6Z+6TKaFFy5cMs50GhM147IDRlDSH5wUc\n\tWsrpSmi/NqivvmgT0vWvoNwxAbBUs5tb6W+kQE0kYZ+bu5576752l1b/srDVccvyFf56\n\tDfrg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=ZWWXxzkpiXhFeZsiVPLzjKg4oAmn09mNEBwBkvPqi0o=;\n\tb=qi2pdZ5ulXwIcVoXaPVAnGvEynX6voKQWkXHZNaf3eMyUKzzoo3VfwiKkSv3Fi4KQb\n\td3aR52i+MsqSc2rtyyjDoBMcSFaMPxWPClrJosVMqKfui2bHf9mlrwCd1Nuei4z2X4lZ\n\tivgGGU3n0+ZTjRO4HDTdFRCWYJIROWKM6HWdDRONg5/8Fqmtyvy26nj/hIvOBAnBWbCy\n\t9cYQIlggnS0t6wd5d/bRSgWtSB8gxBYOluUlHFi9dXYrfnYp8Uolgk/Kb4oZBWInvxXe\n\t+A/8ki2wSbTLlgM6oXiDuVdVuu+I1HJn0Bz0BDZWapHatQF9WozEZfag2dKOFgxEws4I\n\tnyEA==","X-Gm-Message-State":"AOAM531zHEK1y3NeU8nWExuOM2/xdYI11/YZjefAxbPzRmwtMqwjzsz2\n\tGoM6BHNUehwOmL0CSIFbSux/spL5QhK7lw==","X-Google-Smtp-Source":"ABdhPJx1fLsowPT3BSmsxDj84iH5eMA00HtZt8n3rWiQ2lgTPBEB9nNEYx0HgTZNz+xjKf4rolZF9g==","X-Received":"by 2002:a1c:6503:: with SMTP id z3mr4353446wmb.72.1624368021126; \n\tTue, 22 Jun 2021 06:20:21 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 22 Jun 2021 14:20:13 +0100","Message-Id":"<20210622132014.949961-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20210622132014.949961-1-naush@raspberrypi.com>","References":"<20210622132014.949961-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 1/2] ipa: raspberrypi: Use a unique_ptr\n\tfor the metadata parser","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The derived CamHelper class now allocates a metadata parser object through a\nunique_ptr that is passed to the base class constructor. This automates the\nlifetime management of the parser object.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/cam_helper.cpp        | 5 ++---\n src/ipa/raspberrypi/cam_helper.hpp        | 5 +++--\n src/ipa/raspberrypi/cam_helper_imx219.cpp | 4 ++--\n src/ipa/raspberrypi/cam_helper_imx290.cpp | 2 +-\n src/ipa/raspberrypi/cam_helper_imx477.cpp | 2 +-\n src/ipa/raspberrypi/cam_helper_ov5647.cpp | 2 +-\n 6 files changed, 10 insertions(+), 10 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\nindex 062e94c4fef3..90498c37af98 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -40,15 +40,14 @@ CamHelper *CamHelper::Create(std::string const &cam_name)\n \treturn nullptr;\n }\n \n-CamHelper::CamHelper(MdParser *parser, unsigned int frameIntegrationDiff)\n-\t: parser_(parser), initialized_(false),\n+CamHelper::CamHelper(std::unique_ptr<MdParser> parser, unsigned int frameIntegrationDiff)\n+\t: parser_(std::move(parser)), initialized_(false),\n \t  frameIntegrationDiff_(frameIntegrationDiff)\n {\n }\n \n CamHelper::~CamHelper()\n {\n-\tdelete parser_;\n }\n \n void CamHelper::Prepare(Span<const uint8_t> buffer,\ndiff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp\nindex f53f5c39b01c..7371b9d97f66 100644\n--- a/src/ipa/raspberrypi/cam_helper.hpp\n+++ b/src/ipa/raspberrypi/cam_helper.hpp\n@@ -6,6 +6,7 @@\n  */\n #pragma once\n \n+#include <memory>\n #include <string>\n \n #include <libcamera/span.h>\n@@ -67,7 +68,7 @@ class CamHelper\n {\n public:\n \tstatic CamHelper *Create(std::string const &cam_name);\n-\tCamHelper(MdParser *parser, unsigned int frameIntegrationDiff);\n+\tCamHelper(std::unique_ptr<MdParser> parser, unsigned int frameIntegrationDiff);\n \tvirtual ~CamHelper();\n \tvoid SetCameraMode(const CameraMode &mode);\n \tvirtual void Prepare(libcamera::Span<const uint8_t> buffer,\n@@ -92,7 +93,7 @@ protected:\n \tvoid parseEmbeddedData(libcamera::Span<const uint8_t> buffer,\n \t\t\t       Metadata &metadata);\n \n-\tMdParser *parser_;\n+\tstd::unique_ptr<MdParser> parser_;\n \tCameraMode mode_;\n \n private:\ndiff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp\nindex ec218dce5456..c85044a5fa6d 100644\n--- a/src/ipa/raspberrypi/cam_helper_imx219.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_imx219.cpp\n@@ -58,9 +58,9 @@ private:\n \n CamHelperImx219::CamHelperImx219()\n #if ENABLE_EMBEDDED_DATA\n-\t: CamHelper(new MdParserImx219(), frameIntegrationDiff)\n+\t: CamHelper(std::make_unique<MdParserImx219>(), frameIntegrationDiff)\n #else\n-\t: CamHelper(nullptr, frameIntegrationDiff)\n+\t: CamHelper({}, frameIntegrationDiff)\n #endif\n {\n }\ndiff --git a/src/ipa/raspberrypi/cam_helper_imx290.cpp b/src/ipa/raspberrypi/cam_helper_imx290.cpp\nindex 6f412e403f16..871c1f8eaec4 100644\n--- a/src/ipa/raspberrypi/cam_helper_imx290.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_imx290.cpp\n@@ -30,7 +30,7 @@ private:\n };\n \n CamHelperImx290::CamHelperImx290()\n-\t: CamHelper(nullptr, frameIntegrationDiff)\n+\t: CamHelper({}, frameIntegrationDiff)\n {\n }\n \ndiff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp\nindex 25b36bce0dac..d72a9be0438e 100644\n--- a/src/ipa/raspberrypi/cam_helper_imx477.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp\n@@ -50,7 +50,7 @@ private:\n };\n \n CamHelperImx477::CamHelperImx477()\n-\t: CamHelper(new MdParserImx477(), frameIntegrationDiff)\n+\t: CamHelper(std::make_unique<MdParserImx477>(), frameIntegrationDiff)\n {\n }\n \ndiff --git a/src/ipa/raspberrypi/cam_helper_ov5647.cpp b/src/ipa/raspberrypi/cam_helper_ov5647.cpp\nindex 12be6bf931a8..702c2d07f73a 100644\n--- a/src/ipa/raspberrypi/cam_helper_ov5647.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_ov5647.cpp\n@@ -38,7 +38,7 @@ private:\n  */\n \n CamHelperOv5647::CamHelperOv5647()\n-\t: CamHelper(nullptr, frameIntegrationDiff)\n+\t: CamHelper({}, frameIntegrationDiff)\n {\n }\n \n","prefixes":["libcamera-devel","v2","1/2"]}