Patch Detail
Show a patch.
GET /api/1.1/patches/14619/?format=api
{ "id": 14619, "url": "https://patchwork.libcamera.org/api/1.1/patches/14619/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14619/", "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": "<20211116162615.27777-4-laurent.pinchart@ideasonboard.com>", "date": "2021-11-16T16:26:13", "name": "[libcamera-devel,3/5] ipa: ipu3: agc: Rename currentYGain", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "203df9b79b418bd320f11650100d71c0adf6fbdb", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/14619/mbox/", "series": [ { "id": 2722, "url": "https://patchwork.libcamera.org/api/1.1/series/2722/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2722", "date": "2021-11-16T16:26:10", "name": "ipa: ipu3: agc: Misc improvements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2722/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14619/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14619/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 63EABC324E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 16 Nov 2021 16:26:50 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8A35E603F9;\n\tTue, 16 Nov 2021 17:26:48 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D06360376\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Nov 2021 17:26:43 +0100 (CET)", "from localhost.localdomain (117.145-247-81.adsl-dyn.isp.belgacom.be\n\t[81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DEA4DE7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Nov 2021 17:26:42 +0100 (CET)" ], "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=\"Te5nJLfC\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637080002;\n\tbh=CAvTCZMzSAt/NgQqUvP7TCITy9Za6FjWuWY9gVMHEjU=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Te5nJLfCQEBpedYPaeBZZHft2A0UfwCXzPomFHppdkdH8+7I78fcTcFk2yMf3jxzt\n\tIHrDKqM7Ah91gN6RQ+rzPnD877Y65eUtg8Al0bh99Q2Ovgn7quuWar5wuE5vmwOBSz\n\tHTeOXd1nXOtQMLsQpq3QryBKOEcHN+k1XzIkcVZY=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 16 Nov 2021 18:26:13 +0200", "Message-Id": "<20211116162615.27777-4-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "In-Reply-To": "<20211116162615.27777-1-laurent.pinchart@ideasonboard.com>", "References": "<20211116162615.27777-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 3/5] ipa: ipu3: agc: Rename currentYGain", "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 \"current\" prefix in the currentYGain variable name is confusing:\n\n- In Agc::estimateLuminance(), the variable contains the gain to be\n applied to the image, which is neither a \"current\" gain nor a \"Y\"\n gain. Rename it to \"gain\".\n\n- In Agc::computeExposure(), the variable contains the gain computed by\n the relative luminance method, so rename it to \"yGain\".\n\nWhile at it, rename variables to match the libcamera coding style.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/agc.cpp | 32 ++++++++++++++++----------------\n src/ipa/ipu3/algorithms/agc.h | 4 ++--\n 2 files changed, 18 insertions(+), 18 deletions(-)", "diff": "diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex d5840fb0aa97..6aab9fd5ebb5 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -173,9 +173,9 @@ void Agc::filterExposure()\n /**\n * \\brief Estimate the new exposure and gain values\n * \\param[inout] frameContext The shared IPA frame Context\n- * \\param[in] currentYGain The gain calculated on the current brightness level\n+ * \\param[in] yGain The gain calculated based on the relative luminance target\n */\n-void Agc::computeExposure(IPAFrameContext &frameContext, double currentYGain)\n+void Agc::computeExposure(IPAFrameContext &frameContext, double yGain)\n {\n \t/* Get the effective exposure and gain applied on the sensor. */\n \tuint32_t exposure = frameContext.sensor.exposure;\n@@ -189,8 +189,8 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double currentYGain)\n \t */\n \tdouble evGain = kEvGainTarget * knumHistogramBins / iqMean_;\n \n-\tif (evGain < currentYGain)\n-\t\tevGain = currentYGain;\n+\tif (evGain < yGain)\n+\t\tevGain = yGain;\n \n \t/* Consider within 1% of the target as correctly exposed */\n \tif (std::abs(evGain - 1.0) < 0.01)\n@@ -254,7 +254,7 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double currentYGain)\n * \\param[in] frameContext The shared IPA frame context\n * \\param[in] grid The grid used to store the statistics in the IPU3\n * \\param[in] stats The IPU3 statistics and ISP results\n- * \\param[in] currentYGain The gain calculated on the current brightness level\n+ * \\param[in] gain The analogue gain to apply to the frame\n * \\return The relative luminance\n *\n * Luma is the weighted sum of gamma-compressed R′G′B′ components of a color\n@@ -268,7 +268,7 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double currentYGain)\n double Agc::estimateLuminance(IPAFrameContext &frameContext,\n \t\t\t const ipu3_uapi_grid_config &grid,\n \t\t\t const ipu3_uapi_stats_3a *stats,\n-\t\t\t double currentYGain)\n+\t\t\t double gain)\n {\n \tdouble redSum = 0, greenSum = 0, blueSum = 0;\n \n@@ -281,9 +281,9 @@ double Agc::estimateLuminance(IPAFrameContext &frameContext,\n \t\t\t\t\t&stats->awb_raw_buffer.meta_data[cellPosition]\n \t\t\t\t);\n \n-\t\t\tredSum += cell->R_avg * currentYGain;\n-\t\t\tgreenSum += (cell->Gr_avg + cell->Gb_avg) / 2 * currentYGain;\n-\t\t\tblueSum += cell->B_avg * currentYGain;\n+\t\t\tredSum += cell->R_avg * gain;\n+\t\t\tgreenSum += (cell->Gr_avg + cell->Gb_avg) / 2 * gain;\n+\t\t\tblueSum += cell->B_avg * gain;\n \t\t}\n \t}\n \n@@ -310,7 +310,7 @@ void Agc::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n {\n \tmeasureBrightness(stats, context.configuration.grid.bdsGrid);\n \n-\tdouble currentYGain = 1.0;\n+\tdouble yGain = 1.0;\n \tdouble yTarget = kRelativeLuminanceTarget;\n \n \t/*\n@@ -320,18 +320,18 @@ void Agc::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n \tfor (unsigned int i = 0; i < 8; i++) {\n \t\tdouble yValue = estimateLuminance(context.frameContext,\n \t\t\t\t\t\t context.configuration.grid.bdsGrid,\n-\t\t\t\t\t\t stats, currentYGain);\n-\t\tdouble extra_gain = std::min(10.0, yTarget / (yValue + .001));\n+\t\t\t\t\t\t stats, yGain);\n+\t\tdouble extraGain = std::min(10.0, yTarget / (yValue + .001));\n \n-\t\tcurrentYGain *= extra_gain;\n+\t\tyGain *= extraGain;\n \t\tLOG(IPU3Agc, Debug) << \"Y value: \" << yValue\n \t\t\t\t << \", Y target: \" << yTarget\n-\t\t\t\t << \", gives gain \" << currentYGain;\n-\t\tif (extra_gain < 1.01)\n+\t\t\t\t << \", gives gain \" << yGain;\n+\t\tif (extraGain < 1.01)\n \t\t\tbreak;\n \t}\n \n-\tcomputeExposure(context.frameContext, currentYGain);\n+\tcomputeExposure(context.frameContext, yGain);\n \tframeCount_++;\n }\n \ndiff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\nindex 943c354a820e..0c868d6737f1 100644\n--- a/src/ipa/ipu3/algorithms/agc.h\n+++ b/src/ipa/ipu3/algorithms/agc.h\n@@ -34,11 +34,11 @@ private:\n \tvoid measureBrightness(const ipu3_uapi_stats_3a *stats,\n \t\t\t const ipu3_uapi_grid_config &grid);\n \tvoid filterExposure();\n-\tvoid computeExposure(IPAFrameContext &frameContext, double currentYGain);\n+\tvoid computeExposure(IPAFrameContext &frameContext, double yGain);\n \tdouble estimateLuminance(IPAFrameContext &frameContext,\n \t\t\t\t const ipu3_uapi_grid_config &grid,\n \t\t\t\t const ipu3_uapi_stats_3a *stats,\n-\t\t\t\t double currentYGain);\n+\t\t\t\t double gain);\n \n \tuint64_t frameCount_;\n \n", "prefixes": [ "libcamera-devel", "3/5" ] }