Matching and measuring

A gamut charges a gradient nothing

On red to green the shortest path happened to stay inside sRGB where the straight line did not, and that was called a coincidence of mechanism. Made into a measurement it is not a coincidence: constraining a path to stay inside the gamut costs less of the metric's own length than the relaxation's own noise, on every gradient tested — including the ones whose free shortest path is outside at fifteen of its twenty-one steps. The gamut's boundary and the metric's cheap region point the same way, and the price of the constraint is nothing.

Assumes The straight line is not the shortest gradient, Most of this diagram cannot be shown and What a gamut costs.

The straight line is not the shortest gradient found that the shortest path from red to green under ΔE₀₀’s own metric stays inside sRGB at every step where the straight line leaves it, and was careful about what that meant: nothing in the calculation knows what sRGB is, the metric charges less where the chroma weighting is large, and two different constraints happen to point the same way. It called the agreement a tendency rather than a rule.

A tendency with a price attached is a rule. The price is what the gamut charges a path that is made to stay inside it, in the metric’s own units, and it has not been measured.

What a gamut charges a gradient, against what the relaxation's noise is. For each gradient, how much longer the best path that stays inside sRGB is than the free shortest path, as a percentage of the free one. The shaded band is the relaxation's own noise, measured by relaxing the same free path from two different starting points: 0.42 per cent at its worst. Every excess is inside it. So holding a gradient inside a display's gamut costs nothing measurable in the metric's own units, on any of these pairs — including the ones whose free path is outside at most of its points.
Fig. 1 For each gradient, how much longer the best path that stays inside sRGB is than the free shortest path, with the relaxation’s own noise shaded behind it.

Nothing, and measurably nothing

Holding a gradient inside a display’s gamut costs less of the metric’s own length than the relaxation that finds the path can measure — on every pair, including the ones whose free path is outside at most of its steps.

  • The excesses are −0.42, 0.00, 0.03, 0.00, −0.51 and 0.00 per cent, and the relaxation’s own noise, measured by relaxing the same free path from two starting points, is 0.42 per cent at its worst.
  • The constraint is not vacuous. On red to blue the straight line is outside at 19 of its 21 steps, the free shortest path at 15, and the held path at 2.
  • The held path really is held: its worst excursion outside the gamut is a thousandth of a linear coordinate, against 0.212 for the free path.
  • The price is a limit rather than a setting. Raising the penalty that holds the path inside stops changing its length well before the last value tested.
  • The mechanism is that both constraints point the same way. ΔE₀₀ charges less where chroma is low, and low chroma is where a display’s gamut is.

What a gamut could have charged

A constrained shortest path is a well-posed question with a number for an answer, and it is worth saying what a large answer would have looked like.

Two colours inside a gamut can always be joined by a path that stays inside it, because a gamut is a convex solid in linear coordinates and the straight line in those coordinates never leaves it. So the constrained problem is never infeasible, which is more than can be said for the press gamut neither gamut contains the other takes apart. What it can be is expensive: the shortest path in the metric might want to go through colours the display cannot make, and forcing it around them lengthens it.

How much it lengthens it is the gamut’s price, and nothing bounds it in advance. A metric whose cheap regions were outside the gamut would charge a great deal; one whose cheap regions were inside would charge nothing; and neither would be surprising, since the two objects were built by different people for different reasons.

How many of a gradient's steps a display cannot show. For each gradient, how many of its 21 steps fall outside sRGB, for the straight line, for the free shortest path and for the path held inside. On the three gradients whose straight line is outside at most of its steps, the free geodesic is already much better and the held path better again — and the held path costs nothing in length. The gamut's boundary and the metric's cheap region point the same way, which was noticed before as a coincidence on one gradient and is measured here as a rule with a price attached: no price.
Fig. 2 For each gradient, how many of its steps fall outside sRGB, for the straight line, for the free shortest path and for the path held inside.

