home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 2010 Software/Programs / PCGuia_programas.iso / Software / Utils / SPlayer / SPlayerSetup.exe / splayer.exe / 2052 / FILE / 717 < prev    next >
Encoding:
Text File  |  2009-12-01  |  681 b   |  32 lines

  1. sampler s0 : register(s0);
  2. float4 p0 : register(c0);
  3.  
  4. #define height (p0[1])
  5. //#define width (p0[0])
  6.  
  7. #define const_1 (16.0/255.0)
  8. #define const_2 (255.0/219.0)
  9.  
  10.  
  11. float4 main(float2 tex : TEXCOORD0) : COLOR
  12. {
  13.     // original pixel
  14.     float4 c0 = tex2D(s0,tex);
  15.  
  16.     if( height > 719 ) {
  17.         float y=0.299*c0[0] + 0.587*c0[1] + 0.114*c0[2];
  18.         float Cb=-0.172*c0[0] -0.339*c0[1] +0.511*c0[2];
  19.         float Cr=0.511*c0[0] -0.428*c0[1] -0.083*c0[2];
  20.     
  21.         // YUV to RGB [16,235]: 709 mode (Cb and Cr are 128 less)
  22.         float r=y+1.540*Cr;
  23.         float g=y-0.459*Cr-0.183*Cb;
  24.         float b=y+1.816*Cb;
  25.     
  26.         return float4(r,g,b,0);
  27.         
  28.     } else {
  29.         return((c0 - const_1) * const_2);
  30.     }
  31. }
  32.