Patch Detail
Show a patch.
GET /api/patches/27466/?format=api
{ "id": 27466, "url": "https://patchwork.libcamera.org/api/patches/27466/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27466/", "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": "<20260723154327.1357866-18-barnabas.pocze@ideasonboard.com>", "date": "2026-07-23T15:43:00", "name": "[RFC,v2,17/43] ipa: libipa: agc_mean_luminance: calculateNewEv(): Return y target", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ad72fb5a1def0e0adb1802b78d4e989a1c30a619", "submitter": { "id": 216, "url": "https://patchwork.libcamera.org/api/people/216/?format=api", "name": "Barnabás Pőcze", "email": "barnabas.pocze@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/27466/mbox/", "series": [ { "id": 6075, "url": "https://patchwork.libcamera.org/api/series/6075/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6075", "date": "2026-07-23T15:42:43", "name": "ipa: libipa: agc rework", "version": 2, "mbox": "https://patchwork.libcamera.org/series/6075/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27466/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27466/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 9C607C3264\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Jul 2026 15:43:57 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1D54767F34;\n\tThu, 23 Jul 2026 17:43:57 +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 AC3D767EDF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jul 2026 17:43:34 +0200 (CEST)", "from pb-laptop.local (185.182.215.156.nat.pool.zt.hu\n\t[185.182.215.156])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C70442C09\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jul 2026 17:42:33 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZAMHij6Q\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784821353;\n\tbh=DQGwG8eoyhaSWWz/WQAxWjnwUjJ8Y4fCtHJ3VCV+bEY=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=ZAMHij6Q8KkHc/Qc8c5bef0x9wyCAdvqsFt6lMQ4eqSQm9LmaoNP4xHXF9k6290rT\n\tYbG1h+hCCfJZ2Q9F/urYwR2OZNogZ/HGGpobjUf+RL0PLzR27pFcA/hDw1zpreyWeR\n\tfB0plxz1lHeh3NM/d4ffZkIKVGYp9XRMezjeOgYc=", "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[RFC PATCH v2 17/43] ipa: libipa: agc_mean_luminance:\n\tcalculateNewEv(): Return y target", "Date": "Thu, 23 Jul 2026 17:43:00 +0200", "Message-ID": "<20260723154327.1357866-18-barnabas.pocze@ideasonboard.com>", "X-Mailer": "git-send-email 2.55.0", "In-Reply-To": "<20260723154327.1357866-1-barnabas.pocze@ideasonboard.com>", "References": "<20260723154327.1357866-1-barnabas.pocze@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "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": "Return the current applicable y target as part of the result set.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/ipa/libipa/agc_mean_luminance.cpp | 13 ++++++++-----\n src/ipa/libipa/agc_mean_luminance.h | 3 ++-\n src/ipa/rkisp1/algorithms/agc.cpp | 2 +-\n 3 files changed, 11 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp\nindex 5e12c4b475..d25b1e8322 100644\n--- a/src/ipa/libipa/agc_mean_luminance.cpp\n+++ b/src/ipa/libipa/agc_mean_luminance.cpp\n@@ -502,9 +502,8 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime,\n * target\n * \\return The calculated initial gain\n */\n-double AgcMeanLuminance::estimateInitialGain(const Traits &traits) const\n+double AgcMeanLuminance::estimateInitialGain(const Traits &traits, double yTarget) const\n {\n-\tdouble yTarget = effectiveYTarget();\n \tdouble yGain = 1.0;\n \n \t/*\n@@ -671,6 +670,9 @@ utils::Duration AgcMeanLuminance::filterExposure(utils::Duration exposureValue)\n /**\n * \\struct AgcMeanLuminance::Result\n * \\brief Collection of results of the mean luminance AGC algorithm\n+ *\n+ * \\var AgcMeanLuminance::Result::yTarget\n+ * \\brief The current y target including exposure compensation\n */\n \n /**\n@@ -694,6 +696,7 @@ AgcMeanLuminance::calculateNewEv(const Params ¶ms)\n \t */\n \tExposureModeHelper &exposureModeHelper =\n \t\texposureModeHelpers_.at(params.exposureModeIndex);\n+\tdouble yTarget = effectiveYTarget();\n \n \tif (params.effectiveExposureValue == 0s) {\n \t\tLOG(AgcMeanLuminance, Error)\n@@ -704,10 +707,10 @@ AgcMeanLuminance::calculateNewEv(const Params ¶ms)\n \t\t * doesn't get stuck with 0 in case the sensor driver allows a\n \t\t * min exposure of 0.\n \t\t */\n-\t\treturn { exposureModeHelper.splitExposure(10ms) };\n+\t\treturn { exposureModeHelper.splitExposure(10ms), yTarget };\n \t}\n \n-\tdouble gain = estimateInitialGain(params.traits);\n+\tdouble gain = estimateInitialGain(params.traits, yTarget);\n \tgain = constraintClampGain(params.constraintModeIndex, params.yHist, gain);\n \n \t/*\n@@ -726,7 +729,7 @@ AgcMeanLuminance::calculateNewEv(const Params ¶ms)\n \tnewExposureValue = filterExposure(newExposureValue);\n \n \tframeCount_++;\n-\treturn { exposureModeHelper.splitExposure(newExposureValue) };\n+\treturn { exposureModeHelper.splitExposure(newExposureValue), yTarget };\n }\n \n /**\ndiff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h\nindex aa4c0369ac..6418fe2e65 100644\n--- a/src/ipa/libipa/agc_mean_luminance.h\n+++ b/src/ipa/libipa/agc_mean_luminance.h\n@@ -87,6 +87,7 @@ public:\n \t};\n \n \tstruct Result : ExposureModeHelper::Result {\n+\t\tdouble yTarget;\n \t};\n \n \t[[nodiscard]] Result calculateNewEv(const Params ¶ms);\n@@ -103,7 +104,7 @@ private:\n \tint parseConstraint(const ValueNode &modeDict, int32_t id);\n \tint parseConstraintModes(const ValueNode &tuningData);\n \tint parseExposureModes(const ValueNode &tuningData);\n-\tdouble estimateInitialGain(const Traits &traits) const;\n+\tdouble estimateInitialGain(const Traits &traits, double yTarget) const;\n \tdouble constraintClampGain(uint32_t constraintModeIndex,\n \t\t\t\t const Histogram &hist,\n \t\t\t\t double gain) const;\ndiff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex a4567c8258..8ed9d7ea6d 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -741,7 +741,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \tactiveState.agc.automatic.exposure = newEv.exposureTime / lineDuration;\n \tactiveState.agc.automatic.gain = newEv.analogueGain;\n \tactiveState.agc.automatic.quantizationGain = newEv.quantizationGain;\n-\tactiveState.agc.automatic.yTarget = agc_.effectiveYTarget();\n+\tactiveState.agc.automatic.yTarget = newEv.yTarget;\n \t/*\n \t * Expand the target frame duration so that we do not run faster than\n \t * the minimum frame duration when we have short exposures.\n", "prefixes": [ "RFC", "v2", "17/43" ] }