From patchwork Thu Aug 6 15:19:41 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 27664 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 058BBC3306 for ; Thu, 6 Aug 2026 15:27:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3734168184; Thu, 6 Aug 2026 17:27:10 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="UbywwtBl"; dkim-atps=neutral Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id ED1D16807A for ; Thu, 6 Aug 2026 17:27:05 +0200 (CEST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-49802c418b5so22769325e9.1 for ; Thu, 06 Aug 2026 08:27:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1786030025; x=1786634825; 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=9zj0VmNLKpjT+yYACSZDIZZ4CvKkcnncM3GWXkRa3Qw=; b=UbywwtBlfhY5CLSgtRHkZxpigu7c7UVNdA9qJtDStcDiY4AbNse6/erS53MR2EfuDF +nBUbwistNMeTijNDe6n8d6/tvfLNxf6NKDntSxlnrzs9DGkdhJzEc0ag6TGuFkZl/LD DElsc9k9JBqWGiwajB35aKmRaBeLm+cT+4srIJubsx8nuUw+z71eYAD3/jM7p4ygw0aq PsiQVHxqw4oaHNsjgcBhBaKurJaIK7V4BnLYQQDkunsNk0iTibM7ElLAWMVJPrKl0KyI wGUZowlUhNWSvgU9UEEQJfTjxFOTAhypCBkbqxzxs0RNDG6YLKeOlAVE94cZrlQAGjt9 YU6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786030025; x=1786634825; 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=9zj0VmNLKpjT+yYACSZDIZZ4CvKkcnncM3GWXkRa3Qw=; b=Z5TgszVbpRCosLNO40PohXwNuqAxoTSwtcdxMrsC9y4xVgJLLaoThtS7avhDZq4TlV otoVilLj0T28oFXHvh4g+qxY+kOCAXvjOqAnvMDY42Tfvh3rYdYGOlovV4cZzQ6qQV98 GBkwpbTydkmnFrVYBDr2ZjjsPIHrQ+pCimisL8p2s92XiNBfgDMsot4mTiqiwCd+B81F IuVyN5wifaZHWIladAhzoIUGB6qT8qcz/mpCfFNEuNL7b38OO8S+KrAXnNLtUg30I3+0 jtj3+6KgmI0+53uC8dusx9zqV5q4mfDCol2gN76ZxorJuiFUZtUyQ8XIR9mHzTqWEdG0 USKQ== X-Gm-Message-State: AOJu0YzJ8CS7fLPMOTIu/P0vxBPoHnDSH39hvUzsfnR4GtlP2dIf/68O m0f0VuXBq7TJUDs5HvwkTy8uk1+V9Dc2AzLZzN1jhv65VY1FEDszqIWaqfyZPoPfpJ54zAI5Ifs U4Rnp X-Gm-Gg: AR+sD13ACzD4Q9Syd3Wahm3P7RadHfNMdxpEBSqQxLuvEDSp2T0tCYLobPs5GE4VrB1 rPmhW+MzbrObJX8QwTiJt1PcuoAWHHonvrNioxMuS77VLQ4JqAjeCukr4Fcx0PmdkgoMwC1NJkI 5LMaWwxmrRdUfvdYdID/S66ekW8MkIOq8h4q10dqwxFY2C5h57nVcF8W4+LyNYxmgMP6iXuQmAl u0HM7XLhHd8KEUGgxbUORSFSaQgRhIlBXeG6NRSVosNQK6K85y2a3fjsRqW1GVJFQM+MbImjVik pXfbJltbZkKp2M5CFh1huv9fFYKiPb+e6ARclK0k1qKNCu2j+7BeYTydMF6fWLoMrY3/+bizN0D qG0/dU5sPo+GhXqgnwvpg7ITsWI5yc6NvGkasCY2upcGXiKnoQLKJdViu1znLwx1ydwDjqtgDi/ yvvLLorKtQNpf14+ILbM95DAc2PlnO8U85jvQD1lqpFVm9Edmu1lto2q+MYowSNNCt17gea9Yw9 WZBnICHTAZOHKEtSA5ygFPUITM847mK/Ncrn13NiY+rr4AnnS8SUdKamhTiaBa7itkbS/8vk4IW 2zCd X-Received: by 2002:a05:600c:1f86:b0:499:52ab:a50c with SMTP id 5b1f17b1804b1-49952aba5b3mr101058895e9.1.1786030025239; Thu, 06 Aug 2026 08:27:05 -0700 (PDT) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:4706:89ee:c47e:1087]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4995428f294sm70769235e9.15.2026.08.06.08.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2026 08:27:04 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman , Naushir Patuck , Jacopo Mondi Subject: [PATCH v2 1/4] ipa: rpi: cam_helper: Increase frameIntegrationDiff for IMX662 Date: Thu, 6 Aug 2026 16:19:41 +0100 Message-ID: <20260806152701.4179-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260806152701.4179-1-david.plowman@raspberrypi.com> References: <20260806152701.4179-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 Reviewed-by: Naushir Patuck Reviewed-by: Jacopo Mondi --- 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);