What a gamut costs counted how much of the diagram a display cannot reach; this counts how much of a particular journey it cannot. On three of the six gradients the straight line is outside at 19 of its 21 steps. The free shortest path is outside at 0, 8 and 15 of them, which is the tendency the earlier essay reported — sometimes a rescue and sometimes not. The held path is outside at 0, 6 and 2.

So the constraint is doing real work. It moves a path a long way, on gradients where the straight line is almost entirely unshowable, and the question is what that movement costs.

The answer, and how to know it is an answer

The excesses are small enough that the only honest way to report them is against the measurement’s own noise.

A relaxation finds a shortest path by descending, and a descent stops somewhere near the minimum rather than at it. So two relaxations of the same problem from different starting points give slightly different lengths, and the difference between them is the floor below which any comparison is meaningless.

Measured that way the floor is 0.42 per cent at its worst and 0.004 at its best. The excesses are −0.42, 0.00, 0.03, 0.00, −0.51 and 0.00. Two of them are negative, which is not a discovery that a constraint shortens a path: it is the noise, and it is the reason the noise had to be measured rather than assumed.

So the finding is that the excess is indistinguishable from nothing, which is a different claim from the excess being zero and is the claim the measurement supports. What can be said with confidence is that a display’s gamut does not cost a gradient a per cent of its length, and that if it costs anything at all a better relaxation would be needed to find it.

The price is a limit rather than a setting. The constrained path's excess length against the penalty that holds it inside, with how many of its steps are still outside printed under each. At no penalty the path is the free geodesic and 15 of its steps are outside; by a penalty of 3200 it is inside at every step and the excess has stopped moving. So the number reported is the shortest in-gamut path's length rather than an answer at one setting, which is the only form in which "the gamut costs nothing" means anything.
Fig. 3 The constrained path’s excess length against the penalty that holds it inside, with how many of its steps are still outside printed under each.

The other thing a small number needs is a check that it is a limit rather than a setting. Raising the penalty from nothing to 3,200 takes the path from the free geodesic, outside at 15 of its steps, to a path outside at 2 — and the excess stops moving well before the last value. So what is being reported is the shortest in-gamut path’s length rather than the answer at one arbitrary strength of constraint.

The price is a limit rather than a setting. The constrained path's excess length against the penalty that holds it inside, with how many of its steps are still outside printed under each. At no penalty the path is the free geodesic and 0 of its steps are outside; by a penalty of 3200 it is inside at every step and the excess has stopped moving. So the number reported is the shortest in-gamut path's length rather than an answer at one setting, which is the only form in which "the gamut costs nothing" means anything.
Fig. 4 The same sweep on red to green, where the free geodesic is already inside at every step. The excess is flat at nothing across the whole range of penalties, which is what a null looks like and is the control the other sweeps are read against.

The mechanism, and why it is not an accident

Two objects agreeing to within a measurement’s noise deserves an explanation, and the explanation is short.

ΔE₀₀ charges less for a step where the chroma is high. Its chroma weighting divides a chroma difference by one plus 0.045 times the chroma, so a step of one chroma unit at chroma 80 counts for 0.22 of what it counts for at chroma zero. A path that can reduce its own chroma while getting where it is going is buying cheaper steps — the grain a tolerance has a grain measured, followed rather than resisted — and the geodesic does exactly that: it dips towards the neutral axis in the middle of a saturated gradient.

A display’s gamut is largest near the neutral axis and smallest at high chroma. That is what a gamut is: three primaries span a solid whose widest cross-section is in the middle of the lightness range and whose boundary closes in as chroma rises.

So the direction the metric wants to move a path and the direction the gamut needs it moved are the same direction, and not by coincidence — both are consequences of high chroma being unusual. The formula’s weighting is fitted to observers who discriminate less well at high chroma; the display’s boundary is where its three primaries run out. Neither knows about the other and both are downstream of the same fact about colour.

