YCbCr (source code)
= YCbCr
{c}
\b[YCbCr] represents colour using a <luma (video)> component and two scaled colour-difference components. It is a family of encodings: the matrix coefficients, numerical ranges and <color space> must be specified. <Recommendation ITU-R BT.709-6> defines one important set of signal and digital-coding conventions.
For its normalized nonlinear <RGB> signals $R',G',B'$, define
$$
Y'=0.2126R'+0.7152G'+0.0722B',\qquad
P_b=\frac{B'-Y'}{1.8556},\qquad
P_r=\frac{R'-Y'}{1.5748}.
$$
Here $P_b,P_r$ denote normalized colour differences before digital scaling. For nominal eight-bit video codes, the corresponding relationships are
$$
Y_{\mathrm{code}}=\operatorname{round}(16+219Y'),\qquad
C_b=\operatorname{round}(128+224P_b),\qquad
C_r=\operatorname{round}(128+224P_r).
$$
These are the recommendation's signal equations and quantization scales, with nearest-integer rounding applied at the end and half-integers rounded upward.<Recommendation ITU-R BT.709-6>[Printed page4, items3.2–3.4]{ref}
For an original red example, $(R',G',B')=(1,0,0)$ gives $Y'=0.2126$, $P_b\approx-0.1146$ and $P_r=0.5$. The rounded code triple is approximately $(63,102,240)$. Neutral gray $R'=G'=B'=t$ instead gives $P_b=P_r=0$, hence neutral colour-difference codes 128 regardless of gray level. An RGB triple cannot simply be copied into the YCbCr component slots.
This conversion alone need not reduce the number of samples. <Chroma subsampling> separately reduces the spatial sampling of the colour-difference components. <NV12> and <NV21> additionally specify how those samples occupy <computer memory>. A colour conversion, a sampling choice and a storage layout therefore describe three different operations.
Back to article page