Patch Detail
Show a patch.
GET /api/patches/14775/?format=api
{ "id": 14775, "url": "https://patchwork.libcamera.org/api/patches/14775/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14775/", "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": "<20211125102143.52556-2-jeanmichel.hautbois@ideasonboard.com>", "date": "2021-11-25T10:21:40", "name": "[libcamera-devel,1/4] ipa: ipu3: Return filtered value", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "46ee0837776394a92f026304ec846b600f8abf79", "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/14775/mbox/", "series": [ { "id": 2754, "url": "https://patchwork.libcamera.org/api/series/2754/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2754", "date": "2021-11-25T10:21:39", "name": "ipa: ipu3: Misc clean up", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2754/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14775/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14775/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 55698BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Nov 2021 10:21:55 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 69A12603C2;\n\tThu, 25 Nov 2021 11:21:53 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3F4276022D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Nov 2021 11:21:50 +0100 (CET)", "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:d9a5:5e40:3323:d95])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E8F4FA24;\n\tThu, 25 Nov 2021 11:21:49 +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=\"fQQJ5/O0\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637835710;\n\tbh=odbSNMF41jmEwJRGqx2a7AQ2XBy3u5vnDgJyRvTyIUI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=fQQJ5/O0Uwe6OxKuq5KohJ3Nh7kjv7nNMPb3l/zTmr5E2wdSpHrW6WKom2fAEn/m5\n\tfBHUvFfc+cFChMxqqZ+6M2GbFju/YANmZthT5IPIilE0MzVV6y8BMaOvgKGqQgcLcP\n\t0s6djhN3g4DiEWoq+pkpVfr1HiogudL3Yk56VSDg=", "From": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 25 Nov 2021 11:21:40 +0100", "Message-Id": "<20211125102143.52556-2-jeanmichel.hautbois@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "In-Reply-To": "<20211125102143.52556-1-jeanmichel.hautbois@ideasonboard.com>", "References": "<20211125102143.52556-1-jeanmichel.hautbois@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 1/4] ipa: ipu3: Return filtered value", "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": "When the current exposure value is calculated, it is cached and used by\nfilterExposure(). Use private filteredExposure_ and pass currentExposure\nas a member variable.\n\nIn order to limit the use of filteredExposure_, return the value from\nfilterExposure().\n\nWhile at it, remove a stale comment.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/agc.cpp | 31 ++++++++++++++++---------------\n src/ipa/ipu3/algorithms/agc.h | 3 +--\n 2 files changed, 17 insertions(+), 17 deletions(-)", "diff": "diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex 582f0ae1..2945a138 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -71,7 +71,7 @@ static constexpr double kRelativeLuminanceTarget = 0.16;\n \n Agc::Agc()\n \t: frameCount_(0), lineDuration_(0s), minShutterSpeed_(0s),\n-\t maxShutterSpeed_(0s), filteredExposure_(0s), currentExposure_(0s)\n+\t maxShutterSpeed_(0s), filteredExposure_(0s)\n {\n }\n \n@@ -143,7 +143,7 @@ double Agc::measureBrightness(const ipu3_uapi_stats_3a *stats,\n /**\n * \\brief Apply a filter on the exposure value to limit the speed of changes\n */\n-void Agc::filterExposure()\n+utils::Duration Agc::filterExposure(utils::Duration currentExposure)\n {\n \tdouble speed = 0.2;\n \n@@ -152,23 +152,24 @@ void Agc::filterExposure()\n \t\tspeed = 1.0;\n \n \tif (filteredExposure_ == 0s) {\n-\t\t/* DG stands for digital gain.*/\n-\t\tfilteredExposure_ = currentExposure_;\n+\t\tfilteredExposure_ = currentExposure;\n \t} else {\n \t\t/*\n \t\t * If we are close to the desired result, go faster to avoid making\n \t\t * multiple micro-adjustments.\n \t\t * \\todo Make this customisable?\n \t\t */\n-\t\tif (filteredExposure_ < 1.2 * currentExposure_ &&\n-\t\t filteredExposure_ > 0.8 * currentExposure_)\n+\t\tif (filteredExposure_ < 1.2 * currentExposure &&\n+\t\t filteredExposure_ > 0.8 * currentExposure)\n \t\t\tspeed = sqrt(speed);\n \n-\t\tfilteredExposure_ = speed * currentExposure_ +\n+\t\tfilteredExposure_ = speed * currentExposure +\n \t\t\t\tfilteredExposure_ * (1.0 - speed);\n \t}\n \n \tLOG(IPU3Agc, Debug) << \"After filtering, total_exposure \" << filteredExposure_;\n+\n+\treturn filteredExposure_;\n }\n \n /**\n@@ -212,19 +213,19 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double yGain,\n \t * Calculate the current exposure value for the scene as the latest\n \t * exposure value applied multiplied by the new estimated gain.\n \t */\n-\tcurrentExposure_ = effectiveExposureValue * evGain;\n+\tutils::Duration currentExposure = effectiveExposureValue * evGain;\n \n \t/* Clamp the exposure value to the min and max authorized */\n \tutils::Duration maxTotalExposure = maxShutterSpeed_ * maxAnalogueGain_;\n-\tcurrentExposure_ = std::min(currentExposure_, maxTotalExposure);\n-\tLOG(IPU3Agc, Debug) << \"Target total exposure \" << currentExposure_\n+\tcurrentExposure = std::min(currentExposure, maxTotalExposure);\n+\tLOG(IPU3Agc, Debug) << \"Target total exposure \" << currentExposure\n \t\t\t << \", maximum is \" << maxTotalExposure;\n \n-\t/* \\todo: estimate if we need to desaturate */\n-\tfilterExposure();\n-\n-\t/* Divide the exposure value as new exposure and gain values */\n-\tutils::Duration exposureValue = filteredExposure_;\n+\t/*\n+\t * Divide the exposure value as new exposure and gain values\n+\t * \\todo: estimate if we need to desaturate\n+\t */\n+\tutils::Duration exposureValue = filterExposure(currentExposure);\n \tutils::Duration shutterTime;\n \n \t/*\ndiff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\nindex 96ec7005..84bfe045 100644\n--- a/src/ipa/ipu3/algorithms/agc.h\n+++ b/src/ipa/ipu3/algorithms/agc.h\n@@ -33,7 +33,7 @@ public:\n private:\n \tdouble measureBrightness(const ipu3_uapi_stats_3a *stats,\n \t\t\t\t const ipu3_uapi_grid_config &grid) const;\n-\tvoid filterExposure();\n+\tutils::Duration filterExposure(utils::Duration currentExposure);\n \tvoid computeExposure(IPAFrameContext &frameContext, double yGain,\n \t\t\t double iqMeanGain);\n \tdouble estimateLuminance(IPAFrameContext &frameContext,\n@@ -51,7 +51,6 @@ private:\n \tdouble maxAnalogueGain_;\n \n \tutils::Duration filteredExposure_;\n-\tutils::Duration currentExposure_;\n \n \tuint32_t stride_;\n };\n", "prefixes": [ "libcamera-devel", "1/4" ] }