Patch Detail
Show a patch.
GET /api/1.1/patches/14777/?format=api
{ "id": 14777, "url": "https://patchwork.libcamera.org/api/1.1/patches/14777/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14777/", "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": "<20211125102143.52556-4-jeanmichel.hautbois@ideasonboard.com>", "date": "2021-11-25T10:21:42", "name": "[libcamera-devel,3/4] ipa: ipu3: Remove local cached limits for shutter speed and gain", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "f3a1a60e0a26c22aa21858fe6aa967b953440bf8", "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/14777/mbox/", "series": [ { "id": 2754, "url": "https://patchwork.libcamera.org/api/1.1/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/14777/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14777/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 8EB2CC324F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Nov 2021 10:21:57 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 23E04603CB;\n\tThu, 25 Nov 2021 11:21:55 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 889C060233\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 4D0A3881;\n\tThu, 25 Nov 2021 11:21:50 +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=\"T5o0JqYE\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637835710;\n\tbh=+p6Q+oNDzc66MYHrz3PXThSVnjr2guOD/Us7w582AYE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=T5o0JqYE/6mW3Fr8IUEH1vY9HnmjeENtDfrwrWplpvtGqVFRqrrlZph0MFrRjVU9S\n\taDLx6lOCk50sF4hmWBBHR6wVvnQHOmRGd3Md2CG+HtvdG9DE/L2EIGVwXyJ91isL6R\n\tfSwAGXrl7hDE0+iM5OuYFMVe0CcmCz6U993txxHc=", "From": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 25 Nov 2021 11:21:42 +0100", "Message-Id": "<20211125102143.52556-4-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 3/4] ipa: ipu3: Remove local cached limits\n\tfor shutter speed and gain", "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 limits for shutter speed and analogue gain are stored locally while\nthose are only used in computeExposure(). Remove those local variables,\nand use the IPASessionConfiguration values directly.\n\nWhile at it, set default analogue gain and shutter speed.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/agc.cpp | 42 ++++++++++++++++++---------------\n src/ipa/ipu3/algorithms/agc.h | 8 +------\n 2 files changed, 24 insertions(+), 26 deletions(-)", "diff": "diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex 2945a138..b822c79b 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -70,8 +70,7 @@ static constexpr uint32_t kNumStartupFrames = 10;\n static constexpr double kRelativeLuminanceTarget = 0.16;\n \n Agc::Agc()\n-\t: frameCount_(0), lineDuration_(0s), minShutterSpeed_(0s),\n-\t maxShutterSpeed_(0s), filteredExposure_(0s)\n+\t: frameCount_(0), lineDuration_(0s), filteredExposure_(0s)\n {\n }\n \n@@ -90,16 +89,10 @@ int Agc::configure(IPAContext &context, const IPAConfigInfo &configInfo)\n \tlineDuration_ = configInfo.sensorInfo.lineLength * 1.0s\n \t\t / configInfo.sensorInfo.pixelRate;\n \n-\tminShutterSpeed_ = context.configuration.agc.minShutterSpeed;\n-\tmaxShutterSpeed_ = std::min(context.configuration.agc.maxShutterSpeed,\n-\t\t\t\t kMaxShutterSpeed);\n-\n-\tminAnalogueGain_ = std::max(context.configuration.agc.minAnalogueGain, kMinAnalogueGain);\n-\tmaxAnalogueGain_ = std::min(context.configuration.agc.maxAnalogueGain, kMaxAnalogueGain);\n-\n \t/* Configure the default exposure and gain. */\n-\tcontext.frameContext.agc.gain = minAnalogueGain_;\n-\tcontext.frameContext.agc.exposure = minShutterSpeed_ / lineDuration_;\n+\tcontext.frameContext.agc.gain =\n+\t\tstd::max(context.configuration.agc.minAnalogueGain, kMinAnalogueGain);\n+\tcontext.frameContext.agc.exposure = 10ms / lineDuration_;\n \n \treturn 0;\n }\n@@ -174,17 +167,28 @@ utils::Duration Agc::filterExposure(utils::Duration currentExposure)\n \n /**\n * \\brief Estimate the new exposure and gain values\n- * \\param[inout] frameContext The shared IPA frame Context\n+ * \\param[inout] context The shared IPA Context\n * \\param[in] yGain The gain calculated based on the relative luminance target\n * \\param[in] iqMeanGain The gain calculated based on the relative luminance target\n */\n-void Agc::computeExposure(IPAFrameContext &frameContext, double yGain,\n-\t\t\t double iqMeanGain)\n+void Agc::computeExposure(IPAContext &context, double yGain, double iqMeanGain)\n {\n+\tIPASessionConfiguration &configuration = context.configuration;\n+\tIPAFrameContext &frameContext = context.frameContext;\n+\n \t/* Get the effective exposure and gain applied on the sensor. */\n \tuint32_t exposure = frameContext.sensor.exposure;\n \tdouble analogueGain = frameContext.sensor.gain;\n \n+\tutils::Duration minShutterSpeed = configuration.agc.minShutterSpeed;\n+\tutils::Duration maxShutterSpeed = std::min(configuration.agc.maxShutterSpeed,\n+\t\t\t\t\t\t kMaxShutterSpeed);\n+\n+\tdouble minAnalogueGain = std::max(configuration.agc.minAnalogueGain,\n+\t\t\t\t\t kMinAnalogueGain);\n+\tdouble maxAnalogueGain = std::min(configuration.agc.maxAnalogueGain,\n+\t\t\t\t\t kMaxAnalogueGain);\n+\n \t/* Use the highest of the two gain estimates. */\n \tdouble evGain = std::max(yGain, iqMeanGain);\n \n@@ -216,7 +220,7 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double yGain,\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+\tutils::Duration maxTotalExposure = maxShutterSpeed * maxAnalogueGain;\n \tcurrentExposure = std::min(currentExposure, maxTotalExposure);\n \tLOG(IPU3Agc, Debug) << \"Target total exposure \" << currentExposure\n \t\t\t << \", maximum is \" << maxTotalExposure;\n@@ -232,10 +236,10 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double yGain,\n \t* Push the shutter time up to the maximum first, and only then\n \t* increase the gain.\n \t*/\n-\tshutterTime = std::clamp<utils::Duration>(exposureValue / minAnalogueGain_,\n-\t\t\t\t\t\t minShutterSpeed_, maxShutterSpeed_);\n+\tshutterTime = std::clamp<utils::Duration>(exposureValue / minAnalogueGain,\n+\t\t\t\t\t\t minShutterSpeed, maxShutterSpeed);\n \tdouble stepGain = std::clamp(exposureValue / shutterTime,\n-\t\t\t\t minAnalogueGain_, maxAnalogueGain_);\n+\t\t\t\t minAnalogueGain, maxAnalogueGain);\n \tLOG(IPU3Agc, Debug) << \"Divided up shutter and gain are \"\n \t\t\t << shutterTime << \" and \"\n \t\t\t << stepGain;\n@@ -348,7 +352,7 @@ void Agc::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)\n \t\t\tbreak;\n \t}\n \n-\tcomputeExposure(context.frameContext, yGain, iqMeanGain);\n+\tcomputeExposure(context, yGain, iqMeanGain);\n \tframeCount_++;\n }\n \ndiff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\nindex 84bfe045..d9f17e6f 100644\n--- a/src/ipa/ipu3/algorithms/agc.h\n+++ b/src/ipa/ipu3/algorithms/agc.h\n@@ -34,8 +34,7 @@ private:\n \tdouble measureBrightness(const ipu3_uapi_stats_3a *stats,\n \t\t\t\t const ipu3_uapi_grid_config &grid) const;\n \tutils::Duration filterExposure(utils::Duration currentExposure);\n-\tvoid computeExposure(IPAFrameContext &frameContext, double yGain,\n-\t\t\t double iqMeanGain);\n+\tvoid computeExposure(IPAContext &context, double yGain, double iqMeanGain);\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@@ -44,11 +43,6 @@ private:\n \tuint64_t frameCount_;\n \n \tutils::Duration lineDuration_;\n-\tutils::Duration minShutterSpeed_;\n-\tutils::Duration maxShutterSpeed_;\n-\n-\tdouble minAnalogueGain_;\n-\tdouble maxAnalogueGain_;\n \n \tutils::Duration filteredExposure_;\n \n", "prefixes": [ "libcamera-devel", "3/4" ] }