libcamera: stabilize AWB with a white point locus clamp + damping (r8)

The softISP AWB is pure gray world, so panning swings ColourGains with
the frame average (white wall renders green when the frame is
warm-dominated, dark desk renders red when cool-dominated) and the CCM,
interpolated over a CT estimated from those gains, amplifies and
quantizes the swings.

Patch 0015 (ours, original work) adds optional per-sensor Awb tuning to
the simple IPA: a piecewise-linear locus of calibrated illuminant white
points in gain space that the gray-world estimate is clamped to
(clampMargin), a per-stats-frame EMA on the applied gains (damping)
with a fast-converge path for persistent illuminant changes, and CT
interpolated from the applied gains' position along the locus - on the
same scale as the tuning file's ccms table - instead of the generic
estimateCCT(). Tuning files without whitePoints keep the previous
behaviour exactly, so every other sensor is unaffected.

imx896.yaml gains the locus from the stock tuning blob's 10-point
per-illuminant AWB calibration (white points and their exactly
reciprocal gain triplets, cross-validated): the 7 on-locus points as
nodes, the 3 fluorescent points admitted via clampMargin 0.35. The
5000 K label is the blob's own proven anchor; 2856 K (A) is locked by
the fluorescent trio projecting onto the 2856-5000 chord at ~3960 K
(TL84); the rest are geometry-derived approximations.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jorijn van der Graaf 2026-08-17 03:24:56 +02:00
commit 48cedac3c3
3 changed files with 437 additions and 2 deletions

View file

@ -19,6 +19,21 @@
# dynamic estimate ran at 48, leaving a 16-code residual the CCM amplified
# into colour casts in dark regions.
#
# Awb whitePoints: the 10-point per-illuminant AWB calibration from the
# same blob (white points @0x1c69ed, gain triplets @0x1c2dba — exact
# reciprocals of each other, cross-validated to float precision). The
# locus below carries the 7 on-locus points as (R gain, B gain), warm to
# cool. The 3 fluorescent points (idx 4-6) are deliberately NOT locus
# nodes: they sit ~0.33 gain units off the A-D50 chord (green side) and
# would zigzag the locus; clampMargin 0.35 admits them instead. CT
# labels: 5000 K is PROVEN (the blob's default gain + CCT anchor at
# index 3); 2856 K (illuminant A) is locked by two independent checks —
# sensor-typical A ratios AND the fluorescent trio projecting onto the
# 2856-5000 chord at ~3960 K, i.e. exactly TL84; the remaining labels
# are geometry-derived approximations (the blob stores no CCT list).
# Same ct scale as the ccms table below. damping = per-stats-frame EMA
# (stats run every 4th frame), ~1 s settling at 30 fps.
#
# PROVENANCE / LICENSE: the matrices are numeric calibration data read out
# of the proprietary vendor blob (measured spectral response of this
# sensor, not authored expression). Shipping decided 2026-08-17 by the
@ -32,6 +47,16 @@ algorithms:
- BlackLevel:
blackLevel: 4096
- Awb:
whitePoints:
- { ct: 1900, gains: [ 0.878997, 4.771635 ] }
- { ct: 2300, gains: [ 1.119141, 3.340533 ] }
- { ct: 2856, gains: [ 1.377957, 2.769483 ] }
- { ct: 5000, gains: [ 2.037341, 1.809127 ] }
- { ct: 6504, gains: [ 2.367133, 1.574040 ] }
- { ct: 7504, gains: [ 2.741927, 1.357219 ] }
- { ct: 9500, gains: [ 4.508486, 1.012164 ] }
clampMargin: 0.35
damping: 0.8
- Ccm:
ccms:
- ct: 2800