Gloam: A Technical Whitepaper

Windows display correction, measurement, and verification. Last updated July 28, 2026. Also available as Markdown for tools and agents.

A correction is trustworthy only when its signal domain, physical limits, and measured result are kept separate.

Abstract

Gloam controls two related display-correction layers on Windows. Live controls such as gamma, dimming, night mode, and per-game visibility are synthesized as per-channel one-dimensional curves and loaded into the GPU's 256-entry hardware gamma ramp. A colorimeter calibration is installed separately as a Windows color profile containing an MHC2 transform: a 3×3 color matrix followed by three 1024-point tone curves. The live ramp can then compose with the measured panel correction without rebuilding it.

In HDR, Gloam measures absolute FP16 scRGB patches at known ST.2084 wire positions. The MHC2 tone curves invert the measured PQ response while accounting for the neutral luminance scale of the matrix that precedes them. Closed-loop refinement measures the installed matrix and tone curves as one system, fits a small color residual and a neutral luminance residual, installs both atomically, and retains the best jointly measured state.

This paper describes the current implementation. It distinguishes model-based live rendering from instrument-based calibration, states the equations actually used, and records the limits that the software enforces: finite LUT resolution, panel gamut and luminance reachability, meter noise, display drift, Windows profile association, and the restricted form of correction available through MHC2.

1. Scope and Correction Layers

Gloam has two output mechanisms because one-dimensional ramps and measured color transforms solve different problems.

LayerRepresentationPurposeWindows path
Live policy Three generated 1024-point curves, resampled to a 256-entry hardware ramp Gamma preference, dimming, temperature, tint, RGB trims, night mode, gamer visibility SetDeviceGammaRamp, with ArgyllCMS dispwin as fallback
Measured calibration 3×3 matrix plus three 1024-point MHC2 LUTs Panel gamut, white point, per-channel gray tracking, SDR tone response, HDR PQ tracking Windows color profile; Advanced Color association in HDR

A hardware ramp cannot mix channels, so it cannot express a gamut rotation or a general chromatic adaptation matrix. MHC2 can express one linear 3×3 transform and three separable curves, but it is still not a three-dimensional LUT. Gloam therefore keeps color correction in the matrix, neutral tone correction in the curves, and refuses fits that require unreachable primaries or a large nonlinear color transform.

Calibration bypass is a third state, used only while measuring. It clears the live ramp and prevents background reapplication from changing the display during a patch sequence.

2. The SDR-in-HDR Transfer Mismatch

2.1 sRGB and Power-Law Presentation

Windows presents ordinary SDR application content in its Advanced Color desktop using the sRGB transfer function and a user-selected SDR reference-white luminance. A display workflow may instead expect a simple power-law presentation such as gamma 2.2 or 2.4. Those curves are close in the upper range and diverge in shadows, where sRGB's linear toe produces more light than a 2.2 power law for the same encoded value.

Content is not universally mastered to one display gamma. sRGB imagery, Rec.709 video viewed under different conditions, games, and color-managed applications have distinct assumptions. Gloam therefore offers Windows Default, gamma 2.2, and gamma 2.4 as explicit rendering choices rather than declaring one curve correct for every source.

2.2 Size of the Difference

The following values are relative linear light for the same encoded signal v.

SignalsRGB EOTFv2.2sRGB / gamma 2.2
0.050.003940.001372.87×
0.100.010020.006311.59×
0.250.050880.047371.07×
0.500.214040.217640.98×
1.001.000001.000001.00×

The correction reconstructs the SDR signal from the luminance assigned by Windows and then applies the selected power law. It does not change the source file or ask applications to render in a different color space.

3. Transfer Functions and Color Spaces

3.1 Power Law

L = vγ

Here v is a normalized encoded value and L is normalized linear light. Gloam uses γ = 2.2 or 2.4 for the selectable power-law modes.

3.2 sRGB

EsRGB(v) = v / 12.92,   v ≤ 0.04045
EsRGB(v) = ((v + 0.055) / 1.055)2.4,   v > 0.04045

EsRGB is the signal-to-linear-light direction. Its inverse is used to recover an SDR signal from normalized linear luminance.

3.3 SMPTE ST 2084 (PQ)

L = 10000 · ((max(V1/m2 − c1, 0)) / (c2 − c3V1/m2))1/m1

The implementation uses m1 = 2610/16384, m2 = 2523/32, c1 = 3424/4096, c2 = 2413/128, and c3 = 2392/128. PQ values are absolute: V = 1 represents 10,000 cd/m². Gloam uses the inverse function to encode an absolute luminance back to PQ.

3.4 RGB Bases

Live SDR ramps operate in an sRGB/Rec.709 basis. The HDR10 wire is a Rec.2020 container. A diagonal white-point scale depends on the primaries of the RGB basis, so the Accurate, Perceptual, and Ultra Night temperature methods derive different channel ratios for SDR and HDR. The colorimetry matrices are calculated from their chromaticities at full double precision and normalized so reference white maps to Y = 1.

4. Live LUT Synthesis

4.1 SDR Output

For SDR output, Gloam assumes a native display response near gamma 2.2. At LUT input x, it decodes with the selected target gamma, applies user controls in linear light, and encodes for the assumed 2.2 display response:

ℓ = xγtarget
(r, g, b) = A(ℓ, ℓ, ℓ)
LUTc(x) = c1/2.2

Windows Default and gamma 2.2 are therefore identity when no other adjustment is active. Gamma 2.4 darkens the lower range. A measured calibration does not use this assumed response; its own fitted tone curves live in the installed profile.

4.2 HDR Output

Let V be the PQ wire value, P(V) its luminance in cd/m², and W the Windows SDR white level. Within the SDR region, a selected power-law mode computes:

q = EsRGB−1(P(V) / W)
Lγ = W · qγtarget

Windows Default keeps Lγ = P(V). The result is normalized by W, adjusted in linear Rec.2020 RGB, returned to absolute luminance, and PQ-encoded per channel. Values above SDR white transition toward the headroom target described in §5.

4.3 SDR White

Gloam reads DISPLAYCONFIG_SDR_WHITE_LEVEL for each display target. Windows returns a value in thousandths of the 80-nit reference, so the conversion is:

W = raw · 80 / 1000 cd/m²

Unavailable or non-finite readings fall back to 200 cd/m². Runtime values are bounded to 40–1000 cd/m² before LUT generation. A measured HDR profile records the SDR-white state used during measurement, and preflight warns when that state has changed before installation.

4.4 Neutral Reference Curve

The diagnostic gray curve is derived from mean linear light, then encoded. In SDR it is ((r + g + b) / 3)1/2.2; in HDR it is PQ((R + G + B) / 3). Averaging encoded channel values would not represent the signal for their mean emitted light.

5. HDR Headroom

5.1 PQ-Space Shoulder

Gamma and white-balance controls are intended mainly for the SDR desktop region. Applying them unchanged to every HDR highlight would reshape mastered specular content. Above W, Gloam blends the adjusted result toward a headroom target in PQ signal space:

t = clamp((V − PQ(W)) / (1 − PQ(W)), 0, 1)
s(t) = t²(3 − 2t)
output = corrected + s(t)(headroom − corrected)

Smoothstep gives zero first derivative at both ends. Blending in PQ space allocates the transition more evenly by perceptual code distance than a linear-nit blend.

5.2 Dimming and Constant-Luminance Night Mode

At full brightness, the ordinary headroom target is passthrough. When dimming is active, the target uses the same white-anchored perceptual dimming curve as the SDR region, so a dimmed desktop does not leave HDR highlights at full output.

Constant-luminance night mode can lift the adjusted SDR white above the ordinary dimmed white. If that produces an anchor A > 0, Gloam compresses the remaining headroom monotonically:

H(L) = A(L / W)γ′,   γ′ = ln(10000 / A) / ln(10000 / W)

This maps W to A and 10,000 nits to itself. Raising diffuse white consumes real highlight headroom; the power remap preserves ordering rather than hiding that tradeoff.

6. Linear-Light Adjustments

6.1 Order of Operations

  1. Gamer shadow-visibility toe
  2. Dimming
  3. Color temperature, including the per-monitor trim and scheduled shift
  4. Tint
  5. RGB gains
  6. RGB offsets
  7. Range clamp

Every operation in this sequence is evaluated after transfer-function decoding. Applying these multipliers to encoded values would make the physical result depend on the transfer curve.

6.2 Temperature Coordinates

The manual scale maps to K = 6500 + 70T. Saved adjustments support 1900–10,000 K; scheduled night mode is limited to 1900–6500 K. Manual trim and schedule shifts compose in mired space, μ = 106/K:

μeffective = μmanual + μschedule − μ6500

This prevents a fixed Kelvin offset from becoming disproportionately strong near the warm end.

6.3 Temperature Algorithms

  • Standard. Tanner Helland's RGB approximation is normalized against its 6500 K result. Its RGB-like code values are converted through the sRGB EOTF before channel ratios are formed, because the ratios are applied in linear light.
  • Accurate CIE 1931. A Planckian locus is generated from Planck's law and the CIE 1931 2° color-matching functions at 5 nm intervals. Chromaticity is interpolated in log CCT, converted to XYZ, then to the active wire RGB basis. Target and 6500 K values are each normalized to their brightest channel before their ratio is formed. The underlying table spans 1000–25,000 K; public CCT-to-xy calls retain a 1667–25,000 K compatibility clamp. The Kang cubic is only a defensive fallback if table construction fails.
  • Perceptual. The 6500 K and target whites are blended by degree of adaptation D in CAT16 sharpened-cone space. The adapted XYZ white is then reduced to the same basis-specific diagonal used by Accurate mode. The default strength is D = 0.8. This is the recommended default; it is developed in 6.3.1.
  • Blue Reduction. A non-colorimetric heuristic keeps red at 1 while green moves toward 0.7 and blue toward 0.1 as the setting approaches 1900 K.
  • Ultra Night. A deliberately non-colorimetric amber mode for the darkest part of the evening, developed in 6.3.2.

6.3.1 Degree of Adaptation as the Colour-Preserving Lever

The live correction is a one-dimensional per-channel LUT. A full 3×3 chromatic adaptation transform is not separable and therefore cannot be baked into it: whatever Gloam does to the white point must survive reduction to three independent curves. That constraint, not a modelling preference, is what selects the mechanism. Within it the lever that best preserves colour is not the target chromaticity but the degree of adaptation applied to it.

Real chromatic adaptation is never complete. Perceptual mode models the incomplete case directly: for source white X6500, target white XT and degree D ∈ [0, 1], the adapted white is the D-blend of the two taken in CAT16 sharpened cone space, not in display RGB:

X′ = CAT16−1[ (1 − D)·ρ(X6500) + D·ρ(XT) ]

Only then is X′ reduced to per-channel display ratios, through the identical path Accurate mode uses. The distinction matters: an earlier implementation eased the finished multipliers toward unity in display RGB as 1 + D(m − 1), which is incomplete von Kries expressed in the wrong basis. Blending the whites in a sharpened cone space and reducing afterwards is the same operation performed in the space where it is defined.

