From patchwork Tue Feb 16 10:31:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11308 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 C4E55BD160 for ; Tue, 16 Feb 2021 10:32:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3749C637E5; Tue, 16 Feb 2021 11:32:15 +0100 (CET) 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="pSoUytr6"; dkim-atps=neutral Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 99D82637D7 for ; Tue, 16 Feb 2021 11:32:12 +0100 (CET) Received: by mail-wr1-x42d.google.com with SMTP id n8so12264294wrm.10 for ; Tue, 16 Feb 2021 02:32:12 -0800 (PST) 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=qmnEAoO4i7QBLDEGgA6LFmWZLM34sydbmOWer6mxaWY=; b=pSoUytr6z+CFLilg2ARCsxoe6OTXcv/7JZuto6A7mgURY5NrCs1Q7Az4yjKZ46nnqE fD0nJaGsO8bPTzHGGeMINqh2ZvKOuL8yqGZLubrQEwqDvVwEPqVbHkcHwG/SmAmxuuNk 2RqN/pN3Vh6K1DXt24gce1EM922rnozITczO6VIv8ADG7NlTSWTytE/CNPTe3JZuVqVa rbcUA4Oy2GqJpsDV7D0mR085Wdtat2XSLULHrWvjqPfVIqpsKs1yJGNOKhdnLJtB7vrh gQeGD2HDlBgDTNnZlm/rG5kS2bah6npF3YNDPW8lg5GHcYLUTxSWQK+LbnTrUcUhgbxH OgLQ== 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=qmnEAoO4i7QBLDEGgA6LFmWZLM34sydbmOWer6mxaWY=; b=KvLovm+VnYTMAVXB7fYf9d9lXVen9QxaEEAjJQ9ijs3ApZVaSdqRoC1ZB6vIDzyVKO 7MXqPHrIGR+FVE5AVvfjeXOPQAvZJtunjZ60p4eRqoUBa+b3Rjf9EQbFjDBUJh6qhqpp HahXJqgnGCbR9cpD2TWtu1hJK7/2KneNiqiPD0S+fTxJeDoWHlf3DstvsAECifFp3+PT 3EPyqrHg+I5i5eWJYUMqYRFEd/UEcGFaI+kJlmtK8iqYrnnDaxXczidZt4fhaOtcIiTd S2QzXaDPRLVbCv5Mxu4r07xNiBvY1+Qqc4z3cXgyCyXPKycIV7CV6wNCbbsAYYF/iarH QgUA== X-Gm-Message-State: AOAM530lzXpQeQKjasGE1adE9OhYTlk9+sb9wLNMHgIBCDePThCJ9Ebu yPecD6hkrjgw7it3Ub35Ov8wFHbfW+DweFdH X-Google-Smtp-Source: ABdhPJwb8Fr0yOpmyKVY1BZdaHnXHBgj7UsedqYQdIWE68icUHiS1NYvTisxr2AD5jam59dilDd0Eg== X-Received: by 2002:adf:d082:: with SMTP id y2mr1351419wrh.293.1613471532138; Tue, 16 Feb 2021 02:32:12 -0800 (PST) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id a186sm3018054wme.17.2021.02.16.02.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 02:32:11 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Feb 2021 10:31:38 +0000 Message-Id: <20210216103140.1077307-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210216103140.1077307-1-naush@raspberrypi.com> References: <20210216103140.1077307-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/4] ipa: raspberrypi: Remove MdParserRPi 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" With the recent change to pass a ControlList to the IPA with exposure and gain values used for a frame, RPiController::MdParserRPi is not needed any more. Remove all traces of it. The derived CamHelper objects now pass nullptr values for the parser to the base CamHelper class when sensors do not use metadata. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/cam_helper.cpp | 9 ++++-- src/ipa/raspberrypi/cam_helper_imx219.cpp | 4 +-- src/ipa/raspberrypi/cam_helper_ov5647.cpp | 3 +- src/ipa/raspberrypi/md_parser_rpi.cpp | 37 ----------------------- src/ipa/raspberrypi/md_parser_rpi.hpp | 32 -------------------- src/ipa/raspberrypi/meson.build | 1 - 6 files changed, 8 insertions(+), 78 deletions(-) delete mode 100644 src/ipa/raspberrypi/md_parser_rpi.cpp delete mode 100644 src/ipa/raspberrypi/md_parser_rpi.hpp diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp index 93d1b7b0296a..c9cdc39c5932 100644 --- a/src/ipa/raspberrypi/cam_helper.cpp +++ b/src/ipa/raspberrypi/cam_helper.cpp @@ -42,7 +42,8 @@ CamHelper::CamHelper(MdParser *parser, unsigned int frameIntegrationDiff) CamHelper::~CamHelper() { - delete parser_; + if (parser_) + delete parser_; } uint32_t CamHelper::ExposureLines(double exposure_us) const @@ -88,8 +89,10 @@ uint32_t CamHelper::GetVBlanking(double &exposure, double minFrameDuration, void CamHelper::SetCameraMode(const CameraMode &mode) { mode_ = mode; - parser_->SetBitsPerPixel(mode.bitdepth); - parser_->SetLineLengthBytes(0); /* We use SetBufferSize. */ + if (parser_) { + parser_->SetBitsPerPixel(mode.bitdepth); + parser_->SetLineLengthBytes(0); /* We use SetBufferSize. */ + } initialized_ = true; } diff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp index 95b8e698fe3b..0e454d0de2dc 100644 --- a/src/ipa/raspberrypi/cam_helper_imx219.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx219.cpp @@ -19,8 +19,6 @@ #include "cam_helper.hpp" #if ENABLE_EMBEDDED_DATA #include "md_parser.hpp" -#else -#include "md_parser_rpi.hpp" #endif using namespace RPiController; @@ -62,7 +60,7 @@ CamHelperImx219::CamHelperImx219() #if ENABLE_EMBEDDED_DATA : CamHelper(new MdParserImx219(), frameIntegrationDiff) #else - : CamHelper(new MdParserRPi(), frameIntegrationDiff) + : CamHelper(nullptr, frameIntegrationDiff) #endif { } diff --git a/src/ipa/raspberrypi/cam_helper_ov5647.cpp b/src/ipa/raspberrypi/cam_helper_ov5647.cpp index a7f417324048..75486e900d31 100644 --- a/src/ipa/raspberrypi/cam_helper_ov5647.cpp +++ b/src/ipa/raspberrypi/cam_helper_ov5647.cpp @@ -8,7 +8,6 @@ #include #include "cam_helper.hpp" -#include "md_parser_rpi.hpp" using namespace RPiController; @@ -38,7 +37,7 @@ private: */ CamHelperOv5647::CamHelperOv5647() - : CamHelper(new MdParserRPi(), frameIntegrationDiff) + : CamHelper(nullptr, frameIntegrationDiff) { } diff --git a/src/ipa/raspberrypi/md_parser_rpi.cpp b/src/ipa/raspberrypi/md_parser_rpi.cpp deleted file mode 100644 index 2b0bcfc5f034..000000000000 --- a/src/ipa/raspberrypi/md_parser_rpi.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: BSD-2-Clause */ -/* - * Copyright (C) 2020, Raspberry Pi (Trading) Limited - * - * md_parser_rpi.cpp - Metadata parser for generic Raspberry Pi metadata - */ - -#include - -#include "md_parser_rpi.hpp" - -using namespace RPiController; - -MdParserRPi::MdParserRPi() -{ -} - -MdParser::Status MdParserRPi::Parse(void *data) -{ - if (buffer_size_bytes_ < sizeof(rpiMetadata)) - return ERROR; - - memcpy(&metadata, data, sizeof(rpiMetadata)); - return OK; -} - -MdParser::Status MdParserRPi::GetExposureLines(unsigned int &lines) -{ - lines = metadata.exposure; - return OK; -} - -MdParser::Status MdParserRPi::GetGainCode(unsigned int &gain_code) -{ - gain_code = metadata.gain; - return OK; -} diff --git a/src/ipa/raspberrypi/md_parser_rpi.hpp b/src/ipa/raspberrypi/md_parser_rpi.hpp deleted file mode 100644 index 52f54f008056..000000000000 --- a/src/ipa/raspberrypi/md_parser_rpi.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: BSD-2-Clause */ -/* - * Copyright (C) 2019, Raspberry Pi (Trading) Limited - * - * md_parser_rpi.hpp - Raspberry Pi metadata parser interface - */ -#pragma once - -#include "md_parser.hpp" - -namespace RPiController { - -class MdParserRPi : public MdParser -{ -public: - MdParserRPi(); - Status Parse(void *data) override; - Status GetExposureLines(unsigned int &lines) override; - Status GetGainCode(unsigned int &gain_code) override; - -private: - // This must be the same struct that is filled into the metadata buffer - // in the pipeline handler. - struct rpiMetadata - { - uint32_t exposure; - uint32_t gain; - }; - rpiMetadata metadata; -}; - -} diff --git a/src/ipa/raspberrypi/meson.build b/src/ipa/raspberrypi/meson.build index 9e9ea80b93ad..0baf7b7e8d4a 100644 --- a/src/ipa/raspberrypi/meson.build +++ b/src/ipa/raspberrypi/meson.build @@ -17,7 +17,6 @@ rpi_ipa_includes = [ rpi_ipa_sources = files([ 'raspberrypi.cpp', 'md_parser.cpp', - 'md_parser_rpi.cpp', 'cam_helper.cpp', 'cam_helper_ov5647.cpp', 'cam_helper_imx219.cpp',