gDPSetConvert.3p 1.88 KB
.TH gDPSetConvert 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
gDPSetConvert, gsDPSetConvert
\- set the matrix coefficients for converting YUV pixels to RGB.
.SH C SPECIFICATION
.nf
\f3#include "gbi.h"

gDPSetConvert(Gfx *gdl, int k0, int k1, int k2, int k3, int k4, int k5)

gsDPSetConvert(int k0, int k1, int k2, int k3, int k4, int k5)

\fP
.fi
.SH PARAMETERS
.TP 10
.I *gdl
graphics display list pointer.
.TP
.I k0
K0 term of YUV-RGB conversion matrix (9 bits).
.TP
.I k1
K1 term of YUV-RGB conversion matrix (9 bits).
.TP
.I k2
K2 term of YUV-RGB conversion matrix (9 bits).
.TP
.I k3
K3 term of YUV-RGB conversion matrix (9 bits).
.TP
.I k4
K4 term of YUV-RGB conversion matrix (9 bits).
.TP
.I k5
K5 term of YUV-RGB conversion matrix (9 bits).

.SH DESCRIPTION
This macro sets the matrix coefficients for converting YUV pixels to
RGB.
.PP
Conceptually, the equations are:
.PP
.nf
.ta 5 28
\f3
	R = C0 * (Y-16) + C1 * V
	G = C0 * (Y-16) + C2 * U - C3 * V
	B = C0 * (Y-16) + C4 * U
\fP
.fi
.PP
In the hardware, the color conversion is done in two stages. In the
Texture Filter unit (TF), the following equations are performed:
.PP
.nf
.ta 5 28
\f3
	R' = Y + K0 * V
	G' = Y + K1 * U + K2 * V
	B' = Y + K3 * U
\fP
.fi
.PP
In the color combiner, the following equations are performed:
.PP
.nf
.ta 5 28
\f3
	R = (R' - K4) * K5 + R'
	G = (G' - K4) * K5 + G'
	B = (B' - K4) * K5 + B'
\fP
.fi
.PP
Where (Cx terms as used in the conceptual equation above):
.PP
.nf
.ta 5 28
\f3
	K0 = C1/C0
	K1 = C2/C0
	K2 = C3/C0
	K3 = C4/C0
	K4 = 16 + 16/(C0 - 1.0)
	K5 = C0 - 1.0
\fP
.fi
.PP
Typical values for YUV to RGB conversion are:
.PP
.nf
.ta 5 28
\f3
	K0 = 175
	K1 = -43
	K2 = -89
	K3 = 222
	K4 = 114
	K5 = 42
\fP
.fi

.SH NOTE
You must set the color combiner and the texture filter to the
proper settings in order to perform the color conversion.

.SH SEE ALSO
.IR gDPSetTextureConvert (3P),
.IR gDPSetCombineMode (3P)