AlternativeUniversity.net
Alternative University

Computer Science

Raster Image Storage

Higher Precision Extended Range

XRH File Format 4.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 color 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 color channels must be decorrelated. For built-in color decorrelation, this XRH version uses these formulas to convert RGB colors to YCbCr:

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

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

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

Y is the image intensity (luminance). It is the weighted average of the RGB channels. The weights (coefficients αr αg and αb) add up to 1, and depend on which built-in color transformation is used.


If Zero (0) is stored in the Color Transformation Type integer of the XRH file header, then no color transformation is performed.


If the Color Transformation Type is One (1), the following ITU-R BT.709 coefficients are used with the equations above:

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

This is the default color transformation for decorrelation.


If the Color Transformation Type is Two (2), these ITU-R BT.2020 coefficients are used:

αr = 0.2627   αg = 0.6780   αb = 0.0593


Some of the chroma difference channel values (generated by the equations above) may be negative. That is OK. Those values need to be recovered later. When compressing chroma channels, the compressor must support negative values in input, or the input will need to be filtered to temporarily make the values non-negative until recovered later.

To perform a custom color transformation, for your application only, set the high order bit of the Color Transformation Type integer. In that case, no built-in color transformation is performed. Built-in color transformations will not have the high order bit set in the Color Transformation Type integer.


< Prev: JP2K Compression    
    Next: Example Images >
XRH 4.0 File Format
Page 1 : 
Page 2 : 
Page 3 : 
Page 4 : 
Page 5 : 
Page 6 : 
Page 7 : 
Page 8 : 
Page 9 : 
Page 10 : 
Page 11 : 
Page 12 : 
Introduction
Data Types
File Layout & Header
Comments
Custom Properties
Channel Names
Channels
Zebra Compression
SZMOD Compression
JP2K Compression
Color Transformations (this page)
Example Images