Color Managing Video Footage

When importing video, you can use the transforms in the gamma/ directory to remove the gamma that has been applied. The resulting color values are linear, but they are still output-referred and should not be combined with scene-referred linear images.

There are a few options to convert these images to a scene-referred linear state:

SMPTE Legal Video Levels

Digital video standards use integer pixel encodings, and typically define a reference black and white level such that there is some headroom and footroom left for values to exceed these levels without being clipped. For example, SMPTE 10-bit digital video places reference black at 64 and reference white at 940. Broadcasters often have requirements that content provided to them not exceed these "legal" limits. (Note that the precise definition of "legal" varies depending on the video format and broadcaster.)

Software applications that work with integer pixel encodings often follow a different convention which places black and white at the minimum and maximum values allowed by the integer (e.g. for the 10-bit case, black at 0 and white at 1023).

When converting between video and computer encodings, it is necessary to decide whether to keep the headroom and footroom (in which case black and white are not quite where they are expected on the computer), or to discard the headroom and footroom and map the reference video black/white to the computer black/white.

Typically, this choice is made as part of the video I/O process and is applied in the video hardware. However, it is sometimes useful to also have color transforms available so that the conversion may be performed elsewhere in the workflow.

The full-range_to_legal_10bit transform in the levels/ directory scales, offsets, and clamps computer color values (i.e. 0 to 1023) so that they are within the legal SMPTE video range for broadcasting (i.e. 64 and 940). The legal-range_to_full_10bit transform inverts that operation.