Three paths through red to blue, and which of them a display can show. The same plane, with the straight line, the free shortest path and the path held inside sRGB. Filled marks are steps the display can show and open ones are steps it cannot. The straight line is unshowable at 19 of its 21 steps, the free geodesic at 15 and the held path at 2. The held path is 0.51 per cent shorter than the free one, which is inside the relaxation's own noise — the display's boundary has cost this gradient nothing.
Fig. 5 Red to blue, with the straight line, the free shortest path and the path held inside. Filled marks are steps a display can show and open ones are steps it cannot.

Red to blue is the clearest case. Its straight line runs along the outside of the gamut and is unshowable at 19 of 21 steps; the free geodesic already dips inwards and is outside at 15; the held path is outside at 2 and costs nothing measurable. A gradient that was almost entirely unshowable has been made almost entirely showable by a path that is, as far as the metric can tell, exactly as good.

The gradient the constraint does least for

Three of the six gradients have straight lines entirely inside the gamut, and on those the measurement is a null: the free path is inside, the held path is the free path, and the excess is zero to the last digit. They are in the table because a constraint that changed something there would be evidence of a bug rather than of a result.

Three paths through cyan to magenta, and which of them a display can show. The same plane, with the straight line, the free shortest path and the path held inside sRGB. Filled marks are steps the display can show and open ones are steps it cannot. The straight line is unshowable at 19 of its 21 steps, the free geodesic at 8 and the held path at 6. The held path is 0.03 per cent longer than the free one, which is inside the relaxation's own noise — the display's boundary has cost this gradient nothing.
Fig. 6 Cyan to magenta, the middle case. The straight line is outside at 19 of 21 steps, the free geodesic at 8, and the held path at 6 — the one gradient where holding it inside does not finish the job.

Cyan to magenta is the one that is neither. Its straight line is almost entirely unshowable, its free geodesic recovers most of that, and the held path recovers a little more and not all — 6 of 21 steps remain outside at a penalty that has otherwise converged. The excess is 0.03 per cent, which is inside the noise.

That is the shape of a constraint that is binding and not sufficient. The two endpoints are both inside, so a path exists that stays inside; the relaxation has not found it, because the penalty is a soft constraint and a soft constraint trades a small excursion against a small length saving wherever the boundary is nearly parallel to the path. The honest statement is that the held path is much better and is not a proof, and a hard-constrained solver would settle whether the remaining six steps are a property of the problem or of the method.

It is worth being plain that this weakens the headline rather than qualifying it. The claim is that holding a path inside costs nothing measurable; on this gradient the path was not fully held, so what was measured is the price of nearly holding it. The other five gradients carry the claim.

One number is worth stating because it is the comparison this result should be read against. A gamut mapping applied to the straight line from red to blue moves 19 of its 21 steps, and no mapping preserves everything prices what each intent destroys in doing so — a projection loses either the relation between neighbouring colours or their distance from the boundary, and it loses it on every step it touches. Against that, an excess length of under half a per cent on a path that needed no projection at all is not a small saving. It is the difference between a decision made once about a whole gradient and a repair made nineteen times.

What a drawing program should do with this

The advice is simpler than the earlier essay’s and it is the same advice for a different reason.

Route a gradient inside the gamut, and stop treating it as a trade. The received arrangement is to draw the gradient and then map whatever falls outside — most of this diagram cannot be shown is the standing statement of why something has to be done, and a gamut mapping is a projection that moves colours the path has already committed to. Choosing the path inside in the first place avoids the projection entirely, and this measurement says it costs nothing in the metric the projection would have been scored in.

The saving is not small even though the price is nothing. A gamut mapping applied to red to blue moves 19 of its 21 steps; a path chosen inside moves none of them, because none of them is outside. No mapping preserves everything prices what a projection destroys, and the comparison here is against that rather than against zero.

And it is a different operation from gamut mapping, which is why it can be free. A mapping takes a colour that has been decided and moves it; a route chooses which colours to decide. The first is constrained to preserve as much as it can of something already fixed and the second is not constrained at all until the endpoints, which is the whole of why one costs and the other does not. An intent is not a function of the colour is the neighbouring observation that a mapping is chosen per job and applied per pixel; a route is chosen per gradient and applies to nothing else.

