{"id":12583,"url":"https://patchwork.libcamera.org/api/patches/12583/?format=json","web_url":"https://patchwork.libcamera.org/patch/12583/","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":"<20210614095340.3051816-6-naush@raspberrypi.com>","date":"2021-06-14T09:53:39","name":"[libcamera-devel,5/6] ipa: raspberrypi: Embed the metadata parser in the sensor CamHelper classes","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5cb1ffd6e1a3ea4bfb14c29c9bc7a55029917ba8","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/12583/mbox/","series":[{"id":2128,"url":"https://patchwork.libcamera.org/api/series/2128/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2128","date":"2021-06-14T09:53:34","name":"Raspberry Pi: Metadata parsing improvements","version":1,"mbox":"https://patchwork.libcamera.org/series/2128/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12583/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12583/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 7721BC3218\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Jun 2021 09:53:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1220568936;\n\tMon, 14 Jun 2021 11:53:56 +0200 (CEST)","from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com\n\t[IPv6:2a00:1450:4864:20::32d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 13E066893C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Jun 2021 11:53:49 +0200 (CEST)","by mail-wm1-x32d.google.com with SMTP id\n\tk5-20020a05600c1c85b02901affeec3ef8so12627537wms.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Jun 2021 02:53:49 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:fd93:d554:2dff:83ca])\n\tby smtp.gmail.com with ESMTPSA id\n\tc2sm19834891wmf.24.2021.06.14.02.53.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 14 Jun 2021 02:53:48 -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=\"S93QUUwQ\"; 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=XejH4KqE96/4XmZzclPo+84OiNylXyKa77noPloxPaY=;\n\tb=S93QUUwQfGMkrC746tPlkKvY9rYx0wsdHM1jT1B2upnwvi09QY07a/YTpuiFxPelKB\n\tFs90bmxDeOPwz/t+SiNaxQipXzD2RkF9rjQrXH7VnoA2K5b/swbwqX5NG0iE9jAxIPRI\n\tMjJi+8sRYAicVrJExtTDzIpVluMwiceIMKd+v1fePDV0baROhyu18TuQxaJ4CvUyCxEB\n\tpGyqPjMTEhVul5MdAp8kY+USbepjjl3MeP2ivZZMcyNs2hVxpDWH3ZaMbrcQIP2aNagV\n\tT0vmyq2fQrnLJqKlgxE7Vpm/kltRXOLMZiNqY6Wxm5Dv3CA5tIA8Zep0o2HDKY1/Y8QF\n\ttOqA==","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=XejH4KqE96/4XmZzclPo+84OiNylXyKa77noPloxPaY=;\n\tb=TpbMfFavX+1Mvqd1x3uGJLrGy9Qro6ARIlPgzjmINoEA2pln0rkoVll8UCB9ePrru8\n\tvdezWG/U8b+ryRYKHUUoq5exoCGBcOuGEtj/KLCt47/yMqlZADSYZX6/OfoslsYsrR4M\n\ts2keqVwYFsUzs1qqOaO2BPWoSlsut9SxP85z1sH2CHwBdg3NUO0Zrs3aEhJTezjovlxN\n\tgnz2754iQWduXGNFzPNRhMh8uC+DNZCF+Q5861bxQz+8y1WI90eUa2janEutIpGzq1fU\n\td4mYI1wvS5IGqENifedb4lA0PwWnb3OLDbvVfpeMJYNO7oBH5x3k0SfY66DosYs2DM/f\n\tT6VQ==","X-Gm-Message-State":"AOAM5325pTJ2p42tXaj26oIBHiW8LSyvj/fxr9ANT+yKPovQ+bxMPG1M\n\t2Kd1o0iNCA8jspAh8UUFI9znzfuDWLQJtw==","X-Google-Smtp-Source":"ABdhPJyeNmkx8fcd16wzfe4vOYJe4n9BZqAlTqeGXOYqlOTsuAh14tbILgt86T2lSndU5SbSfLM3fw==","X-Received":"by 2002:a7b:c853:: with SMTP id\n\tc19mr32219493wml.30.1623664428547; \n\tMon, 14 Jun 2021 02:53:48 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 5/6] ipa: raspberrypi: Embed the metadata\n\tparser in the sensor CamHelper classes","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":"This avoids the need for any dynamic allocations and lifetime management. The\nbase CamHelper class still accesses the parser through a pointer that is setup\nby the derived class constructor.\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        | 2 +-\n src/ipa/raspberrypi/cam_helper_imx219.cpp | 9 +++++----\n src/ipa/raspberrypi/cam_helper_imx290.cpp | 2 +-\n src/ipa/raspberrypi/cam_helper_imx477.cpp | 5 ++++-\n src/ipa/raspberrypi/cam_helper_ov5647.cpp | 2 +-\n 6 files changed, 14 insertions(+), 11 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\nindex 062e94c4fef3..ab66e2ddef3e 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(unsigned int frameIntegrationDiff)\n+\t: parser_(nullptr), 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..460839079741 100644\n--- a/src/ipa/raspberrypi/cam_helper.hpp\n+++ b/src/ipa/raspberrypi/cam_helper.hpp\n@@ -67,7 +67,7 @@ class CamHelper\n {\n public:\n \tstatic CamHelper *Create(std::string const &cam_name);\n-\tCamHelper(MdParser *parser, unsigned int frameIntegrationDiff);\n+\tCamHelper(unsigned int frameIntegrationDiff);\n \tvirtual ~CamHelper();\n \tvoid SetCameraMode(const CameraMode &mode);\n \tvirtual void Prepare(libcamera::Span<const uint8_t> buffer,\ndiff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp\nindex ec218dce5456..36dbe8cd941a 100644\n--- a/src/ipa/raspberrypi/cam_helper_imx219.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_imx219.cpp\n@@ -54,15 +54,16 @@ private:\n \t * in units of lines.\n \t */\n \tstatic constexpr int frameIntegrationDiff = 4;\n+\n+\tMdParserImx219 imx219_parser;\n };\n \n CamHelperImx219::CamHelperImx219()\n+\t: CamHelper(frameIntegrationDiff)\n+{\n #if ENABLE_EMBEDDED_DATA\n-\t: CamHelper(new MdParserImx219(), frameIntegrationDiff)\n-#else\n-\t: CamHelper(nullptr, frameIntegrationDiff)\n+\tparser_ = &imx219_parser;\n #endif\n-{\n }\n \n uint32_t CamHelperImx219::GainCode(double gain) const\ndiff --git a/src/ipa/raspberrypi/cam_helper_imx290.cpp b/src/ipa/raspberrypi/cam_helper_imx290.cpp\nindex 6f412e403f16..dea57b84bf0b 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..038a8583d311 100644\n--- a/src/ipa/raspberrypi/cam_helper_imx477.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp\n@@ -47,11 +47,14 @@ private:\n \t * in units of lines.\n \t */\n \tstatic constexpr int frameIntegrationDiff = 22;\n+\n+\tMdParserImx477 imx477_parser;\n };\n \n CamHelperImx477::CamHelperImx477()\n-\t: CamHelper(new MdParserImx477(), frameIntegrationDiff)\n+\t: CamHelper(frameIntegrationDiff)\n {\n+\tparser_ = &imx477_parser;\n }\n \n uint32_t CamHelperImx477::GainCode(double gain) const\ndiff --git a/src/ipa/raspberrypi/cam_helper_ov5647.cpp b/src/ipa/raspberrypi/cam_helper_ov5647.cpp\nindex 12be6bf931a8..fff648279d2a 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","5/6"]}