{"id":12744,"url":"https://patchwork.libcamera.org/api/1.1/patches/12744/?format=json","web_url":"https://patchwork.libcamera.org/patch/12744/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20210629104500.51672-2-naush@raspberrypi.com>","date":"2021-06-29T10:44:59","name":"[libcamera-devel,v3,1/2] ipa: raspberrypi: Use a unique_ptr for the metadata parser","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"51c0d0cdd9007155f43fdf998b9d59b5b1c55aee","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12744/mbox/","series":[{"id":2191,"url":"https://patchwork.libcamera.org/api/1.1/series/2191/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2191","date":"2021-06-29T10:44:58","name":"Raspberry Pi: Metadata parsing improvements (II)","version":3,"mbox":"https://patchwork.libcamera.org/series/2191/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12744/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12744/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 0FDDCC3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 29 Jun 2021 10:45:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AFCC1684F1;\n\tTue, 29 Jun 2021 12:45:14 +0200 (CEST)","from mail-wr1-x430.google.com (mail-wr1-x430.google.com\n\t[IPv6:2a00:1450:4864:20::430])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B747C684CB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Jun 2021 12:45:10 +0200 (CEST)","by mail-wr1-x430.google.com with SMTP id j1so25195855wrn.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Jun 2021 03:45:10 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:d9cf:b3d0:bdee:72b2])\n\tby smtp.gmail.com with ESMTPSA id\n\tl20sm16669930wmq.3.2021.06.29.03.45.09\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 29 Jun 2021 03:45:09 -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=\"ZTBPlv/L\"; 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=ByU0tPnr2bUEFQTfwUWtu++AJuNRXu6bhgu6LjppJcU=;\n\tb=ZTBPlv/LaRG8n6QhiMM0VgShSF83bJhDQGdHw0oY9nhLGp7Agp+gxfXBsTMnFJPPm0\n\t7ln9bBw3L7CwZz+YiP/IpP/p926BEaPk/t9mj/dKax82VA8tRRM/o9C6+CoCSLICZ25c\n\ti8VaSBJ+FaIRdQ51umBzBnn0qrW1HSL25rbgDxQJFGYSOTUGnPsjx0rk5gN6I6zTCoRd\n\t7aFz/JjxZ8B1ByirF8IPhDOvMoXb4IToZ0QNiR3aPO7celAfnNFPibvh6KXHc4H2HEs5\n\tcFI/GAxtYZ1XTzgdC/dLHBvoKzBUg/djGM/S6gmQarWYHjmOCIflUFsL4E4wgykLNwVH\n\tMMiA==","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=ByU0tPnr2bUEFQTfwUWtu++AJuNRXu6bhgu6LjppJcU=;\n\tb=ZJcO1smbrwqWuQEVcQTFgpyTFCw9tUE5jxj7xsvRLEuEy5px0NnVb77pqhwHntfGzv\n\tBrVJGpbCRGwM3/77lsVMNmCTDBHObqDSkAAjWtAMyLhDskaPNnM8/b1oE9Gcky3skcKn\n\t0SbBvaL1DWNQN+eIdWFTYpj0zFycoJ+HFmLIRW0tpFJSOgdtTUCH1WJkBMpb6zyqUY3E\n\tEc811fq6Kajfc5wpM35+VuizMYuf+Li5HFaPkjBUWlul268jRyi96025VUZEfG1VFW9l\n\tENgIivoFHC/2qpvFqInLMrDBkeHKm5nekGxXHzQ2cfZgduj7PV6pNJdrp0hR3k+ShuWO\n\t8kNQ==","X-Gm-Message-State":"AOAM530S/U2hI19pavdNE2thtkbQCgf/3cJ1cA3dKhl1Y7LGCJHWWpLK\n\tMxlOclpb4BtR+pIasEaAoZuReWLJdSg3Vg==","X-Google-Smtp-Source":"ABdhPJyxE4eYd2jbB/0VFV6HBXc+FGd0ybMBhkZyXYXch2UEDhe4zsT9qTm/ZIfl59gbBmJmQmZ4Nw==","X-Received":"by 2002:adf:f907:: with SMTP id\n\tb7mr32715778wrr.357.1624963510283; \n\tTue, 29 Jun 2021 03:45:10 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 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>\nReviewed-by: David Plowman <david.plowman@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 src/ipa/raspberrypi/cam_helper_ov9281.cpp | 2 +-\n 7 files changed, 11 insertions(+), 11 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 b19c95f67453..fc3139e22be0 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/base/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 \ndiff --git a/src/ipa/raspberrypi/cam_helper_ov9281.cpp b/src/ipa/raspberrypi/cam_helper_ov9281.cpp\nindex 54091f835565..9de868c31dc0 100644\n--- a/src/ipa/raspberrypi/cam_helper_ov9281.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_ov9281.cpp\n@@ -34,7 +34,7 @@ private:\n  */\n \n CamHelperOv9281::CamHelperOv9281()\n-\t: CamHelper(nullptr, frameIntegrationDiff)\n+\t: CamHelper({}, frameIntegrationDiff)\n {\n }\n \n","prefixes":["libcamera-devel","v3","1/2"]}