Patch Detail
Show a patch.
GET /api/1.1/patches/13440/?format=api
{ "id": 13440, "url": "https://patchwork.libcamera.org/api/1.1/patches/13440/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13440/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20210823124937.253539-6-jeanmichel.hautbois@ideasonboard.com>", "date": "2021-08-23T12:49:35", "name": "[libcamera-devel,v1,5/7] ipa: ipu3: rename AGC algorithm", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "dda225d45d1c4064490d83f32d4f7b78ac80855e", "submitter": { "id": 75, "url": "https://patchwork.libcamera.org/api/1.1/people/75/?format=api", "name": "Jean-Michel Hautbois", "email": "jeanmichel.hautbois@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13440/mbox/", "series": [ { "id": 2385, "url": "https://patchwork.libcamera.org/api/1.1/series/2385/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2385", "date": "2021-08-23T12:49:30", "name": "IPU3: AWB and AGC improvements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2385/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13440/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13440/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 29425BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Aug 2021 12:49:51 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E6889688AE;\n\tMon, 23 Aug 2021 14:49:50 +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 99CDE68892\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Aug 2021 14:49:43 +0200 (CEST)", "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:b920:776:a08c:1d1f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 509AFDEF;\n\tMon, 23 Aug 2021 14:49:43 +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=\"u+7v1b0Z\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1629722983;\n\tbh=1vBod9TGeRYs2oPIlzmj9W8zwjl+281J1OAaooAQwWQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=u+7v1b0ZxlESCCE5SzPQhwfr0WQefLrKiy7rGd79my7WgGGe5YbAb4sjWXLrAWos6\n\thRl6z86oclffRlxdxGWTzgJAl5gEpEnwSf+OUykDaq69d5J3tC1NUAUWHiBVUlzmyL\n\t7yRIsIEuqaipyiyqExLo1MA2U1cu2/AaCj0QAakA=", "From": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 23 Aug 2021 14:49:35 +0200", "Message-Id": "<20210823124937.253539-6-jeanmichel.hautbois@ideasonboard.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20210823124937.253539-1-jeanmichel.hautbois@ideasonboard.com>", "References": "<20210823124937.253539-1-jeanmichel.hautbois@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v1 5/7] ipa: ipu3: rename AGC algorithm", "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": "The initial AGC algorithm is a simple one, which calculates the exposure\nand gain values by trying to have a mean histogram value to 128.\nRename it as \"AgcMean\" to make it easy to distinguish.\n\nNow that we are modular, we can have multiple algorithms for one\nfunctionnality (here, AGC). Naming those algorithms makes it easier to\nchose between them.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n .../ipu3/algorithms/{agc.cpp => agc_mean.cpp} | 31 +++++++++----------\n src/ipa/ipu3/algorithms/{agc.h => agc_mean.h} | 8 ++---\n src/ipa/ipu3/algorithms/meson.build | 2 +-\n src/ipa/ipu3/ipu3.cpp | 4 +--\n 4 files changed, 22 insertions(+), 23 deletions(-)\n rename src/ipa/ipu3/algorithms/{agc.cpp => agc_mean.cpp} (87%)\n rename src/ipa/ipu3/algorithms/{agc.h => agc_mean.h} (90%)", "diff": "diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc_mean.cpp\nsimilarity index 87%\nrename from src/ipa/ipu3/algorithms/agc.cpp\nrename to src/ipa/ipu3/algorithms/agc_mean.cpp\nindex 5ff50f4a..193f6e9a 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc_mean.cpp\n@@ -2,10 +2,10 @@\n /*\n * Copyright (C) 2021, Ideas On Board\n *\n- * ipu3_agc.cpp - AGC/AEC control algorithm\n+ * agc_mean.cpp - AGC/AEC control algorithm\n */\n \n-#include \"agc.h\"\n+#include \"agc_mean.h\"\n \n #include <algorithm>\n #include <chrono>\n@@ -23,7 +23,7 @@ using namespace std::literals::chrono_literals;\n \n namespace ipa::ipu3::algorithms {\n \n-LOG_DEFINE_CATEGORY(IPU3Agc)\n+LOG_DEFINE_CATEGORY(IPU3AgcMean)\n \n /* Number of frames to wait before calculating stats on minimum exposure */\n static constexpr uint32_t kInitialFrameMinAECount = 4;\n@@ -50,16 +50,15 @@ static constexpr double kEvGainTarget = 0.5;\n /* A cell is 8 bytes and contains averages for RGB values and saturation ratio */\n static constexpr uint8_t kCellSize = 8;\n \n-Agc::Agc()\n+AgcMean::AgcMean()\n \t: frameCount_(0), lastFrame_(0), iqMean_(0.0), lineDuration_(0s),\n \t maxExposureTime_(0s), prevExposure_(0s), prevExposureNoDg_(0s),\n \t currentExposure_(0s), currentExposureNoDg_(0s)\n {\n }\n \n-int Agc::configure([[maybe_unused]] IPAContext &context,\n-\t\t const IPAConfigInfo &configInfo)\n-{\n+int AgcMean::configure([[maybe_unused]] IPAContext &context,\n+\t\t const IPAConfigInfo &configInfo){\n \tlineDuration_ = configInfo.sensorInfo.lineLength * 1.0s\n \t\t / configInfo.sensorInfo.pixelRate;\n \tmaxExposureTime_ = kMaxExposure * lineDuration_;\n@@ -67,7 +66,7 @@ int Agc::configure([[maybe_unused]] IPAContext &context,\n \treturn 0;\n }\n \n-void Agc::processBrightness(const ipu3_uapi_stats_3a *stats,\n+void AgcMean::processBrightness(const ipu3_uapi_stats_3a *stats,\n \t\t\t const ipu3_uapi_grid_config &grid)\n {\n \tconst struct ipu3_uapi_grid_config statsAeGrid = stats->stats_4a_config.awb_config.grid;\n@@ -109,7 +108,7 @@ void Agc::processBrightness(const ipu3_uapi_stats_3a *stats,\n \tiqMean_ = Histogram(Span<uint32_t>(hist)).interQuantileMean(0.98, 1.0);\n }\n \n-void Agc::filterExposure()\n+void AgcMean::filterExposure()\n {\n \tdouble speed = 0.2;\n \tif (prevExposure_ == 0s) {\n@@ -140,10 +139,10 @@ void Agc::filterExposure()\n \tif (prevExposureNoDg_ <\n \t prevExposure_ * fastReduceThreshold)\n \t\tprevExposureNoDg_ = prevExposure_ * fastReduceThreshold;\n-\tLOG(IPU3Agc, Debug) << \"After filtering, total_exposure \" << prevExposure_;\n+\tLOG(IPU3AgcMean, Debug) << \"After filtering, total_exposure \" << prevExposure_;\n }\n \n-void Agc::lockExposureGain(uint32_t &exposure, double &gain)\n+void AgcMean::lockExposureGain(uint32_t &exposure, double &gain)\n {\n \t/* Algorithm initialization should wait for first valid frames */\n \t/* \\todo - have a number of frames given by DelayedControls ?\n@@ -153,20 +152,20 @@ void Agc::lockExposureGain(uint32_t &exposure, double &gain)\n \n \t/* Are we correctly exposed ? */\n \tif (std::abs(iqMean_ - kEvGainTarget * knumHistogramBins) <= 1) {\n-\t\tLOG(IPU3Agc, Debug) << \"!!! Good exposure with iqMean = \" << iqMean_;\n+\t\tLOG(IPU3AgcMean, Debug) << \"!!! Good exposure with iqMean = \" << iqMean_;\n \t} else {\n \t\tdouble newGain = kEvGainTarget * knumHistogramBins / iqMean_;\n \n \t\t/* extracted from Rpi::Agc::computeTargetExposure */\n \t\tlibcamera::utils::Duration currentShutter = exposure * lineDuration_;\n \t\tcurrentExposureNoDg_ = currentShutter * gain;\n-\t\tLOG(IPU3Agc, Debug) << \"Actual total exposure \" << currentExposureNoDg_\n+\t\tLOG(IPU3AgcMean, Debug) << \"Actual total exposure \" << currentExposureNoDg_\n \t\t\t\t << \" Shutter speed \" << currentShutter\n \t\t\t\t << \" Gain \" << gain;\n \t\tcurrentExposure_ = currentExposureNoDg_ * newGain;\n \t\tlibcamera::utils::Duration maxTotalExposure = maxExposureTime_ * kMaxGain;\n \t\tcurrentExposure_ = std::min(currentExposure_, maxTotalExposure);\n-\t\tLOG(IPU3Agc, Debug) << \"Target total exposure \" << currentExposure_;\n+\t\tLOG(IPU3AgcMean, Debug) << \"Target total exposure \" << currentExposure_;\n \n \t\t/* \\todo: estimate if we need to desaturate */\n \t\tfilterExposure();\n@@ -181,12 +180,12 @@ void Agc::lockExposureGain(uint32_t &exposure, double &gain)\n \t\t\tnewExposure = currentExposure_ / gain;\n \t\t\texposure = std::clamp(static_cast<uint32_t>(exposure * currentExposure_ / newExposure), kMinExposure, kMaxExposure);\n \t\t}\n-\t\tLOG(IPU3Agc, Debug) << \"Adjust exposure \" << exposure * lineDuration_ << \" and gain \" << gain;\n+\t\tLOG(IPU3AgcMean, Debug) << \"Adjust exposure \" << exposure * lineDuration_ << \" and gain \" << gain;\n \t}\n \tlastFrame_ = frameCount_;\n }\n \n-void Agc::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n+void AgcMean::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n {\n \tuint32_t &exposure = context.frameContext.agc.exposure;\n \tdouble &gain = context.frameContext.agc.gain;\ndiff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc_mean.h\nsimilarity index 90%\nrename from src/ipa/ipu3/algorithms/agc.h\nrename to src/ipa/ipu3/algorithms/agc_mean.h\nindex e36797d3..97114121 100644\n--- a/src/ipa/ipu3/algorithms/agc.h\n+++ b/src/ipa/ipu3/algorithms/agc_mean.h\n@@ -2,7 +2,7 @@\n /*\n * Copyright (C) 2021, Ideas On Board\n *\n- * agc.h - IPU3 AGC/AEC control algorithm\n+ * agc_mean.h - IPU3 AGC/AEC control algorithm\n */\n #ifndef __LIBCAMERA_IPU3_ALGORITHMS_AGC_H__\n #define __LIBCAMERA_IPU3_ALGORITHMS_AGC_H__\n@@ -23,11 +23,11 @@ namespace ipa::ipu3::algorithms {\n \n using utils::Duration;\n \n-class Agc : public Algorithm\n+class AgcMean : public Algorithm\n {\n public:\n-\tAgc();\n-\t~Agc() = default;\n+\tAgcMean();\n+\t~AgcMean() = default;\n \n \tint configure(IPAContext &context, const IPAConfigInfo &configInfo) override;\n \tvoid process(IPAContext &context, const ipu3_uapi_stats_3a *stats) override;\ndiff --git a/src/ipa/ipu3/algorithms/meson.build b/src/ipa/ipu3/algorithms/meson.build\nindex deae225b..807b53ea 100644\n--- a/src/ipa/ipu3/algorithms/meson.build\n+++ b/src/ipa/ipu3/algorithms/meson.build\n@@ -1,7 +1,7 @@\n # SPDX-License-Identifier: CC0-1.0\n \n ipu3_ipa_algorithms = files([\n- 'agc.cpp',\n+ 'agc_mean.cpp',\n 'algorithm.cpp',\n 'awb.cpp',\n 'tone_mapping.cpp',\ndiff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 0ed0a6f1..b73c4f7b 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -29,7 +29,7 @@\n \n #include \"libcamera/internal/mapped_framebuffer.h\"\n \n-#include \"algorithms/agc.h\"\n+#include \"algorithms/agc_mean.h\"\n #include \"algorithms/algorithm.h\"\n #include \"algorithms/awb.h\"\n #include \"algorithms/tone_mapping.h\"\n@@ -266,7 +266,7 @@ int IPAIPU3::init(const IPASettings &settings,\n \t*ipaControls = ControlInfoMap(std::move(controls), controls::controls);\n \n \t/* Construct our Algorithms */\n-\talgorithms_.push_back(std::make_unique<algorithms::Agc>());\n+\talgorithms_.push_back(std::make_unique<algorithms::AgcMean>());\n \talgorithms_.push_back(std::make_unique<algorithms::Awb>());\n \talgorithms_.push_back(std::make_unique<algorithms::ToneMapping>());\n \n", "prefixes": [ "libcamera-devel", "v1", "5/7" ] }