From patchwork Tue Jul 26 12:45:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 16776 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 C870FC3275 for ; Tue, 26 Jul 2022 12:46:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 69BE86331B; Tue, 26 Jul 2022 14:46:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658839563; bh=A9qFVsr4ysD6H31zQ+LpZvDY/RnDf/oQQaUK0g3K3kE=; 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=WyERdKHrHdIoN4KgGq2JggLVN+5fGLK6I8hYxDsUV3opcJ6cqvaMKNQZBrkeM8t4e 9FTlJgTkJGERXaUqvix49vSI0w68qFUFODUiMUgfAi1TYWs2ycxibpJnHuUx8gEhf9 dA9YZWhwgFpBUPZiRMmvY8k0JXyvp1cy9S6rjOotHOiKE+g25Q6tTxQrKlliJJEt7l lB41acn142nNjljm3jwn7a9WwkzoxdLlev5uju6U6mNNv6YgAbah0jOhd5qvNSTz/7 wJhUWzcpkZMTTbJYv0KcNn7uqUhvHDX5q2JdWTmdqODr1eEd8dEM+wk64DsC6F64ct 29iz7MthAPkAw== Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 72C0560487 for ; Tue, 26 Jul 2022 14:45:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="PsOHaaYv"; dkim-atps=neutral Received: by mail-wr1-x433.google.com with SMTP id d8so19897595wrp.6 for ; Tue, 26 Jul 2022 05:45:58 -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=C3mG9N/O4kjLV5Q756klG3p/Rxqeg7NfD57FGce0BGs=; b=PsOHaaYvPctkAir9sNFtTN7thp2xGVQ6EM+YUnwFtsSLUCSxk+vlWLPz9ox54FpGXw a4q/MvcgUHsycPbOgFgV+W2vJhoDQ/tIINttIamPdAK5czGAwSxFSOawhxKyYP6uy8WS dDavDxdemekGIM53hHEP0Mhg6W9sFUoF+gf4UsWzrm952sbQ9zjZAujYDhb+EhGRAWbr 1FYKyGy4yo55jZ82nmy/nH8dxPXSGQVAoJtgBZ3HOGXA+sxZwXsRrN5H1W8d99be9MEv 9CgKXIFzEkLj9oH7ryLWgH5qMF4UN6t4tjarslQKeeYpULZRWYCXwZJ6kBoisUKsvLlW tIuA== 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=C3mG9N/O4kjLV5Q756klG3p/Rxqeg7NfD57FGce0BGs=; b=fVhAyfGBwohNGKIa0wVfGWD9hk4JVerJZNn7S8t0d9Lb4RlYkPlOUfpLjs5HtbkdLs xXoEFPSI2HCpP2YqE65MR6/OggiHSXBi1pEsEoKTMmzb6zKwN05lbZ6TOT84U/XZENon 91MXSBv/zmne9A3ddykzcDEUYVytBcMHNxy3UWc5gpRuc6EaSoYZiECFnFADYVPfBUNg +NKnxDyggbRBh8FuBgOVSRnR2b7DZ92lrBS3VEW7rdPDjvPODCZTq2WUJ5rtMyYVVL8N mr4Pxwj+C3pPF1qQMyQcY32jLo90s2Vvvt9bh99Z90+gOOk2wOEFg9sKucQ7KTR51vMA uLMQ== X-Gm-Message-State: AJIora+AvjWVmmOxww+XCBkHPxxLIpUIc58mYJlumHOfI8Tn1TTeH4DY TxveSmFStldfWotFowj7bs1PgkXQ9I21kw== X-Google-Smtp-Source: AGRyM1si9HOcuUc5Ad+6hrUwxsb9YBEHgLt98sAV4nSuNtflCTTzakzc7Qcvq+5fQI3vCY0LJcgWFg== X-Received: by 2002:a5d:5147:0:b0:21e:832e:7f0f with SMTP id u7-20020a5d5147000000b0021e832e7f0fmr7971116wrt.651.1658839557712; Tue, 26 Jul 2022 05:45:57 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id y17-20020adfd091000000b0021e87ec980bsm5948460wrh.84.2022.07.26.05.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 05:45:56 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Jul 2022 13:45:35 +0100 Message-Id: <20220726124549.1646-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220726124549.1646-1-naush@raspberrypi.com> References: <20220726124549.1646-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 03/17] 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