Patch Detail
Show a patch.
GET /api/patches/15337/?format=api
{ "id": 15337, "url": "https://patchwork.libcamera.org/api/patches/15337/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15337/", "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": "<20220207135937.221226-4-jeanmichel.hautbois@ideasonboard.com>", "date": "2022-02-07T13:59:37", "name": "[libcamera-devel,v2,3/3] ipa: ipu3: agc: Introduce lineDuration in IPASessionConfiguration", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "e8d9e6ba38be41c101f238a9f2c5c5def4f5f271", "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/15337/mbox/", "series": [ { "id": 2918, "url": "https://patchwork.libcamera.org/api/series/2918/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2918", "date": "2022-02-07T13:59:34", "name": "ipa: ipu3: Misc clean up", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2918/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15337/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15337/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 8CD2DC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 7 Feb 2022 13:59:48 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D6A916108F;\n\tMon, 7 Feb 2022 14:59:45 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C01AB61070\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 7 Feb 2022 14:59:42 +0100 (CET)", "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:f807:d5e7:1307:1df2])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 77001499;\n\tMon, 7 Feb 2022 14:59: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=\"lBR9T9LZ\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1644242382;\n\tbh=9/vtAg0HeK956Mv0GPf3VCD4uXKfQbUx1pE3UA7hak8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=lBR9T9LZaFO4Rl2HrmP9oeMCL4bLSxkFfwp+2RhlZArwVOIEwVCb8DdvcdZlbGbvR\n\tyjpkCH8QPdDiaClyuNF79S2TeFWHvcXZ48HR7Ocm9FnbpEK0yXAgPX6EpwWSCQhZ8T\n\tgNWBwnI1U+HxKR6r6jVQw4Yv5k4zEccvfQCVdmYk=", "From": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 7 Feb 2022 14:59:37 +0100", "Message-Id": "<20220207135937.221226-4-jeanmichel.hautbois@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "In-Reply-To": "<20220207135937.221226-1-jeanmichel.hautbois@ideasonboard.com>", "References": "<20220207135937.221226-1-jeanmichel.hautbois@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 3/3] ipa: ipu3: agc: Introduce\n\tlineDuration in IPASessionConfiguration", "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": "Instead of having a local cached value for line duration, store it in\nthe IPASessionConfiguration::agc structure.\nWhile at it, configure the default analogue gain and shutter speed to\ncontrolled fixed values.\n\nThe latter is set to be 10ms as it will in most cases be close to the\none needed, making the AGC faster to converge.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/agc.cpp | 25 +++++++++++++++----------\n src/ipa/ipu3/algorithms/agc.h | 3 +--\n src/ipa/ipu3/ipa_context.cpp | 3 +++\n src/ipa/ipu3/ipa_context.h | 1 +\n 4 files changed, 20 insertions(+), 12 deletions(-)", "diff": "diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex a929085c..137c36cf 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -71,7 +71,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: frameCount_(0), minShutterSpeed_(0s),\n \t maxShutterSpeed_(0s), filteredExposure_(0s)\n {\n }\n@@ -85,11 +85,14 @@ Agc::Agc()\n */\n int Agc::configure(IPAContext &context, const IPAConfigInfo &configInfo)\n {\n-\tstride_ = context.configuration.grid.stride;\n+\tIPASessionConfiguration &configuration = context.configuration;\n+\tIPAFrameContext &frameContext = context.frameContext;\n+\n+\tstride_ = configuration.grid.stride;\n \n \t/* \\todo use the IPAContext to provide the limits */\n-\tlineDuration_ = configInfo.sensorInfo.lineLength * 1.0s\n-\t\t / configInfo.sensorInfo.pixelRate;\n+\tconfiguration.agc.lineDuration = configInfo.sensorInfo.lineLength * 1.0s\n+\t\t\t\t / configInfo.sensorInfo.pixelRate;\n \n \tminShutterSpeed_ = context.configuration.agc.minShutterSpeed;\n \tmaxShutterSpeed_ = std::min(context.configuration.agc.maxShutterSpeed,\n@@ -99,8 +102,8 @@ int Agc::configure(IPAContext &context, const IPAConfigInfo &configInfo)\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+\tframeContext.agc.gain = std::max(minAnalogueGain_, kMinAnalogueGain);\n+\tframeContext.agc.exposure = 10ms / configuration.agc.lineDuration;\n \n \treturn 0;\n }\n@@ -182,9 +185,11 @@ utils::Duration Agc::filterExposure(utils::Duration exposureValue)\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+void Agc::computeExposure(IPAContext &context, double yGain,\n \t\t\t double iqMeanGain)\n {\n+\tconst IPASessionConfiguration &configuration = context.configuration;\n+\tIPAFrameContext &frameContext = context.frameContext;\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@@ -200,7 +205,7 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double yGain,\n \t/* extracted from Rpi::Agc::computeTargetExposure */\n \n \t/* Calculate the shutter time in seconds */\n-\tutils::Duration currentShutter = exposure * lineDuration_;\n+\tutils::Duration currentShutter = exposure * configuration.agc.lineDuration;\n \n \t/*\n \t * Update the exposure value for the next computation using the values\n@@ -247,7 +252,7 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double yGain,\n \t\t\t << stepGain;\n \n \t/* Update the estimated exposure and gain. */\n-\tframeContext.agc.exposure = shutterTime / lineDuration_;\n+\tframeContext.agc.exposure = shutterTime / configuration.agc.lineDuration;\n \tframeContext.agc.gain = stepGain;\n }\n \n@@ -354,7 +359,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..ad705605 100644\n--- a/src/ipa/ipu3/algorithms/agc.h\n+++ b/src/ipa/ipu3/algorithms/agc.h\n@@ -34,7 +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+\tvoid computeExposure(IPAContext &context, double yGain,\n \t\t\t double iqMeanGain);\n \tdouble estimateLuminance(IPAFrameContext &frameContext,\n \t\t\t\t const ipu3_uapi_grid_config &grid,\n@@ -43,7 +43,6 @@ private:\n \n \tuint64_t frameCount_;\n \n-\tutils::Duration lineDuration_;\n \tutils::Duration minShutterSpeed_;\n \tutils::Duration maxShutterSpeed_;\n \ndiff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp\nindex 86794ac1..ace9c66f 100644\n--- a/src/ipa/ipu3/ipa_context.cpp\n+++ b/src/ipa/ipu3/ipa_context.cpp\n@@ -84,6 +84,9 @@ namespace libcamera::ipa::ipu3 {\n *\n * \\var IPASessionConfiguration::agc.maxAnalogueGain\n * \\brief Maximum analogue gain supported with the configured sensor\n+ *\n+ * \\var IPASessionConfiguration::agc.lineDuration\n+ * \\brief Line duration in microseconds\n */\n \n /**\ndiff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\nindex c6dc0814..7696fd14 100644\n--- a/src/ipa/ipu3/ipa_context.h\n+++ b/src/ipa/ipu3/ipa_context.h\n@@ -30,6 +30,7 @@ struct IPASessionConfiguration {\n \t\tutils::Duration maxShutterSpeed;\n \t\tdouble minAnalogueGain;\n \t\tdouble maxAnalogueGain;\n+\t\tutils::Duration lineDuration;\n \t} agc;\n };\n \n", "prefixes": [ "libcamera-devel", "v2", "3/3" ] }