{"id":16781,"url":"https://patchwork.libcamera.org/api/1.1/patches/16781/?format=json","web_url":"https://patchwork.libcamera.org/patch/16781/","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":"<20220726124549.1646-9-naush@raspberrypi.com>","date":"2022-07-26T12:45:40","name":"[libcamera-devel,08/17] DNI: ipa: raspberrypi: Code refactoring to match style guidelines","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a33107f2f90636784a7b0eef0f90caff1f1767b6","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/16781/mbox/","series":[{"id":3325,"url":"https://patchwork.libcamera.org/api/1.1/series/3325/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3325","date":"2022-07-26T12:45:32","name":"Raspberry Pi IPA code refactor","version":1,"mbox":"https://patchwork.libcamera.org/series/3325/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16781/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16781/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 21292C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jul 2022 12:46:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B28536331C;\n\tTue, 26 Jul 2022 14:46:08 +0200 (CEST)","from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C09726331C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 14:46:04 +0200 (CEST)","by mail-wm1-x331.google.com with SMTP id\n\tb21-20020a05600c4e1500b003a32bc8612fso8093507wmq.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 05:46:04 -0700 (PDT)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ty17-20020adfd091000000b0021e87ec980bsm5948460wrh.84.2022.07.26.05.46.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 26 Jul 2022 05:46:02 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658839568;\n\tbh=QO35yZnt0woM4gUBa9xZXM+Scv1x9CAVfUHOAqb6VHI=;\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=1kM2SVIMIb2hl0xaJOAjk9wmiGOPFdqvsopWJkbN/TC8iw0Bs4MiKN0n86YxiY3Zb\n\tqhO6iHBdhO6i8QFNXKEuwL6q7mpjJ+9fgCWzP4ShI1rnXwHjxuTQASX39c9WekT0Oc\n\tZ+834kmItU5X2Suy6JLJRFeFsDL+9AHSg1FcFHvuoMEIlH/2BBQob1wUOKRgjXlFa1\n\tZuSuv/bY148uPezYZoLy5IH6dDMgcV9DI6zW/gljFhFPmbX/DATWlMDmKxUWU7poqz\n\tExFhHxqpLrkhUSyOOp57x4JmdwEK1fnRB+S/K4AwJ8VV+3YgPSgeOj5RMwf3me3svk\n\tBxLILEGIHQ7dA==","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=hAGPSSJvx902LtVAushGNNjOrVHyzSw5YGgJ1D+1AZw=;\n\tb=EqyVT1rcXxLyu9+4ZmCrtStqBYynVEtSvlD+WYaLfbRPi3cd/wmNeK369cc4+vKSor\n\tWQorr92OljXTEJneMKxfw4WZhyCgEv30ClA2se7HruIKDRPcQM0fSw3BJ5eALt6KmqGl\n\t7Aqy4LfHg0sRZFXSLcX2APtdoH0/6n8isF60z9x2dYQ/RRznHQpMhNl37a0huGgOTd6O\n\ts4ipfFthKPqNl5XBRAvJO9VzWxl8IOPDK9ipGD1Dth8ZTh+9dqSF5nh2sSqAyNL2dkta\n\tgNKpYoi2Nw1HTt6Cy225txi/+796qkq9YlBF0RMxKmbhXgI/TVLOMM3KidArYkr8riCY\n\tDUjA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"EqyVT1rc\"; 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=hAGPSSJvx902LtVAushGNNjOrVHyzSw5YGgJ1D+1AZw=;\n\tb=UW7fwa8CGsEFTLZ0xdIBPPmmJpI4OZuLHlRDd/9YeXVKzV3SVI4xJXDlRAymjaZMdN\n\tfPgcCDaU7bDhHh2COCPFcf4b1S+yOyEIHkAgDiByni8z+KNpB/mtWs+hU8rFVyqYPbDg\n\tCg+mKdtGB8l9sQoNhbpCkkPiUDFHTBHJMZkN+K+kel6BFaU4yL3w5xBaKs4LNvGgmOCy\n\t5xp0DutKJNJi6VKJk1fcz1yp23MHFW4UYHFgsvoKcpDLA7r3IvVW+/h9GBpovx/QCxmz\n\tWhxmqn6c6wpGPXPNVOGUyRqPX+4wga5jY/L2VYNvyYNu6ip1Wf+qt3ngFlq9P5ZyyrXB\n\tA0Sw==","X-Gm-Message-State":"AJIora94v9H95X2ZL9L274TsIYxHaQwy3FDd5uRL4t4gKgEERYEAZQFy\n\tZx2z1zZNB6P3VDe9g7uejaiKSPPX/5EBKA==","X-Google-Smtp-Source":"AGRyM1upYnl7vfbH/riMtf7XRRd4Q4M8Hj7/YR+eWnLdx2E9fn27eiA/UaoFqhNxRq/85jPQsW5xCQ==","X-Received":"by 2002:a05:600c:3ac7:b0:3a3:64c3:6ddf with SMTP id\n\td7-20020a05600c3ac700b003a364c36ddfmr5970643wms.105.1658839563425; \n\tTue, 26 Jul 2022 05:46:03 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 Jul 2022 13:45:40 +0100","Message-Id":"<20220726124549.1646-9-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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 08/17] 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 src/ipa/raspberrypi/controller/rps/[b|c|d]* 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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../controller/black_level_status.h           |   6 +-\n src/ipa/raspberrypi/controller/rpi/agc.cpp    |   2 +-\n .../controller/rpi/black_level.cpp            |  34 ++---\n .../controller/rpi/black_level.hpp            |  12 +-\n src/ipa/raspberrypi/controller/rpi/ccm.cpp    |  84 +++++++------\n src/ipa/raspberrypi/controller/rpi/ccm.hpp    |  12 +-\n .../raspberrypi/controller/rpi/contrast.cpp   | 118 +++++++++---------\n .../raspberrypi/controller/rpi/contrast.hpp   |  30 ++---\n src/ipa/raspberrypi/controller/rpi/dpc.cpp    |  18 +--\n src/ipa/raspberrypi/controller/rpi/dpc.hpp    |   6 +-\n 10 files changed, 160 insertions(+), 162 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/controller/black_level_status.h b/src/ipa/raspberrypi/controller/black_level_status.h\nindex d085f64b27fe..df3661401d99 100644\n--- a/src/ipa/raspberrypi/controller/black_level_status.h\n+++ b/src/ipa/raspberrypi/controller/black_level_status.h\n@@ -13,9 +13,9 @@ extern \"C\" {\n #endif\n \n struct BlackLevelStatus {\n-\tuint16_t black_level_r; // out of 16 bits\n-\tuint16_t black_level_g;\n-\tuint16_t black_level_b;\n+\tuint16_t blackLevelR; // out of 16 bits\n+\tuint16_t blackLevelG;\n+\tuint16_t blackLevelB;\n };\n \n #ifdef __cplusplus\ndiff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\nindex c19769f4e27b..408ff9cf296d 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n@@ -250,7 +250,7 @@ void Agc::setFixedShutter(Duration fixedShutter)\n \n void Agc::setFixedAnalogueGain(double fixedAnalogueGain)\n {\n-\tfixedAnalogueGain_ = fixedAnalogueGain_;\n+\tfixedAnalogueGain_ = fixedAnalogueGain;\n \t// Set this in case someone calls Pause() straight after.\n \tstatus_.analogueGain = fixedAnalogueGain;\n }\ndiff --git a/src/ipa/raspberrypi/controller/rpi/black_level.cpp b/src/ipa/raspberrypi/controller/rpi/black_level.cpp\nindex 6b3497f13c19..101b5ea92cf5 100644\n--- a/src/ipa/raspberrypi/controller/rpi/black_level.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/black_level.cpp\n@@ -26,38 +26,38 @@ BlackLevel::BlackLevel(Controller *controller)\n {\n }\n \n-char const *BlackLevel::Name() const\n+char const *BlackLevel::name() const\n {\n \treturn NAME;\n }\n \n-void BlackLevel::Read(boost::property_tree::ptree const &params)\n+void BlackLevel::read(boost::property_tree::ptree const &params)\n {\n-\tuint16_t black_level = params.get<uint16_t>(\n+\tuint16_t blackLevel = params.get<uint16_t>(\n \t\t\"black_level\", 4096); // 64 in 10 bits scaled to 16 bits\n-\tblack_level_r_ = params.get<uint16_t>(\"black_level_r\", black_level);\n-\tblack_level_g_ = params.get<uint16_t>(\"black_level_g\", black_level);\n-\tblack_level_b_ = params.get<uint16_t>(\"black_level_b\", black_level);\n+\tblackLevelR_ = params.get<uint16_t>(\"blackLevelR\", blackLevel);\n+\tblackLevelG_ = params.get<uint16_t>(\"blackLevelG\", blackLevel);\n+\tblackLevelB_ = params.get<uint16_t>(\"blackLevelB\", blackLevel);\n \tLOG(RPiBlackLevel, Debug)\n-\t\t<< \" Read black levels red \" << black_level_r_\n-\t\t<< \" green \" << black_level_g_\n-\t\t<< \" blue \" << black_level_b_;\n+\t\t<< \" Read black levels red \" << blackLevelR_\n+\t\t<< \" green \" << blackLevelG_\n+\t\t<< \" blue \" << blackLevelB_;\n }\n \n-void BlackLevel::Prepare(Metadata *image_metadata)\n+void BlackLevel::prepare(Metadata *imageMetadata)\n {\n-\t// Possibly we should think about doing this in a switch_mode or\n+\t// Possibly we should think about doing this in a switchMode or\n \t// something?\n \tstruct BlackLevelStatus status;\n-\tstatus.black_level_r = black_level_r_;\n-\tstatus.black_level_g = black_level_g_;\n-\tstatus.black_level_b = black_level_b_;\n-\timage_metadata->Set(\"black_level.status\", status);\n+\tstatus.blackLevelR = blackLevelR_;\n+\tstatus.blackLevelG = blackLevelG_;\n+\tstatus.blackLevelB = blackLevelB_;\n+\timageMetadata->set(\"black_level.status\", status);\n }\n \n // Register algorithm with the system.\n-static Algorithm *Create(Controller *controller)\n+static Algorithm *create(Controller *controller)\n {\n \treturn new BlackLevel(controller);\n }\n-static RegisterAlgorithm reg(NAME, &Create);\n+static RegisterAlgorithm reg(NAME, &create);\ndiff --git a/src/ipa/raspberrypi/controller/rpi/black_level.hpp b/src/ipa/raspberrypi/controller/rpi/black_level.hpp\nindex 65ec4d0ed26c..0d74f6a4c49b 100644\n--- a/src/ipa/raspberrypi/controller/rpi/black_level.hpp\n+++ b/src/ipa/raspberrypi/controller/rpi/black_level.hpp\n@@ -17,14 +17,14 @@ class BlackLevel : public Algorithm\n {\n public:\n \tBlackLevel(Controller *controller);\n-\tchar const *Name() const override;\n-\tvoid Read(boost::property_tree::ptree const &params) override;\n-\tvoid Prepare(Metadata *image_metadata) override;\n+\tchar const *name() const override;\n+\tvoid read(boost::property_tree::ptree const &params) override;\n+\tvoid prepare(Metadata *imageMetadata) override;\n \n private:\n-\tdouble black_level_r_;\n-\tdouble black_level_g_;\n-\tdouble black_level_b_;\n+\tdouble blackLevelR_;\n+\tdouble blackLevelG_;\n+\tdouble blackLevelB_;\n };\n \n } // namespace RPiController\ndiff --git a/src/ipa/raspberrypi/controller/rpi/ccm.cpp b/src/ipa/raspberrypi/controller/rpi/ccm.cpp\nindex 821a4c7c98c5..24d8e5bd1fd8 100644\n--- a/src/ipa/raspberrypi/controller/rpi/ccm.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/ccm.cpp\n@@ -37,7 +37,7 @@ Matrix::Matrix(double m0, double m1, double m2, double m3, double m4, double m5,\n \tm[0][0] = m0, m[0][1] = m1, m[0][2] = m2, m[1][0] = m3, m[1][1] = m4,\n \tm[1][2] = m5, m[2][0] = m6, m[2][1] = m7, m[2][2] = m8;\n }\n-void Matrix::Read(boost::property_tree::ptree const &params)\n+void Matrix::read(boost::property_tree::ptree const &params)\n {\n \tdouble *ptr = (double *)m;\n \tint n = 0;\n@@ -53,47 +53,49 @@ void Matrix::Read(boost::property_tree::ptree const &params)\n Ccm::Ccm(Controller *controller)\n \t: CcmAlgorithm(controller), saturation_(1.0) {}\n \n-char const *Ccm::Name() const\n+char const *Ccm::name() const\n {\n \treturn NAME;\n }\n \n-void Ccm::Read(boost::property_tree::ptree const &params)\n+void Ccm::read(boost::property_tree::ptree const &params)\n {\n \tif (params.get_child_optional(\"saturation\"))\n-\t\tconfig_.saturation.Read(params.get_child(\"saturation\"));\n+\t\tconfig_.saturation.read(params.get_child(\"saturation\"));\n \tfor (auto &p : params.get_child(\"ccms\")) {\n-\t\tCtCcm ct_ccm;\n-\t\tct_ccm.ct = p.second.get<double>(\"ct\");\n-\t\tct_ccm.ccm.Read(p.second.get_child(\"ccm\"));\n+\t\tCtCcm ctCcm;\n+\t\tctCcm.ct = p.second.get<double>(\"ct\");\n+\t\tctCcm.ccm.read(p.second.get_child(\"ccm\"));\n \t\tif (!config_.ccms.empty() &&\n-\t\t    ct_ccm.ct <= config_.ccms.back().ct)\n+\t\t    ctCcm.ct <= config_.ccms.back().ct)\n \t\t\tthrow std::runtime_error(\n \t\t\t\t\"Ccm: CCM not in increasing colour temperature order\");\n-\t\tconfig_.ccms.push_back(std::move(ct_ccm));\n+\t\tconfig_.ccms.push_back(std::move(ctCcm));\n \t}\n \tif (config_.ccms.empty())\n \t\tthrow std::runtime_error(\"Ccm: no CCMs specified\");\n }\n \n-void Ccm::SetSaturation(double saturation)\n+void Ccm::setSaturation(double saturation)\n {\n \tsaturation_ = saturation;\n }\n \n-void Ccm::Initialise() {}\n+void Ccm::initialise()\n+{\n+}\n \n template<typename T>\n-static bool get_locked(Metadata *metadata, std::string const &tag, T &value)\n+static bool getLocked(Metadata *metadata, std::string const &tag, T &value)\n {\n-\tT *ptr = metadata->GetLocked<T>(tag);\n+\tT *ptr = metadata->getLocked<T>(tag);\n \tif (ptr == nullptr)\n \t\treturn false;\n \tvalue = *ptr;\n \treturn true;\n }\n \n-Matrix calculate_ccm(std::vector<CtCcm> const &ccms, double ct)\n+Matrix calculateCcm(std::vector<CtCcm> const &ccms, double ct)\n {\n \tif (ct <= ccms.front().ct)\n \t\treturn ccms.front().ccm;\n@@ -109,7 +111,7 @@ Matrix calculate_ccm(std::vector<CtCcm> const &ccms, double ct)\n \t}\n }\n \n-Matrix apply_saturation(Matrix const &ccm, double saturation)\n+Matrix applySaturation(Matrix const &ccm, double saturation)\n {\n \tMatrix RGB2Y(0.299, 0.587, 0.114, -0.169, -0.331, 0.500, 0.500, -0.419,\n \t\t     -0.081);\n@@ -119,51 +121,51 @@ Matrix apply_saturation(Matrix const &ccm, double saturation)\n \treturn Y2RGB * S * RGB2Y * ccm;\n }\n \n-void Ccm::Prepare(Metadata *image_metadata)\n+void Ccm::prepare(Metadata *imageMetadata)\n {\n-\tbool awb_ok = false, lux_ok = false;\n+\tbool awbOk = false, luxOk = false;\n \tstruct AwbStatus awb = {};\n-\tawb.temperature_K = 4000; // in case no metadata\n+\tawb.temperatureK = 4000; // in case no metadata\n \tstruct LuxStatus lux = {};\n \tlux.lux = 400; // in case no metadata\n \t{\n \t\t// grab mutex just once to get everything\n-\t\tstd::lock_guard<Metadata> lock(*image_metadata);\n-\t\tawb_ok = get_locked(image_metadata, \"awb.status\", awb);\n-\t\tlux_ok = get_locked(image_metadata, \"lux.status\", lux);\n+\t\tstd::lock_guard<Metadata> lock(*imageMetadata);\n+\t\tawbOk = getLocked(imageMetadata, \"awb.status\", awb);\n+\t\tluxOk = getLocked(imageMetadata, \"lux.status\", lux);\n \t}\n-\tif (!awb_ok)\n+\tif (!awbOk)\n \t\tLOG(RPiCcm, Warning) << \"no colour temperature found\";\n-\tif (!lux_ok)\n+\tif (!luxOk)\n \t\tLOG(RPiCcm, Warning) << \"no lux value found\";\n-\tMatrix ccm = calculate_ccm(config_.ccms, awb.temperature_K);\n+\tMatrix ccm = calculateCcm(config_.ccms, awb.temperatureK);\n \tdouble saturation = saturation_;\n-\tstruct CcmStatus ccm_status;\n-\tccm_status.saturation = saturation;\n-\tif (!config_.saturation.Empty())\n-\t\tsaturation *= config_.saturation.Eval(\n-\t\t\tconfig_.saturation.Domain().Clip(lux.lux));\n-\tccm = apply_saturation(ccm, saturation);\n+\tstruct CcmStatus ccmStatus;\n+\tccmStatus.saturation = saturation;\n+\tif (!config_.saturation.empty())\n+\t\tsaturation *= config_.saturation.eval(\n+\t\t\tconfig_.saturation.domain().clip(lux.lux));\n+\tccm = applySaturation(ccm, saturation);\n \tfor (int j = 0; j < 3; j++)\n \t\tfor (int i = 0; i < 3; i++)\n-\t\t\tccm_status.matrix[j * 3 + i] =\n+\t\t\tccmStatus.matrix[j * 3 + i] =\n \t\t\t\tstd::max(-8.0, std::min(7.9999, ccm.m[j][i]));\n \tLOG(RPiCcm, Debug)\n-\t\t<< \"colour temperature \" << awb.temperature_K << \"K\";\n+\t\t<< \"colour temperature \" << awb.temperatureK << \"K\";\n \tLOG(RPiCcm, Debug)\n-\t\t<< \"CCM: \" << ccm_status.matrix[0] << \" \" << ccm_status.matrix[1]\n-\t\t<< \" \" << ccm_status.matrix[2] << \"     \"\n-\t\t<< ccm_status.matrix[3] << \" \" << ccm_status.matrix[4]\n-\t\t<< \" \" << ccm_status.matrix[5] << \"     \"\n-\t\t<< ccm_status.matrix[6] << \" \" << ccm_status.matrix[7]\n-\t\t<< \" \" << ccm_status.matrix[8];\n-\timage_metadata->Set(\"ccm.status\", ccm_status);\n+\t\t<< \"CCM: \" << ccmStatus.matrix[0] << \" \" << ccmStatus.matrix[1]\n+\t\t<< \" \" << ccmStatus.matrix[2] << \"     \"\n+\t\t<< ccmStatus.matrix[3] << \" \" << ccmStatus.matrix[4]\n+\t\t<< \" \" << ccmStatus.matrix[5] << \"     \"\n+\t\t<< ccmStatus.matrix[6] << \" \" << ccmStatus.matrix[7]\n+\t\t<< \" \" << ccmStatus.matrix[8];\n+\timageMetadata->set(\"ccm.status\", ccmStatus);\n }\n \n // Register algorithm with the system.\n-static Algorithm *Create(Controller *controller)\n+static Algorithm *create(Controller *controller)\n {\n \treturn (Algorithm *)new Ccm(controller);\n \t;\n }\n-static RegisterAlgorithm reg(NAME, &Create);\n+static RegisterAlgorithm reg(NAME, &create);\ndiff --git a/src/ipa/raspberrypi/controller/rpi/ccm.hpp b/src/ipa/raspberrypi/controller/rpi/ccm.hpp\nindex 330ed51fe398..4c4807b8a942 100644\n--- a/src/ipa/raspberrypi/controller/rpi/ccm.hpp\n+++ b/src/ipa/raspberrypi/controller/rpi/ccm.hpp\n@@ -20,7 +20,7 @@ struct Matrix {\n \t       double m6, double m7, double m8);\n \tMatrix();\n \tdouble m[3][3];\n-\tvoid Read(boost::property_tree::ptree const &params);\n+\tvoid read(boost::property_tree::ptree const &params);\n };\n static inline Matrix operator*(double d, Matrix const &m)\n {\n@@ -61,11 +61,11 @@ class Ccm : public CcmAlgorithm\n {\n public:\n \tCcm(Controller *controller = NULL);\n-\tchar const *Name() const override;\n-\tvoid Read(boost::property_tree::ptree const &params) override;\n-\tvoid SetSaturation(double saturation) override;\n-\tvoid Initialise() override;\n-\tvoid Prepare(Metadata *image_metadata) override;\n+\tchar const *name() const override;\n+\tvoid read(boost::property_tree::ptree const &params) override;\n+\tvoid setSaturation(double saturation) override;\n+\tvoid initialise() override;\n+\tvoid prepare(Metadata *imageMetadata) override;\n \n private:\n \tCcmConfig config_;\ndiff --git a/src/ipa/raspberrypi/controller/rpi/contrast.cpp b/src/ipa/raspberrypi/controller/rpi/contrast.cpp\nindex ae55aad56739..169837576678 100644\n--- a/src/ipa/raspberrypi/controller/rpi/contrast.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/contrast.cpp\n@@ -31,40 +31,40 @@ Contrast::Contrast(Controller *controller)\n {\n }\n \n-char const *Contrast::Name() const\n+char const *Contrast::name() const\n {\n \treturn NAME;\n }\n \n-void Contrast::Read(boost::property_tree::ptree const &params)\n+void Contrast::read(boost::property_tree::ptree const &params)\n {\n \t// enable adaptive enhancement by default\n-\tconfig_.ce_enable = params.get<int>(\"ce_enable\", 1);\n+\tconfig_.ceEnable = params.get<int>(\"ce_enable\", 1);\n \t// the point near the bottom of the histogram to move\n-\tconfig_.lo_histogram = params.get<double>(\"lo_histogram\", 0.01);\n+\tconfig_.loHistogram = params.get<double>(\"lo_histogram\", 0.01);\n \t// where in the range to try and move it to\n-\tconfig_.lo_level = params.get<double>(\"lo_level\", 0.015);\n+\tconfig_.loLevel = params.get<double>(\"lo_level\", 0.015);\n \t// but don't move by more than this\n-\tconfig_.lo_max = params.get<double>(\"lo_max\", 500);\n+\tconfig_.loMax = params.get<double>(\"lo_max\", 500);\n \t// equivalent values for the top of the histogram...\n-\tconfig_.hi_histogram = params.get<double>(\"hi_histogram\", 0.95);\n-\tconfig_.hi_level = params.get<double>(\"hi_level\", 0.95);\n-\tconfig_.hi_max = params.get<double>(\"hi_max\", 2000);\n-\tconfig_.gamma_curve.Read(params.get_child(\"gamma_curve\"));\n+\tconfig_.hiHistogram = params.get<double>(\"hi_histogram\", 0.95);\n+\tconfig_.hiLevel = params.get<double>(\"hi_level\", 0.95);\n+\tconfig_.hiMax = params.get<double>(\"hi_max\", 2000);\n+\tconfig_.gammaCurve.read(params.get_child(\"gamma_curve\"));\n }\n \n-void Contrast::SetBrightness(double brightness)\n+void Contrast::setBrightness(double brightness)\n {\n \tbrightness_ = brightness;\n }\n \n-void Contrast::SetContrast(double contrast)\n+void Contrast::setContrast(double contrast)\n {\n \tcontrast_ = contrast;\n }\n \n-static void fill_in_status(ContrastStatus &status, double brightness,\n-\t\t\t   double contrast, Pwl &gamma_curve)\n+static void fillInStatus(ContrastStatus &status, double brightness,\n+\t\t\t double contrast, Pwl &gammaCurve)\n {\n \tstatus.brightness = brightness;\n \tstatus.contrast = contrast;\n@@ -73,104 +73,100 @@ static void fill_in_status(ContrastStatus &status, double brightness,\n \t\t\t       : (i < 24 ? (i - 16) * 2048 + 16384\n \t\t\t\t\t : (i - 24) * 4096 + 32768);\n \t\tstatus.points[i].x = x;\n-\t\tstatus.points[i].y = std::min(65535.0, gamma_curve.Eval(x));\n+\t\tstatus.points[i].y = std::min(65535.0, gammaCurve.eval(x));\n \t}\n \tstatus.points[CONTRAST_NUM_POINTS - 1].x = 65535;\n \tstatus.points[CONTRAST_NUM_POINTS - 1].y = 65535;\n }\n \n-void Contrast::Initialise()\n+void Contrast::initialise()\n {\n \t// Fill in some default values as Prepare will run before Process gets\n \t// called.\n-\tfill_in_status(status_, brightness_, contrast_, config_.gamma_curve);\n+\tfillInStatus(status_, brightness_, contrast_, config_.gammaCurve);\n }\n \n-void Contrast::Prepare(Metadata *image_metadata)\n+void Contrast::prepare(Metadata *imageMetadata)\n {\n \tstd::unique_lock<std::mutex> lock(mutex_);\n-\timage_metadata->Set(\"contrast.status\", status_);\n+\timageMetadata->set(\"contrast.status\", status_);\n }\n \n-Pwl compute_stretch_curve(Histogram const &histogram,\n-\t\t\t  ContrastConfig const &config)\n+Pwl computeStretchCurve(Histogram const &histogram,\n+\t\t\tContrastConfig const &config)\n {\n \tPwl enhance;\n-\tenhance.Append(0, 0);\n+\tenhance.append(0, 0);\n \t// If the start of the histogram is rather empty, try to pull it down a\n \t// bit.\n-\tdouble hist_lo = histogram.Quantile(config.lo_histogram) *\n-\t\t\t (65536 / NUM_HISTOGRAM_BINS);\n-\tdouble level_lo = config.lo_level * 65536;\n+\tdouble histLo = histogram.quantile(config.loHistogram) *\n+\t\t\t(65536 / NUM_HISTOGRAM_BINS);\n+\tdouble levelLo = config.loLevel * 65536;\n \tLOG(RPiContrast, Debug)\n-\t\t<< \"Move histogram point \" << hist_lo << \" to \" << level_lo;\n-\thist_lo = std::max(\n-\t\tlevel_lo,\n-\t\tstd::min(65535.0, std::min(hist_lo, level_lo + config.lo_max)));\n+\t\t<< \"Move histogram point \" << histLo << \" to \" << levelLo;\n+\thistLo = std::max(levelLo,\n+\t\t\t  std::min(65535.0, std::min(histLo, levelLo + config.loMax)));\n \tLOG(RPiContrast, Debug)\n-\t\t<< \"Final values \" << hist_lo << \" -> \" << level_lo;\n-\tenhance.Append(hist_lo, level_lo);\n+\t\t<< \"Final values \" << histLo << \" -> \" << levelLo;\n+\tenhance.append(histLo, levelLo);\n \t// Keep the mid-point (median) in the same place, though, to limit the\n \t// apparent amount of global brightness shift.\n-\tdouble mid = histogram.Quantile(0.5) * (65536 / NUM_HISTOGRAM_BINS);\n-\tenhance.Append(mid, mid);\n+\tdouble mid = histogram.quantile(0.5) * (65536 / NUM_HISTOGRAM_BINS);\n+\tenhance.append(mid, mid);\n \n \t// If the top to the histogram is empty, try to pull the pixel values\n \t// there up.\n-\tdouble hist_hi = histogram.Quantile(config.hi_histogram) *\n-\t\t\t (65536 / NUM_HISTOGRAM_BINS);\n-\tdouble level_hi = config.hi_level * 65536;\n+\tdouble histHi = histogram.quantile(config.hiHistogram) *\n+\t\t\t(65536 / NUM_HISTOGRAM_BINS);\n+\tdouble levelHi = config.hiLevel * 65536;\n \tLOG(RPiContrast, Debug)\n-\t\t<< \"Move histogram point \" << hist_hi << \" to \" << level_hi;\n-\thist_hi = std::min(\n-\t\tlevel_hi,\n-\t\tstd::max(0.0, std::max(hist_hi, level_hi - config.hi_max)));\n+\t\t<< \"Move histogram point \" << histHi << \" to \" << levelHi;\n+\thistHi = std::min(levelHi,\n+\t\t\t  std::max(0.0, std::max(histHi, levelHi - config.hiMax)));\n \tLOG(RPiContrast, Debug)\n-\t\t<< \"Final values \" << hist_hi << \" -> \" << level_hi;\n-\tenhance.Append(hist_hi, level_hi);\n-\tenhance.Append(65535, 65535);\n+\t\t<< \"Final values \" << histHi << \" -> \" << levelHi;\n+\tenhance.append(histHi, levelHi);\n+\tenhance.append(65535, 65535);\n \treturn enhance;\n }\n \n-Pwl apply_manual_contrast(Pwl const &gamma_curve, double brightness,\n-\t\t\t  double contrast)\n+Pwl applyManualContrast(Pwl const &gammaCurve, double brightness,\n+\t\t\tdouble contrast)\n {\n-\tPwl new_gamma_curve;\n+\tPwl newGammaCurve;\n \tLOG(RPiContrast, Debug)\n \t\t<< \"Manual brightness \" << brightness << \" contrast \" << contrast;\n-\tgamma_curve.Map([&](double x, double y) {\n-\t\tnew_gamma_curve.Append(\n+\tgammaCurve.map([&](double x, double y) {\n+\t\tnewGammaCurve.append(\n \t\t\tx, std::max(0.0, std::min(65535.0,\n \t\t\t\t\t\t  (y - 32768) * contrast +\n \t\t\t\t\t\t\t  32768 + brightness)));\n \t});\n-\treturn new_gamma_curve;\n+\treturn newGammaCurve;\n }\n \n-void Contrast::Process(StatisticsPtr &stats,\n-\t\t       [[maybe_unused]] Metadata *image_metadata)\n+void Contrast::process(StatisticsPtr &stats,\n+\t\t       [[maybe_unused]] Metadata *imageMetadata)\n {\n \tHistogram histogram(stats->hist[0].g_hist, NUM_HISTOGRAM_BINS);\n \t// We look at the histogram and adjust the gamma curve in the following\n \t// ways: 1. Adjust the gamma curve so as to pull the start of the\n \t// histogram down, and possibly push the end up.\n-\tPwl gamma_curve = config_.gamma_curve;\n-\tif (config_.ce_enable) {\n-\t\tif (config_.lo_max != 0 || config_.hi_max != 0)\n-\t\t\tgamma_curve = compute_stretch_curve(histogram, config_)\n-\t\t\t\t\t      .Compose(gamma_curve);\n+\tPwl gammaCurve = config_.gammaCurve;\n+\tif (config_.ceEnable) {\n+\t\tif (config_.loMax != 0 || config_.hiMax != 0)\n+\t\t\tgammaCurve = computeStretchCurve(histogram, config_).compose(gammaCurve);\n \t\t// We could apply other adjustments (e.g. partial equalisation)\n \t\t// based on the histogram...?\n \t}\n \t// 2. Finally apply any manually selected brightness/contrast\n \t// adjustment.\n \tif (brightness_ != 0 || contrast_ != 1.0)\n-\t\tgamma_curve = apply_manual_contrast(gamma_curve, brightness_,\n-\t\t\t\t\t\t    contrast_);\n+\t\tgammaCurve = applyManualContrast(gammaCurve, brightness_, contrast_);\n \t// And fill in the status for output. Use more points towards the bottom\n \t// of the curve.\n \tContrastStatus status;\n-\tfill_in_status(status, brightness_, contrast_, gamma_curve);\n+\tfillInStatus(status, brightness_, contrast_, gammaCurve);\n \t{\n \t\tstd::unique_lock<std::mutex> lock(mutex_);\n \t\tstatus_ = status;\n@@ -178,8 +174,8 @@ void Contrast::Process(StatisticsPtr &stats,\n }\n \n // Register algorithm with the system.\n-static Algorithm *Create(Controller *controller)\n+static Algorithm *create(Controller *controller)\n {\n \treturn (Algorithm *)new Contrast(controller);\n }\n-static RegisterAlgorithm reg(NAME, &Create);\n+static RegisterAlgorithm reg(NAME, &create);\ndiff --git a/src/ipa/raspberrypi/controller/rpi/contrast.hpp b/src/ipa/raspberrypi/controller/rpi/contrast.hpp\nindex 85624539a1da..5a6d530f63fd 100644\n--- a/src/ipa/raspberrypi/controller/rpi/contrast.hpp\n+++ b/src/ipa/raspberrypi/controller/rpi/contrast.hpp\n@@ -17,27 +17,27 @@ namespace RPiController {\n // Back End AWB.\n \n struct ContrastConfig {\n-\tbool ce_enable;\n-\tdouble lo_histogram;\n-\tdouble lo_level;\n-\tdouble lo_max;\n-\tdouble hi_histogram;\n-\tdouble hi_level;\n-\tdouble hi_max;\n-\tPwl gamma_curve;\n+\tbool ceEnable;\n+\tdouble loHistogram;\n+\tdouble loLevel;\n+\tdouble loMax;\n+\tdouble hiHistogram;\n+\tdouble hiLevel;\n+\tdouble hiMax;\n+\tPwl gammaCurve;\n };\n \n class Contrast : public ContrastAlgorithm\n {\n public:\n \tContrast(Controller *controller = NULL);\n-\tchar const *Name() const override;\n-\tvoid Read(boost::property_tree::ptree const &params) override;\n-\tvoid SetBrightness(double brightness) override;\n-\tvoid SetContrast(double contrast) override;\n-\tvoid Initialise() override;\n-\tvoid Prepare(Metadata *image_metadata) override;\n-\tvoid Process(StatisticsPtr &stats, Metadata *image_metadata) override;\n+\tchar const *name() const override;\n+\tvoid read(boost::property_tree::ptree const &params) override;\n+\tvoid setBrightness(double brightness) override;\n+\tvoid setContrast(double contrast) override;\n+\tvoid initialise() override;\n+\tvoid prepare(Metadata *imageMetadata) override;\n+\tvoid process(StatisticsPtr &stats, Metadata *imageMetadata) override;\n \n private:\n \tContrastConfig config_;\ndiff --git a/src/ipa/raspberrypi/controller/rpi/dpc.cpp b/src/ipa/raspberrypi/controller/rpi/dpc.cpp\nindex 110f50560e76..42154cf300b8 100644\n--- a/src/ipa/raspberrypi/controller/rpi/dpc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/dpc.cpp\n@@ -24,30 +24,30 @@ Dpc::Dpc(Controller *controller)\n {\n }\n \n-char const *Dpc::Name() const\n+char const *Dpc::name() const\n {\n \treturn NAME;\n }\n \n-void Dpc::Read(boost::property_tree::ptree const &params)\n+void Dpc::read(boost::property_tree::ptree const &params)\n {\n \tconfig_.strength = params.get<int>(\"strength\", 1);\n \tif (config_.strength < 0 || config_.strength > 2)\n \t\tthrow std::runtime_error(\"Dpc: bad strength value\");\n }\n \n-void Dpc::Prepare(Metadata *image_metadata)\n+void Dpc::prepare(Metadata *imageMetadata)\n {\n-\tDpcStatus dpc_status = {};\n+\tDpcStatus dpcStatus = {};\n \t// Should we vary this with lux level or analogue gain? TBD.\n-\tdpc_status.strength = config_.strength;\n-\tLOG(RPiDpc, Debug) << \"strength \" << dpc_status.strength;\n-\timage_metadata->Set(\"dpc.status\", dpc_status);\n+\tdpcStatus.strength = config_.strength;\n+\tLOG(RPiDpc, Debug) << \"strength \" << dpcStatus.strength;\n+\timageMetadata->set(\"dpc.status\", dpcStatus);\n }\n \n // Register algorithm with the system.\n-static Algorithm *Create(Controller *controller)\n+static Algorithm *create(Controller *controller)\n {\n \treturn (Algorithm *)new Dpc(controller);\n }\n-static RegisterAlgorithm reg(NAME, &Create);\n+static RegisterAlgorithm reg(NAME, &create);\ndiff --git a/src/ipa/raspberrypi/controller/rpi/dpc.hpp b/src/ipa/raspberrypi/controller/rpi/dpc.hpp\nindex d90285c4eb56..039310cc8d05 100644\n--- a/src/ipa/raspberrypi/controller/rpi/dpc.hpp\n+++ b/src/ipa/raspberrypi/controller/rpi/dpc.hpp\n@@ -21,9 +21,9 @@ class Dpc : public Algorithm\n {\n public:\n \tDpc(Controller *controller);\n-\tchar const *Name() const override;\n-\tvoid Read(boost::property_tree::ptree const &params) override;\n-\tvoid Prepare(Metadata *image_metadata) override;\n+\tchar const *name() const override;\n+\tvoid read(boost::property_tree::ptree const &params) override;\n+\tvoid prepare(Metadata *imageMetadata) override;\n \n private:\n \tDpcConfig config_;\n","prefixes":["libcamera-devel","08/17"]}