From patchwork Wed Nov 18 16:46:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: GuyliandeJong X-Patchwork-Id: 29021 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 3A95AC3304 for ; Wed, 18 Nov 2026 16:46:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 02EF16A906; Wed, 18 Nov 2026 17:46:40 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=proton.me header.i=@proton.me header.b="FqMil7MP"; dkim-atps=neutral Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 795866A8C7 for ; Wed, 18 Nov 2026 17:46:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail2; t=1795020397; x=1795279597; bh=eF4QN5UyVin6G7Pz4pgwCWk2YZSrrytx/jJVyEcsD88=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=FqMil7MPbhlPC0NUxLmmMRscpB3l4sC0M+PIk5Wx7Eki8RGe/qCpbD+tSm02y1pl7 oj2gWLGx9cKIZvdZLb97VDNY0936p8gfSBuHpjpo3cNUNLNYomLHntfaJuFCfE/CAt A7zZc2/+ztoh8KiIHF3dd/GIfiBJuzrfo7S8cPMr1XuU7CzB161ZZ+WdJXv9AOyATa 5wlXo9jnm3KR1Fas6HLuRREtc+A+sxWVdW7RjG5wgE6qs5GvS9wWbx3pA2zxiQyr83 WxMBS7Y9JhrGQQmbDbpRXz5Wu2OzkDjthmE99S1b0dNiS6xcC+Pr+68zn1SRrKy4ex cotC4BOXpWYOQ== Date: Wed, 18 Nov 2026 16:46:31 +0000 To: libcamera-devel@lists.libcamera.org From: GuyliandeJong Cc: Daniel Scally , Barnabas Pocze , Afonso Figuinha Subject: [PATCH 0/6] ipu3: Lens shading and black level fixes, OV9734 tuning Message-ID: <20261118164621.15513-1-guyliandejong@proton.me> Feedback-ID: 112452169:user:proton X-Pm-Message-ID: e1879cd61da430e821fbb514f05f1003bdd9d338 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" This series fixes issues found while bringing up the OV9734 front camera of the Microsoft Surface Laptop 2 (Intel IPU3) on master, and adds a tuning file for that sensor. Except for the tuning file, none of the changes is specific to the OV9734. Patches 1/6 and 2/6 fix the IPU3 lens shading LUT. The number of LUT sets was computed from the number of columns instead of rows, which leaves the bottom rows uncorrected when the grid has more rows than columns (the bottom 4 rows for the OV9734). And the gains were written as total gains while the ImgU adds a base gain of 1.0, as the comment in prepare() already assumed: on hardware, a table of unity gains made the image about 1.7 times brighter. Patch 3/6 reports the first ImgU frame after starting as an error. After a change of the output size it is processed with leftover parameters and shows bars of random colours, for instance when a video call preview opens. Patch 4/6 makes the IPU3 AWB report statistics without enough usable zones as invalid. They were processed as zero means, which made the colour temperature drop to 0K for a dark frame at stream start. Patch 5/6 adds an OV9734 tuning file with a polynomial Lsc table measured from raw flat fields. The processed flat field is uniform to within 3% with it, against a corner to centre ratio of 0.64 without. Patch 6/6 takes the IPU3 black level from the camera sensor helper instead of a fixed 64. The obgrid scale was measured to be twice the 10-bit scale. This changes the value for other IPU3 sensors with a helper black level too, which I could not test. The series applies to master on its own. It was tested on the Surface Laptop 2 on top of "[PATCH v2 0/3] ipu3: Fix support for small sensors such as the OV9734" and "[PATCH] ipa: ipu3: Don't set sensor controls from an unprepared frame context", as the OV9734 needs the camera sensor helper from the former to work at all. The unit tests pass. One issue is not addressed: there is still one nearly black frame at stream start, as the AGC start values are written to the sensor before the first AGC result. I believe this is part of #374. GuyliandeJong (6): ipa: ipu3: lsc: Fill all rows of the shading table ipa: ipu3: lsc: Subtract the base gain from the shading LUT values libcamera: pipeline: ipu3: Report the first ImgU frame as an error ipa: ipu3: awb: Report statistics without enough zones as invalid ipa: ipu3: Add a tuning file for the OV9734 ipa: ipu3: blc: Use the black level from the camera sensor helper src/ipa/ipu3/algorithms/awb.cpp | 12 ++++--- src/ipa/ipu3/algorithms/blc.cpp | 53 +++++++++++++++++++++++----- src/ipa/ipu3/algorithms/blc.h | 4 +++ src/ipa/ipu3/algorithms/lsc.cpp | 22 +++++++++--- src/ipa/ipu3/data/meson.build | 1 + src/ipa/ipu3/data/ov9734.yaml | 22 ++++++++++++ src/libcamera/pipeline/ipu3/ipu3.cpp | 10 ++++++ 7 files changed, 105 insertions(+), 19 deletions(-) create mode 100644 src/ipa/ipu3/data/ov9734.yaml