Skip to content

P7: two-white (RGBWW) allocation is unimplemented — findings from a failed attempt #4198

Closed

Description

@zackees

P7 (#4041) asks for the C3 allocation policy on "RGBW/RGBWW". The one-white case is done and merged (#4188, #4193). Two whites are not, and this records what I established attempting it, including where I went wrong, so the next attempt starts further along.

Why two whites is a different problem

With one white the feasible levels form an interval and the policy picks an end. With two, maximizing w1 + w2 is a linear program over a polygon.

docs/color-gamut-algorithm-selection.md already records that the obvious reduction — run the one-white form per white, keep the better answer — agrees with the reference on every corpus vector while being wrong on 85% of random reachable targets, because a single emitter's drive is capped at 1.

A reduction that works, up to a point

At a fixed total s = w1 + w2, substituting w2 = s − w1 gives RGB drives of

(d0 − s·dW2) − w1·(dW1 − dW2)

which is exactly the one-white shape with a shifted target and a difference column. So testing a total costs the same six comparisons as testing a single white level, and the polygon never has to be enumerated.

Checked against an exact vertex enumeration: worst disagreement 1.8e-12 over the targets where both methods returned an answer.

At the chosen total the split is still free, and the P5 reference settles it by minimizing the sum of squares of the RGB drives. Those are affine in w1, so that is a quadratic — one division, not a search. With the split included, the method reproduces the reference on all 48 rgbww corpus vectors to 1.7e-12.

Where it breaks, and the mistake I made

The achievable totals form an interval [s_lo, s_hi], not [0, s_hi]. A bright target is infeasible at s = 0 — the primaries alone cannot reach it — so a bisection seeded at zero has no feasible starting point and reports the target unreachable.

My validation hid this. The harness skipped any target where my method returned no answer, and I read "0 disagreements over 10,285 targets" as success without noticing that roughly 30,000 of 40,000 were skipped, many of them precisely the cases the method could not handle. The corpus did not catch it either: its rgbww vectors are all reachable with the primaries alone or nearly so, which is the same corpus gap that hides the 85% figure above.

What a working version needs

The feasible-s interval has to be found, not assumed to start at zero. All the bounds are affine in s, so max(lower bounds) <= min(upper bounds) is a conjunction of pairwise linear inequalities in s — roughly 25 of them for 5 lower and 5 upper bounds — each solvable for an s bound. Intersecting them gives [s_lo, s_hi] in closed form, with no search at all. That looks more promising than either the vertex enumeration or a two-phase scan-then-bisect, but I have not implemented or measured it.

Cost is the open question either way: ~25 divisions per pixel against six for the one-white case, and the one-white path is already the only per-pixel division in the pipeline (see the note in white_allocation.h).

Also needed

Corpus vectors bright enough to require both whites. Without them, nothing about this can be validated against the P5 reference — only against an independently written solver, which is weaker evidence.

Related: #4041, #4188, #4193, #4197.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions