The final pixel transform before the output image: BT.709 full-range YUV↔RGB, planes
normalised to [0,1], chroma carrying the +0.5 offset.
r = y + Kry·(v-½) ; b = y + Kby·(u-½)
g = y - (Kb·Kby/Kg)·(u-½) - (Kr·Kry/Kg)·(v-½)
(Kr,Kg,Kb,Kby,Kry = 0.2126, 0.7152, 0.0722, 1.8556, 1.5748)
rgb_to_yuv is the exact inverse (for round-trip / re-encode). Validated against a
BT.709-formula golden (max|Δ| = 1e-7) plus unit tests: greyscale (u=v=½ → r=g=b=y) and
rgb→yuv→rgb round-trip identity to float precision.
Co-Authored-By: Claude Opus 4.8 <[email protected]>