Alternative University

Computer Science

Raster Image Storage

Higher Precision Extended Range

XRH File Format 1.0

Color Transformations

If a pictorial color image is stored as red, green and blue (RGB) channels, it must use lossless compression to avoid smearing of primary colors.

If the three channels of a pictorial color image use lossy compression, storage as RGB channels is not suitable, because lossy compression spatially affects different channels differently, causing primary colors to smear relative to each other.

To use lossy compression, the three channels must be decorrelated. For effective high definition color decorrelation, the XRH file format uses ITU-R BT.709 o, which converts RGB channels to decorrelated YCbCr channels (one intensity channel denoted Y, and two chroma difference channels denoted Cb and Cr). It is the YCbCr channels that are compressed and stored, instead of the RGB channels.

The following formulas (Figure 1) convert RGB colors to YCbCr:

αr = 0.2126   αg = 0.7152   αb = 0.0722

Y = αr · R + αg · G + αb · B

Cb = 0.5 (B − Y) ⁄ (1 − αb)

Cr = 0.5 (R − Y) ⁄ (1 − αr)

Figure 1

Y is the image intensity (luminance). It is the weighted average of the RGB channels. The weights (αr, αg and αb) are derived from the following chromaticities (Figure 2):

xr = 0.6400   yr = 0.3300
xg = 0.3000   yg = 0.6000
xb = 0.1500   yb = 0.0600
xw = 0.3127   yw = 0.3290

Figure 2

Those are the default chromaticities that are automatically used if zero is specified for the chromaciticities in the XRH file header.

To use weights other than the weights shown in Figure 1, specify other chromaticities in the XRH file header.

If the Color Transformations field of the XRH file header is 1, the first three channels of the file must be Y, Cb and Cr in that order (regardless of optional channel names). For data retrieval, those three channels are first uncompressed, and then the inverse of the equations of Figure 1 above are applied to convert the YCbCr channels back to RGB.

To use a color transformation other than ITU-R BT.709 as described in this page, store zero in the Color Transformations field of the XRH file header (to avoid automatic ITU-R BT.709 transformation). 

< Prev: SZ219 Compression    
    Next: XRHLIB Software >
XRH File Format
Page 1 : 
Page 2 : 
Page 3 : 
Page 4 : 
Page 5 : 
Page 6 : 
Page 7 : 
Page 8 : 
Page 9 : 
File Layout & Header
Custom Properties
Channel Names
Zebra Compression
SZ219 Compression
Color Transformations (this page)

Return to Computer Science

Return to Alternative University

Copyright © 2020 Arc Math Software, All rights reserved
Arc Math Software, P.O. Box 221190, Sacramento CA 95822 USA   Contact
2020–Nov–25  19:49  UTC