{"id":25166,"url":"https://patchwork.libcamera.org/api/patches/25166/?format=json","web_url":"https://patchwork.libcamera.org/patch/25166/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251124195254.1567409-1-stefan.klug@ideasonboard.com>","date":"2025-11-24T19:52:41","name":"libipa: exposure_mode_helper: Set quantizationGain in absence of a sensor helper","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"179b773626483f32bec4ce64ea392bfaa6ea8c6c","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/25166/mbox/","series":[{"id":5611,"url":"https://patchwork.libcamera.org/api/series/5611/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5611","date":"2025-11-24T19:52:41","name":"libipa: exposure_mode_helper: Set quantizationGain in absence of a sensor helper","version":1,"mbox":"https://patchwork.libcamera.org/series/5611/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25166/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25166/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 76F29C32EF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Nov 2025 19:53:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7382D60A86;\n\tMon, 24 Nov 2025 20:53:07 +0100 (CET)","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 D3E336096B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Nov 2025 20:53:05 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:beca:d134:91bf:b5d2])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 6B0BC89A;\n\tMon, 24 Nov 2025 20:50:57 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"LpGiNvHm\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1764013857;\n\tbh=Wcv0aPP1t90L+MN+2uDfWF3wGC3QROwRlSjleczFfJE=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=LpGiNvHm0AsHBWpyBM6wCoS+87oyEe3eLZMPH83V9/PzNB6MpDvAExNVgsSxCWZ1m\n\tezggr4tD5cS10k8Sv+Jqqeb0vej67Vpm9kAIxUsbxDBBj1J43GChEbLdusC90vqIUD\n\tqBfN7m28y2ppfXc0Ixj43FWRYHdwboV6WpU/Sevg=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH] libipa: exposure_mode_helper: Set quantizationGain in\n\tabsence of a sensor helper","Date":"Mon, 24 Nov 2025 20:52:41 +0100","Message-ID":"<20251124195254.1567409-1-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.51.0","MIME-Version":"1.0","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":"In commit f077c58e087e (\"libipa: exposure_mode_helper: Take\nexposure/gain quantization into account\") calculation of the\nquantization gain was added to ExposureModeHelper::clampGain(). This\nworks as expected when a sensor helper is configured but the gain is not\nreset to 1.0 in case the sensor helper is not configured. This leads to\nincorrect gain calculations in ExposureModeHelper::splitExposure() as\nthat expects the quantization gain to be valid in any case. Fix that by\nsetting the quantization gain to 1.0 in case no sensor helper is\nconfigured.\n\nFixes: f077c58e087e (\"libipa: exposure_mode_helper: Take exposure/gain quantization into account\")\nCloses: https://gitlab.freedesktop.org/camera/libcamera/-/issues/292\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/libipa/exposure_mode_helper.cpp | 10 +++++++---\n 1 file changed, 7 insertions(+), 3 deletions(-)","diff":"diff --git a/src/ipa/libipa/exposure_mode_helper.cpp b/src/ipa/libipa/exposure_mode_helper.cpp\nindex 29e316d9d091..01c5cba8e22c 100644\n--- a/src/ipa/libipa/exposure_mode_helper.cpp\n+++ b/src/ipa/libipa/exposure_mode_helper.cpp\n@@ -144,9 +144,13 @@ utils::Duration ExposureModeHelper::clampExposureTime(utils::Duration exposureTi\n double ExposureModeHelper::clampGain(double gain, double *quantizationGain) const\n {\n \tdouble clamped = std::clamp(gain, minGain_, maxGain_);\n-\tif (!sensorHelper_)\n-\t\treturn clamped;\n-\treturn sensorHelper_->quantizeGain(clamped, quantizationGain);\n+\tif (sensorHelper_)\n+\t\treturn sensorHelper_->quantizeGain(clamped, quantizationGain);\n+\n+\tif (quantizationGain)\n+\t\t*quantizationGain = 1.0;\n+\n+\treturn clamped;\n }\n \n /**\n","prefixes":[]}