Patch Detail
Show a patch.
GET /api/patches/13337/?format=api
{ "id": 13337, "url": "https://patchwork.libcamera.org/api/patches/13337/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13337/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210812165243.276977-10-jeanmichel.hautbois@ideasonboard.com>", "date": "2021-08-12T16:52:42", "name": "[libcamera-devel,v2,09/10] ipa: ipu3: Move IPU3 awb into algorithms", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "fc86c728297e01f94d12042ec78b9421f23efd36", "submitter": { "id": 75, "url": "https://patchwork.libcamera.org/api/people/75/?format=api", "name": "Jean-Michel Hautbois", "email": "jeanmichel.hautbois@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13337/mbox/", "series": [ { "id": 2347, "url": "https://patchwork.libcamera.org/api/series/2347/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2347", "date": "2021-08-12T16:52:33", "name": "IPU3: Introduce modularity for algorithms", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2347/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13337/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13337/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 0D71EC3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 12 Aug 2021 16:52:57 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B905E68893;\n\tThu, 12 Aug 2021 18:52:56 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7C7B968895\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Aug 2021 18:52:48 +0200 (CEST)", "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:3d6d:7284:3c48:5edc])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 349268AF;\n\tThu, 12 Aug 2021 18:52:48 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"iIb1wkbK\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628787168;\n\tbh=oTYrAdFvDG9G2sxyLw1UwJCWc33uGxq2cjwwCgRAZSQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=iIb1wkbKqk8iAouB1J0QD9360ubMbqmlUOd/Bz7IjekAIEyAco2kGHx3sPZk2LMUR\n\t5Axmhag2T0eISe3zegva3hhK1us8+gl0tFl0Y9B4YrVi0K2jzYSGsMKzC78MN71ALK\n\tqViThGtWiKJ3GkCYzkJ2B1RD1JKyq1WLOgyzdhRE=", "From": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 12 Aug 2021 18:52:42 +0200", "Message-Id": "<20210812165243.276977-10-jeanmichel.hautbois@ideasonboard.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20210812165243.276977-1-jeanmichel.hautbois@ideasonboard.com>", "References": "<20210812165243.276977-1-jeanmichel.hautbois@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 09/10] ipa: ipu3: Move IPU3 awb into\n\talgorithms", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Now that the interface is properly used by the AWB class, move it into\nipa::ipu3::algorithms and let the loops do the calls.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n .../ipu3/{ipu3_awb.cpp => algorithms/awb.cpp} | 28 +++++++++----------\n src/ipa/ipu3/{ipu3_awb.h => algorithms/awb.h} | 20 ++++++-------\n src/ipa/ipu3/algorithms/meson.build | 1 +\n src/ipa/ipu3/ipu3.cpp | 12 ++------\n src/ipa/ipu3/meson.build | 1 -\n 5 files changed, 28 insertions(+), 34 deletions(-)\n rename src/ipa/ipu3/{ipu3_awb.cpp => algorithms/awb.cpp} (94%)\n rename src/ipa/ipu3/{ipu3_awb.h => algorithms/awb.h} (84%)", "diff": "diff --git a/src/ipa/ipu3/ipu3_awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\nsimilarity index 94%\nrename from src/ipa/ipu3/ipu3_awb.cpp\nrename to src/ipa/ipu3/algorithms/awb.cpp\nindex b422b095..0f401d6d 100644\n--- a/src/ipa/ipu3/ipu3_awb.cpp\n+++ b/src/ipa/ipu3/algorithms/awb.cpp\n@@ -2,9 +2,9 @@\n /*\n * Copyright (C) 2021, Ideas On Board\n *\n- * ipu3_awb.cpp - AWB control algorithm\n+ * awb.cpp - AWB control algorithm\n */\n-#include \"ipu3_awb.h\"\n+#include \"awb.h\"\n \n #include <algorithm>\n #include <cmath>\n@@ -13,7 +13,7 @@\n \n namespace libcamera {\n \n-namespace ipa::ipu3 {\n+namespace ipa::ipu3::algorithms {\n \n LOG_DEFINE_CATEGORY(IPU3Awb)\n \n@@ -114,7 +114,7 @@ static const struct ipu3_uapi_ccm_mat_config imguCssCcmDefault = {\n \t0, 0, 8191, 0\n };\n \n-IPU3Awb::IPU3Awb()\n+Awb::Awb()\n \t: Algorithm()\n {\n \tasyncResults_.blueGain = 1.0;\n@@ -125,7 +125,7 @@ IPU3Awb::IPU3Awb()\n \tzones_.reserve(kAwbStatsSizeX * kAwbStatsSizeY);\n }\n \n-IPU3Awb::~IPU3Awb()\n+Awb::~Awb()\n {\n }\n \n@@ -143,7 +143,7 @@ IPU3Awb::~IPU3Awb()\n * More detailed information can be found in:\n * https://en.wikipedia.org/wiki/Color_temperature#Approximation\n */\n-uint32_t IPU3Awb::estimateCCT(double red, double green, double blue)\n+uint32_t Awb::estimateCCT(double red, double green, double blue)\n {\n \t/* Convert the RGB values to CIE tristimulus values (XYZ) */\n \tdouble X = (-0.14282) * (red) + (1.54924) * (green) + (-0.95641) * (blue);\n@@ -160,7 +160,7 @@ uint32_t IPU3Awb::estimateCCT(double red, double green, double blue)\n }\n \n /* Generate an RGB vector with the average values for each region */\n-void IPU3Awb::generateZones(std::vector<RGB> &zones)\n+void Awb::generateZones(std::vector<RGB> &zones)\n {\n \tfor (unsigned int i = 0; i < kAwbStatsSizeX * kAwbStatsSizeY; i++) {\n \t\tRGB zone;\n@@ -177,7 +177,7 @@ void IPU3Awb::generateZones(std::vector<RGB> &zones)\n }\n \n /* Translate the IPU3 statistics into the default statistics region array */\n-void IPU3Awb::generateAwbStats(const ipu3_uapi_stats_3a *stats)\n+void Awb::generateAwbStats(const ipu3_uapi_stats_3a *stats)\n {\n \tuint32_t regionWidth = round(awbGrid_.width / static_cast<double>(kAwbStatsSizeX));\n \tuint32_t regionHeight = round(awbGrid_.height / static_cast<double>(kAwbStatsSizeY));\n@@ -209,7 +209,7 @@ void IPU3Awb::generateAwbStats(const ipu3_uapi_stats_3a *stats)\n \t}\n }\n \n-void IPU3Awb::clearAwbStats()\n+void Awb::clearAwbStats()\n {\n \tfor (unsigned int i = 0; i < kAwbStatsSizeX * kAwbStatsSizeY; i++) {\n \t\tawbStats_[i].bSum = 0;\n@@ -220,7 +220,7 @@ void IPU3Awb::clearAwbStats()\n \t}\n }\n \n-void IPU3Awb::awbGreyWorld()\n+void Awb::awbGreyWorld()\n {\n \tLOG(IPU3Awb, Debug) << \"Grey world AWB\";\n \t/*\n@@ -260,7 +260,7 @@ void IPU3Awb::awbGreyWorld()\n \tasyncResults_.blueGain = blueGain;\n }\n \n-void IPU3Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)\n+void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)\n {\n \tASSERT(stats->stats_3a_status.awb_en);\n \tzones_.clear();\n@@ -275,7 +275,7 @@ void IPU3Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)\n \t}\n }\n \n-void IPU3Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n+void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n {\n \tcalculateWBGains(stats);\n \tcontext.frameContext.awb.gains.blueGain = asyncResults_.blueGain;\n@@ -283,7 +283,7 @@ void IPU3Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n \tcontext.frameContext.awb.gains.redGain = asyncResults_.redGain;\n }\n \n-void IPU3Awb::prepare(IPAContext &context, ipu3_uapi_params ¶ms)\n+void Awb::prepare(IPAContext &context, ipu3_uapi_params ¶ms)\n {\n \tparams.use.acc_awb = 1;\n \tparams.acc_param.awb.config.rgbs_thr_gr = 8191;\n@@ -327,6 +327,6 @@ void IPU3Awb::prepare(IPAContext &context, ipu3_uapi_params ¶ms)\n \tparams.acc_param.ccm = imguCssCcmDefault;\n }\n \n-} /* namespace ipa::ipu3 */\n+} /* namespace ipa::ipu3::algorithms */\n \n } /* namespace libcamera */\ndiff --git a/src/ipa/ipu3/ipu3_awb.h b/src/ipa/ipu3/algorithms/awb.h\nsimilarity index 84%\nrename from src/ipa/ipu3/ipu3_awb.h\nrename to src/ipa/ipu3/algorithms/awb.h\nindex 4de3fae2..ad640521 100644\n--- a/src/ipa/ipu3/ipu3_awb.h\n+++ b/src/ipa/ipu3/algorithms/awb.h\n@@ -2,10 +2,10 @@\n /*\n * Copyright (C) 2021, Ideas On Board\n *\n- * ipu3_awb.h - IPU3 AWB control algorithm\n+ * awb.h - IPU3 AWB control algorithm\n */\n-#ifndef __LIBCAMERA_IPU3_AWB_H__\n-#define __LIBCAMERA_IPU3_AWB_H__\n+#ifndef __LIBCAMERA_IPU3_ALGORITHMS_AWB_H__\n+#define __LIBCAMERA_IPU3_ALGORITHMS_AWB_H__\n \n #include <vector>\n \n@@ -13,21 +13,21 @@\n \n #include <libcamera/geometry.h>\n \n-#include \"algorithms/algorithm.h\"\n+#include \"algorithm.h\"\n \n namespace libcamera {\n \n-namespace ipa::ipu3 {\n+namespace ipa::ipu3::algorithms {\n \n /* Region size for the statistics generation algorithm */\n static constexpr uint32_t kAwbStatsSizeX = 16;\n static constexpr uint32_t kAwbStatsSizeY = 12;\n \n-class IPU3Awb : public Algorithm\n+class Awb : public Algorithm\n {\n public:\n-\tIPU3Awb();\n-\t~IPU3Awb();\n+\tAwb();\n+\t~Awb();\n \n \tvoid prepare(IPAContext &context, ipu3_uapi_params ¶ms) override;\n \tvoid process(IPAContext &context, const ipu3_uapi_stats_3a *stats) override;\n@@ -85,7 +85,7 @@ private:\n \tAwbStatus asyncResults_;\n };\n \n-} /* namespace ipa::ipu3 */\n+} /* namespace ipa::ipu3::algorithms */\n \n } /* namespace libcamera*/\n-#endif /* __LIBCAMERA_IPU3_AWB_H__ */\n+#endif /* __LIBCAMERA_IPU3_ALGORITHMS_AWB_H__ */\ndiff --git a/src/ipa/ipu3/algorithms/meson.build b/src/ipa/ipu3/algorithms/meson.build\nindex 69a59096..9ef2dd41 100644\n--- a/src/ipa/ipu3/algorithms/meson.build\n+++ b/src/ipa/ipu3/algorithms/meson.build\n@@ -1,6 +1,7 @@\n # SPDX-License-Identifier: CC0-1.0\n \n ipu3_ipa_algorithms = files([\n+ 'awb.cpp',\n 'contrast.cpp',\n 'grid.cpp',\n ])\ndiff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 27765aa6..bea2a372 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -30,10 +30,10 @@\n #include \"libcamera/internal/mapped_framebuffer.h\"\n \n #include \"algorithms/algorithm.h\"\n+#include \"algorithms/awb.h\"\n #include \"algorithms/contrast.h\"\n #include \"algorithms/grid.h\"\n #include \"ipu3_agc.h\"\n-#include \"ipu3_awb.h\"\n #include \"libipa/camera_sensor_helper.h\"\n \n namespace libcamera {\n@@ -84,8 +84,6 @@ private:\n \tuint32_t minGain_;\n \tuint32_t maxGain_;\n \n-\t/* Interface to the AWB algorithm */\n-\tstd::unique_ptr<IPU3Awb> awbAlgo_;\n \t/* Interface to the AEC/AGC algorithm */\n \tstd::unique_ptr<IPU3Agc> agcAlgo_;\n \t/* Interface to the Camera Helper */\n@@ -168,6 +166,8 @@ int IPAIPU3::init(const IPASettings &settings,\n \t*ipaControls = ControlInfoMap(std::move(controls), controls::controls);\n \t/* Construct our Algorithms */\n \talgorithms_.emplace_back(new algorithms::Grid());\n+\t/* Grid needs to be prepared before AWB */\n+\talgorithms_.emplace_back(new algorithms::Awb());\n \talgorithms_.emplace_back(new algorithms::Contrast());\n \n \treturn 0;\n@@ -229,8 +229,6 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo)\n \t\t\treturn ret;\n \t}\n \n-\tawbAlgo_ = std::make_unique<IPU3Awb>();\n-\n \tagcAlgo_ = std::make_unique<IPU3Agc>();\n \tagcAlgo_->configure(context_, configInfo);\n \n@@ -309,8 +307,6 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)\n \tfor (auto const &algo : algorithms_)\n \t\talgo->prepare(context_, params_);\n \n-\tawbAlgo_->prepare(context_, params_);\n-\n \t*params = params_;\n \n \tIPU3Action op;\n@@ -335,8 +331,6 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n \tgain = context_.frameContext.agc.gain;\n \tgain_ = camHelper_->gainCode(gain);\n \n-\tawbAlgo_->process(context_, stats);\n-\n \tsetControls(frame);\n \n \t/* \\todo Use VBlank value calculated from each frame exposure. */\ndiff --git a/src/ipa/ipu3/meson.build b/src/ipa/ipu3/meson.build\nindex fcb27d68..d1126947 100644\n--- a/src/ipa/ipu3/meson.build\n+++ b/src/ipa/ipu3/meson.build\n@@ -7,7 +7,6 @@ ipa_name = 'ipa_ipu3'\n ipu3_ipa_sources = files([\n 'ipu3.cpp',\n 'ipu3_agc.cpp',\n- 'ipu3_awb.cpp',\n ])\n \n ipu3_ipa_sources += ipu3_ipa_algorithms\n", "prefixes": [ "libcamera-devel", "v2", "09/10" ] }