From patchwork Mon Aug 3 12:07:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 27544 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id B1F4ABDE4C for ; Mon, 3 Aug 2026 12:30:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DF5E368066; Mon, 3 Aug 2026 14:30:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="cjreDmfC"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 551E567EE4 for ; Mon, 3 Aug 2026 14:30:19 +0200 (CEST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4954a2e73a9so12208185e9.3 for ; Mon, 03 Aug 2026 05:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1785760219; x=1786365019; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=NFSuLfdR1m+HCw+72HztqNDyQZp4Oll/4I82jqmyna4=; b=cjreDmfC7HepCD2QsfdAhi5u3mQsiIRaOstPL2jK4Sn+E3gtS8ZyrjCC6NSUZ2ACF9 Vl9lAbSTzdR9Ex0OiD+LRZUU0Ogcrb1b0tUHnyt8GFDB9LWyO3bKsWWgKG4xvCspMGiJ t/jjOJ/KFBu4elSssTkO3NttiSKxN+esrCpm4LwH9JFqn8QeEfQNcuhHmUE6d3l4x6vx JH7/sRd6G4adZ3kaWIrK9W4AM/T1bDvWWqeGDlwgywTPsb6l3ATAW8UVoHFC26xtHnXl mIf5UPVygnZm4DJP/D1A3C+ybdpHLPP+3/bvM+RFfZRzorCDlAolXO0u9yHUcklMK53r slNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785760219; x=1786365019; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=NFSuLfdR1m+HCw+72HztqNDyQZp4Oll/4I82jqmyna4=; b=GbReJN8JMQ8UySlMI1/qi2z5P6X7tW2zCrPT7U5mRh2vfPzRbtNMFuiOzMkcz3r8DG Ms0T7X3bjtE2oxWjcJ2mQKs42/6wGVXOrrq975rIFVZtGRLceXut94iiJbtw+eFTcfax bvB50EaobW5+d4UFTY87Ak+uKILbRZjufriNQPElXUocNhHJ0gwDMKal+TodTlafemlp 9tUv3qQNJaPH9oFvHf6SNEZALObjFvejCb41rgidzMF1Pm7MUvvdIEn+G5LFDOnqDaoo bkNuz0Do+/Pzi5Qt6b+gdKP7O8U7bqzCDb86V7cKmmItGP1rgSpstuqJeJoizuSv3PlE Qu2A== X-Gm-Message-State: AOJu0Yzvpd6B+UvG2MunoN8xjQ+mImWBrDVR8yYITD5tlnI1a05Xt882 H75Z6VZbloOsROpj8zzWctYMJrhF8AdYxvw+B1K+5vKS3HPLL/n8Pq4J5qMYRlqJ6TUNKDYHCzW wNXTV X-Gm-Gg: AR+sD13jTI/NluLOIdw6BIRiVKptFJlYH67uzYUyUkiNTa5AATls0o4mRToEbOvAGj0 qgg43SokKDYCGFcqXpzPi7R3cLHKmmdoREnXis6U0hoZQryW8tsqqCA6JKsqOv38m5MsXCzz2Wa gBeBapz8hgyO7uCCdhHyU4QiAU9Wb11JTVR6pQ3wtQv4y4w+y6eI28CD+WHnSChYj4sLsQwC1Ei jnczGmBE6daeIOVsZ1T8eKdHnl5Qk7C1BEKl3n2iZB/hQIWUVMygHsPU8u8byKd4cm6AyAmIwnb rGGq5IIu2mV+lbkLNHufOAoiUbc8m9LHW8QYJUCaoPAB4FsRDraq+BWm46BO8FJjLlyW8kSgwbw 6X7gBdnQZgculdfXgLUOf5HXPn51oTthjTur6VK7UJ1MVl1RaXA6auuTuh7jDshr0iaqQLuLiWb dx5Z/nHGiXBjtS99l4BUxWMhhYT22SZVxVfJ3JC5lf+45UYq9Ira5mZxCBu4MQv3yOxroPh+BS2 LBgdW4RYj6W1kGci8qLPibh/3z22RXCnheYINfDE79EO5a3hWzdO7kTPTacMGk5O5/OqD6Afdzd IFKD X-Received: by 2002:a05:600c:608e:b0:493:f140:c3fb with SMTP id 5b1f17b1804b1-4980c64a978mr276264775e9.7.1785760218536; Mon, 03 Aug 2026 05:30:18 -0700 (PDT) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:4706:89ee:c47e:1087]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49808690ffbsm256452635e9.10.2026.08.03.05.30.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 05:30:18 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [PATCH 1/4] ipa: rpi: cam_helper: Increase frameIntegrationDiff for IMX662 Date: Mon, 3 Aug 2026 13:07:52 +0100 Message-ID: <20260803123012.10175-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260803123012.10175-1-david.plowman@raspberrypi.com> References: <20260803123012.10175-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" IMX662 can still share its CamHelper with the IMX290 and other sensors, but requires a frameIntegrationDiff of 6 (as opposed to 2 for the others). The value 2 is invalid for the IMX662 and can lead to bad black level values in HCG (High Conversion Gain) mode. The CamHelperImx290 constructor is refactored slightly to allow the IMX662 version to be created with a custom frameIntegrationDiff. Signed-off-by: David Plowman --- src/ipa/rpi/cam_helper/cam_helper_imx290.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx290.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx290.cpp index b69d38c31..2b9cfee21 100644 --- a/src/ipa/rpi/cam_helper/cam_helper_imx290.cpp +++ b/src/ipa/rpi/cam_helper/cam_helper_imx290.cpp @@ -14,7 +14,7 @@ using namespace RPiController; class CamHelperImx290 : public CamHelper { public: - CamHelperImx290(); + CamHelperImx290(unsigned int frameIntegrationDiff = kFrameIntegrationDiff); uint32_t gainCode(double gain) const override; double gain(uint32_t gainCode) const override; unsigned int hideFramesStartup() const override; @@ -25,10 +25,10 @@ private: * Smallest difference between the frame length and integration time, * in units of lines. */ - static constexpr int frameIntegrationDiff = 2; + static constexpr unsigned int kFrameIntegrationDiff = 2; }; -CamHelperImx290::CamHelperImx290() +CamHelperImx290::CamHelperImx290(unsigned int frameIntegrationDiff) : CamHelper({}, frameIntegrationDiff) { } @@ -61,7 +61,18 @@ static CamHelper *create() return new CamHelperImx290(); } +static CamHelper *createImx662() +{ + /* + * The imx662 requires a frame integration diff of at least 4, + * according to the datasheet, but in practice this didn't prevent + * bad black level values in HCG (high conversion gain) mode. + * So instead, we go with 6 for "safety". + */ + return new CamHelperImx290(6); +} + static RegisterCamHelper reg("imx290", &create); static RegisterCamHelper reg327("imx327", &create); static RegisterCamHelper reg462("imx462", &create); -static RegisterCamHelper reg662("imx662", &create); +static RegisterCamHelper reg662("imx662", &createImx662); From patchwork Mon Aug 3 12:07:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 27547 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1D6A9C328C for ; Mon, 3 Aug 2026 12:30:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 88DB468071; Mon, 3 Aug 2026 14:30:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="cIln9mOB"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8F37768069 for ; Mon, 3 Aug 2026 14:30:29 +0200 (CEST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-495590dde14so20389995e9.0 for ; Mon, 03 Aug 2026 05:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1785760229; x=1786365029; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=6sCb2Flj7Tg1+PVP4S5OmXEko1eJ2hZmIe43/SIZYRw=; b=cIln9mOBSJxKOkoCH/al95hQmSn0S0yMTPowU7NediFzQ5Hu144LyiQyRiFZaS3eFh WYB+WimGe/pbEN5j5quv3MonQC5IoABdohheR+GGM40z8rLhJi6Dddhb51uO6kvSdVgK jGm43hRUK1wUPWvenBMk3rSxPLsxmvGlgLf++0OoU4KbnKEwBGhxYYRhXJQIEr8WFHV9 /IZFyAgja1/D1mfHQy5blnSKAoJAwI6jQyTrfDbceoc371QlWTXVhOWj25A24l+xNE+V 13eZwOXx4MfpXm29kshSK3F5MkpsgBbeBZyc+fUB6yR3UBcoVXnkzePhDUSLWJgG+YNK UaQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785760229; x=1786365029; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=6sCb2Flj7Tg1+PVP4S5OmXEko1eJ2hZmIe43/SIZYRw=; b=iA3wSMLW2fE3cubGHuXmExA7BuhKP2soHbHcD5snJL3mf2bgpqdJgfeE04OLoOWdud oB4XypVwnv1fxAhMUrBrwnCkWRef9aiewlDhWVWO6yDAY8zuk/uBBu7e8pXBLYsob8vd kMy2AOSMJ2hDyJZozgMfwOpGFSGTEtzcgz+iFrb0pk64NfV4HrIszQ0T/4zn7OHzfnSG MTRIEJzhMyv2yIjdY3kF5BDSyBU1Tg/xMOsUvpggunGRg4KyP2GwakLvlEOHE1kxhPTo 29hL666yzWRI1gSd+IUUmUFK/9H3AB0MACtGn4OalSeytmHdGmM1r8gutoILBlMQx8Z0 uRZw== X-Gm-Message-State: AOJu0YxrwYdoSa0Abid/KcFxNlCm43PDinaU4ktiFNlLEoh5GFMAK3zV QqYkw/ApSoZ28PEIfd6CsJYKUY/4Tb0ofoPy0wisqlWd2oFTiRTPljopuuAyMEv9NbRy3KjzuRW zr/e+ X-Gm-Gg: AR+sD12JUMLr/Z4+yAZLlX/CroDNH3K4zZkqBLNGHv7mFik/Vq2DXIeEr4JpXbCyJ4c ddIZwknHNZBaEeU5qK74l4S04L9mcKjCMs4wnW7LxPkANXdVzc1Yxr6tasmSm1yvP837Du0/KUQ 4KYShmX+5Dm0NMR1OU4nvztGpmavRO4iGfjJtzg5si+ssgxKvxhM4Dt3RmjaKYNLxY8UfiLaexG dDGd1YxjuP05G+NYIJ8c3NqGwK0gq6TdV2kCti7s5aBUlwryqhBf9LoXmS9sv2NWRkcNMxf//s5 0IX9Z80/uchiBZxYAjevrEgEtlUq2ekeUvVXxM/f8Mres7WcqmpOq2/j7S4zBZBuO5FZufHlzjA xi2Yd9TT4gvaC9g2/bHPn9CcU49EwH+jbPAeVilxntQa5jrtovqK88huIZ7YDV140RGd/tfnuQx 7omHHqnquJO7/l25+GeTMBA0k8iMtLp4O6rsAfahR0rJDGoZhHpEpgaQX1tFHVsFvKRlZqUMZ67 zq0S6ZIXhb+OVXyi7wFN1OFroOPi74rQzx860OLMUM2I+h3kZTh7XaJA6Fo28+psk8sbKwIkIsp oMCB X-Received: by 2002:a05:600c:4f4a:b0:495:6478:2dbc with SMTP id 5b1f17b1804b1-4980eea02e5mr205696185e9.6.1785760219094; Mon, 03 Aug 2026 05:30:19 -0700 (PDT) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:4706:89ee:c47e:1087]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49808690ffbsm256452635e9.10.2026.08.03.05.30.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 05:30:18 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [PATCH 2/4] ipa: rpi: Allow black levels to vary with analogue gain Date: Mon, 3 Aug 2026 13:07:53 +0100 Message-ID: <20260803123012.10175-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260803123012.10175-1-david.plowman@raspberrypi.com> References: <20260803123012.10175-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Optionally, a PWL (piecewise linear) function can be specified as the black level instead of a constant value. This PWL is evaluated at the current analogue gain for each frame. Tuning files will also accept "black_level_func" as a shorthand for all three channels. Signed-off-by: David Plowman --- src/ipa/rpi/controller/rpi/black_level.cpp | 33 +++++++++++++++++++--- src/ipa/rpi/controller/rpi/black_level.h | 7 +++++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/ipa/rpi/controller/rpi/black_level.cpp b/src/ipa/rpi/controller/rpi/black_level.cpp index 42ea15050..876bc661d 100644 --- a/src/ipa/rpi/controller/rpi/black_level.cpp +++ b/src/ipa/rpi/controller/rpi/black_level.cpp @@ -41,12 +41,29 @@ int BlackLevel::read(const libcamera::ValueNode ¶ms) << " Read black levels red " << blackLevelR_ << " green " << blackLevelG_ << " blue " << blackLevelB_; + + /* Allow "black_level_func" as a shorthand for all 3 colours. */ + libcamera::ipa::Pwl blackLevelFunc; + blackLevelFunc = params["black_level_func"].get(ipa::Pwl{}); + blackLevelFuncR_ = params["black_level_func_r"].get(blackLevelFunc); + blackLevelFuncG_ = params["black_level_func_g"].get(blackLevelFunc); + blackLevelFuncB_ = params["black_level_func_b"].get(blackLevelFunc); + return 0; } void BlackLevel::initialValues(uint16_t &blackLevelR, uint16_t &blackLevelG, uint16_t &blackLevelB) { + if (!blackLevelFuncR_.empty()) + blackLevelR_ = blackLevelFuncR_.eval(1.0); + + if (!blackLevelFuncG_.empty()) + blackLevelG_ = blackLevelFuncG_.eval(1.0); + + if (!blackLevelFuncB_.empty()) + blackLevelB_ = blackLevelFuncB_.eval(1.0); + blackLevelR = blackLevelR_; blackLevelG = blackLevelG_; blackLevelB = blackLevelB_; @@ -54,10 +71,18 @@ void BlackLevel::initialValues(uint16_t &blackLevelR, uint16_t &blackLevelG, void BlackLevel::prepare(Metadata *imageMetadata) { - /* - * Possibly we should think about doing this in a switchMode or - * something? - */ + DeviceStatus deviceStatus; + if (!imageMetadata->get("device.status", deviceStatus)) { + if (!blackLevelFuncR_.empty()) + blackLevelR_ = blackLevelFuncR_.eval(deviceStatus.analogueGain); + + if (!blackLevelFuncG_.empty()) + blackLevelG_ = blackLevelFuncG_.eval(deviceStatus.analogueGain); + + if (!blackLevelFuncB_.empty()) + blackLevelB_ = blackLevelFuncB_.eval(deviceStatus.analogueGain); + } + struct BlackLevelStatus status; status.blackLevelR = blackLevelR_; status.blackLevelG = blackLevelG_; diff --git a/src/ipa/rpi/controller/rpi/black_level.h b/src/ipa/rpi/controller/rpi/black_level.h index dbf29b282..34bb81548 100644 --- a/src/ipa/rpi/controller/rpi/black_level.h +++ b/src/ipa/rpi/controller/rpi/black_level.h @@ -6,6 +6,8 @@ */ #pragma once +#include + #include "../black_level_algorithm.h" #include "../black_level_status.h" @@ -27,6 +29,11 @@ private: double blackLevelR_; double blackLevelG_; double blackLevelB_; + + /* Black levels can vary with analogue gain instead of being constant. */ + libcamera::ipa::Pwl blackLevelFuncR_; + libcamera::ipa::Pwl blackLevelFuncG_; + libcamera::ipa::Pwl blackLevelFuncB_; }; } /* namespace RPiController */ From patchwork Mon Aug 3 12:07:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 27546 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 8BDB6C3264 for ; Mon, 3 Aug 2026 12:30:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F38DE6806A; Mon, 3 Aug 2026 14:30:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="DUJ1puxV"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8565A67EE4 for ; Mon, 3 Aug 2026 14:30:27 +0200 (CEST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4980fe6b3beso9532145e9.0 for ; Mon, 03 Aug 2026 05:30:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1785760227; x=1786365027; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=2jDGBVvc7JL72mgs7Hyf6RrZ4unICd74+eDb1x+i5PQ=; b=DUJ1puxVJTILA2MF777HbgEaxYDQIPz6aqWdeSxA2Fd1PxDfoButA4oJaNuw3gnzNT R0ODgIlt10hJIlB4m1AijGqg1UfCnnVxBQJGUTNtyll6gfLiv7mKOWeR8plVfj6C0Rnk eFk5Hfcp3FYLQ20kAM+ybNEcmnVwNNtl3oKJZc8VMEWNzklUAOuPFjkW2nbOiqZYrsr7 XAcsVZYzdGXxD1T93vAwLtYwhxwhndSfjsALm8jt2nkCfFt4OQhQqxGOWlCFfGEMGZu2 u2/XLv6/gGt9TucVQ2Lodw+ZDWO600dZL+NuN/PXotY9Hj71AGYVQhBh4Ys2xiLf1MvS cl/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785760227; x=1786365027; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=2jDGBVvc7JL72mgs7Hyf6RrZ4unICd74+eDb1x+i5PQ=; b=bFIXQkwUqq6tIBnFVvn5fpGgu780YEQhltxA+2XE5KgHbfOllxylcGIG3dt3UDAiQn dH13LP7TLrRMO2rOO0GNvIKt7tIywfkw7PKOKlJT6R7+P0EBNBwunmaSTg/Vrr3E2YVe UZIxyKLUYXUpI2h2CqjxrllZ8cR+D1ulLK5Ygo+ZgDJvSuR56Wp2IQNYYVe9+8PbWIBW eRcbz1Gbhffjp3qam34r88twWdDPRWT+SSNzcBlG82RmC9gaJLLM5fIVBsQfu6s22i9b r8uqaTGDPnCiLJNphpbmuN7RY54wRr/bJHfPvCeuPt9vnFqasO/HnUTkLKLK9rYu0rPw I3jw== X-Gm-Message-State: AOJu0YyAyOSNm7aJP0WwtYp3cBHB3ODi4/L+yaL923ZxStIL+xA3e9/1 JFeYVFy8iNniyNBCFx2FDhr4IQmK7V9gT95O12NGu1QaBY5l6PomZdB8Py1mGF9K+1miauZdd37 U+DPT X-Gm-Gg: AR+sD11oX4EiZ24g65+SgFiZkM+18F+bXaSsI/TwTB4Qz911zbr6lQbYHT3hqXMPq7I KTfvIEYjALXgG/fVZHb/8xBlC8fuiMd6ArfhqA3woQ09SLKLfY+z19PDaNdMJfZeboj0oUkL37X 5Cf0iQQssvDBLoWMZ6F3zkORTMTiQXqur5zdvrfipLBAXYqUpLGb5g76ZaKHbE2wZ2A7Ys8noNo HkH03jl41N5IBY7Jtol5FcuO4ke/pDCDOgW3gP8AAGF0aZkUKkhzfftp6RGygwqfvgadClU4CYn fJNOz2VAyfyj66nQw0nma9jJCoYIGdf9Nhg5caFweBOwML+EyAgYqw65TX/L3agvQWrIvnkF/Ce 6CBPN1MppNR7AZJtHnr8Vfc0hMMmf0lJs77W9TaNwPDbuMiYXAbg6ipNqJ3hYkbeXVOacrEn9li OJmR07TVSDLJsZlPdBLVjw1O+uj1H1eLegM5UkMkJqlC2MM34Wc1gPB5/l66TrtotQZw3CNofm/ ZYdjuMMq82H3grzJW6lN0iSF2+IZx6qdibQ+zrLZjMI3NUcGgil0TU2oVHPo/qDNUm3K64UobJR K4gH X-Received: by 2002:a05:600c:1990:b0:493:f783:c46a with SMTP id 5b1f17b1804b1-4980eb9b432mr172688635e9.6.1785760219591; Mon, 03 Aug 2026 05:30:19 -0700 (PDT) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:4706:89ee:c47e:1087]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49808690ffbsm256452635e9.10.2026.08.03.05.30.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 05:30:19 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [PATCH 3/4] ipa: rpi: Update black level tuning for IMX662 Date: Mon, 3 Aug 2026 13:07:54 +0100 Message-ID: <20260803123012.10175-4-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260803123012.10175-1-david.plowman@raspberrypi.com> References: <20260803123012.10175-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" At very high gains, the measured black level increases noticeably from the nominal value of 3200. Signed-off-by: David Plowman --- src/ipa/rpi/pisp/data/imx662.json | 11 ++++++++++- src/ipa/rpi/vc4/data/imx662.json | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/ipa/rpi/pisp/data/imx662.json b/src/ipa/rpi/pisp/data/imx662.json index b146d6b59..1aa5cf533 100644 --- a/src/ipa/rpi/pisp/data/imx662.json +++ b/src/ipa/rpi/pisp/data/imx662.json @@ -5,7 +5,16 @@ { "rpi.black_level": { - "black_level": 3200 + "black_level_func": + [ + 1.0, 3200, + 192.0, 3200, + 256.0, 3245, + 320.0, 3331, + 384.0, 3443, + 480.0, 3606, + 512.0, 3623 + ] } }, { diff --git a/src/ipa/rpi/vc4/data/imx662.json b/src/ipa/rpi/vc4/data/imx662.json index cec937d62..dc28b53c4 100644 --- a/src/ipa/rpi/vc4/data/imx662.json +++ b/src/ipa/rpi/vc4/data/imx662.json @@ -5,7 +5,16 @@ { "rpi.black_level": { - "black_level": 3200 + "black_level_func": + [ + 1.0, 3200, + 192.0, 3200, + 256.0, 3245, + 320.0, 3331, + 384.0, 3443, + 480.0, 3606, + 512.0, 3623 + ] } }, { From patchwork Mon Aug 3 12:07:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 27545 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C6AADBE080 for ; Mon, 3 Aug 2026 12:30:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 582CE68069; Mon, 3 Aug 2026 14:30:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="py2vHyYq"; dkim-atps=neutral Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5031C68063 for ; Mon, 3 Aug 2026 14:30:21 +0200 (CEST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-49558ce01afso15936015e9.1 for ; Mon, 03 Aug 2026 05:30:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1785760221; x=1786365021; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HbVLuWIhConhp0P9JzjItBCaymGZzqF8W2Ku9zwCVfI=; b=py2vHyYqquyYvJRXuHWHnmPsIT0DwT5EdRpqBwySvP1oQfcqZL/mr76Gy/SbbuRvRF 0jhjOwyL8FyBku0SCRdoq4INLH206r2YeE83D5ZfLRe5+vbCOVLJP6B/5+hzWDHKsG+0 xCNXEG7bZCLjn0c0N7QsCJQGWe2Pu051cDrBk+hAqUOtRQz998+u7V341Nv7dl4hMgiq D11s9pjUb5Tyq6b/+//SN1VKxuHXVhiexezBk+gxOxjuYZ7YzotmNYg3JXZsOTlQadhl jdJNRa+k1P8DV3jWzCcXnsOTUGkZDfAq94Q68rcy+K5hoKAPg5GgjMmu5VKzLGkqdmSq rgbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785760221; x=1786365021; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=HbVLuWIhConhp0P9JzjItBCaymGZzqF8W2Ku9zwCVfI=; b=EslSj0AZHTQ+st3DNkI6mhC01Bc5WJOpB5lOoPBIIRiP66Vpic7xXnz3s1gAbICO+C Abj7Y/tIgJdWwBtwrob3s7Ds5Bg+5lhZz/UQ4Lj0aG4vMQ9R8gmiC/5peIa1LA9+tAMY jJCADXFvv2ycxIpkjl8j66lmisfndjD1+jhU6bVUCVhu7q8O0Ot1cJT7eAPvWPy72rsN 9GvSlt27VF48dAnn36bkM5qFVoqU1affy7xxW+f6sQciiWXzDBfhuHZcPoGxPAThTE+h J2j/3earR8ZkL8OrKfgM8O6pArQgTtlKzC6vM5Z/Bq/COY8x7IYuxH6RCMveedu3Axcv cJsw== X-Gm-Message-State: AOJu0YwsyZsiaNnufeQ+ha+6FsZDGCC4n5E7uBrh8c4tl9dWamIEtY5I 7H5rCKC+E8VMUIbwus0mcH3rMDpyy14MtvQvOpT687Apa9heGHJBmL9nprtqm8gbnHTjvDJ1ikn LBu2/ X-Gm-Gg: AR+sD103ug/7v5lNHqr9QSHyzdxKYjRi5+cWGd8GuZ//QmwBkwPyzjjboMXbBVQEStC aGn731GlpMmZanzCmHHH41l3aZo4pTykZk8NSKhrfMRobEf3v/yewxRCST8hKp+lmZpf431oP4x kzSe2wwApARIbyPqDHgwECdpuM8eYBRKMJ238e8HIcxFkiM9+/sbMo3sw6h3AjR6RuF/2BA7y2I h0iJryYVYEc3Y59iN7HG2QINjE/1CEwjOD1Bm2P1h7YKL3CHfrZ80/bZ61DM6CQuxVQ08lB/jy0 +Nz3A5Rz97yP5kubOnC+XWAT39xjEWUilWjd1dKajoLlw3Tc5w7QJcNAlR+WXgdSDlZadV1Y9HE KDvujR/q8tHOskxj7o04nkkU560c3XL35VMUObfmjrvl4ql6wcF/3mzE0cu3+e3NaRCpaAFQTA0 FbwZTdbrQe1BfPggF7ihRmduIUzTjUVc7W9/eeQDw6pm83r1eNMoOgUFuHnfppv9UUIbibhYrdE 97XHwyJ31UlKiRb2ONi+MJluSYvxw4BOyr0QrH20AraREdfaLtx6TZrDNCrzywDpo0BSlPNZ7sa SFEP X-Received: by 2002:a05:600c:a45:b0:492:45a0:dcef with SMTP id 5b1f17b1804b1-4980c66d8a5mr186444035e9.5.1785760220068; Mon, 03 Aug 2026 05:30:20 -0700 (PDT) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:4706:89ee:c47e:1087]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49808690ffbsm256452635e9.10.2026.08.03.05.30.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 05:30:19 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [PATCH 4/4] ipa: rpi: Update colour temperature curve for IMX662 Date: Mon, 3 Aug 2026 13:07:55 +0100 Message-ID: <20260803123012.10175-5-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260803123012.10175-1-david.plowman@raspberrypi.com> References: <20260803123012.10175-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The CT (colour temperature) curve is extended at the bottom end, so that low light halogen images are less orange. Signed-off-by: David Plowman --- src/ipa/rpi/pisp/data/imx662.json | 4 +++- src/ipa/rpi/vc4/data/imx662.json | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ipa/rpi/pisp/data/imx662.json b/src/ipa/rpi/pisp/data/imx662.json index 1aa5cf533..8491452b1 100644 --- a/src/ipa/rpi/pisp/data/imx662.json +++ b/src/ipa/rpi/pisp/data/imx662.json @@ -155,7 +155,7 @@ { "auto": { - "lo": 2910.0, + "lo": 2500.0, "hi": 5535.0 }, "incandescent": @@ -192,6 +192,7 @@ "bayes": 1, "ct_curve": [ + 2500.0, 0.6632, 0.2893, 2910.0, 0.5579, 0.3553, 3600.0, 0.4693, 0.4364, 4490.0, 0.3855, 0.5469, @@ -250,6 +251,7 @@ "enable_nn": 1, "ct_curve": [ + 2500.0, 0.6632, 0.2893, 2910.0, 0.5579, 0.3553, 3600.0, 0.4693, 0.4364, 4490.0, 0.3855, 0.5469, diff --git a/src/ipa/rpi/vc4/data/imx662.json b/src/ipa/rpi/vc4/data/imx662.json index dc28b53c4..aafccaced 100644 --- a/src/ipa/rpi/vc4/data/imx662.json +++ b/src/ipa/rpi/vc4/data/imx662.json @@ -86,7 +86,7 @@ { "auto": { - "lo": 2910.0, + "lo": 2500.0, "hi": 5535.0 }, "incandescent": @@ -123,6 +123,7 @@ "bayes": 1, "ct_curve": [ + 2500.0, 0.6632, 0.2893, 2910.0, 0.5583, 0.3541, 3600.0, 0.4695, 0.4348, 4490.0, 0.3856, 0.5447,