The 6500 K reference is pushed through the same CAT16 round trip as the target rather than assumed to be unity. At 6500 K the two are then bit-identical and their ratio is exactly (1, 1, 1). That invariant is load-bearing rather than cosmetic: without it, switching temperature algorithm at the neutral point would visibly shift the white. Because the blend is normalized against the brightest channel, that channel stays at 1.0, so no headroom is consumed and no clipping-induced cast is introduced. At D = 1 the mode reduces exactly to Accurate; at D = 0 it is the identity.

6.3.2 Ultra Night

Ultra Night targets maximum circadian protection and accepts the loss of colour accuracy that requires. Blue carries most of a display's melanopic weight per unit luminance, so the mode drives toward amber, cutting blue hard and green substantially while preserving red for legible text. It is not a warmer Accurate; it is a different objective, and the whitepaper states that plainly because the mode should not be selected for colour work.

With warmth factor f = clamp((6500 − T) / 4500, 0, 1) and Planckian ratios (aR, aG, aB) from Accurate mode in the active wire basis:

dim = 1 − 0.30f
(r, g, b) = (aR·dim, aG·dim, aB·dim)
b ← max(b, 0.10)
g ← max(g, b)

Three of those steps encode a defect found in practice. Building on the true Planckian ratios rather than hand-authored amber keeps the hue on the blackbody locus; cutting green below its Planckian ratio directly is what produces the magenta cast that afflicts naive blue-reduction filters, and the final green floor at b is a second guard against the same failure.

The blue floor of 0.10 is a platform constraint, not a perceptual choice. A channel driven to zero makes its gamma ramp map white to black, and Windows' SetDeviceGammaRamp rejects that ramp outright, so nothing applies at all. 0.10 is the warmest blue the driver accepts and still removes roughly 90% of blue output. The 30% luminance reduction is likewise deliberate: at the deepest evening setting a full-brightness amber white is both uncomfortable and a needlessly high melanopic dose, so the dimming is part of the mode's purpose rather than a side effect.

When panel spectra are available, green is biased further down in proportion to how much more melanopic dose it carries per unit luminance than red. With per-primary melanopic efficacies μc = melc / Yc:

