From patchwork Mon Jul 25 13:46:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 16756 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 817BAC3275 for ; Mon, 25 Jul 2022 13:46:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0ED1D6331F; Mon, 25 Jul 2022 15:46:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658756812; bh=wBr6GeSNjbNeiJOfvAajOGR2cAJkB4sACYZ4PNt+0vI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=dmnSgpjMMs5cy8Kr2Ud4RlL4tBANRlhhp16zGnkfW+UY9C5322n79ja/9pWYgmwBb v1O1UbXrfMB78zH7BvFr/Nqz2sR4alsqIP1tuT2rGEOWK2LDe7SB/w7EubHrPQvZh1 7duUfZ9PnZe1mrQslvKIqmbfLmLiNIU/MfPFhNRTKXGs2FMCqxYOfsjv5Twx9cCLFL uU0lbb97XlmuEq4nMc8UYH4DXMNtp1ckj7yu0kdo1kIdJt/yh5r5lJpAr3j0LlC5ZJ XDO+7quk4X/nZz0KNUj2iY3fuoD3zYkpL3AlREnpOucHl3cEN1+esIdwX5y0ll5Orv G9M/Ffb0NS8Xw== Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5381D63318 for ; Mon, 25 Jul 2022 15:46:46 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="OKlDEyjX"; dkim-atps=neutral Received: by mail-wr1-x431.google.com with SMTP id l15so11987862wro.11 for ; Mon, 25 Jul 2022 06:46:46 -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=Zoj/Sckg9nfwUrL0mofZdw8XDWZ4WXG8lzOxuOccHAk=; b=OKlDEyjXU8jTDAOYLx2XAds6oUEm7Mgixo3kkEN/8HsHw980ImAGoQ50pNoPu7O4U+ Re4O/Dsk+/sKqEWjci9kWgGwBa1V8DLePvfyiCZt+nyZ7N+o0eo2nG/UkRN3Ksvqi1FI VRmx5R4cVKGYOvdJC3npuUGjYEt6b6s+3ElEbcgr2cgtb0hqERvI8eBs1D1i+AvFnqDJ y1Nw3lo6fklX3gg0SPdUbpAKdeS/gkIQ6oyj3cB4A3E27i5O/yTgqQIU/Le/egqXLvtV UZZql+ErlkgwuFuM343SIO12XVzosFYq1KHmA45Saze4oq6t2MAyxHe5kKbW9Db++z5X ggPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zoj/Sckg9nfwUrL0mofZdw8XDWZ4WXG8lzOxuOccHAk=; b=AFgb34B00hC/DQpcTrkfW9oRFBR2+PDYCMm0GYOzd0iXRwwr7vsxkU2E4rU24DOJjo IPLnUOlfIPuYzvS8DvfS5cHqPnFeTUXoHs7+4CXD9nqjkeQTNMTX47ifyKazJ70x6P9f u+gzK7fQhXd/CEBYCLhPRjzjI8Xl/ZdVi8ulDX3wo75Din59FT0K8WlZSLNlJqSLuNcn qgCZIr600sJdMEpUcMBuvC2b3Z+azXyG4IPseijVuRqq5u/o7mKC/vl8j6xBsV3foPGc Xf1VT+/fTY20Ym+jFoEnGQZs3tdBEBbF6lW8qyeOeV59SK5gAHxX9DaoXC5LZ8HkCiPB 8Mjw== X-Gm-Message-State: AJIora/WvqG0fpn3OL+xcAKybu7j6vbewQJT/QULviZemgLUhYMqcqPA ZD+qyC24G/1WGvFJ4b+XxVOhq8hSQlXLAA== X-Google-Smtp-Source: AGRyM1vmrjmP/64epK8siK5Zr5DwYd9pgsBGCDnliIYO6sA7R2Wc8FgwlH3FJhix8vaNRLVxrX4+kA== X-Received: by 2002:a5d:65c8:0:b0:21e:6459:4a1c with SMTP id e8-20020a5d65c8000000b0021e64594a1cmr7473333wrw.639.1658756805616; Mon, 25 Jul 2022 06:46:45 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id a20-20020a05600c225400b003a32167b8d4sm18054320wmm.13.2022.07.25.06.46.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:46:45 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 25 Jul 2022 14:46:27 +0100 Message-Id: <20220725134639.4572-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220725134639.4572-1-naush@raspberrypi.com> References: <20220725134639.4572-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 03/15] DNI: ipa: raspberrypi: Code refactoring to match style guidelines 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: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Refactor the source files under src/ipa/raspberrypi/controller/a* to match the recommended formatting guidelines for the libcamera project. The vast majority of changes in this commit comprise of switching from snake_case to CamelCase, and starting class member functions with a lower case character. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- .../raspberrypi/controller/agc_algorithm.hpp | 19 +++++++------- src/ipa/raspberrypi/controller/agc_status.h | 22 ++++++++-------- src/ipa/raspberrypi/controller/algorithm.cpp | 20 +++++++------- src/ipa/raspberrypi/controller/algorithm.hpp | 26 +++++++++---------- .../raspberrypi/controller/awb_algorithm.hpp | 6 ++--- src/ipa/raspberrypi/controller/awb_status.h | 8 +++--- 6 files changed, 51 insertions(+), 50 deletions(-) diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp b/src/ipa/raspberrypi/controller/agc_algorithm.hpp index 61595ea2b006..51900b687778 100644 --- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp +++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp @@ -17,16 +17,15 @@ class AgcAlgorithm : public Algorithm public: AgcAlgorithm(Controller *controller) : Algorithm(controller) {} // An AGC algorithm must provide the following: - virtual unsigned int GetConvergenceFrames() const = 0; - virtual void SetEv(double ev) = 0; - virtual void SetFlickerPeriod(libcamera::utils::Duration flicker_period) = 0; - virtual void SetFixedShutter(libcamera::utils::Duration fixed_shutter) = 0; - virtual void SetMaxShutter(libcamera::utils::Duration max_shutter) = 0; - virtual void SetFixedAnalogueGain(double fixed_analogue_gain) = 0; - virtual void SetMeteringMode(std::string const &metering_mode_name) = 0; - virtual void SetExposureMode(std::string const &exposure_mode_name) = 0; - virtual void - SetConstraintMode(std::string const &contraint_mode_name) = 0; + virtual unsigned int getConvergenceFrames() const = 0; + virtual void setEv(double ev) = 0; + virtual void setFlickerPeriod(libcamera::utils::Duration flickerPeriod) = 0; + virtual void setFixedShutter(libcamera::utils::Duration fixedShutter) = 0; + virtual void setMaxShutter(libcamera::utils::Duration maxShutter) = 0; + virtual void setFixedAnalogueGain(double fixedAnalogueGain) = 0; + virtual void setMeteringMode(std::string const &meteringModeName) = 0; + virtual void setExposureMode(std::string const &exposureModeName) = 0; + virtual void setConstraintMode(std::string const &contraintModeName) = 0; }; } // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/agc_status.h b/src/ipa/raspberrypi/controller/agc_status.h index 20cb1b624b33..5d04c61d04bd 100644 --- a/src/ipa/raspberrypi/controller/agc_status.h +++ b/src/ipa/raspberrypi/controller/agc_status.h @@ -20,19 +20,19 @@ extern "C" { // ignored until then. struct AgcStatus { - libcamera::utils::Duration total_exposure_value; // value for all exposure and gain for this image - libcamera::utils::Duration target_exposure_value; // (unfiltered) target total exposure AGC is aiming for - libcamera::utils::Duration shutter_time; - double analogue_gain; - char exposure_mode[32]; + libcamera::utils::Duration totalExposureValue; // value for all exposure and gain for this image + libcamera::utils::Duration targetExposureValue; // (unfiltered) target total exposure AGC is aiming for + libcamera::utils::Duration shutterTime; + double analogueGain; + char exposureMode[32]; char constraint_mode[32]; - char metering_mode[32]; + char meteringMode[32]; double ev; - libcamera::utils::Duration flicker_period; - int floating_region_enable; - libcamera::utils::Duration fixed_shutter; - double fixed_analogue_gain; - double digital_gain; + libcamera::utils::Duration flickerPeriod; + int floatingRegionEnable; + libcamera::utils::Duration fixedShutter; + double fixedAnalogueGain; + double digitalGain; int locked; }; diff --git a/src/ipa/raspberrypi/controller/algorithm.cpp b/src/ipa/raspberrypi/controller/algorithm.cpp index 43ad0a2be222..cfcd18a96c93 100644 --- a/src/ipa/raspberrypi/controller/algorithm.cpp +++ b/src/ipa/raspberrypi/controller/algorithm.cpp @@ -9,36 +9,38 @@ using namespace RPiController; -void Algorithm::Read([[maybe_unused]] boost::property_tree::ptree const ¶ms) +void Algorithm::read([[maybe_unused]] boost::property_tree::ptree const ¶ms) { } -void Algorithm::Initialise() {} +void Algorithm::initialise() +{ +} -void Algorithm::SwitchMode([[maybe_unused]] CameraMode const &camera_mode, +void Algorithm::switchMode([[maybe_unused]] CameraMode const &cameraMode, [[maybe_unused]] Metadata *metadata) { } -void Algorithm::Prepare([[maybe_unused]] Metadata *image_metadata) +void Algorithm::prepare([[maybe_unused]] Metadata *imageMetadata) { } -void Algorithm::Process([[maybe_unused]] StatisticsPtr &stats, - [[maybe_unused]] Metadata *image_metadata) +void Algorithm::process([[maybe_unused]] StatisticsPtr &stats, + [[maybe_unused]] Metadata *imageMetadata) { } // For registering algorithms with the system: static std::map algorithms; -std::map const &RPiController::GetAlgorithms() +std::map const &RPiController::getAlgorithms() { return algorithms; } RegisterAlgorithm::RegisterAlgorithm(char const *name, - AlgoCreateFunc create_func) + AlgoCreateFunc createFunc) { - algorithms[std::string(name)] = create_func; + algorithms[std::string(name)] = createFunc; } diff --git a/src/ipa/raspberrypi/controller/algorithm.hpp b/src/ipa/raspberrypi/controller/algorithm.hpp index 5123c87bab34..a33b14da2726 100644 --- a/src/ipa/raspberrypi/controller/algorithm.hpp +++ b/src/ipa/raspberrypi/controller/algorithm.hpp @@ -29,18 +29,18 @@ public: { } virtual ~Algorithm() = default; - virtual char const *Name() const = 0; - virtual bool IsPaused() const { return paused_; } - virtual void Pause() { paused_ = true; } - virtual void Resume() { paused_ = false; } - virtual void Read(boost::property_tree::ptree const ¶ms); - virtual void Initialise(); - virtual void SwitchMode(CameraMode const &camera_mode, Metadata *metadata); - virtual void Prepare(Metadata *image_metadata); - virtual void Process(StatisticsPtr &stats, Metadata *image_metadata); - Metadata &GetGlobalMetadata() const + virtual char const *name() const = 0; + virtual bool isPaused() const { return paused_; } + virtual void pause() { paused_ = true; } + virtual void resume() { paused_ = false; } + virtual void read(boost::property_tree::ptree const ¶ms); + virtual void initialise(); + virtual void switchMode(CameraMode const &cameraMode, Metadata *metadata); + virtual void prepare(Metadata *imageMetadata); + virtual void process(StatisticsPtr &stats, Metadata *imageMetadata); + Metadata &getGlobalMetadata() const { - return controller_->GetGlobalMetadata(); + return controller_->getGlobalMetadata(); } private: @@ -53,8 +53,8 @@ private: typedef Algorithm *(*AlgoCreateFunc)(Controller *controller); struct RegisterAlgorithm { - RegisterAlgorithm(char const *name, AlgoCreateFunc create_func); + RegisterAlgorithm(char const *name, AlgoCreateFunc createFunc); }; -std::map const &GetAlgorithms(); +std::map const &getAlgorithms(); } // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/awb_algorithm.hpp b/src/ipa/raspberrypi/controller/awb_algorithm.hpp index 96f88afc3a8d..c5d2ca90263c 100644 --- a/src/ipa/raspberrypi/controller/awb_algorithm.hpp +++ b/src/ipa/raspberrypi/controller/awb_algorithm.hpp @@ -15,9 +15,9 @@ class AwbAlgorithm : public Algorithm public: AwbAlgorithm(Controller *controller) : Algorithm(controller) {} // An AWB algorithm must provide the following: - virtual unsigned int GetConvergenceFrames() const = 0; - virtual void SetMode(std::string const &mode_name) = 0; - virtual void SetManualGains(double manual_r, double manual_b) = 0; + virtual unsigned int getConvergenceFrames() const = 0; + virtual void setMode(std::string const &modeName) = 0; + virtual void setManualGains(double manualR, double manualB) = 0; }; } // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/awb_status.h b/src/ipa/raspberrypi/controller/awb_status.h index 46d7c842299a..bc428ed3206a 100644 --- a/src/ipa/raspberrypi/controller/awb_status.h +++ b/src/ipa/raspberrypi/controller/awb_status.h @@ -15,10 +15,10 @@ extern "C" { struct AwbStatus { char mode[32]; - double temperature_K; - double gain_r; - double gain_g; - double gain_b; + double temperatureK; + double gainR; + double gainG; + double gainB; }; #ifdef __cplusplus