[0/6] ipu3: Lens shading and black level fixes, OV9734 tuning
mbox series

Message ID 20261118164621.15513-1-guyliandejong@proton.me
Headers show
Series
  • ipu3: Lens shading and black level fixes, OV9734 tuning
Related show

Message

GuyliandeJong Nov. 18, 2026, 4:46 p.m. UTC
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