silu的w(全名忘了..

)大寫的shader code..:
(調整非全黑的情況...ATi不需要..

..這是nVIDIA用的)
sampler s0 : register(s0);
//BT.601
#define Kb 0.114
#define Kr 0.299
//BT.709
#define Kb7 0.0722
#define Kr7 0.2126
float4 main(float2 tex : TEXCOORD0) : COLOR
{
float Y = dot(tex2D(s0, tex), float4(Kr ,1-Kr-Kb ,Kb ,0));
float Pb = (dot(tex2D(s0, tex), float4(0,0,1,0))-Y)*0.5/(1-Kb);
float Pr = (dot(tex2D(s0, tex), float4(1,0,0,0))-Y)*0.5/(1-Kr);
// Y range is 16 ~ 235, PbPr range is -112 ~ 112
float X = 1/15.9375;
Y = Y-X;
Y = Y * 255/219;
if(Y <= 0) Y = 0;
if(Y >= 1) Y = 1;
Pb = Pb * 128/112;
Pr = Pr * 128/112;
float R = Y+2*Pr*(1-Kr);;
float G = Y - (2*Kb*(1-Kb)/(1-Kb-Kr)) * Pb
- (2*Kr*(1-Kr)/(1-Kb-Kr)) * Pr;
float B = Y+2*Pb*(1-Kb);
return float4(R,G,B,0);
}