Color Gamut & Grading Calculations

Updated

Gamut coverage between Rec. 709, DCI-P3 and Rec. 2020 worked out from their primaries, HDR and SDR reference levels, mired shifts for gels and white balance, the code values each bit depth holds, and how big a 3D LUT is.

Color Science Reference

Color Spaces

Rec. 709

ITU-R BT.709

HD and SDR delivery; sRGB uses the same primaries

DCI-P3

SMPTE RP 431-2

Digital cinema projection; P3-D65 is a common HDR mastering gamut

Rec. 2020

ITU-R BT.2020

UHD; the container for HDR10, HLG and Dolby Vision (BT.2100 uses the same primaries)

Adobe RGB

Photography

Wider greens than Rec. 709; a photo and print gamut, rarely a video one

Dynamic Range

SDR

100 nits

Reference white for grading SDR (ITU-R BT.2035)

HDR10

PQ, to 10,000 nits

Static metadata for the whole program (SMPTE ST 2086, MaxCLL, MaxFALL)

HDR10+

PQ, to 10,000 nits

Dynamic metadata, scene by scene (SMPTE ST 2094-40)

Dolby Vision

PQ, to 10,000 nits

Dynamic metadata (SMPTE ST 2094-10)

HLG

Relative, no metadata

ITU-R BT.2100; the reference display peaks at 1,000 nits

Bit Depth

8-bit

256 levels

16.7 million colors; video range is 16–235, so 220 luma code values

10-bit

1,024 levels

1.07 billion colors; video range is 64–940, so 877 luma code values

12-bit

4,096 levels

68.7 billion colors; video range is 256–3,760

16-bit

65,536 levels

Integer TIFF and DPX; half-float EXR is also 16 bits but stores floating-point values

Color Grading Calculations

Color Gamut Coverage

Plot each gamut as the triangle between its red, green and blue primaries and compare the areas. When one gamut sits inside the other, coverage and area ratio are the same number.

Formula:

Area = |xR(yG − yB) + xG(yB − yR) + xB(yR − yG)| ÷ 2; Coverage % = Smaller Area ÷ Larger Area × 100

Examples:

DCI-P3 against Rec. 2020

Calculation: 0.1520 ÷ 0.2119 × 100, in CIE 1931 xy

Result: 71.7% of Rec. 2020 (72.9% in CIE 1976 u'v')

Rec. 709 against DCI-P3

Calculation: 0.11205 ÷ 0.1520 × 100, in CIE 1931 xy

Result: 73.7% of DCI-P3 (79.6% in CIE 1976 u'v')

Rec. 709 against Rec. 2020

Calculation: 0.11205 ÷ 0.2119 × 100, in CIE 1931 xy

Result: 52.9% of Rec. 2020 (58.0% in CIE 1976 u'v')

Rec. 709 triangle area, step by step

Calculation: |0.64(0.60 − 0.06) + 0.30(0.06 − 0.33) + 0.15(0.33 − 0.60)| ÷ 2

Result: 0.2241 ÷ 2 = 0.11205

Tips:

  • Always name the diagram: the same two gamuts give different percentages in CIE 1931 xy and CIE 1976 u'v'
  • Area is a flat slice of a 3D color volume and says nothing about brightness
  • Grading in a wide gamut for a Rec. 709 delivery still needs a gamut-mapping step at output

HDR to SDR Reference Levels

Match HDR and SDR at diffuse white, then roll off the highlights. ITU-R BT.2408 puts HDR reference white at 203 nits, where SDR puts 100% white at 100 nits.

Formula:

SDR Luminance (up to reference white) = HDR Luminance × (100 ÷ 203)

Examples:

HDR diffuse white (203 nits, 58% PQ)

Calculation: 203 × (100 ÷ 203) = 100 nits

Result: 100% SDR white

18% grey card (26 nits in HDR, 38% PQ)

Calculation: 26 × (100 ÷ 203) = 12.8 nits

Result: 12.8 nits in SDR

Tips:

  • Highlights above 203 nits have no SDR equivalent: compress them with a roll-off curve rather than scaling the whole range
  • On a PQ waveform, 1,000 nits reads 75% and 4,000 nits reads 90%
  • BT.2408 is written for live production: graded drama often sits grey cards and skin lower than its table

Mired Shift (Color Temperature)

Convert kelvin to mireds (1,000,000 ÷ K) before working out a correction. Mired steps look even to the eye where kelvin steps do not, and the mired values of stacked gels add up.

Formula:

Mired Shift = (1,000,000 ÷ Target K) − (1,000,000 ÷ Source K)

Examples:

3200K tungsten to 5600K daylight

Calculation: (1M ÷ 5600) − (1M ÷ 3200) = −134 mireds

Result: −134: bluer. LEE 201 Full CTB is rated −137

6500K daylight to 3200K tungsten

Calculation: (1M ÷ 3200) − (1M ÷ 6500) = +159 mireds

Result: +159: warmer. LEE 204 Full CTO is rated +159

Tips:

  • The same 500 K is a big shift near tungsten and a small one near daylight: 3000K to 3500K is 48 mireds, 6000K to 6500K is 13
  • Negative mireds go bluer, positive go warmer
  • Gel makers publish a mired shift for each conversion gel; check it against the shift you worked out

Bit Depth and Code Values

Each bit removed halves the number of code values. Too few steps across a smooth gradient, such as a sky, is what shows up as banding.

Formula:

Levels = 2^bits; Levels Lost % = (Source Levels − Target Levels) ÷ Source Levels × 100

Examples:

10-bit to 8-bit

Calculation: (1,024 − 256) ÷ 1,024 × 100 = 75%

Result: 75% fewer code values

12-bit to 8-bit

Calculation: (4,096 − 256) ÷ 4,096 × 100 = 93.75%

Result: 93.75% fewer code values

Tips:

  • Grade at 10-bit or higher and drop to 8-bit only at the final encode
  • Add dither or a little grain when reducing bit depth to break up banding
  • Video range loses more: 8-bit video has 220 luma code values from black to white, not 256

3D LUT Size

A 3D LUT samples the color cube N times along each axis and interpolates between the points. Adobe's Cube LUT Specification 1.0 allows N from 2 to 256 for 3D tables (and up to 65,536 entries for 1D tables).

Formula:

Sample Points = N³; Values Stored = 3 × N³

Examples:

33-point LUT

Calculation: 33³ = 35,937 points × 3 values

Result: 107,811 values

65-point LUT

Calculation: 65³ = 274,625 points × 3 values

Result: 823,875 values, 7.6 times a 33-point LUT

Tips:

  • A .cube file lists one point per line with red changing fastest and blue slowest
  • The Cube spec asks readers to use tetrahedral interpolation between 3D points
  • Integer images are scaled to 0.0–1.0 before lookup: 10-bit 0–1023 becomes 0.0–1.0, then back