Ultech Corporation DV2000 User Manual page 37

Digital video vbi encoder / character generator
Table of Contents

Advertisement

Converting RGB to YCRCB
The following pseudo code illustrates how to convert RGB image information into YCRCB
image information.
,
, Yvalue, Cvalue, and Avalue are 8 bit unsigned values,
GREEN
BLUE
Yhi, Ylo, Chi, Clo, Ahi, and Alo are 8 bit unsigned values,
R0, G0, B0, A0, R1, G1, B1, and A1 are floating point values,
AVGR, AVGG, and AVGB are floating point values,
Y0, Y1, CR, and CB are floating point values,
Yarray, Carray, and Aarray are arrays of 16 bit unsigned values.
for L = 0 to (Y size - 1)
for P = 0 to (Xsize - 1) step 2
get
RED
R0 =
RED
G0 =
GREEN
B0 =
BLUE
if (X size is odd) and (P = (Xsize - 1)) then
else
end if
AVGR = (R0 + R1) / 2
AVGG = (G0 + G1) / 2
AVGB = (B0 + B1) / 2
Y0 = 0.299 R0 + 0.587 G0 + 0.114 B0
Y1 = 0.299 R1 + 0.587 G1 + 0.114 B1
CR = 2 * (0.500 AVGR - 0.419 AVGG - 0.081 AVGB)
CB = 2 * (0.500 AVGB - 0.169 AVGR - 0.331 AVGG)
,
,
. and alpha value for line L, pixel P
GREEN
BLUE
/ 255
/ 255
/ 255
R1 = R0
G1 = G0
B1 = B0
A1 = 0
get RED, GREEN, BLUE. and alpha value for line L, pixel P+1
R1 = RED / 255
G1 = GREEN / 255
B1 = BLUE / 255
(floating point value between 0 and 1)
(floating point value between 0 and 1)
(floating point value between 0 and 1)
(if image width is odd then make the
image width even by adding a
transparent pixel at the end of each line)
(floating point value between 0 and 1)
(floating point value between 0 and 1)
(floating point value between 0 and 1)
(compute average color of pixel pair)
5. Files
37

Advertisement

Table of Contents
loading

Table of Contents