N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

   

gDPSetConvert

Format
#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)
Arguments
  • gdl is the pointer to the graphics display list
  • k0 is the K0 term of the YUV-RGB conversion matrix (9 bits)
  • k1 is the K1 term of the YUV-RGB conversion matrix (9 bits)
  • k2 is the K2 term of the YUV-RGB conversion matrix (9 bits)
  • k3 is the K3 term of the YUV-RGB conversion matrix (9 bits)
  • k4 is the K4 term of the YUV-RGB conversion matrix (9 bits)
  • k5 is the K5 term of the YUV-RGB conversion matrix (9 bits)
What This Macro Does
This macro sets the matrix coefficients for converting YUV pixels to RGB.

Conceptually, the equations are:
R = C0 * (Y-16) + C1 * V
G = C0 * (Y-16) + C2 * U - C3 * V
B = C0 * (Y-16) + C4 * U
In the hardware, the color conversion is done in two stages. In the Texture Filter unit (TF), the following equations are performed:
R' = Y + K0 * V
G' = Y + K1 * U + K2 * V
B' = Y + K3 * U
In the color combiner, the following equations are performed:
R = (R' - K4) * K5 + R'
G = (G' - K4) * K5 + G'
B = (B' - K4) * K5 + B'
Where (Cx terms as used in the conceptual equation above):
K0 = C1/C0
K1 = C2/C0
K2 = C3/C0
K3 = C4/C0
K4 = 16 + 16/(C0 - 1.0)
K5 = C0 - 1.0
Typical values for YUV to RGB conversion are:
K0 = 175
K1 = -43
K2 = -89
K3 = 222
K4 = 114
K5 = 42
Note
You must set the color combiner (CC) and the texture filter to the proper settings in order to perform the color conversion.

See Also
gDPSetTextureConvert
gDPSetCombineMode



Nintendo® Confidential

Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.


Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated January 1998