[5/6] ipa: ipu3: Add a tuning file for the OV9734
diff mbox series

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

Commit Message

GuyliandeJong Nov. 18, 2026, 4:47 p.m. UTC
The OV9734, used as the front camera of the Surface Laptop 1 and 2,
has strong lens shading: the relative illumination drops to about 0.38
at three quarters of the image radius and to about 0.25 in the corners,
and the red channel falls off faster than the others. The uncalibrated
tuning file has no Lsc entry, so none of this is corrected.

Add a tuning file with a polynomial Lsc table, and keep the other
algorithms at their defaults as in uncalibrated.yaml.

The polynomials were measured on a Surface Laptop 2 from raw CIO2
frames of a diffuser over the lens, under room lighting of about
3200K. The log of each frame was fitted with a radial polynomial plus
a plane, to separate the lens shading from gradients in the lighting.
Two captures with the light coming from different directions gave the
same radial falloff (a gain of 1.56 and 1.66 at half the radius, 2.64
for both at three quarters).

With this file, the processed image of the flat field is uniform to
within 3%, against a corner to centre ratio of 0.64 without it. The
corner gains of up to 4.6 are clamped to the 4.0 maximum of the LUT
format, which only affects the outermost corners.

Signed-off-by: GuyliandeJong <guyliandejong@proton.me>
---
 src/ipa/ipu3/data/meson.build |  1 +
 src/ipa/ipu3/data/ov9734.yaml | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 src/ipa/ipu3/data/ov9734.yaml

Patch
diff mbox series

diff --git a/src/ipa/ipu3/data/meson.build b/src/ipa/ipu3/data/meson.build
index 0f7cd5c6..9fb0cfdb 100644
--- a/src/ipa/ipu3/data/meson.build
+++ b/src/ipa/ipu3/data/meson.build
@@ -1,6 +1,7 @@ 
 # SPDX-License-Identifier: CC0-1.0
 
 conf_files = files([
+    'ov9734.yaml',
     'uncalibrated.yaml',
 ])
 
diff --git a/src/ipa/ipu3/data/ov9734.yaml b/src/ipa/ipu3/data/ov9734.yaml
new file mode 100644
index 00000000..d031ec3f
--- /dev/null
+++ b/src/ipa/ipu3/data/ov9734.yaml
@@ -0,0 +1,22 @@ 
+# SPDX-License-Identifier: CC0-1.0
+%YAML 1.1
+---
+version: 1
+algorithms:
+  - Af:
+  - Agc:
+  - Awb:
+  - BlackLevelCorrection:
+  - Ccm:
+  - Lsc:
+      # Measured from raw flat fields (diffuser over the lens) on a Surface
+      # Laptop 2, under room lighting of about 3200K.
+      type: polynomial
+      sets:
+        - ct: 3200
+          r: { cx: 0.5, cy: 0.5, k0: 2.1956, k1: 1.7585, k2: 2.9072, k3: -3.2151, k4: 0.0 }
+          gr: { cx: 0.5, cy: 0.5, k0: 2.0225, k1: 1.5855, k2: 0.9147, k3: -1.6029, k4: 0.0 }
+          gb: { cx: 0.5, cy: 0.5, k0: 2.0237, k1: 1.5748, k2: 1.0013, k3: -1.6269, k4: 0.0 }
+          b: { cx: 0.5, cy: 0.5, k0: 1.8914, k1: 1.7020, k2: 1.6762, k3: -2.6457, k4: 0.0 }
+  - ToneMapping:
+...