diff options
author | clsid2 <clsid2@users.sourceforge.net> | 2009-01-24 01:45:17 +0300 |
---|---|---|
committer | clsid2 <clsid2@users.sourceforge.net> | 2009-01-24 01:45:17 +0300 |
commit | 5f2eb0a7586dfdca232b48144bf891bfcecfcb90 (patch) | |
tree | f4c4545e4c132ab7e68046fff5fcb4a926121011 /src/apps/mplayerc/res | |
parent | 78201b55788c811bee1d245b297c9e886eb90be9 (diff) |
Added a variant of the "16-235 -> 0-255" shader that only modifies SD resolution video.
Cleaned up the code of some shaders.
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@982 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/res')
-rw-r--r-- | src/apps/mplayerc/res/shaders/BT601BT701.psh | 23 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/EdgeSharpen.psh | 7 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/SharpenComplex.psh | 126 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/contour.psh | 7 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/deinterlace (blend).psh | 7 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/denoise.psh | 7 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/emboss.psh | 7 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/grayscale.psh | 11 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/invert.psh | 13 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/letterbox.psh | 7 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/levels.psh | 28 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/levels2.psh | 19 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/sharpen.psh | 8 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/sphere.psh | 6 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/spotlight.psh | 4 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/wave.psh | 8 |
16 files changed, 99 insertions, 189 deletions
diff --git a/src/apps/mplayerc/res/shaders/BT601BT701.psh b/src/apps/mplayerc/res/shaders/BT601BT701.psh index 51ee144db..04662ee05 100644 --- a/src/apps/mplayerc/res/shaders/BT601BT701.psh +++ b/src/apps/mplayerc/res/shaders/BT601BT701.psh @@ -1,19 +1,20 @@ 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);
+ // original pixel
+ float4 c0 = tex2D(s0,tex);
- // Uncomment to activate for HD only
- //if(height >719 )
- //{
- // return c0;
- //}
+ // 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)
@@ -26,7 +27,5 @@ float4 main(float2 tex : TEXCOORD0) : COLOR 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 + return float4(r,g,b,0);
+}
diff --git a/src/apps/mplayerc/res/shaders/EdgeSharpen.psh b/src/apps/mplayerc/res/shaders/EdgeSharpen.psh index 6b6c4916b..78956d698 100644 --- a/src/apps/mplayerc/res/shaders/EdgeSharpen.psh +++ b/src/apps/mplayerc/res/shaders/EdgeSharpen.psh @@ -1,15 +1,8 @@ sampler s0 : register(s0);
float4 p0 : register(c0);
-float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
-#define counter (p0[2])
-#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
-
-#define PI acos(-1)
#define NbPixel 1
diff --git a/src/apps/mplayerc/res/shaders/SharpenComplex.psh b/src/apps/mplayerc/res/shaders/SharpenComplex.psh index 5b1179820..5d2db1a05 100644 --- a/src/apps/mplayerc/res/shaders/SharpenComplex.psh +++ b/src/apps/mplayerc/res/shaders/SharpenComplex.psh @@ -1,82 +1,70 @@ -sampler s0 : register(s0);
-float4 p0 : register(c0);
-float4 p1 : register(c1);
+sampler s0 : register(s0);
+float4 p1 : register(c1);
-#define width (p0[0])
-#define height (p0[1])
+#define dx (p1[0])
+#define dy (p1[1])
-#define dx (p1[0])
-#define dy (p1[1])
+float4 main( float2 tex : TEXCOORD0 ) : COLOR
+{
+ // definition des pixels : original, flouté, corigé, final
+ float4 ori;
+ float4 flou;
+ float4 cori;
+ float4 final;
-float4 main( float2 tex : TEXCOORD0 ) : COLOR
-{
-// definition des pixels : original, flouté, corigé, final
-float4 ori;
-float4 flou;
-float4 cori;
-float4 final;
+ // récuppération de la matrice de 9 points
+ // [ 1, 2 , 3 ]
+ // [ 4,ori, 5 ]
+ // [ 6, 7 , 8 ]
-////////////////////////////////////////////////////
-// récuppération de la matrice de 9 points
-// [ 1, 2 , 3 ]
-// [ 4,ori, 5 ]
-// [ 6, 7 , 8 ]
+ ori = tex2D(s0, tex);
+ float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
+ float4 c2 = tex2D(s0, tex + float2(0,-dy));
+ float4 c3 = tex2D(s0, tex + float2(dx,-dy));
+ float4 c4 = tex2D(s0, tex + float2(-dx,0));
+ float4 c5 = tex2D(s0, tex + float2(dx,0));
+ float4 c6 = tex2D(s0, tex + float2(-dx,dy));
+ float4 c7 = tex2D(s0, tex + float2(0,dy));
+ float4 c8 = tex2D(s0, tex + float2(dx,dy));
- ori = tex2D(s0, tex);
- float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
- float4 c2 = tex2D(s0, tex + float2(0,-dy));
- float4 c3 = tex2D(s0, tex + float2(dx,-dy));
- float4 c4 = tex2D(s0, tex + float2(-dx,0));
- float4 c5 = tex2D(s0, tex + float2(dx,0));
- float4 c6 = tex2D(s0, tex + float2(-dx,dy));
- float4 c7 = tex2D(s0, tex + float2(0,dy));
- float4 c8 = tex2D(s0, tex + float2(dx,dy));
+ // calcul image floue (filtre gaussien)
+ // pour normaliser les valeurs, il faut diviser par la somme des coef
+ // 1/(1+2+1+2+4+2+1+2+1) = 1/ 16 = .0625
+ flou = (c1+c3+c6+c8 + 2*(c2+c4+c5+c7)+ 4*ori)*0.0625;
-////////////////////////////////////////////////////
-// calcul image floue (filtre gaussien)
- // pour normaliser les valeurs, il faut diviser par la somme des coef
- // 1/(1+2+1+2+4+2+1+2+1) = 1/ 16 = .0625
- flou = (c1+c3+c6+c8 + 2*(c2+c4+c5+c7)+ 4*ori)*0.0625;
+ // soustraction de l'image flou à l'image originale
+ cori = 2*ori - flou;
-// soustraction de l'image flou à l'image originale
- cori = 2*ori - flou;
+ // détection des contours
+ float delta1;
+ float delta2;
+ float value;
-////////////////////////////////////////////////////
-// détection des contours
-float delta1;
-float delta2;
-float value;
+ // par filtre de sobel
+ // Gradient horizontal
+ // [ -1, 0 ,1 ]
+ // [ -2, 0, 2 ]
+ // [ -1, 0 ,1 ]
+ delta1 = (c3 + 2*c5 + c8)-(c1 + 2*c4 + c6);
-// par filtre de sobel
- // Gradient horizontal
- // [ -1, 0 ,1 ]
- // [ -2, 0, 2 ]
- // [ -1, 0 ,1 ]
- delta1 = (c3 + 2*c5 + c8)-(c1 + 2*c4 + c6);
+ // Gradient vertical
+ // [ -1,- 2,-1 ]
+ // [ 0, 0, 0 ]
+ // [ 1, 2, 1 ]
+ delta2 = (c6 + 2*c7 + c8)-(c1 + 2*c2 + c3);
- // Gradient vertical
- // [ -1,- 2,-1 ]
- // [ 0, 0, 0 ]
- // [ 1, 2, 1 ]
- delta2 = (c6 + 2*c7 + c8)-(c1 + 2*c2 + c3);
+ // calcul
+ value = sqrt( mul(delta1,delta1) + mul(delta2,delta2) ) ;
- // calcul
- value = sqrt( mul(delta1,delta1) + mul(delta2,delta2) ) ;
+ if( value >.3 ) {
+ // si contour, sharpen
+ #define Sharpen_val0 2.0
+ #define Sharpen_val1 0.125
+ final = ori*2 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * 0.125 ;
+ //final= float4(1,0,0,0);
+ return final;
+ }
- if( value >.3 )
- {
-////////////////////////////////////////////////////
-// si contour, sharpen
-#define Sharpen_val0 2.0
-#define Sharpen_val1 0.125
- final = ori*2 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * 0.125 ;
-// final= float4(1,0,0,0);
- return final;
- }
- else
- {
-////////////////////////////////////////////////////
-// sinon, image corrigée
- return cori;
- }
+ // sinon, image corrigée
+ return cori;
}
\ No newline at end of file diff --git a/src/apps/mplayerc/res/shaders/contour.psh b/src/apps/mplayerc/res/shaders/contour.psh index 7b0480d50..b89e96198 100644 --- a/src/apps/mplayerc/res/shaders/contour.psh +++ b/src/apps/mplayerc/res/shaders/contour.psh @@ -1,15 +1,8 @@ sampler s0 : register(s0);
float4 p0 : register(c0);
-float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
-#define counter (p0[2])
-#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
-
-#define PI acos(-1)
float4 main(float2 tex : TEXCOORD0) : COLOR
{
diff --git a/src/apps/mplayerc/res/shaders/deinterlace (blend).psh b/src/apps/mplayerc/res/shaders/deinterlace (blend).psh index 2dc2606e5..51a6be5f3 100644 --- a/src/apps/mplayerc/res/shaders/deinterlace (blend).psh +++ b/src/apps/mplayerc/res/shaders/deinterlace (blend).psh @@ -1,15 +1,8 @@ sampler s0 : register(s0);
float4 p0 : register(c0);
-float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
-#define counter (p0[2])
-#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
-
-#define PI acos(-1)
float4 main(float2 tex : TEXCOORD0) : COLOR
{
diff --git a/src/apps/mplayerc/res/shaders/denoise.psh b/src/apps/mplayerc/res/shaders/denoise.psh index b135cc81d..0394081b0 100644 --- a/src/apps/mplayerc/res/shaders/denoise.psh +++ b/src/apps/mplayerc/res/shaders/denoise.psh @@ -1,21 +1,14 @@ sampler s0 : register(s0);
float4 p0 : register(c0);
-float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
-#define counter (p0[2])
-#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
#define val0 (1.0)
#define val1 (0.125)
#define effect_width (0.1)
-#define PI acos(-1)
-
float4 main(float2 tex : TEXCOORD0) : COLOR
{
float dx = 0.0f;
diff --git a/src/apps/mplayerc/res/shaders/emboss.psh b/src/apps/mplayerc/res/shaders/emboss.psh index 4dc2bba00..a0053996c 100644 --- a/src/apps/mplayerc/res/shaders/emboss.psh +++ b/src/apps/mplayerc/res/shaders/emboss.psh @@ -1,15 +1,8 @@ sampler s0 : register(s0);
float4 p0 : register(c0);
-float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
-#define counter (p0[2])
-#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
-
-#define PI acos(-1)
float4 main(float2 tex : TEXCOORD0) : COLOR
{
diff --git a/src/apps/mplayerc/res/shaders/grayscale.psh b/src/apps/mplayerc/res/shaders/grayscale.psh index d57c94201..46952b3d2 100644 --- a/src/apps/mplayerc/res/shaders/grayscale.psh +++ b/src/apps/mplayerc/res/shaders/grayscale.psh @@ -1,15 +1,4 @@ sampler s0 : register(s0);
-float4 p0 : register(c0);
-float4 p1 : register(c1);
-
-#define width (p0[0])
-#define height (p0[1])
-#define counter (p0[2])
-#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
-
-#define PI acos(-1)
float4 main(float2 tex : TEXCOORD0) : COLOR
{
diff --git a/src/apps/mplayerc/res/shaders/invert.psh b/src/apps/mplayerc/res/shaders/invert.psh index 4d61115c3..902391b81 100644 --- a/src/apps/mplayerc/res/shaders/invert.psh +++ b/src/apps/mplayerc/res/shaders/invert.psh @@ -1,19 +1,8 @@ sampler s0 : register(s0);
-float4 p0 : register(c0);
-float4 p1 : register(c1);
-
-#define width (p0[0])
-#define height (p0[1])
-#define counter (p0[2])
-#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
-
-#define PI acos(-1)
float4 main(float2 tex : TEXCOORD0) : COLOR
{
float4 c0 = float4(1, 1, 1, 1) - tex2D(s0, tex);
return c0;
-}
+}
\ No newline at end of file diff --git a/src/apps/mplayerc/res/shaders/letterbox.psh b/src/apps/mplayerc/res/shaders/letterbox.psh index c3a17297b..63c70aef2 100644 --- a/src/apps/mplayerc/res/shaders/letterbox.psh +++ b/src/apps/mplayerc/res/shaders/letterbox.psh @@ -1,15 +1,8 @@ sampler s0 : register(s0);
float4 p0 : register(c0);
-float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
-#define counter (p0[2])
-#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
-
-#define PI acos(-1)
float4 main(float2 tex : TEXCOORD0) : COLOR
{
diff --git a/src/apps/mplayerc/res/shaders/levels.psh b/src/apps/mplayerc/res/shaders/levels.psh index 6b36fb5a6..62e7ca672 100644 --- a/src/apps/mplayerc/res/shaders/levels.psh +++ b/src/apps/mplayerc/res/shaders/levels.psh @@ -1,26 +1,12 @@ -sampler s0 : register(s0);
-float4 p0 : register(c0);
-float4 p1 : register(c1);
+sampler s0 : register(s0);
-#define width (p0[0])
-#define height (p0[1])
-#define counter (p0[2])
-#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
+#define const_1 (16.0/255.0)
+#define const_2 (255.0/219.0)
-#define PI acos(-1)
-
-#define Const_1 (16.0/255.0)
-#define Const_2 (255.0/219.0)
-
-float4 main(float2 tex : TEXCOORD0) : COLOR
+float4 main(float2 tex : TEXCOORD0) : COLOR
{
-// #### Uncomment this part to limit TV->PC level to SD files
-// if (height < 720)
-// return( ( tex2D( s0, tex ) - Const_1 ) * Const_2 );
-// else
-// return tex2D( s0, tex );
+ // original pixel
+ float4 c0 = tex2D(s0,tex);
- return( ( tex2D( s0, tex ) - Const_1 ) * Const_2 );
+ return((c0 - const_1) * const_2);
}
diff --git a/src/apps/mplayerc/res/shaders/levels2.psh b/src/apps/mplayerc/res/shaders/levels2.psh new file mode 100644 index 000000000..08d1a4abb --- /dev/null +++ b/src/apps/mplayerc/res/shaders/levels2.psh @@ -0,0 +1,19 @@ +sampler s0 : register(s0);
+float4 p0 : register(c0);
+
+#define height (p0[1])
+
+#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 ) {
+ return c0;
+ } else {
+ return((c0 - const_1) * const_2);
+ }
+}
diff --git a/src/apps/mplayerc/res/shaders/sharpen.psh b/src/apps/mplayerc/res/shaders/sharpen.psh index e1001f476..90d9ec4c2 100644 --- a/src/apps/mplayerc/res/shaders/sharpen.psh +++ b/src/apps/mplayerc/res/shaders/sharpen.psh @@ -1,14 +1,14 @@ sampler s0 : register(s0);
float4 p0 : register(c0);
float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
#define effect_width (1.6)
#define val0 (2.0)
#define val1 (-0.125)
-#define width (p0[0])
-#define height (p0[1])
-
float4 main(float2 tex : TEXCOORD0) : COLOR
{
float dx = effect_width/width;
@@ -24,7 +24,7 @@ float4 main(float2 tex : TEXCOORD0) : COLOR float4 c8 = tex2D(s0, tex + float2(+dx,-dy)) * val1;
float4 c9 = tex2D(s0, tex) * val0;
- float4 c0 = (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 +c9);
+ float4 c0 = (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9);
return c0;
}
\ No newline at end of file diff --git a/src/apps/mplayerc/res/shaders/sphere.psh b/src/apps/mplayerc/res/shaders/sphere.psh index 62dca5645..56276716c 100644 --- a/src/apps/mplayerc/res/shaders/sphere.psh +++ b/src/apps/mplayerc/res/shaders/sphere.psh @@ -1,13 +1,7 @@ sampler s0 : register(s0);
float4 p0 : register(c0);
-float4 p1 : register(c1);
-#define width (p0[0])
-#define height (p0[1])
-#define counter (p0[2])
#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
#define PI acos(-1)
diff --git a/src/apps/mplayerc/res/shaders/spotlight.psh b/src/apps/mplayerc/res/shaders/spotlight.psh index 1a185a8f4..e6fae3aa0 100644 --- a/src/apps/mplayerc/res/shaders/spotlight.psh +++ b/src/apps/mplayerc/res/shaders/spotlight.psh @@ -1,13 +1,9 @@ sampler s0 : register(s0);
float4 p0 : register(c0);
-float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
-#define counter (p0[2])
#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
#define PI acos(-1)
diff --git a/src/apps/mplayerc/res/shaders/wave.psh b/src/apps/mplayerc/res/shaders/wave.psh index 8cc42ed5c..2bd7ff38d 100644 --- a/src/apps/mplayerc/res/shaders/wave.psh +++ b/src/apps/mplayerc/res/shaders/wave.psh @@ -1,20 +1,12 @@ sampler s0 : register(s0);
float4 p0 : register(c0);
-float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
-#define counter (p0[2])
#define clock (p0[3])
-#define one_over_width (p1[0])
-#define one_over_height (p1[1])
-
-#define PI acos(-1)
float4 main(float2 tex : TEXCOORD0) : COLOR
{
- // don't look at this for too long, you'll get dizzy :)
-
float4 c0 = 0;
tex.x += sin(tex.x+clock/0.3)/20;
|