Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasimir666 <casimir666@users.sourceforge.net>2008-07-23 01:26:27 +0400
committerCasimir666 <casimir666@users.sourceforge.net>2008-07-23 01:26:27 +0400
commit1ec609c06024974f6bd953a88ec5e9ecd0b3f24f (patch)
treeea3c193e4edbef6cbab83cc00a2e67c47b913cd6 /src/apps/mplayerc/res
parentcccbc9b6a12d3c1cf02149fdf0e1770e3b89706d (diff)
NEW : Pixel shader to convert BT601 -> BT701
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@680 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/res')
-rw-r--r--src/apps/mplayerc/res/shaders/BT601BT701.psh32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/apps/mplayerc/res/shaders/BT601BT701.psh b/src/apps/mplayerc/res/shaders/BT601BT701.psh
new file mode 100644
index 000000000..51ee144db
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/BT601BT701.psh
@@ -0,0 +1,32 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+
+// Hauteur de la frame
+#define height (p0[1])
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ // c0 = pixel original
+ float4 c0=tex2D(s0,tex);
+
+ // Uncomment to activate for HD only
+ //if(height >719 )
+ //{
+ // return c0;
+ //}
+
+ // r=c0[0], g=c0[1], b=c0[2]
+ // RGB [16,235] to YUV: 601 mode (128 is not added to Cb and Cr)
+ 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;
+
+ float4 ret=float4(r,g,b,0);
+
+ return ret;
+} \ No newline at end of file