{"id":16756,"url":"https://patchwork.libcamera.org/api/1.1/patches/16756/?format=json","web_url":"https://patchwork.libcamera.org/patch/16756/","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":"<20220725134639.4572-4-naush@raspberrypi.com>","date":"2022-07-25T13:46:27","name":"[libcamera-devel,03/15] DNI: ipa: raspberrypi: Code refactoring to match style guidelines","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"be6aa19aa2fe052377732de55708fb4e8ff054fd","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/16756/mbox/","series":[{"id":3323,"url":"https://patchwork.libcamera.org/api/1.1/series/3323/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3323","date":"2022-07-25T13:46:24","name":"Raspberry Pi IPA code refactor","version":1,"mbox":"https://patchwork.libcamera.org/series/3323/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16756/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16756/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 817BAC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 Jul 2022 13:46:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0ED1D6331F;\n\tMon, 25 Jul 2022 15:46:52 +0200 (CEST)","from mail-wr1-x431.google.com (mail-wr1-x431.google.com\n\t[IPv6:2a00:1450:4864:20::431])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5381D63318\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Jul 2022 15:46:46 +0200 (CEST)","by mail-wr1-x431.google.com with SMTP id l15so11987862wro.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Jul 2022 06:46:46 -0700 (PDT)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ta20-20020a05600c225400b003a32167b8d4sm18054320wmm.13.2022.07.25.06.46.44\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 25 Jul 2022 06:46:45 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658756812;\n\tbh=wBr6GeSNjbNeiJOfvAajOGR2cAJkB4sACYZ4PNt+0vI=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=dmnSgpjMMs5cy8Kr2Ud4RlL4tBANRlhhp16zGnkfW+UY9C5322n79ja/9pWYgmwBb\n\tv1O1UbXrfMB78zH7BvFr/Nqz2sR4alsqIP1tuT2rGEOWK2LDe7SB/w7EubHrPQvZh1\n\t7duUfZ9PnZe1mrQslvKIqmbfLmLiNIU/MfPFhNRTKXGs2FMCqxYOfsjv5Twx9cCLFL\n\tuU0lbb97XlmuEq4nMc8UYH4DXMNtp1ckj7yu0kdo1kIdJt/yh5r5lJpAr3j0LlC5ZJ\n\tXDO+7quk4X/nZz0KNUj2iY3fuoD3zYkpL3AlREnpOucHl3cEN1+esIdwX5y0ll5Orv\n\tG9M/Ffb0NS8Xw==","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=Zoj/Sckg9nfwUrL0mofZdw8XDWZ4WXG8lzOxuOccHAk=;\n\tb=OKlDEyjXU8jTDAOYLx2XAds6oUEm7Mgixo3kkEN/8HsHw980ImAGoQ50pNoPu7O4U+\n\tRe4O/Dsk+/sKqEWjci9kWgGwBa1V8DLePvfyiCZt+nyZ7N+o0eo2nG/UkRN3Ksvqi1FI\n\tVRmx5R4cVKGYOvdJC3npuUGjYEt6b6s+3ElEbcgr2cgtb0hqERvI8eBs1D1i+AvFnqDJ\n\ty1Nw3lo6fklX3gg0SPdUbpAKdeS/gkIQ6oyj3cB4A3E27i5O/yTgqQIU/Le/egqXLvtV\n\tUZZql+ErlkgwuFuM343SIO12XVzosFYq1KHmA45Saze4oq6t2MAyxHe5kKbW9Db++z5X\n\tggPg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"OKlDEyjX\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\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=Zoj/Sckg9nfwUrL0mofZdw8XDWZ4WXG8lzOxuOccHAk=;\n\tb=AFgb34B00hC/DQpcTrkfW9oRFBR2+PDYCMm0GYOzd0iXRwwr7vsxkU2E4rU24DOJjo\n\tIPLnUOlfIPuYzvS8DvfS5cHqPnFeTUXoHs7+4CXD9nqjkeQTNMTX47ifyKazJ70x6P9f\n\tu+gzK7fQhXd/CEBYCLhPRjzjI8Xl/ZdVi8ulDX3wo75Din59FT0K8WlZSLNlJqSLuNcn\n\tqgCZIr600sJdMEpUcMBuvC2b3Z+azXyG4IPseijVuRqq5u/o7mKC/vl8j6xBsV3foPGc\n\tXf1VT+/fTY20Ym+jFoEnGQZs3tdBEBbF6lW8qyeOeV59SK5gAHxX9DaoXC5LZ8HkCiPB\n\t8Mjw==","X-Gm-Message-State":"AJIora/WvqG0fpn3OL+xcAKybu7j6vbewQJT/QULviZemgLUhYMqcqPA\n\tZD+qyC24G/1WGvFJ4b+XxVOhq8hSQlXLAA==","X-Google-Smtp-Source":"AGRyM1vmrjmP/64epK8siK5Zr5DwYd9pgsBGCDnliIYO6sA7R2Wc8FgwlH3FJhix8vaNRLVxrX4+kA==","X-Received":"by 2002:a5d:65c8:0:b0:21e:6459:4a1c with SMTP id\n\te8-20020a5d65c8000000b0021e64594a1cmr7473333wrw.639.1658756805616; \n\tMon, 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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 03/15] DNI: ipa: raspberrypi: Code\n\trefactoring to match style guidelines","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>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Refactor the source files under src/ipa/raspberrypi/controller/a* to match the\nrecommended formatting guidelines for the libcamera project. The vast majority\nof changes in this commit comprise of switching from snake_case to CamelCase,\nand starting class member functions with a lower case character.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../raspberrypi/controller/agc_algorithm.hpp  | 19 +++++++-------\n src/ipa/raspberrypi/controller/agc_status.h   | 22 ++++++++--------\n src/ipa/raspberrypi/controller/algorithm.cpp  | 20 +++++++-------\n src/ipa/raspberrypi/controller/algorithm.hpp  | 26 +++++++++----------\n .../raspberrypi/controller/awb_algorithm.hpp  |  6 ++---\n src/ipa/raspberrypi/controller/awb_status.h   |  8 +++---\n 6 files changed, 51 insertions(+), 50 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\nindex 61595ea2b006..51900b687778 100644\n--- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n+++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n@@ -17,16 +17,15 @@ class AgcAlgorithm : public Algorithm\n public:\n \tAgcAlgorithm(Controller *controller) : Algorithm(controller) {}\n \t// An AGC algorithm must provide the following:\n-\tvirtual unsigned int GetConvergenceFrames() const = 0;\n-\tvirtual void SetEv(double ev) = 0;\n-\tvirtual void SetFlickerPeriod(libcamera::utils::Duration flicker_period) = 0;\n-\tvirtual void SetFixedShutter(libcamera::utils::Duration fixed_shutter) = 0;\n-\tvirtual void SetMaxShutter(libcamera::utils::Duration max_shutter) = 0;\n-\tvirtual void SetFixedAnalogueGain(double fixed_analogue_gain) = 0;\n-\tvirtual void SetMeteringMode(std::string const &metering_mode_name) = 0;\n-\tvirtual void SetExposureMode(std::string const &exposure_mode_name) = 0;\n-\tvirtual void\n-\tSetConstraintMode(std::string const &contraint_mode_name) = 0;\n+\tvirtual unsigned int getConvergenceFrames() const = 0;\n+\tvirtual void setEv(double ev) = 0;\n+\tvirtual void setFlickerPeriod(libcamera::utils::Duration flickerPeriod) = 0;\n+\tvirtual void setFixedShutter(libcamera::utils::Duration fixedShutter) = 0;\n+\tvirtual void setMaxShutter(libcamera::utils::Duration maxShutter) = 0;\n+\tvirtual void setFixedAnalogueGain(double fixedAnalogueGain) = 0;\n+\tvirtual void setMeteringMode(std::string const &meteringModeName) = 0;\n+\tvirtual void setExposureMode(std::string const &exposureModeName) = 0;\n+\tvirtual void setConstraintMode(std::string const &contraintModeName) = 0;\n };\n \n } // namespace RPiController\ndiff --git a/src/ipa/raspberrypi/controller/agc_status.h b/src/ipa/raspberrypi/controller/agc_status.h\nindex 20cb1b624b33..5d04c61d04bd 100644\n--- a/src/ipa/raspberrypi/controller/agc_status.h\n+++ b/src/ipa/raspberrypi/controller/agc_status.h\n@@ -20,19 +20,19 @@ extern \"C\" {\n // ignored until then.\n \n struct AgcStatus {\n-\tlibcamera::utils::Duration total_exposure_value; // value for all exposure and gain for this image\n-\tlibcamera::utils::Duration target_exposure_value; // (unfiltered) target total exposure AGC is aiming for\n-\tlibcamera::utils::Duration shutter_time;\n-\tdouble analogue_gain;\n-\tchar exposure_mode[32];\n+\tlibcamera::utils::Duration totalExposureValue; // value for all exposure and gain for this image\n+\tlibcamera::utils::Duration targetExposureValue; // (unfiltered) target total exposure AGC is aiming for\n+\tlibcamera::utils::Duration shutterTime;\n+\tdouble analogueGain;\n+\tchar exposureMode[32];\n \tchar constraint_mode[32];\n-\tchar metering_mode[32];\n+\tchar meteringMode[32];\n \tdouble ev;\n-\tlibcamera::utils::Duration flicker_period;\n-\tint floating_region_enable;\n-\tlibcamera::utils::Duration fixed_shutter;\n-\tdouble fixed_analogue_gain;\n-\tdouble digital_gain;\n+\tlibcamera::utils::Duration flickerPeriod;\n+\tint floatingRegionEnable;\n+\tlibcamera::utils::Duration fixedShutter;\n+\tdouble fixedAnalogueGain;\n+\tdouble digitalGain;\n \tint locked;\n };\n \ndiff --git a/src/ipa/raspberrypi/controller/algorithm.cpp b/src/ipa/raspberrypi/controller/algorithm.cpp\nindex 43ad0a2be222..cfcd18a96c93 100644\n--- a/src/ipa/raspberrypi/controller/algorithm.cpp\n+++ b/src/ipa/raspberrypi/controller/algorithm.cpp\n@@ -9,36 +9,38 @@\n \n using namespace RPiController;\n \n-void Algorithm::Read([[maybe_unused]] boost::property_tree::ptree const &params)\n+void Algorithm::read([[maybe_unused]] boost::property_tree::ptree const &params)\n {\n }\n \n-void Algorithm::Initialise() {}\n+void Algorithm::initialise()\n+{\n+}\n \n-void Algorithm::SwitchMode([[maybe_unused]] CameraMode const &camera_mode,\n+void Algorithm::switchMode([[maybe_unused]] CameraMode const &cameraMode,\n \t\t\t   [[maybe_unused]] Metadata *metadata)\n {\n }\n \n-void Algorithm::Prepare([[maybe_unused]] Metadata *image_metadata)\n+void Algorithm::prepare([[maybe_unused]] Metadata *imageMetadata)\n {\n }\n \n-void Algorithm::Process([[maybe_unused]] StatisticsPtr &stats,\n-\t\t\t[[maybe_unused]] Metadata *image_metadata)\n+void Algorithm::process([[maybe_unused]] StatisticsPtr &stats,\n+\t\t\t[[maybe_unused]] Metadata *imageMetadata)\n {\n }\n \n // For registering algorithms with the system:\n \n static std::map<std::string, AlgoCreateFunc> algorithms;\n-std::map<std::string, AlgoCreateFunc> const &RPiController::GetAlgorithms()\n+std::map<std::string, AlgoCreateFunc> const &RPiController::getAlgorithms()\n {\n \treturn algorithms;\n }\n \n RegisterAlgorithm::RegisterAlgorithm(char const *name,\n-\t\t\t\t     AlgoCreateFunc create_func)\n+\t\t\t\t     AlgoCreateFunc createFunc)\n {\n-\talgorithms[std::string(name)] = create_func;\n+\talgorithms[std::string(name)] = createFunc;\n }\ndiff --git a/src/ipa/raspberrypi/controller/algorithm.hpp b/src/ipa/raspberrypi/controller/algorithm.hpp\nindex 5123c87bab34..a33b14da2726 100644\n--- a/src/ipa/raspberrypi/controller/algorithm.hpp\n+++ b/src/ipa/raspberrypi/controller/algorithm.hpp\n@@ -29,18 +29,18 @@ public:\n \t{\n \t}\n \tvirtual ~Algorithm() = default;\n-\tvirtual char const *Name() const = 0;\n-\tvirtual bool IsPaused() const { return paused_; }\n-\tvirtual void Pause() { paused_ = true; }\n-\tvirtual void Resume() { paused_ = false; }\n-\tvirtual void Read(boost::property_tree::ptree const &params);\n-\tvirtual void Initialise();\n-\tvirtual void SwitchMode(CameraMode const &camera_mode, Metadata *metadata);\n-\tvirtual void Prepare(Metadata *image_metadata);\n-\tvirtual void Process(StatisticsPtr &stats, Metadata *image_metadata);\n-\tMetadata &GetGlobalMetadata() const\n+\tvirtual char const *name() const = 0;\n+\tvirtual bool isPaused() const { return paused_; }\n+\tvirtual void pause() { paused_ = true; }\n+\tvirtual void resume() { paused_ = false; }\n+\tvirtual void read(boost::property_tree::ptree const &params);\n+\tvirtual void initialise();\n+\tvirtual void switchMode(CameraMode const &cameraMode, Metadata *metadata);\n+\tvirtual void prepare(Metadata *imageMetadata);\n+\tvirtual void process(StatisticsPtr &stats, Metadata *imageMetadata);\n+\tMetadata &getGlobalMetadata() const\n \t{\n-\t\treturn controller_->GetGlobalMetadata();\n+\t\treturn controller_->getGlobalMetadata();\n \t}\n \n private:\n@@ -53,8 +53,8 @@ private:\n \n typedef Algorithm *(*AlgoCreateFunc)(Controller *controller);\n struct RegisterAlgorithm {\n-\tRegisterAlgorithm(char const *name, AlgoCreateFunc create_func);\n+\tRegisterAlgorithm(char const *name, AlgoCreateFunc createFunc);\n };\n-std::map<std::string, AlgoCreateFunc> const &GetAlgorithms();\n+std::map<std::string, AlgoCreateFunc> const &getAlgorithms();\n \n } // namespace RPiController\ndiff --git a/src/ipa/raspberrypi/controller/awb_algorithm.hpp b/src/ipa/raspberrypi/controller/awb_algorithm.hpp\nindex 96f88afc3a8d..c5d2ca90263c 100644\n--- a/src/ipa/raspberrypi/controller/awb_algorithm.hpp\n+++ b/src/ipa/raspberrypi/controller/awb_algorithm.hpp\n@@ -15,9 +15,9 @@ class AwbAlgorithm : public Algorithm\n public:\n \tAwbAlgorithm(Controller *controller) : Algorithm(controller) {}\n \t// An AWB algorithm must provide the following:\n-\tvirtual unsigned int GetConvergenceFrames() const = 0;\n-\tvirtual void SetMode(std::string const &mode_name) = 0;\n-\tvirtual void SetManualGains(double manual_r, double manual_b) = 0;\n+\tvirtual unsigned int getConvergenceFrames() const = 0;\n+\tvirtual void setMode(std::string const &modeName) = 0;\n+\tvirtual void setManualGains(double manualR, double manualB) = 0;\n };\n \n } // namespace RPiController\ndiff --git a/src/ipa/raspberrypi/controller/awb_status.h b/src/ipa/raspberrypi/controller/awb_status.h\nindex 46d7c842299a..bc428ed3206a 100644\n--- a/src/ipa/raspberrypi/controller/awb_status.h\n+++ b/src/ipa/raspberrypi/controller/awb_status.h\n@@ -15,10 +15,10 @@ extern \"C\" {\n \n struct AwbStatus {\n \tchar mode[32];\n-\tdouble temperature_K;\n-\tdouble gain_r;\n-\tdouble gain_g;\n-\tdouble gain_b;\n+\tdouble temperatureK;\n+\tdouble gainR;\n+\tdouble gainG;\n+\tdouble gainB;\n };\n \n #ifdef __cplusplus\n","prefixes":["libcamera-devel","03/15"]}