home *** CD-ROM | disk | FTP | other *** search
- sampler s0 : register(s0);
- float4 p0 : register(c0);
-
- #define height (p0[1])
- //#define width (p0[0])
-
- #define const_1 (16.0/255.0)
- #define const_2 (255.0/219.0)
-
-
- float4 main(float2 tex : TEXCOORD0) : COLOR
- {
- // original pixel
- float4 c0 = tex2D(s0,tex);
-
- if( height > 719 ) {
- float y=0.299*c0[0] + 0.587*c0[1] + 0.114*c0[2];
- float Cb=-0.172*c0[0] -0.339*c0[1] +0.511*c0[2];
- float Cr=0.511*c0[0] -0.428*c0[1] -0.083*c0[2];
-
- // YUV to RGB [16,235]: 709 mode (Cb and Cr are 128 less)
- float r=y+1.540*Cr;
- float g=y-0.459*Cr-0.183*Cb;
- float b=y+1.816*Cb;
-
- return float4(r,g,b,0);
-
- } else {
- return((c0 - const_1) * const_2);
- }
- }
-