Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Color Encoding: Signal Properties That Define Color

· 6 min read · Home Tech

In this article
  1. What Is Color Encoding?
  2. Core Signal Properties: Luminance, Hue, Saturation
  3. Color Spaces and Gamut
  4. Transfer Functions and Gamma
  5. Bit Depth and Quantization
  6. Chroma Subsampling and Compression
  7. Common Misconceptions and Pitfalls
  8. Frequently Asked Questions

Color encoding is the process of representing the physical properties of light—intensity and wavelength—as signals that can be stored, transmitted, and displayed. The signal properties that define color are luminance (brightness), chrominance (hue and saturation), and, in digital systems, the specific color space and bit depth used to quantize those values.

What Is Color Encoding?

Color encoding is a systematic way of translating the continuous spectrum of visible light into discrete numeric or analog values. Human eyes have three types of cone cells, each sensitive to different ranges of wavelengths—roughly red, green, and blue. Most color encoding schemes exploit this trichromatic nature by using three components to represent a color.

The earliest standardized systems, like the CIE 1931 XYZ color space, were based on experiments where human observers matched colors by mixing red, green, and blue primaries. Later systems, such as sRGB and Rec. 709, were designed to match the capabilities of CRT displays and now dominate digital media. Encoding is not just about picking three numbers; it involves choosing a color space, a transfer function (gamma), and a bit depth to define how precisely each component is stored.

Core Signal Properties: Luminance, Hue, Saturation

Every color signal can be broken down into three perceptual attributes:

  • Luminance – the perceived brightness of a color, typically denoted Y. It is a weighted sum of the red, green, and blue components, with green contributing most because the human eye is most sensitive to it.
  • Hue – the attribute that distinguishes red from green or blue. It is often represented as an angle in a color wheel, ranging from 0° to 360°.
  • Saturation – the intensity or purity of a hue, ranging from gray (0%) to fully vivid (100%).

In broadcast video, these are often encoded as YCbCr, where Y is luma (a gamma-corrected version of luminance) and Cb, Cr are blue-difference and red-difference chroma components. This separation allows chroma subsampling, a technique that reduces bandwidth by storing color at lower resolution than brightness, exploiting the eye's lower sensitivity to color detail.

Color Spaces and Gamut

A color space defines the range of colors (gamut) that can be represented. The most common is sRGB, designed for web and computer displays. It covers about 35% of the visible CIE 1931 chromaticity diagram. Adobe RGB extends the gamut to include more greens and cyans, useful for print. Rec. 2020, used for ultra-high-definition TV, covers about 75% of the visible spectrum.

Encoding a color outside the gamut of a color space is impossible without clipping or mapping. For example, a highly saturated violet may be representable in Rec. 2020 but not in sRGB. When converting between color spaces, out-of-gamut colors must be handled via clipping (which loses information) or gamut mapping (which shifts the color perceptually).

Transfer Functions and Gamma

Transfer functions, often called gamma curves, map linear light intensity to encoded values. Human perception of brightness is nonlinear—we are more sensitive to dark variations than bright ones. Early CRT displays also had a nonlinear response, so encoding with a gamma of about 2.2 became standard.

In sRGB, the transfer function is piecewise: a linear segment for very dark values and a power law with exponent 1/2.4 for the rest. This allocates more code values to darker tones, reducing visible banding. High dynamic range (HDR) systems use more complex transfer functions like PQ (Perceptual Quantizer) or HLG (Hybrid Log-Gamma) to encode a wider luminance range while preserving perceptual uniformity.

Bit Depth and Quantization

Bit depth determines how many discrete levels each color channel can have. An 8-bit system offers 256 levels per channel, yielding about 16.7 million colors. 10-bit provides 1,024 levels per channel, over a billion colors. Higher bit depth reduces banding, especially in smooth gradients like skies or skin tones.

However, bit depth alone does not guarantee accuracy. The transfer function and the precision of the decoder matter. For example, an 8-bit sRGB image may show obvious banding in a dark gradient, while a 10-bit Rec. 2020 image with PQ transfer can display smooth HDR content. In practice, video is often encoded in 10-bit even if the source is 8-bit, to avoid generation loss during editing.

Chroma Subsampling and Compression

Chroma subsampling is a form of lossy compression that reduces color resolution while preserving luma. Common formats are 4:4:4 (no subsampling), 4:2:2 (half horizontal chroma), and 4:2:0 (quarter chroma). The numbers refer to a 4-pixel-wide block: the first digit is luma samples, the second is chroma samples in the first row, the third in the second row.

For example, 4:2:0 stores two chroma samples for every four luma samples horizontally and vertically. This is standard for consumer video because the human visual system is less sensitive to color detail. However, for computer graphics or color grading, 4:4:4 is preferred to avoid artifacts like color fringing on text or sharp edges.

Common Misconceptions and Pitfalls

One frequent misconception is that “color space” and “color model” are the same. A color model (like RGB or HSL) is a way to describe color numerically; a color space (like sRGB) adds a reference to a specific gamut and transfer function. Another error is assuming that a wider gamut automatically means better color. If a display cannot reproduce the gamut, or the content is not mastered for it, colors may appear oversaturated or unnatural.

When converting between color spaces, a common mistake is ignoring the transfer function. Simply swapping the RGB matrix without applying gamma correction leads to washed-out or too-dark images. Tools like ICC profiles and color management systems exist to handle these conversions, but they require accurate profiles for both source and destination.

Frequently Asked Questions

What is the difference between RGB and YCbCr?

RGB stores color as red, green, and blue intensities. YCbCr separates luma (Y) from chroma (Cb, Cr), which allows chroma subsampling and better compression. RGB is used for computer displays and image editing; YCbCr is used for video transmission and storage.

Why do colors look different on different screens?

Displays have different color gamuts, white points, and transfer functions. Even two monitors with the same color space can differ due to calibration. Without color management, an image encoded in sRGB may appear differently on a wide-gamut display because the display assumes a different color space.

What is HDR and how does it affect color encoding?

HDR (High Dynamic Range) encoding uses a wider luminance range and often a wider color gamut. It relies on transfer functions like PQ or HLG and typically requires 10-bit or 12-bit depth. HDR content contains more brightness levels and can show details in both shadows and highlights that SDR cannot.

Is a higher bit depth always better?

Yes, in terms of precision, but it comes with larger file sizes and processing overhead. For final delivery, 8-bit is usually sufficient for SDR web images, while 10-bit is recommended for HDR video. Editing in 16-bit or 32-bit floating point can prevent banding during color grading.

Can I convert any color to any color space without loss?

No. If a color is outside the target gamut, it cannot be represented exactly. The conversion will either clip the color or compress the gamut, both of which change the appearance. Also, quantization to a lower bit depth introduces rounding errors.

What is the difference between gamma and transfer function?

Gamma is a specific power-law transfer function, commonly with exponent 2.2. A transfer function is a more general curve that may include linear segments and different exponents. For example, sRGB uses a piecewise transfer function that is not a pure gamma curve.