Video and Image Processing Suite User Guide

ID 683416
Date 4/04/2022
Public
Document Table of Contents

12.2. Color Space Conversion

You convert between color spaces by providing an array of nine coefficients and three summands that relate the color spaces.

You can set these coefficients and summands at compile time, or you can enable the Avalon-MM slave interface to change them dynamically at run-time.

Given a set of nine coefficients [A0, A1, A2, B0, B1, B2, C0, C1, C2] and a set of three summands [S0, S1, S2], the IP cores calculate the output values for color planes 0, 1, and 2 (denoted dout_0, dout_1, and dout_2):
dout_0 = (A0 × din_0) + (B0 × din_1) + (C0 × din_2) + S0
dout_1 = (A1 × din_0) + (B1 × din_1) + (C1 × din_2) + S1
dout_2 = (A2 × din_0) + (B2 × din_1) + (C2 × din_2) + S2
Note: din_0, din_1, and din_2 are inputs read from color planes 0, 1, and 2.
The Color Space Converter II IP core supports the following predefined conversions that are available through the Platform Designer presets:
  • Computer B’G’R’ to CbCrY’: SDTV
  • CbCrY’: SDTV to Computer B’G’R’
  • Computer B’G’R’ to CbCrY’: HDTV
  • CbCrY’: HDTV to Computer B’G’R’
  • Studio B’G’R’ to CbCrY’: SDTV
  • CbCrY’: SDTV to Studio B’G’R’
  • Studio B’G’R’ to CbCrY’: HDTV
  • CbCrY’: HDTV to Studio B’G’R’
  • IQY' to Computer B'G'R'
  • Computer B'G'R' to IQY'
  • UVY' to Computer B'G'R'
  • Computer B'G'R' to UVY'

The values are assigned in the order indicated by the conversion name. For example, if you select Computer B’G’R’ to CbCrY’: SDTV, din_0 = B’, din_1 = G’, din_2 = R’, dout_0 = Cb’, dout_1 = Cr, and dout_2 = Y’.

If the channels are in sequence, din_0 is first, then din_1, and din_2. If the channels are in parallel, din_0 occupies the least significant bits of the word, din_1 the middle bits, and din_2 the most significant bits. For example, if there are 8 bits per sample and one of the predefined conversions inputs B’G’R’, din_0 carries B’ in bits 0–7, din_1 carries G’ in bits 8–15, and din_2 carries R’ in bits 16–23.