penalty = clamp( (μG / μR − 1) / 4, 0, 1 )
gfloor = max(1.8b, 0.12)
gg + (min(g, gfloor) − gf·penalty

The readable green floor exists so that text does not degrade into harsh magenta-red on panels whose green primary is unusually melanopic. Ultra Night is also excluded from the constant-Y rescaling of 6.4: restoring its luminance would undo precisely the dose reduction the mode exists to produce.

6.4 Constant-Y White

For temperature multipliers m, let Y(m) be their luminance in the active RGB basis, d the dimmed-white fraction, and c the permitted channel ceiling. The ideal luminance-restoring scale is 1/Y(m), bounded by available headroom:

s = min(1 / Y(m), c / (d · max(m)))

Full-brightness SDR has c = 1, so this mode is inert there. Dimming creates SDR ramp headroom. In HDR, c is min(2, DXGI-reported peak / SDR white) when usable. Ultra Night is excluded because recovering its luminance would undo its intended dose reduction.

6.5 Tint and Dimming

With normalized tint t in [−1, 1], the green direction uses (1 − 0.08|t|, 1 + 0.10|t|, 1 − 0.08|t|). The magenta direction uses (1 + 0.08t, 1 − 0.12t, 1 + 0.08t). These are restrained display-RGB trims, not a CIE tint coordinate.

Perceptual dimming uses brightness fraction b and input light x:

g = 1 + 0.3(1 − b)
D(x, b) = b · x1/g

Linear dimming, when selected, uses D(x, b) = bx.

7. Night Mode and Melanopic Policy

7.1 Scheduling

A schedule is an ordered set of fixed-time, sunrise, or sunset points. Each point defines the target Kelvin and the duration of the transition to that target. Solar times use the NOAA solar position equations with latitude, longitude, local UTC offset, and optional ±120-minute offsets. Polar day or night substitutes fixed 07:00 and 19:00 sentinels, since the NOAA solar result would otherwise collapse to a degenerate 0 h or 24 h event. The user-facing states are off, scheduled, and manual override.

7.2 Fade Pacing

Temperature interpolates linearly in mired, not Kelvin. The timer also adapts its step size to the active rendering algorithm. Around the current white, Gloam estimates ΔE ITP per mired by central difference at a 100 cd/m² reference and targets at most 0.5 ΔE ITP per hardware write. The permitted step is bounded to 0.01–2.0 mired; 0.05 mired is the fallback if the derivative is unusable.

Fade ticks are bounded to 16.7–500 ms, while hardware writes are coalesced to no more than one every 250 ms per monitor. The requested fade duration remains authoritative if it cannot satisfy the half-JND target at that write rate. Outside a fade, the service sleeps until the next event or for at most 60 seconds.

7.3 Melanopic Estimates

An additive display's emitted spectrum is the gain-weighted sum of its channel spectra, so with per-channel linear gains kc and measured channel SPDs Sc(λ) from a CCSS, the current and unshifted spectra are:

Sstate(λ) = kRSR(λ) + kGSG(λ) + kBSB(λ)
Sbase(λ) = SR(λ) + SG(λ) + SB(λ)

Additivity is an assumption, and it is not silently absorbed: the CCSS file's own measured white row will not exactly equal the sum of its channel rows, and that residual is carried forward as a named uncertainty term rather than discarded. The gains carry spectral shape only. Brightness is deliberately excluded from them and passed separately as an absolute white luminance, because dimming scales magnitude rather than shape and folding it into the gains would corrupt the ratio quantities below.

Melanopic content is expressed as the melanopic daylight efficacy ratio, the melanopic ELR of the spectrum normalized by that of CIE D65 (1.3262 mW·lm−1), so mel-DER is 1 for D65 by construction. Writing Yrel for the photopic luminance of the state relative to the unshifted white, Lwhite for the absolute white luminance at the current brightness, and Ω for the effective viewing solid angle:

Lscreen = Lwhite · Yrel
EvLscreen · Ω
mel-EDI = Ev · mel-DERstate

The two numbers Gloam reports are epistemically different, and it separates them for that reason. The headline figure is the reduction against the same panel's own 6500 K white:

reduction = 1 − (Yrel · mel-DERstate) / mel-DERbase

Ω, brightness and the white level all cancel out of that expression. It is geometry-free and immune to every assumption in the chain except the CCSS itself, which is what makes it safe to quote. Absolute mel-EDI is not: it additionally requires the corneal-illuminance step EvL·Ω, whose Ω defaults to 0.20 sr, roughly a 27-inch 16:9 panel at 60 cm viewed head-on. That assumption is exposed as a user-facing setting and appears as a dominant term in the reported uncertainty. It is never presented as measured truth, because a viewer at a different distance has a materially different corneal dose from an identical screen.

Without a CCSS, Gloam synthesizes Gaussian primaries at typical peaks and widths, 615/545/455 nm at 60/70/25 nm FWHM for sRGB-class panels and 630/530/455 nm at 30/35/20 nm for wide-gamut QD and OLED panels, luminance-weighted so their sum approximates a D65-like white. Every reading from this path is flagged as an estimate, paired with a much wider uncertainty band and a prompt to load a CCSS. The reduction percentage survives the substitution better than the absolute dose does, because it is a ratio taken through the same assumed spectra on both sides.

7.4 Optional Dose Ceiling

Setting a melanopic-EDI ceiling changes the question from "what colour did the schedule ask for" to "what is the least visible state that meets a biological constraint". Two levers reach the ceiling, warming and dimming, and they trade against each other, so the governor is posed as a constrained minimization rather than a rule.

The feasible set is deliberately one-sided: the governor never brightens and never cools, so it can only ever move further in the direction the schedule was already going. Candidate temperatures run from the scheduled value down to 1900 K in 50 K steps, and brightness from the scheduled value down to a 10% floor. At fixed temperature the spectral shape is fixed, so mel-EDI is exactly linear in white luminance and the minimum compliant dimming follows in closed form from a single probe rather than a search:

bneeded = bsched · ceiling / mel-EDI(T, bsched)

Cost is measured as CAM16-UCS ΔE′ against the scheduled appearance. The choice of metric is the substantive decision here. The candidates differ in luminance as well as chromaticity, and a colour-difference metric that does not model the observer's adaptation state will misprice that: ΔE ITP-style metrics under-price the adaptation benefit of dimming, while a pure-Kelvin rule ignores dimming altogether and would always answer by warming. CAM16-UCS prices luminance and chromaticity changes against each other under stated viewing conditions, which is exactly the comparison being made.

Those conditions are anchored once and shared by every candidate so the comparison stays apples-to-apples: the reference white is the display's unshifted 6500 K white at the scheduled brightness, with adapting luminance LA = Ywhite/5 on the gray-world convention, background Yb = 20, and a dim surround appropriate to a desktop at night. Only the forward model is needed; the solver never inverts it.

Candidates that meet the ceiling are preferred over those that do not, and among them the smallest ΔE′ wins. When no candidate can comply, the governor returns the lowest remaining dose and reports the ceiling as unreachable rather than silently presenting a non-compliant state as a success. Because the apply path re-evaluates on every fade tick, solutions are memoized against inputs quantized to 25 K and 2% brightness, steps small enough to be imperceptible in the governed trajectory.

8. Gamer Mode

8.1 Session Policy

Gamer profiles are keyed by executable name and, when known, canonical path. Launcher, helper, overlay, installer, server, shell, and Gloam processes are rejected from automatic ownership. One executable may own one or more displays at a time; competing executables cannot control the pipeline concurrently. Display scope can follow the game window, select every display, or name one display explicitly.

Foreground activation is settled before application: 350 ms for a candidate game, 900 ms before releasing an active game, and 250 ms for ordinary changes. Gameplay Lock freezes the scheduled Kelvin captured at activation, while the ramp guard can still repair a verified external reset. A panic suspend clears the active policy in memory even if settings persistence is unavailable.

8.2 Shadow Visibility Toe

Competitive visibility is a black-anchored, monotonic toe in linear luminance. For strength a ∈ [0, 1], pivot p, and 0 < L < p:

L′ = min(p, L + 1.5aL(1 − L/p)²)

Zero and the pivot are unchanged, the derivative rejoins at one, and values above the pivot are bit-identical to the underlying calibration. Gloam evaluates luminance with Rec.709 weights in SDR or Rec.2020 weights in HDR, then scales RGB together along the same hue ray, limited by channel headroom.

The squared shoulder term is what buys the C1 join. Both the lift and its first derivative vanish at L = p, so the toe meets the untouched curve without a visible crease at the handover, which a linear shoulder would produce. Anchoring at black rather than lifting the whole curve matters for the stated purpose: a black lift raises the floor everywhere and washes the image, whereas this form leaves absolute black at zero and redistributes contrast only within the shadow range.

Monotonicity is guaranteed analytically rather than checked numerically. Differentiating the toe gives a minimum slope of 1 − 1.5a/3 = 1 − 0.5a inside the pivot, which is strictly positive for every a ∈ [0, 1]; at full strength the flattest part of the curve still rises at half the identity rate. No permitted setting can invert tonal order or crush two distinct shadow levels into one, which is the failure mode that makes many "black equalizer" controls destroy the detail they claim to reveal.

This is a visibility aid, not a correction, and Gloam does not present it otherwise. It deliberately departs from the calibrated transfer function, so a display running a competitive toe is no longer colour-accurate in the shadows. That is why the toe is a Gamer Mode session property scoped to an owning executable rather than a global setting, and why the Reference and Cinematic HDR presets set it to zero.

8.3 Presets and Signal Diagnostics

  • Reference: no gamma override, no toe, daylight policy.
  • Competitive Clarity: gamma 2.2, toe strength 0.55, pivot 0.10, follows the schedule.
  • Cinematic HDR: Windows Default transfer, no toe, daylight policy, HDR expected.
  • Night Ops: gamma 2.2, toe strength 0.45, pivot 0.10, Perceptual night rendering at up to 3400 K and strength 0.55. Its melanopic ceiling is opt-in.

At activation, diagnostics compare the requested SDR/HDR mode with the active output, decode the DXGI color-space and bit-depth state, check SDR-white headroom against reported peak luminance, and verify the saved MHC2 association when Windows exposes it. These checks report risk; they do not infer the game's internal tone mapper or claim that reported peak metadata is measured truth.

9. Windows Application Architecture

9.1 Hardware Ramp

Live curves are calculated at 1024 samples and linearly resampled to the 256 unsigned 16-bit entries required by SetDeviceGammaRamp. The native call is the fast path. If a driver rejects it, Gloam writes a temporary Argyll .cal file and invokes dispwin for the target display. Display matching uses the GDI device name parsed from Argyll's display list, with the DXGI output index only as a fallback.

Identical curves are not rewritten. Rapid changes are latest-value coalesced per monitor with a 250 ms write floor. Every ten seconds, the ramp guard reads back the current hardware state and restores a curve that a driver or full-screen application replaced. Drivers whose readback cannot match within 512 16-bit counts after restoration are marked unverifiable so the guard does not create a flashing repair loop. Calibration bypass suppresses both normal writes and guard repairs.

9.2 Windows Color Profiles

Measured profiles are installed per display and per measured SDR/HDR mode. HDR profiles use the Advanced Color association APIs and are read back after activation. SDR profiles use the current- user WCS default. Cross-mode installation is refused because an SDR signal-domain curve and an HDR PQ-domain curve do not share a meaningful input axis.

In an HDR profile, ordinary ICC matrix/TRC tags describe the app-facing sRGB presentation path; the PQ correction remains inside the MHC2 payload. Advertising PQ in the classic ICC TRCs would cause color-managed SDR applications to encode content for PQ before the compositor performs its own Advanced Color mapping.

9.3 Composition Rules

The native MHC2 profile corrects the panel at the compositor. The live ramp remains available for the user's gamma, night, and gamer policy. Its SDR encode side assumes a ~2.2 presentation, which is what an uncorrected Windows SDR display gives. Composition with an installed MHC2 correction is therefore exact when the calibration target is a 2.2 power law and approximate otherwise: a BT.1886 or piecewise-sRGB target retargets the display to a curve the live ramp does not know about, and the residual concentrates in the shadows, where those curves diverge most from a power law. Gloam does not silently accept that configuration: install preflight warns when a non-2.2 SDR target is installed on a display that also has a live regrade applied, and names the fix (set the display to Windows Default for calibration-accurate viewing). Explicit settings previews temporarily take ownership from gamer mode. App exclusions can block live policy on the display intersecting an excluded foreground window without removing the measured panel profile.

10. Measurement and Characterization

10.1 Acquisition

ArgyllCMS spotread supplies XYZ measurements. The application owns one measurement session and one patch surface for the run. SDR patches use the ordinary patch window. Absolute HDR patches use an FP16 scRGB surface, where a channel value represents cd/m² divided by 80; Windows converts the scRGB surface into the active HDR wire space. Probe position, patch size, and monitor placement are reused for verification, refinement, spectral capture, and trust checks.

Existing live ramps are bypassed during calibration. Measurement validation rejects missing anchors, implausible range, non-monotonic or insufficient HDR coverage, excessive repeated-white drift, and other states that would make the fitted correction untrustworthy.

10.2 Repeat Reads and Settling

Near-black patches, white, and full primaries receive multiple reads; their reported XYZ is the per-component median. If the luminance spread exceeds 5% of the mean or 0.02 cd/m², a fourth read is added. A luminance-decade noise model learns from these bursts. Later patches predicted to land in a noisy decade receive longer settling and can be promoted from a single read to a median burst. Patch settling also increases with the size of the signal transition and gives large downward transitions extra time.

10.3 Drift

Thorough, Full, and Adaptive sequences interleave white anchors every 25 ordinary patches and black anchors every 50. White drift is modeled as a multiplicative luminance factor, interpolated linearly in time; XYZ is divided by that factor, preserving chromaticity. Drift up to 8% can be normalized. Larger drift is left untouched so validation can fail the run instead of concealing an unstable display. Black re-reads are analyzed as an additive-domain diagnostic and are not used in the multiplicative correction.

A time-only multiplicative model is licensed on automatic-brightness-limiter panels because the run holds patch geometry, patch size, and surround constant (§10.1), so average picture level, and therefore ABL state, is approximately stationary across the sequence; what remains varying is warm-up and settling, which are slow functions of time.

10.4 Adaptive Patch Placement

A fixed patch set spends its budget uniformly whether or not the panel needs it there. The Adaptive preset instead treats acquisition as an experimental-design problem: measure where the current display model is least trustworthy. It begins from a coarse seed covering the gray axis, the individual channel ramps, primaries, secondaries and selected mixed colours, refits the model after each batch, and chooses the next batch from the refitted residuals. The planner is deterministic, with no randomness anywhere: identical inputs produce identical picks, so a run is reproducible and a support report is meaningful.

Manifolds

The governing idea is that residual interpolation and coverage are only meaningful along a manifold. A grayscale tone residual says nothing about the red-only ramp, and a point in the middle of the colour cube says nothing about either. Every candidate and measurement is therefore tagged as gray (R = G = B), one of the three single-channel ramps, or a general cube location, and distance is defined accordingly: |Δlevel| along the one-dimensional manifolds, Euclidean in the cube, and infinite between manifolds. That last case is what stops a well-sampled gray axis from making the planner believe the red ramp is covered.

Scoring

Tone and colour errors have different units and different targets, so each residual is first divided by its own accuracy target to give a normalized residual ni, where 1.0 means "exactly at target" on a single shared scale. Each candidate then scores as an inverse-distance-weighted interpolation of the ni on its own manifold, plus a coverage term:

score = Σwini / Σwi + 0.5·gap,    wi = 1 / (di + 0.02)

The residual term is high where the model demonstrably fails nearby; the softening constant sets the locality, so a residual dominates candidates within a few multiples of it and fades beyond. The gap term is the distance to the nearest measured point on the same manifold, taken as full scale when the manifold is entirely unmeasured. Its half weight is calibrated rather than arbitrary: an unmeasured full-scale span scores like a residual at half its target, enough that early rounds fill genuine coverage holes, small enough that a demonstrated error always outranks mere distance from data.

Tone residuals are measured as |ΔL*| against a target of 1.5, roughly 1.5 lightness JND on the worst predicted point, and colour residuals as ΔE2000 against 0.8. The tone metric was chosen over the more obvious photometric |ΔY|/(white − black): that target penalized a shadow error and a highlight error of equal ΔY equally, even though the shadow error is far more visible. Because dL*/dY grows toward black, the same budget now spends shadow samples in proportion to their visibility, while L*'s linear toe keeps the weighting bounded near black instead of blowing up. At mid-gray the two targets nearly coincide, since |ΔY| ≈ 1.5% maps to |ΔL*| ≈ 1.5.

Thinning

Scoring alone would let a single sharp residual capture an entire batch, which wastes eleven measurements confirming what the first one already established. Winners are therefore visited in score order and accepted only if no already-accepted winner lies within a minimum separation: one candidate-pool lattice step (4 codes in 8-bit, about 1.6% signal) on the one-dimensional manifolds, 0.05 Euclidean in the cube. Candidates within half a code of an existing measurement are dropped as duplicates.

This is a spacing floor, not a farthest-point or OFPS optimizer: it does not maximize the minimum inter-pick distance, and it is not claimed to. Separation is enforced only within a batch, which is what allows later rounds to interleave finer samples and densify around a feature that turns out to deserve it.

Stopping

Two different summaries of the residual distribution drive two different decisions, and conflating them is the failure mode this design avoids.

  • Success uses the maximum. The whole point of adaptive placement is to chase the worst point, so targets are declared met only when every point, including a narrow defect the planner is actively crowding, is at target. This is strict by design and never reports clean success while the worst point is still bad.
  • Plateau detection uses the 90th percentile, with patience. A max-based plateau check false-triggers constantly, because resolving the current worst point merely exposes a next-worst point of similar size and the maximum barely moves. The robust summary instead tracks the whole distribution shifting down. A round must improve it by more than 10% to count as progress, and two consecutive shortfalls are required before stopping.

The ordinary-patch budget is 120, excluding drift anchors, with 12 patches per round. Any stop that is not "targets met", whether budget exhaustion or a genuine plateau above target, is recorded as a degraded outcome and surfaced as a warning. A run that ran out of budget with the worst point still at three times target is a different result from a converged one, and the report says so.

10.5 Display Model

Characterization derives measured white, black, primary chromaticities, a white-normalized RGB-to-XYZ matrix, a neutral tone curve, and per-channel tone curves when the patch set contains single-channel ramps. Monotonic interpolation is enforced where a curve will be inverted. These measurements support the installed matrix and one-dimensional tone correction; mixed-color residuals can also feed 3D LUT exports, but an MHC2 install remains constrained to matrix plus separable curves.

11. MHC2 Profile Mathematics

11.1 Absolute Gamut Matrix

Let D map native display-linear RGB to XYZ and T map target-linear RGB to XYZ. The open-loop drive matrix is:

M = D−1T

White-point-only targets substitute the measured panel primaries while retaining the requested target white. A reachability gate permits primary drive only in the tolerance band −0.05 to 1.30; values outside it indicate a target materially beyond the measured panel gamut. If the complete target transform requires a drive above one, the whole matrix is scaled by:

s = min(1, 1 / maxTargetDrive)

Uniform scaling preserves every chromaticity. Per-channel clipping or normalization would re-tint colors the matrix had just placed.

11.2 Windows Matrix Domain

Windows evaluates the MHC2 matrix between fixed sRGB↔XYZ stages. If S is the fixed linear sRGB-to-XYZ matrix, the tag stores:

Mtag = S(sM)S−1

The surrounding fixed transforms then cancel and apply the intended scaled RGB-to-RGB matrix. This sandwich is undocumented Windows behavior, derived from MHC2Gen and verified against the Windows 11 compositor; regression tests pin the identity and reference cases.

11.3 SDR Tone Curves

SDR MHC2 LUTs operate in SDR signal space. The generated correction inverts the measured neutral response toward the target. When separate channel ramps were measured and the base correction is neutral, Gloam composes each channel's relative gray-tracking correction fc−1∘fneutral onto the shared curve. This keeps gray chromaticity stable through the range without moving gamut correction out of the matrix.

11.4 HDR Wire Ladder

The preferred HDR model uses absolute rungs at 0, 2, 4, 8, 16, 32, 64, 100, 150, 220, 320, 450, 650, and 1000 cd/m². The set stops at min(0.9 × reported peak, 1000), adding the cap itself when the last fixed rung leaves more than a 5% gap. Each requested luminance d is rendered at the exact wire coordinate P−1(d) and measured in absolute XYZ, where P is the ST.2084 signal-to-nits function from §3.3.

Because the matrix scale s runs before the tone LUT, content wire value v reaches that LUT at:

pin(v) = P−1(s · P(v))

Equivalently, a LUT input p is solved against desired content luminance P(p)/s. This composition makes the installed matrix-plus-LUT chain track absolute PQ. The HDR tone LUT is neutral (identical red, green, and blue curves), because the matrix owns white point and gamut.

With a usable wire ladder, the inverse measured response is applied through the measured span and blends to identity from 90% of measured peak to peak. Above the reachable range the panel's own rolloff is left alone. If no usable wire ladder exists, a compatibility fallback assumes Windows mapped SDR signal v to P−1(W · EsRGB(v)); that correction is limited to the lower half of the measured range and blends to identity from 50% to 80% because its wire axis and knee are inferred rather than measured.

11.5 Profile Metadata and Association

The MHC2 payload contains a 3×4 fixed-point matrix and three 1024-entry sf32 curves. HDR min/max luminance metadata uses measured black and measured peak together when that pair is valid; DXGI peak is a fallback, not mixed provenance. ICC colorimetry tags are regenerated from the corrected presentation primaries and white. Installation uses a fresh profile identity when necessary to force compositor reload, verifies the current-user Advanced Color default, retains the pre-Gloam default for restoration, and retires only superseded profiles owned by the session.

12. Joint HDR Refinement

12.1 Why the Solve Is Joint

Changing the color matrix can change its required uniform scale, which changes the PQ input coordinates seen by the tone LUT. Refining either component in isolation can therefore invalidate the other. Gloam measures neutral tone rungs and colored stimuli through the same installed state, builds one candidate matrix-plus-LUT pair, installs it atomically, and measures both objectives again.

12.2 Tone Residual

For requested luminance d and measured luminance Y, the multiplicative error is e = Y/d. At the matrix-scaled LUT input P−1(sd), the current LUT output luminance is divided by a damped, interpolated version of e:

e′ = clamp(1 + λ(e − 1), 0.7, 1.4)
out′ = P−1(P(out) / e′)

At least four valid rungs below the identity region are required. A rung beyond ±35% refuses the touch-up as evidence of a different failure. Average absolute error below 1% is converged. The correction fades to one before the identity blend and preserves endpoints and monotonicity.

A refusal here or in the color fit below is not silent: the reason is recorded in that pass's record and surfaced in the report, and the prior best-measured installed state is retained rather than replaced by an unverified candidate.

12.3 Color Residual

The color sweep uses target-container R, G, B, C, M, Y, plus white anchors at 100, 203, and 400 cd/m² when the display peak can reach the rung. A stimulus producing less than 85% of target luminance is classified as hardware-limited and excluded from the matrix fit. A matrix cannot recover saturated light the panel did not emit.

For reachable measurements, the residual F in XYZmeasuredFXYZreference is fitted by weighted least squares. Each pair is normalized by rung luminance and weighted by √Y, giving brighter rungs more influence without letting absolute magnitude dominate. The fit requires at least eight reachable stimuli and a white anchor. Average ΔE ITP below 2 is converged; above 25 is too large for a linear touch-up; each coefficient is limited to 0.25 from identity.

The fitted residual is divided by its luminance gain on target white before composition. That keeps the white chromaticity correction while assigning neutral luminance error only to the tone LUT. The cumulative matrix becomes D−1F−1T, followed by the same reachability and uniform-scale policy as an initial install.

12.4 Keep-Best Objective

Refinement normalizes tone error by 1% and color error by 2 ΔE ITP:

J = √((tone / 0.01)² + (color / 2)²)

A candidate must lower J without worsening tone by more than 0.25 percentage points or color by more than 0.5 ΔE ITP. The live workflow runs at most two passes, with damping λ = 1 on the first pass and 0.55 later. Cancellation or regression restores the best measured installed state. Refinement rungs stop at 85% of measured peak, below the region deliberately left to the panel's rolloff.

13. Verification, Uncertainty, and Reports

13.1 Measured “After” Values

Verification is performed through the active profile with the live ramp held at identity. The quick set has 14 SDR-content patches: seven neutral levels, primaries, secondaries, and a skin mixture. Detailed verification has 39 patches: a 21-step gray ramp, four saturation levels for each primary, and six memory colors. In HDR mode these remain sRGB application-content patches mapped by Windows to SDR white; they are not PQ-decoded as though they were native HDR stimuli.

ΔE2000 is computed after normalizing measured XYZ to the measured white and using the target white as the Lab reference. Grayscale error is split into tone and chroma components. ΔE ITP is also computed from absolute XYZ through the BT.2124 XYZ-to-LMS, PQ, and ICtCp path:

ΔEITP = 720√(ΔI² + ΔT² + ΔP²),   T = 0.5CT

HDR verification adds two independent sweeps. A neutral PQ ladder reports absolute luminance tracking only inside the corrected region. Colored HDR verification measures target-container R/G/B/C/M/Y at reachable 100, 203, and 400-nit rungs and reports ΔE ITP separately, so wide-gamut hardware limits do not dilute the SDR-content grade.

13.2 Profile Activation Sentinel

Native and verified measurements are compared on matching patches. When an inaccurate native panel does not move measurably toward the target after installation, the report warns that profile activation is suspect. This is a sentinel, not proof: display drift and meter noise can also reduce the apparent improvement.

13.3 Measurement Uncertainty

The report's expanded uncertainty is a GUM-style engineering estimate, not a laboratory certificate. Per-patch luminance repeatability comes from observed read range and the exact or tabulated small-sample standard error of the median; single reads inherit their luminance decade's noise estimate. A numeric two-point perturbation propagates luminance uncertainty to ΔE. The average combines independent patch terms as √Σui²/N, then combines instrument/correction and drift terms in root-sum-square. The displayed interval uses k = 2.

Instrument terms are explicitly labeled estimates: 0.5 ΔE standard uncertainty for a filter colorimeter with a panel-matched correction, 1.5 without one, and 0.3 for a recognized spectrometer. Melanopic intervals additionally account for spectral-source provenance and, for absolute EDI, the assumed viewing geometry. The ratiometric reduction does not include geometry.

13.4 Refinement and Report State

After an HDR refinement attempt, Gloam automatically runs the full selected verification path against the final installed correction. The new measurements replace the report's after values, grade, recommendations, chart overlays, detailed patch analysis, PQ tracking, colored-HDR summary, and persisted measurement payload. PostCalibrationDeltaE is the verified corrected value; PreCalibrationDeltaE remains the native panel value. The saved report JSON is rewritten in place, and future print-to-PDF exports render from that refreshed state. A PDF that was already exported remains a static external file and is not silently overwritten.

13.5 Validation Strategy

Automated tests pin standard transfer-function values, matrix-domain wrapping, LUT monotonicity and endpoints, headroom continuity, constant-Y bounds, gamer-toe slope, adaptive stopping, uncertainty propagation, profile persistence, and simulated closed-loop convergence. Golden measurement fixtures replay the HDR model against captured display data. These tests establish mathematical and serialization invariants; physical verification still requires a meter on the target display and confirmation that Windows activated the intended profile.

14. Acknowledgements and References

Gloam builds on Dylan Raga's identification and implementation of the Windows SDR-in-HDR sRGB-to-gamma correction. ArgyllCMS supplies the measurement and fallback ramp tools. MHC2Gen provided the essential reference for the MHC2 tag and Windows' fixed matrix stages.

  1. Poynton, C. (2003). Digital Video and HDTV: Algorithms and Interfaces. Morgan Kaufmann.
  2. IEC 61966-2-1:1999. Multimedia systems and equipment - Colour management - Default RGB colour space - sRGB.
  3. Stokes, M., Anderson, M., Chandrasekar, S., & Motta, R. (1996). A Standard Default Color Space for the Internet - sRGB.
  4. Raga, D. win11hdr-srgb-to-gamma2.2-icm. github.com/dylanraga/win11hdr-srgb-to-gamma2.2-icm.
  5. SMPTE ST 2084:2014. High Dynamic Range Electro-Optical Transfer Function of Mastering Reference Displays.
  6. ITU-R BT.2100. Image parameter values for high dynamic range television.
  7. ITU-R BT.2124. Objective metric for the assessment of the potential visibility of colour differences in television.
  8. ITU-R BT.2408. Operational practices in HDR television production.
  9. CIE 015. Colorimetry.
  10. CIE S 026/E:2018. CIE System for Metrology of Optical Radiation for ipRGC-Influenced Responses to Light.
  11. Helland, T. (2012). How to Convert Temperature (K) to RGB. tannerhelland.com.
  12. Kang, B. et al. (2002). Design of Advanced Color Temperature Control System for HDTV Applications. Journal of the Korean Physical Society, 41(6), 865–871.
  13. Li, C. et al. (2017). Comprehensive color solutions: CAM16, CAT16, and CAM16-UCS. Color Research & Application, 42(6), 703–718.
  14. Ohno, Y. (2014). Practical Use and Calculation of CCT and Duv. LEUKOS, 10(1), 47–55.
  15. JCGM 100:2008. Evaluation of measurement data - Guide to the expression of uncertainty in measurement.
  16. ArgyllCMS, by Graeme Gill.
  17. MHC2Gen, by dantmnf.

Revision of July 28, 2026: bounded the §9.3 composition claim to what the live ramp actually assumes and noted the preflight warning that covers the non-2.2 case; stated in §10.3 why a time-only multiplicative drift model is licensed on ABL panels; recorded in §12.2 that refusals are reported with their reason and that the prior best-measured state is retained.

Revision of July 27, 2026: corrected the polar day/night fallback in §7.1 to the fixed 07:00/19:00 sentinels the schedule resolver actually emits.

Revision of July 22, 2026: separated the hardware-ramp and MHC2 paths; aligned SDR, HDR, temperature, headroom, constant-Y, night, melanopic, and gamer equations with the current C# implementation; documented adaptive acquisition, drift and noise handling, exact PQ wire calibration, matrix-scale composition, joint tone-and-color refinement, colored HDR verification, uncertainty, and automatic post-refinement report refresh.