| Message ID | 20260305-agc-proportional-v3-0-25abc1bfacca@jetm.me |
|---|---|
| Headers | show
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 [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 2916ABE086 for <parsemail@patchwork.libcamera.org>; Thu, 5 Mar 2026 20:16:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5345E625F7; Thu, 5 Mar 2026 21:16:23 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=jetm.me header.i=@jetm.me header.b="bHxb4eOm"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="iFeyiCfD"; dkim-atps=neutral Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D6189622AE for <libcamera-devel@lists.libcamera.org>; Thu, 5 Mar 2026 21:16:21 +0100 (CET) Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 863C77A01B3; Thu, 5 Mar 2026 15:16:20 -0500 (EST) Received: from phl-imap-07 ([10.202.2.97]) by phl-compute-02.internal (MEProxy); Thu, 05 Mar 2026 15:16:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jetm.me; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm3; t=1772741780; x=1772828180; bh=SUvy2mhbM5 T8c1aUrCR8Pk3OtQoVFgy9zWn5seU+zKs=; b=bHxb4eOmC/BgwfeH5Im4lCroNj PW/fPSNf6fTCmsXFHReno56Vakc9mYhAiiuqaA2pqciVXGSv8tpFv/pXipO3LkdX 3ALtYvmtcQP7GedrFZcoDPv+r75hDjB885nODNh0agY147oc8fxX9ayT6+7dVn6z NIsl+LRmL/t9Y/JaRta3vBSIhcFy4bF+tcpmzZOgZS0GxgNmWgdvealjhdJ8JTMy sR8xYtBh29zdu8paL5THHI/wRq/SdWXY+1lcZkBfuo1TGHcAGFIybl764uOn9Exs URYth3N6/bQVtHvzuqatzKzOYAAVf0lGmE3tMyeCdbUhw66JlxT5nPxdSVHQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1772741780; x=1772828180; bh=SUvy2mhbM5T8c1aUrCR8Pk3OtQoV Fgy9zWn5seU+zKs=; b=iFeyiCfD8YYoAiiNcLesbrV6jETDyn1nWcm5RMJaL52p y5hZDfgWMfH2wE8/w+Dwq8aotG2X/01Oyhhibpv4At1wpALod29585herd07K6hl vOwY8o0HnD/dRfPEvj4RBmMHEUOD1ZsKNemkAviXvuUTaZGfbqf6xaqaU6+u11Ek Wh3mJmfdoq4O/6au4/Tv6NgbTHmwQBzloKyhtF7TYvoxmbenQ3p++sEbOXY8b2yA Ll+9J5aeSACxQR8h3iHBjDqPvI7tEYZquxtfzfeK8VawBU7VVk50qYM3XkIAFT3U slt3wydTuZXM/klAWTSQfEVdT8N6Wz/zG0FnOFxGXQ== X-ME-Sender: <xms:k-SpadQL6tZMEYZrl9E8q0lzHz087LPW6Uf_CIGJeSAMW4BS0F1Xtg> <xme:k-SpaRlVRmNLwt6ppsDajbAxd_7ELOERws3KhMrqsN9FfKYIny1f2IjX_qZnbY4lT Ay7y7uIXprUJnvYmsT3UxsCZOhKNo7Fy6okuIQ0smXhGYZeO2GlqShF> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvieejfedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepoffhufffkfggtgfgvfevofesthejredtredtjeenucfhrhhomheplfgrvhhivghr ucfvihgruceofhhlohhsshesjhgvthhmrdhmvgeqnecuggftrfgrthhtvghrnhepjeegve fffeekhfegieeggfetveefgefgudeggfettddvtdffieevffdtgeeuueeunecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepfhhlohhsshesjhgvth hmrdhmvgdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthht oheprhhosggvrhhtrdhmrgguvghrsegtohhllhgrsghorhgrrdgtohhmpdhrtghpthhtoh epfhhlohhsshesjhgvthhmrdhmvgdprhgtphhtthhopehlihgstggrmhgvrhgrqdguvghv vghlsehlihhsthhsrdhlihgstggrmhgvrhgrrdhorhhgpdhrtghpthhtohepmhiirghmrg iirghlsehrvgguhhgrthdrtghomh X-ME-Proxy: <xmx:k-SpaT5mBJpEYgFCbaQ1A8MKyZn3fJAnjTFEeR9LU1wnEEWxdYsoEA> <xmx:k-SpaWtKA2brbQbo0uq_V-o7GP-IKbs53p6QSABFj3_4RMMOaUuwJw> <xmx:k-SpaU4HKHadoSHhwS__4NPVHZf5IMRF4Y1h6Stz1LyFKiqoO0Ef5Q> <xmx:k-SpaRV-GfRVOCDiV6Bd214mstADo7AY508Pb2S9yleC2LlvNomvlg> <xmx:lOSpaYJ7v-I4xQQBR3jBb8Ox5_5-bYCHZXN47ihSV-Grr3Uf8WPIErGE> Feedback-ID: i9dde48b3:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id CE15B1EA006B; Thu, 5 Mar 2026 15:16:19 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface From: Javier Tia <floss@jetm.me> Subject: [PATCH v3 0/3] Simple pipeline: proportional AGC, AWB stats fix, OV2740 black level Date: Thu, 05 Mar 2026 14:10:36 -0600 Message-Id: <20260305-agc-proportional-v3-0-25abc1bfacca@jetm.me> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/x2MQQqAIBAAvxJ7Tlgsg/pKdNBaayFU1ogg/HvSc WBmXsgkTBmm5gWhmzPHUKFrG1gPG3ZSvFUGjXrADo2y+6qSxBTlqqo9lbManR+N79FBzZKQ5+d fzkspH+1adWxiAAAA X-Change-ID: 20260305-agc-proportional-ba20bf95f40b To: libcamera-devel@lists.libcamera.org Cc: Javier Tia <floss@jetm.me>, Milan Zamazal <mzamazal@redhat.com>, Robert Mader <robert.mader@collabora.com> X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3012; i=floss@jetm.me; h=from:subject:message-id; bh=wwVAZ/arlASqfg3ZpmeNKQIMDNyP02S89sLRsZE/jdM=; b=owEB7QES/pANAwAKAbXuwwuoZ3cfAcsmYgBpqeM8jAIIs7G4DhovcP4ASwUSSecbvSwOO46+N wr3Ra6iFBCJAbMEAAEKAB0WIQSbE7ILzw7eI0VKk8m17sMLqGd3HwUCaanjPAAKCRC17sMLqGd3 H02sDACehEIdD4G4O/pR18B6LPSwDhTr8zoOmm111jmiFHFM3OQ0wSMMRrT9XdWCXfwZjbJxihl CNzlIsJ636LBZstGPCpG1YEcBo/xY944SSbuQoRz/DmL5fHuZnAytEgMwuhSRc3QGphjV2/9zS1 6aWVNH59Xx/qpjms4rpI4zvjS/VYXK2mRgzxeeb/pHM2affkU7EMeZn2FUqHDZGLFgyrVtd3h2u WzOVhf+wF7VCJyQ7iUVzKDzB0+aYNHuQeUSbRKDymtZkIcUhPrI/mdOrGjl6FAYBvmZntWKuWLY 1ODr9qtYqkmzTkM/BRyj8yvlkmaIhQ5C+pByVGvbmqfDELvRVTXXEZVlQ1AtPu2qSSzdo+co8k/ 4qLwicNUk5IMZ2sULUie7nVxtZ4A7ngVG6q3mfud9Is+w2msdfR4mVdWIPzRLOVvu1kki2TUF78 ifjc5C7X61lR+nNzXhqX1F1ebjC4raJhfACkyIcamljEY/eLM3sfP2dMUr/qjVumxNMyw= X-Developer-Key: i=floss@jetm.me; a=openpgp; fpr=9B13B20BCF0EDE23454A93C9B5EEC30BA867771F 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>, <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>, <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> |
| Series |
|
| Related |
show
|
This series fixes AGC oscillation and an AWB statistics bug in the Simple pipeline, and adds the OV2740 black level to the sensor helper. Patch 1 replaces the fixed 10% bang-bang step in the AGC with a proportional controller where step size scales with the MSV error. This eliminates the brightness flicker observed on sensors with non-trivial control latency (tested on OV2740 behind Intel IPU6/IVSC). Patch 2 fixes a bit-depth mismatch in the statistics gathering. The SWSTATS_ACCUMULATE_LINE_STATS() macro divides the luminance value for the histogram to normalize it to 8-bit range, but does not apply the same normalization to the RGB sums. For 10-bit and 12-bit unpacked Bayer formats, the sums are accumulated at native bit depth while the AWB subtracts an 8-bit black level, under-correcting by 4x or 16x respectively. This skews the AWB grey world gains, producing a visible color cast (~9% green on the OV2740 with BLC=16). The fix right-shifts the RGB sums in finishFrame() to normalize them to 8-bit scale, matching the histogram and the 8-bit BLC used by AWB. Patch 3 adds the OV2740 black level (4096, i.e. 0x40 at 10-bit) to CameraSensorHelperOv2740, following the established pattern used by OV5675, IMX219, and other sensors. This is the canonical location for sensor calibration data and is used across all pipeline handlers. Changes since v2: - Dropped the OV2740 tuning file patch (was 3/4). Without a CCM it is identical to uncalibrated.yaml and adds no value. A proper tuning file with calibrated color matrices can be added later. - Added Reviewed-by/Tested-by from Milan Zamazal on all patches. Changes since v1: - Added patch 2 (AWB stats normalization fix). - Removed CCM from the OV2740 tuning file (dropped in v3). - Moved black level from tuning file to CameraSensorHelper (patch 3) as suggested by Robert Mader. Tested on ThinkPad X1 Carbon Gen 10 (Alder Lake, OV2740, IPU6 ISYS, CachyOS kernel 6.19.3, libcamera 0.7.0). Test results (converged frames, 6500K lighting, no CCM): With AWB fix (v2+): R/G=0.984 B/G=0.985 (~1.5% residual) Without fix (v1): R/G=0.910 B/G=0.904 (~9% green cast) BLC=0 control: R/G=1.000 B/G=1.001 (proves the mismatch) Signed-off-by: Javier Tia <floss@jetm.me> --- Javier Tia (3): ipa: simple: agc: Replace bang-bang controller with proportional libcamera: software_isp: Normalize statistics sums to 8-bit ipa: libipa: camera_sensor_helper: Add OV2740 black level .../libcamera/internal/software_isp/swstats_cpu.h | 1 + src/ipa/libipa/camera_sensor_helper.cpp | 2 + src/ipa/simple/algorithms/agc.cpp | 73 +++++++++++++++------- src/libcamera/software_isp/swstats_cpu.cpp | 9 +++ 4 files changed, 61 insertions(+), 24 deletions(-) --- base-commit: 14ba4d168085dd27aed9bcb043996d6a5f28867e change-id: 20260305-agc-proportional-ba20bf95f40b Best regards,