How the constrained path was found

The constraint is a penalty rather than a projection: the objective is the path’s length plus a coefficient times the sum of the squared excursions outside the gamut, where an excursion is how far a colour’s linear sRGB coordinates fall outside the unit interval. A penalty is used rather than a hard boundary because the boundary is not smooth and a descent against a non-smooth constraint stops on it rather than along it.

The penalty is swept and the reported answer is the one it has converged to, so what is reported is the shortest in-gamut path rather than the answer at one coefficient. The held path’s worst excursion is reported alongside its length, because a penalty that has not held the path inside would report a short path and mean nothing.

The relaxation’s own noise is measured rather than assumed: the same free path is relaxed from the straight line and from a displaced version of it, and the difference in their lengths is the floor. Everything above is reported against that floor.

What this does not settle

The measurement is over six gradients between primaries and secondaries, which are the extreme cases and were chosen for the earlier essay’s purpose rather than for this one. Pairs drawn at random from the cube would give a distribution, and the interesting part of it would be the tail: whether there is any pair whose gamut price is measurable.

The gamut is sRGB. A wider one charges less by construction, and a narrower one — a press, which is not convex in the same way and has a much more complicated boundary — is the case where a price is most likely to be found. Neither gamut contains the other takes the press’s shape apart, and its concavities are exactly the feature a path might have to detour around.

And the metric is ΔE₀₀’s. Two uniform spaces disagree about between found that CAM16-UCS’s geodesics run elsewhere, and whether its cheap region also coincides with the gamut is the same computation with the other metric. The mechanism argued above would predict that it does, since the appearance model’s compression is also in colourfulness.

Still open: whether a press charges what a display does not

The convexity of sRGB’s gamut is doing quiet work in this result. A path that wants to leave a convex solid can be pushed back onto its boundary at a cost that is second-order in how far it wanted to go, because a convex boundary curves away from the path. A press’s gamut is not convex — it has a shoulder where the third and fourth inks run out and a pinched region in the greens — and a path pushed onto a concave boundary has to choose a side.

The prediction is that the price stops being nothing. A gradient whose free path crosses a concavity has two in-gamut routes around it of different lengths, the shorter is not near the free path, and the constrained relaxation has to find which — which is the first arrangement in this essay where the constraint could be expensive rather than merely binding.

The measurement is this one with the press’s own gamut in place of the cube, which is already carried as a voxel set with a membership test. The number to watch is not the mean but the worst: a gamut that charges nothing for most gradients and a great deal for the ones that cross its concavity is a different object from one that charges nothing, and only the second justifies routing without a check.

A constraint’s price is a measurement, not a presumption

The habit is about what to do when two requirements happen to agree.

The natural reading of an agreement is that it is lucky and will not last, and the natural response is to keep the two requirements separate and handle each in turn. Here that is the received arrangement: choose the path, then map what falls outside. It is defensible and it presumes the price of combining them is large.

The move is to combine them and measure. A constrained optimisation is usually no harder than the unconstrained one it is built from, the excess length is one subtraction, and the answer is a number rather than a presumption — which can then be compared against the cost of the arrangement that avoided asking.

The failure mode is to price a constraint by how much it moves things. The held path here is a long way from the free one and costs nothing, because the metric is nearly flat in the direction the constraint pushes. How far a constraint moves an answer and how much it costs are different quantities, and only the second is the price.

What this makes readable

Essays that name this one as a prerequisite.

Named alongside this one

Essays reaching for the same objects. Nobody chose these; they are what the index of named objects makes visible.

What links here

Every essay whose body links to this one.

The objects this essay names

Each one links to every other essay that touches it.

CIEDE2000CIELABColour differenceConstraintDisplay gamutGamutGamut mappingGradientPerceptual uniformityTrade-off