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 [macro]

Sets the matrix coefficients for converting from YUV pixels to RGB.

Syntax

#include <ultra64.h> /* gbi.h */
gDPSetConvert(Gfx *gdl, s32 k0, s32 k1, s32 k2, s32 k3, s32 k4, s32 k5)
gsDPSetConvert(s32 k0, s32 k1, s32 k2, s32 k3, s32 k4, s32 k5)

Arguments

  • gdl is the display list pointer.

  • k0 is the K0 term of the YUV-RGB conversion matrix (9-bit precision, -256~255).

  • k1 is the K1 term of the YUV-RGB conversion matrix (9-bit precision, -256~255).

  • k2 is the K2 term of the YUV-RGB conversion matrix (9-bit precision, -256~255).

  • k3 is the K3 term of the YUV-RGB conversion matrix (9-bit precision, -256~255).

  • k4 is the K4 term of the YUV-RGB conversion matrix (9-bit precision, -256~255).

  • k5 is the K5 term of the YUV-RGB conversion matrix (9-bit precision, -256~255).

Explanation
Sets the matrix coefficients used to convert YUV pixels into RGB. Conceptually, the equations are as shown below:

R = C0 * (Y-16) + C1 * V

G = C0 * (Y-16) + C2 * U - C3 * V

B = C0 * (Y-16) + C4 * U

Color conversion in the RDP is performed via the texture filter (TF) and the color combiner (CC).
The following calculations are executed in the TF:

R' = Y + K0 * V

G' = Y + K1 * U + K2 * V

B' = Y + K3 * U

The following calculations are executed in the CC:

R = (R' - K4) * K5 + R'

G = (G' - K4) * K5 + G'

B = (B' - K4) * K5 + B'

The relationships between Cn and Kn are shown below:

K0 = C1/C0

K1 = C2/C0

K2 = C3/C0

K3 = C4/C0

K4 = 16 + 16/(C0 - 1.0)

K5 = C0 - 1.0

The values normally used for the conversion from YUV to RGB are shown below:

K0 = 175

K1 = -43

K2 = -89

K3 = 222

K4 = 114

K5 = 42

Notes
The CC and TF must be appropriately set when executing a color conversion. To learn more about these settings, see gDPSetCombineMode and gDPSetTextureConvert.

For further details, see Section 12.5.2, "Color Space Conversion," and Section 12.6, "CC: Color Combiner," in the N64 Programming Manual.

See Also
gDPSetCombineMode
gDPSetTextureConvert

Revision History
2/1/99 Completely rewritten.




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-1999
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last Updated April, 1999