Alternative University

Computer Science

Raster Image Storage

Higher Precision Extended Range

XRH File Format 2.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.

Color transformation using ITU-R BT.709 is performed for a channel that sets Color Transformation Type to 1 in its Channel Block o, indicating it is a Y channel of Cb and Cr channels that follow in that order. In that case, the ITU-R BT.709 transformation is performed on those three channels.

To use a color transformation other than ITU-R BT.709 as described in this page, store zero in the channel Color Transformation Type.


< Prev: Porcupine 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 : 
Page 10 : 
Page 11 : 
Introduction
File Layout & Header
Comments
Custom Properties
Channel Names
Channels
Zebra Compression
SZMOD Compression
ZFP Compression
Porcupine Compression
Color Transformations (this page)

Return to Computer Science

Return to Alternative University

Copyright © 2021 Arc Math Software, All rights reserved
Arc Math Software, P.O. Box 221190, Sacramento CA 95822 USA   Contact
2021–Jan–22  06:54  UTC