diff options
author | clsid2 <clsid2@users.sourceforge.net> | 2009-12-15 13:24:45 +0300 |
---|---|---|
committer | clsid2 <clsid2@users.sourceforge.net> | 2009-12-15 13:24:45 +0300 |
commit | 255b9e316821fc12e09400c871a6d964229488c5 (patch) | |
tree | b93d39f80fceb92a0037a596efd8a593ba1f5665 /src/apps/mplayerc/res | |
parent | fd25905c6b0b466967ab075a46cc10394d9da18f (diff) |
Minor changes
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1418 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/res')
-rw-r--r-- | src/apps/mplayerc/res/shaders/SharpenComplex2.psh | 155 | ||||
-rw-r--r-- | src/apps/mplayerc/res/shaders/levels2.psh | 8 |
2 files changed, 74 insertions, 89 deletions
diff --git a/src/apps/mplayerc/res/shaders/SharpenComplex2.psh b/src/apps/mplayerc/res/shaders/SharpenComplex2.psh index db4f21a12..6f930bdd3 100644 --- a/src/apps/mplayerc/res/shaders/SharpenComplex2.psh +++ b/src/apps/mplayerc/res/shaders/SharpenComplex2.psh @@ -1,22 +1,19 @@ -////////////////////////////////////////////////////
-// Sharpen complex v2 (nécessite ps >=2a)
-////////////////////////////////////////////////////
-sampler s0 : register(s0);
-float4 p0 : register(c0);
-float4 p1 : register(c1);
+/* Sharpen complex v2 (requires ps >= 2a) */
+
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
-// résolution de l'image
-#define width (p0[0])
-#define height (p0[1])
// "largeur" d'un pixel
#define px (p1[0])
#define py (p1[1])
+/* Parameters */
-////////////////////////////////////////////////////
-// Paramètres
-////////////////////////////////////////////////////
- // pour le calcul du flou
+// pour le calcul du flou
#define moyenne 0.6
#define dx (moyenne*px)
#define dy (moyenne*py)
@@ -24,83 +21,71 @@ float4 p1 : register(c1); #define CoefFlou 2
#define CoefOri (1+ CoefFlou)
- // pour le sharpen
-#define SharpenEdge 0.2
-#define Sharpen_val0 2
-#define Sharpen_val1 ((Sharpen_val0-1) / 8.0)
-
-
-////////////////////////////////////////////////////
-float4 main( float2 tex : TEXCOORD0 ) : COLOR
-{
- // recup du pixel original
- float4 ori = tex2D(s0, tex); ;
+// pour le sharpen
+#define SharpenEdge 0.2
+#define Sharpen_val0 2
+#define Sharpen_val1 ((Sharpen_val0-1) / 8.0)
-////////////////////////////////////////////////////
-// calcul image floue (filtre gaussien)
-////////////////////////////////////////////////////
- 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));
+float4 main( float2 tex : TEXCOORD0 ) : COLOR
+{
+ // recup du pixel original
+ float4 ori = tex2D(s0, tex); ;
- // filtre gaussien
- // [ 1, 2 , 1 ]
- // [ 2, 4 , 2 ]
- // [ 1, 2 , 1 ]
- // 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
- float4 flou = (c1+c3+c6+c8 + 2*(c2+c4+c5+c7)+ 4*ori)*0.0625;
+ // calcul image floue (filtre gaussien)
+ 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));
- // soustraction de l'image flou à l'image originale
- float4 cori = CoefOri*ori - CoefFlou*flou;
+ // filtre gaussien
+ // [ 1, 2 , 1 ]
+ // [ 2, 4 , 2 ]
+ // [ 1, 2 , 1 ]
+ // 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
+ float4 flou = (c1+c3+c6+c8 + 2*(c2+c4+c5+c7)+ 4*ori)*0.0625;
-////////////////////////////////////////////////////
-// détection des contours
-////////////////////////////////////////////////////
- // récuppération des 9 voisins
- // [ c1, c2 , c3 ]
- // [ c4,ori , c5 ]
- // [ c6, c7 , c8 ]
- c1 = tex2D(s0, tex + float2(-px,-py));
- c2 = tex2D(s0, tex + float2(0,-py));
- c3 = tex2D(s0, tex + float2(px,-py));
- c4 = tex2D(s0, tex + float2(-px,0));
- c5 = tex2D(s0, tex + float2(px,0));
- c6 = tex2D(s0, tex + float2(-px,py));
- c7 = tex2D(s0, tex + float2(0,py));
- c8 = tex2D(s0, tex + float2(px,py));
+ // soustraction de l'image flou à l'image originale
+ float4 cori = CoefOri*ori - CoefFlou*flou;
-// par filtre de sobel
- // Gradient horizontal
- // [ -1, 0 ,1 ]
- // [ -2, 0, 2 ]
- // [ -1, 0 ,1 ]
- float delta1 = (c3 + 2*c5 + c8)-(c1 + 2*c4 + c6);
+ // détection des contours
+ // récuppération des 9 voisins
+ // [ c1, c2 , c3 ]
+ // [ c4,ori , c5 ]
+ // [ c6, c7 , c8 ]
+ c1 = tex2D(s0, tex + float2(-px,-py));
+ c2 = tex2D(s0, tex + float2(0,-py));
+ c3 = tex2D(s0, tex + float2(px,-py));
+ c4 = tex2D(s0, tex + float2(-px,0));
+ c5 = tex2D(s0, tex + float2(px,0));
+ c6 = tex2D(s0, tex + float2(-px,py));
+ c7 = tex2D(s0, tex + float2(0,py));
+ c8 = tex2D(s0, tex + float2(px,py));
- // Gradient vertical
- // [ -1,- 2,-1 ]
- // [ 0, 0, 0 ]
- // [ 1, 2, 1 ]
- float delta2 = (c6 + 2*c7 + c8)-(c1 + 2*c2 + c3);
+ // par filtre de sobel
+ // Gradient horizontal
+ // [ -1, 0 ,1 ]
+ // [ -2, 0, 2 ]
+ // [ -1, 0 ,1 ]
+ float delta1 = (c3 + 2*c5 + c8)-(c1 + 2*c4 + c6);
- // calcul
- if( sqrt( mul(delta1,delta1) + mul(delta2,delta2) ) >SharpenEdge )
- {
-////////////////////////////////////////////////////
-// si contour, sharpen
- // return float4(1,0,0,0);
- return ori*Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1 ;
- }
- else
- {
-////////////////////////////////////////////////////
-// sinon, image corrigée
- return cori;
- }
-}
+ // Gradient vertical
+ // [ -1,- 2,-1 ]
+ // [ 0, 0, 0 ]
+ // [ 1, 2, 1 ]
+ float delta2 = (c6 + 2*c7 + c8)-(c1 + 2*c2 + c3);
+ // calcul
+ if( sqrt( mul(delta1,delta1) + mul(delta2,delta2) ) >SharpenEdge ) {
+ // si contour, sharpen
+ //return float4(1,0,0,0);
+ return ori*Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1 ;
+ } else {
+ // sinon, image corrigée
+ return cori;
+ }
+}
\ No newline at end of file diff --git a/src/apps/mplayerc/res/shaders/levels2.psh b/src/apps/mplayerc/res/shaders/levels2.psh index 6574faa14..047509979 100644 --- a/src/apps/mplayerc/res/shaders/levels2.psh +++ b/src/apps/mplayerc/res/shaders/levels2.psh @@ -2,7 +2,7 @@ sampler s0 : register(s0); float4 p0 : register(c0);
#define height (p0[1])
-//#define width (p0[0])
+#define width (p0[0])
#define const_1 (16.0/255.0)
#define const_2 (255.0/219.0)
@@ -12,10 +12,10 @@ float4 main(float2 tex : TEXCOORD0) : COLOR // original pixel
float4 c0 = tex2D(s0,tex);
- if(height > 719 ) {
- //if(width > 1279) {
+ /* ATI driver only looks at the height */
+ if(height >= 720 ) {
return c0;
} else {
return((c0 - const_1) * const_2);
}
-}
+}
\ No newline at end of file |