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:
Diffstat (limited to 'src/apps/mplayerc/res/shaders')
-rw-r--r--src/apps/mplayerc/res/shaders/BT601BT709.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/EdgeSharpen.psh101
-rw-r--r--src/apps/mplayerc/res/shaders/SharpenComplex.psh9
-rw-r--r--src/apps/mplayerc/res/shaders/SharpenComplex2.psh17
-rw-r--r--src/apps/mplayerc/res/shaders/YV12ChromaUpsampling.psh49
-rw-r--r--src/apps/mplayerc/res/shaders/contour.psh14
-rw-r--r--src/apps/mplayerc/res/shaders/deinterlace (blend).psh7
-rw-r--r--src/apps/mplayerc/res/shaders/denoise.psh18
-rw-r--r--src/apps/mplayerc/res/shaders/emboss.psh9
-rw-r--r--src/apps/mplayerc/res/shaders/empty.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/final.psh3
-rw-r--r--src/apps/mplayerc/res/shaders/grayscale.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/invert.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/letterbox.psh12
-rw-r--r--src/apps/mplayerc/res/shaders/levels.psh3
-rw-r--r--src/apps/mplayerc/res/shaders/levels2.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/levels3.psh3
-rw-r--r--src/apps/mplayerc/res/shaders/nightvision.psh3
-rw-r--r--src/apps/mplayerc/res/shaders/procamp.psh18
-rw-r--r--src/apps/mplayerc/res/shaders/resizer.psh44
-rw-r--r--src/apps/mplayerc/res/shaders/sharpen.psh47
-rw-r--r--src/apps/mplayerc/res/shaders/sphere.psh34
-rw-r--r--src/apps/mplayerc/res/shaders/spotlight.psh5
-rw-r--r--src/apps/mplayerc/res/shaders/wave.psh12
24 files changed, 198 insertions, 235 deletions
diff --git a/src/apps/mplayerc/res/shaders/BT601BT709.psh b/src/apps/mplayerc/res/shaders/BT601BT709.psh
index 04662ee05..fd5f8406e 100644
--- a/src/apps/mplayerc/res/shaders/BT601BT709.psh
+++ b/src/apps/mplayerc/res/shaders/BT601BT709.psh
@@ -3,14 +3,13 @@ float4 p0 : register(c0);
#define height (p0[1])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
// original pixel
float4 c0 = tex2D(s0,tex);
// uncomment to activate for HD only
/*
- if(height > 719)
+ if (height > 719)
{
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/EdgeSharpen.psh b/src/apps/mplayerc/res/shaders/EdgeSharpen.psh
index 78956d698..14c0e4679 100644
--- a/src/apps/mplayerc/res/shaders/EdgeSharpen.psh
+++ b/src/apps/mplayerc/res/shaders/EdgeSharpen.psh
@@ -1,56 +1,53 @@
sampler s0 : register(s0);
float4 p0 : register(c0);
-#define width (p0[0])
-#define height (p0[1])
-
-#define NbPixel 1
-
-#define Edge_threshold 0.2
-
-#define Sharpen_val0 2.0
-#define Sharpen_val1 0.125
-
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
-// taille de NbPixel pixels
-float dx = NbPixel/width;
-float dy = NbPixel/height;
-float4 Res = 0;
-
-// Détection de contour par Prewitt
- // récuppération des 9 points
- // [ 1, 2, 3 ]
- // [ 4, 0, 5 ]
- // [ 6, 7, 8 ]
- float4 c0 = 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 des 3 vecteurs dérivé (hor,vert, diag1, diag2)
- float4 delta1 = (c6+c4+c1-c3-c5-c8);
- float4 delta2 = (c4+c1+c2-c5-c8-c7);
- float4 delta3 = (c1+c2+c3-c8-c7-c6);
- float4 delta4 = (c2+c3+c5-c7-c6-c4);
-
- // calcul du Prewitt
- float value = length(abs(delta1) + abs(delta2) + abs(delta3) + abs(delta4))/6;
-
-// Si c'est un contour (vector lenght > Edge_threshold) => filtre de sharpen
- if(value > Edge_threshold )
- {
- Res = c0 * Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1 ;
- // Pour voir les contour en rouge ...
- //Res = float4( 1.0, 0.0, 0.0, 0.0 );
-
- return Res;
- }
- else
- return c0;
+#define width (p0[0])
+#define height (p0[1])
+
+#define NbPixel 1
+
+#define Edge_threshold 0.2
+
+#define Sharpen_val0 2.0
+#define Sharpen_val1 0.125
+
+float4 main(float2 tex : TEXCOORD0) : COLOR {
+ // taille de NbPixel pixels
+ float dx = NbPixel/width;
+ float dy = NbPixel/height;
+ float4 Res = 0;
+
+ // Détection de contour par Prewitt
+ // récuppération des 9 points
+ // [ 1, 2, 3 ]
+ // [ 4, 0, 5 ]
+ // [ 6, 7, 8 ]
+ float4 c0 = 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 des 3 vecteurs dérivé (hor,vert, diag1, diag2)
+ float4 delta1 = (c6+c4+c1-c3-c5-c8);
+ float4 delta2 = (c4+c1+c2-c5-c8-c7);
+ float4 delta3 = (c1+c2+c3-c8-c7-c6);
+ float4 delta4 = (c2+c3+c5-c7-c6-c4);
+
+ // calcul du Prewitt
+ float value = length(abs(delta1) + abs(delta2) + abs(delta3) + abs(delta4))/6;
+
+ // Si c'est un contour (vector lenght > Edge_threshold) => filtre de sharpen
+ if (value > Edge_threshold) {
+ Res = c0 * Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1;
+ // Pour voir les contour en rouge ...
+ //Res = float4( 1.0, 0.0, 0.0, 0.0 );
+
+ return Res;
+ } else
+ { return c0; }
} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/SharpenComplex.psh b/src/apps/mplayerc/res/shaders/SharpenComplex.psh
index 5d2db1a05..7341a1ab0 100644
--- a/src/apps/mplayerc/res/shaders/SharpenComplex.psh
+++ b/src/apps/mplayerc/res/shaders/SharpenComplex.psh
@@ -4,8 +4,7 @@ float4 p1 : register(c1);
#define dx (p1[0])
#define dy (p1[1])
-float4 main( float2 tex : TEXCOORD0 ) : COLOR
-{
+float4 main( float2 tex : TEXCOORD0 ) : COLOR {
// definition des pixels : original, flouté, corigé, final
float4 ori;
float4 flou;
@@ -54,13 +53,13 @@ float4 main( float2 tex : TEXCOORD0 ) : COLOR
delta2 = (c6 + 2*c7 + c8)-(c1 + 2*c2 + c3);
// calcul
- value = sqrt( mul(delta1,delta1) + mul(delta2,delta2) ) ;
+ value = sqrt( mul(delta1,delta1) + mul(delta2,delta2) );
- if( value >.3 ) {
+ 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 = ori*2 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * 0.125;
//final= float4(1,0,0,0);
return final;
}
diff --git a/src/apps/mplayerc/res/shaders/SharpenComplex2.psh b/src/apps/mplayerc/res/shaders/SharpenComplex2.psh
index 6f930bdd3..ec441a885 100644
--- a/src/apps/mplayerc/res/shaders/SharpenComplex2.psh
+++ b/src/apps/mplayerc/res/shaders/SharpenComplex2.psh
@@ -26,10 +26,9 @@ float4 p1 : register(c1);
#define Sharpen_val0 2
#define Sharpen_val1 ((Sharpen_val0-1) / 8.0)
-float4 main( float2 tex : TEXCOORD0 ) : COLOR
-{
+float4 main( float2 tex : TEXCOORD0 ) : COLOR {
// recup du pixel original
- float4 ori = tex2D(s0, tex); ;
+ float4 ori = tex2D(s0, tex);
// calcul image floue (filtre gaussien)
float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
@@ -53,10 +52,10 @@ float4 main( float2 tex : TEXCOORD0 ) : COLOR
float4 cori = CoefOri*ori - CoefFlou*flou;
// détection des contours
- // récuppération des 9 voisins
- // [ c1, c2 , c3 ]
- // [ c4,ori , c5 ]
- // [ c6, c7 , c8 ]
+ // 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));
@@ -80,10 +79,10 @@ float4 main( float2 tex : TEXCOORD0 ) : COLOR
float delta2 = (c6 + 2*c7 + c8)-(c1 + 2*c2 + c3);
// calcul
- if( sqrt( mul(delta1,delta1) + mul(delta2,delta2) ) >SharpenEdge ) {
+ 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 ;
+ return ori*Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1;
} else {
// sinon, image corrigée
return cori;
diff --git a/src/apps/mplayerc/res/shaders/YV12ChromaUpsampling.psh b/src/apps/mplayerc/res/shaders/YV12ChromaUpsampling.psh
index 172c4ed87..9b48206d7 100644
--- a/src/apps/mplayerc/res/shaders/YV12ChromaUpsampling.psh
+++ b/src/apps/mplayerc/res/shaders/YV12ChromaUpsampling.psh
@@ -2,11 +2,11 @@
YV12 chroma upsampling fixer
by Kurt Bernhard 'Leak' Pruenner
-Use with YV12 output if the half-resolution chroma
+Use with YV12 output if the half-resolution chroma
gets upsampled in hardware by doubling the values
instead of interpolating between them.
-(i.e. if you're getting blocky red edges on dark
+(i.e. if you're getting blocky red edges on dark
backgrounds...)
*/
@@ -21,41 +21,38 @@ float4 getPixel(float2 tex, float dx, float dy)
{
tex.x+=dx;
tex.y+=dy;
-
+
return tex2D(s0, tex);
}
float4 rgb2yuv(float4 rgb)
{
- float4x4 coeffs=
- {
- 0.299, 0.587, 0.114, 0.000,
- -0.147,-0.289, 0.436, 0.000,
- 0.615,-0.515,-0.100, 0.000,
- 0.000, 0.000, 0.000, 0.000
- };
-
+ float4x4 coeffs= {
+ 0.299, 0.587, 0.114, 0.000,
+ -0.147,-0.289, 0.436, 0.000,
+ 0.615,-0.515,-0.100, 0.000,
+ 0.000, 0.000, 0.000, 0.000
+ };
+
return mul(coeffs,rgb);
}
float4 yuv2rgb(float4 yuv)
{
- float4x4 coeffs=
- {
- 1.000, 0.000, 1.140, 0.000,
- 1.000,-0.395,-0.581, 0.000,
- 1.000, 2.032, 0.000, 0.000,
- 0.000, 0.000, 0.000, 0.000
- };
-
+ float4x4 coeffs= {
+ 1.000, 0.000, 1.140, 0.000,
+ 1.000,-0.395,-0.581, 0.000,
+ 1.000, 2.032, 0.000, 0.000,
+ 0.000, 0.000, 0.000, 0.000
+ };
+
return mul(coeffs,yuv);
}
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float dx=1/width;
float dy=1/height;
-
+
float4 yuv00=rgb2yuv(getPixel(tex,-dx,-dy));
float4 yuv01=rgb2yuv(getPixel(tex,-dx, 0));
float4 yuv02=rgb2yuv(getPixel(tex,-dx, dy));
@@ -67,10 +64,10 @@ float4 main(float2 tex : TEXCOORD0) : COLOR
float4 yuv22=rgb2yuv(getPixel(tex, dx, dy));
float4 yuv=
- (yuv00*1+yuv01*2+yuv02*1+
- yuv10*2+yuv11*4+yuv12*2+
- yuv20*1+yuv21*2+yuv22*1)/16;
-
+ (yuv00*1+yuv01*2+yuv02*1+
+ yuv10*2+yuv11*4+yuv12*2+
+ yuv20*1+yuv21*2+yuv22*1)/16;
+
yuv.r=yuv11.r;
return yuv2rgb(yuv);
diff --git a/src/apps/mplayerc/res/shaders/contour.psh b/src/apps/mplayerc/res/shaders/contour.psh
index b89e96198..8fd122ee4 100644
--- a/src/apps/mplayerc/res/shaders/contour.psh
+++ b/src/apps/mplayerc/res/shaders/contour.psh
@@ -4,20 +4,20 @@ float4 p0 : register(c0);
#define width (p0[0])
#define height (p0[1])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float dx = 4/width;
float dy = 4/height;
-
+
float4 c2 = tex2D(s0, tex + float2(0,-dy));
float4 c4 = tex2D(s0, tex + float2(-dx,0));
float4 c5 = tex2D(s0, tex + float2(0,0));
float4 c6 = tex2D(s0, tex + float2(dx,0));
float4 c8 = tex2D(s0, tex + float2(0,dy));
-
+
float4 c0 = (-c2-c4+c5*4-c6-c8);
- if(length(c0) < 1.0) c0 = float4(0,0,0,0);
- else c0 = float4(1,1,1,0);
-
+ if (length(c0) < 1.0) {
+ c0 = float4(0,0,0,0);
+ } else { c0 = float4(1,1,1,0); }
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/deinterlace (blend).psh b/src/apps/mplayerc/res/shaders/deinterlace (blend).psh
index 51a6be5f3..0e955f3a2 100644
--- a/src/apps/mplayerc/res/shaders/deinterlace (blend).psh
+++ b/src/apps/mplayerc/res/shaders/deinterlace (blend).psh
@@ -4,14 +4,13 @@ float4 p0 : register(c0);
#define width (p0[0])
#define height (p0[1])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = tex2D(s0, tex);
-
+
float2 h = float2(0, 1/height);
float4 c1 = tex2D(s0, tex-h);
float4 c2 = tex2D(s0, tex+h);
c0 = (c0*2+c1+c2)/4;
-
+
return c0;
} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/denoise.psh b/src/apps/mplayerc/res/shaders/denoise.psh
index 0394081b0..78b1e3716 100644
--- a/src/apps/mplayerc/res/shaders/denoise.psh
+++ b/src/apps/mplayerc/res/shaders/denoise.psh
@@ -5,22 +5,20 @@ float4 p0 : register(c0);
#define height (p0[1])
#define val0 (1.0)
-#define val1 (0.125)
+#define val1 (0.125)
#define effect_width (0.1)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float dx = 0.0f;
float dy = 0.0f;
- float fTap = effect_width;
+ float fTap = effect_width;
float4 cAccum = tex2D(s0, tex) * val0;
- for ( int iDx = 0 ; iDx < 16; ++iDx )
- {
- dx = fTap /width;
- dy = fTap /height;
+ for ( int iDx = 0 ; iDx < 16; ++iDx ) {
+ dx = fTap /width;
+ dy = fTap /height;
cAccum += tex2D(s0, tex + float2(-dx,-dy)) * val1;
cAccum += tex2D(s0, tex + float2(0,-dy)) * val1;
@@ -30,9 +28,9 @@ float4 main(float2 tex : TEXCOORD0) : COLOR
cAccum += tex2D(s0, tex + float2(dx,dy)) * val1;
cAccum += tex2D(s0, tex + float2(-dx,+dy)) * val1;
cAccum += tex2D(s0, tex + float2(+dx,-dy)) * val1;
-
+
fTap += 0.1f;
}
-
+
return(cAccum/16.0f);
} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/emboss.psh b/src/apps/mplayerc/res/shaders/emboss.psh
index a0053996c..2d9c535c2 100644
--- a/src/apps/mplayerc/res/shaders/emboss.psh
+++ b/src/apps/mplayerc/res/shaders/emboss.psh
@@ -4,20 +4,19 @@ float4 p0 : register(c0);
#define width (p0[0])
#define height (p0[1])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float dx = 1/width;
float dy = 1/height;
-
+
float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
float4 c2 = tex2D(s0, tex + float2(0,-dy));
float4 c4 = tex2D(s0, tex + float2(-dx,0));
float4 c6 = tex2D(s0, tex + float2(dx,0));
float4 c8 = tex2D(s0, tex + float2(0,dy));
float4 c9 = tex2D(s0, tex + float2(dx,dy));
-
+
float4 c0 = (-c1-c2-c4+c6+c8+c9);
c0 = (c0.r+c0.g+c0.b)/3 + 0.5;
-
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/empty.psh b/src/apps/mplayerc/res/shaders/empty.psh
index 3d0ab987a..e15b71b6b 100644
--- a/src/apps/mplayerc/res/shaders/empty.psh
+++ b/src/apps/mplayerc/res/shaders/empty.psh
@@ -11,9 +11,8 @@ float4 p1 : register(c1);
#define PI acos(-1)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = tex2D(s0, tex);
-
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/final.psh b/src/apps/mplayerc/res/shaders/final.psh
index 96eccb562..c39b5078e 100644
--- a/src/apps/mplayerc/res/shaders/final.psh
+++ b/src/apps/mplayerc/res/shaders/final.psh
@@ -17,8 +17,7 @@ static const float LUT3D_SCALE = (LUT3D_SIZE - 1.0f) / LUT3D_SIZE;
static const float LUT3D_OFFSET = 1.0f / (2.0f * LUT3D_SIZE);
#endif
-float4 main(float2 imageCoord : TEXCOORD0) : COLOR
-{
+float4 main(float2 imageCoord : TEXCOORD0) : COLOR {
float4 pixel = tex2D(image, imageCoord);
#if LUT3D_ENABLED
diff --git a/src/apps/mplayerc/res/shaders/grayscale.psh b/src/apps/mplayerc/res/shaders/grayscale.psh
index 46952b3d2..c337021ed 100644
--- a/src/apps/mplayerc/res/shaders/grayscale.psh
+++ b/src/apps/mplayerc/res/shaders/grayscale.psh
@@ -1,8 +1,7 @@
sampler s0 : register(s0);
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float c0 = dot(tex2D(s0, tex), float4(0.299, 0.587, 0.114, 0));
-
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/invert.psh b/src/apps/mplayerc/res/shaders/invert.psh
index 902391b81..54eb8b9e0 100644
--- a/src/apps/mplayerc/res/shaders/invert.psh
+++ b/src/apps/mplayerc/res/shaders/invert.psh
@@ -1,8 +1,7 @@
sampler s0 : register(s0);
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+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 63c70aef2..bb3cd0fe0 100644
--- a/src/apps/mplayerc/res/shaders/letterbox.psh
+++ b/src/apps/mplayerc/res/shaders/letterbox.psh
@@ -4,15 +4,15 @@ float4 p0 : register(c0);
#define width (p0[0])
#define height (p0[1])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = 0;
-
+
float2 ar = float2(16, 9);
float h = (1 - width/height * ar.y/ar.x) / 2;
-
- if(tex.y >= h && tex.y <= 1-h)
+
+ if (tex.y >= h && tex.y <= 1-h) {
c0 = tex2D(s0, tex);
-
+ }
+
return c0;
} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/levels.psh b/src/apps/mplayerc/res/shaders/levels.psh
index 62e7ca672..aa4201f80 100644
--- a/src/apps/mplayerc/res/shaders/levels.psh
+++ b/src/apps/mplayerc/res/shaders/levels.psh
@@ -3,8 +3,7 @@ sampler s0 : register(s0);
#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 {
// original pixel
float4 c0 = tex2D(s0,tex);
diff --git a/src/apps/mplayerc/res/shaders/levels2.psh b/src/apps/mplayerc/res/shaders/levels2.psh
index 047509979..86cc6d03a 100644
--- a/src/apps/mplayerc/res/shaders/levels2.psh
+++ b/src/apps/mplayerc/res/shaders/levels2.psh
@@ -7,13 +7,12 @@ float4 p0 : register(c0);
#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 {
// original pixel
float4 c0 = tex2D(s0,tex);
/* ATI driver only looks at the height */
- if(height >= 720 ) {
+ if (height >= 720 ) {
return c0;
} else {
return((c0 - const_1) * const_2);
diff --git a/src/apps/mplayerc/res/shaders/levels3.psh b/src/apps/mplayerc/res/shaders/levels3.psh
index d88796645..952a8bdf0 100644
--- a/src/apps/mplayerc/res/shaders/levels3.psh
+++ b/src/apps/mplayerc/res/shaders/levels3.psh
@@ -3,8 +3,7 @@ sampler s0 : register(s0);
#define const_1 (16.0/255.0)
#define const_2 (219.0/255.0)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
// original pixel
float4 c0 = tex2D(s0,tex);
diff --git a/src/apps/mplayerc/res/shaders/nightvision.psh b/src/apps/mplayerc/res/shaders/nightvision.psh
index 1fc4adfee..c887b5622 100644
--- a/src/apps/mplayerc/res/shaders/nightvision.psh
+++ b/src/apps/mplayerc/res/shaders/nightvision.psh
@@ -1,7 +1,6 @@
sampler s0 : register(s0);
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float c = dot(tex2D(s0, tex), float4(0.2, 0.6, 0.1, 0.1));
return float4(0,c,0,0);
}
diff --git a/src/apps/mplayerc/res/shaders/procamp.psh b/src/apps/mplayerc/res/shaders/procamp.psh
index ec331d6bd..4016f444c 100644
--- a/src/apps/mplayerc/res/shaders/procamp.psh
+++ b/src/apps/mplayerc/res/shaders/procamp.psh
@@ -11,19 +11,17 @@ float4 p1 : register(c1);
#define PI acos(-1)
-static float4x4 r2y =
-{
+static float4x4 r2y = {
0.299, 0.587, 0.114, 0,
-0.147, -0.289, 0.437, 0,
0.615, -0.515, -0.100, 0,
0, 0, 0, 0
};
-static float4x4 y2r =
-{
- 1.0, 0.0, 1.140, 0,
+static float4x4 y2r = {
+ 1.0, 0.0, 1.140, 0,
1.0, -0.394, -0.581, 0,
- 1.0, 2.028, 0.0, 0,
+ 1.0, 2.028, 0.0, 0,
0, 0, 0, 0
};
@@ -44,18 +42,16 @@ static float4x4 y2r =
// #define Brightness (-ymin)
// #define Contrast (1.0/(ymax-ymin))
-static float2x2 HueMatrix =
-{
+static float2x2 HueMatrix = {
cos(Hue * PI / 180), sin(Hue * PI / 180),
-sin(Hue * PI / 180), cos(Hue * PI / 180)
};
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = tex2D(s0, tex);
c0 = mul(r2y, c0);
c0.r = Contrast * (c0.r - ymin) + ymin + Brightness;
c0.gb = mul(HueMatrix, c0.gb) * Saturation;
c0 = mul(y2r, c0);
- return c0;
+ return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/resizer.psh b/src/apps/mplayerc/res/shaders/resizer.psh
index 66cd0bb27..31c6be47b 100644
--- a/src/apps/mplayerc/res/shaders/resizer.psh
+++ b/src/apps/mplayerc/res/shaders/resizer.psh
@@ -5,19 +5,18 @@ sampler s2 : register(s2);
sampler s3 : register(s3);
sampler s4 : register(s4);
-float4 dxdy05 : register(c0);
+float4 dxdy05 : register(c0);
float2 dxdy : register(c1);
float2 dx : register(c2);
float2 dy : register(c3);
#define A _The_Value_Of_A_Is_Set_Here_
-// none of the resizers here can be used for 1:1 mapping!
+// none of the resizers here can be used for 1:1 mapping!
// tex * size won't be 0, 1, 2, 3, .. as you might expect, but something like 0, 0.999, 2.001, 2.999, ...
// this means when the fractional part becomes 0.999 we will be interpolating with the wrong value!!!
-struct PS_INPUT
-{
+struct PS_INPUT {
float2 t0 : TEXCOORD0;
float2 t1 : TEXCOORD1;
float2 t2 : TEXCOORD2;
@@ -25,9 +24,8 @@ struct PS_INPUT
float2 t4 : TEXCOORD4;
};
-float4 main_bilinear(PS_INPUT input) : COLOR
-{
- float2 PixelPos = input.t0;
+float4 main_bilinear(PS_INPUT input) : COLOR {
+ float2 PixelPos = input.t0;
float2 dd = frac(PixelPos);
float2 ExactPixel = PixelPos - dd;
float2 samplePos = ExactPixel*dxdy + dxdy05;
@@ -36,12 +34,11 @@ float4 main_bilinear(PS_INPUT input) : COLOR
lerp(tex2D(s0, samplePos), tex2D(s0, samplePos + dx), dd.x),
lerp(tex2D(s0, samplePos + dy), tex2D(s0, samplePos + dxdy), dd.x),
dd.y);
-
+
return c;
}
-static float4x4 tco =
-{
+static float4x4 tco = {
0, A, -2*A, A,
1, 0, -A-3, A+2,
0, -A, 2*A+3, -A-2,
@@ -63,7 +60,7 @@ float4 SampleX(float4 tx, float2 t0)
tex2D(s0, t0 + dx),
tex2D(s0, t0 + dx + dx)
)
- );
+ );
}
float4 SampleY(float4 tx, float4 ty, float2 t0)
@@ -76,12 +73,11 @@ float4 SampleY(float4 tx, float4 ty, float2 t0)
SampleX(tx, t0 + dy),
SampleX(tx, t0 + dy + dy)
)
- );
+ );
}
-float4 main_bicubic1pass(PS_INPUT input) : COLOR
-{
- float2 PixelPos = input.t0;
+float4 main_bicubic1pass(PS_INPUT input) : COLOR {
+ float2 PixelPos = input.t0;
float2 dd = frac(PixelPos);
float2 ExactPixel = PixelPos - dd;
float2 samplePos = ExactPixel*dxdy + dxdy05;
@@ -91,33 +87,31 @@ float4 main_bicubic1pass(PS_INPUT input) : COLOR
float4 Sample(float4 t, float2 samplePos, float2 sampleD)
{
return
- mul(t,
+ mul(t,
float4x4(
tex2D(s0, samplePos - sampleD),
tex2D(s0, samplePos),
tex2D(s0, samplePos + sampleD),
tex2D(s0, samplePos + sampleD + sampleD)
)
- );
+ );
}
-float4 main_bicubic2pass_pass1(PS_INPUT input) : COLOR
-{
- float2 PixelPos = input.t0;
+float4 main_bicubic2pass_pass1(PS_INPUT input) : COLOR {
+ float2 PixelPos = input.t0;
float2 dd = frac(PixelPos);
float2 ExactPixel = PixelPos - dd;
float2 samplePos = ExactPixel*dxdy + dxdy05;
-
+
return Sample(taps(dd.x), samplePos, dx);
}
-float4 main_bicubic2pass_pass2(PS_INPUT input) : COLOR
-{
- float2 PixelPos = input.t0;
+float4 main_bicubic2pass_pass2(PS_INPUT input) : COLOR {
+ float2 PixelPos = input.t0;
float2 dd = frac(PixelPos);
float2 ExactPixel = PixelPos - dd;
float2 samplePos = ExactPixel*dxdy + dxdy05;
-
+
return Sample(taps(dd.y), samplePos, dy);
}
diff --git a/src/apps/mplayerc/res/shaders/sharpen.psh b/src/apps/mplayerc/res/shaders/sharpen.psh
index 90d9ec4c2..b475576ad 100644
--- a/src/apps/mplayerc/res/shaders/sharpen.psh
+++ b/src/apps/mplayerc/res/shaders/sharpen.psh
@@ -2,29 +2,28 @@ 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;
- float dy = effect_width/height;
-
- float4 c1 = tex2D(s0, tex + float2(-dx,-dy)) * val1;
- float4 c2 = tex2D(s0, tex + float2(0,-dy)) * val1;
- float4 c3 = tex2D(s0, tex + float2(-dx,0)) * val1;
- float4 c4 = tex2D(s0, tex + float2(dx,0)) * val1;
- float4 c5 = tex2D(s0, tex + float2(0,dy)) * val1;
- float4 c6 = tex2D(s0, tex + float2(dx,dy)) * val1;
- float4 c7 = tex2D(s0, tex + float2(-dx,+dy)) * val1;
- 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);
-
- return c0;
+#define effect_width (1.6)
+#define val0 (2.0)
+#define val1 (-0.125)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR {
+ float dx = effect_width/width;
+ float dy = effect_width/height;
+
+ float4 c1 = tex2D(s0, tex + float2(-dx,-dy)) * val1;
+ float4 c2 = tex2D(s0, tex + float2(0,-dy)) * val1;
+ float4 c3 = tex2D(s0, tex + float2(-dx,0)) * val1;
+ float4 c4 = tex2D(s0, tex + float2(dx,0)) * val1;
+ float4 c5 = tex2D(s0, tex + float2(0,dy)) * val1;
+ float4 c6 = tex2D(s0, tex + float2(dx,dy)) * val1;
+ float4 c7 = tex2D(s0, tex + float2(-dx,+dy)) * val1;
+ 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);
+
+ 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 56276716c..d50422a46 100644
--- a/src/apps/mplayerc/res/shaders/sphere.psh
+++ b/src/apps/mplayerc/res/shaders/sphere.psh
@@ -5,50 +5,48 @@ float4 p0 : register(c0);
#define PI acos(-1)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
// - this is a very simple raytracer, one sphere only
// - no reflection or refraction, yet (my ati 9800 has a 64 + 32 instruction limit...)
-
+
float3 pl = float3(3,-3,-4); // light pos
float4 cl = 0.4; // light color
-
+
float3 pc = float3(0,0,-1); // cam pos
float3 ps = float3(0,0,0.5); // sphere pos
float r = 0.65; // sphere radius
-
+
float3 pd = normalize(float3(tex.x-0.5, tex.y-0.5, 0) - pc);
-
+
float A = 1;
float B = 2*dot(pd, pc - ps);
float C = dot(pc - ps, pc - ps) - r*r;
float D = B*B - 4*A*C;
-
+
float4 c0 = 0;
-
- if(D >= 0)
- {
+
+ if (D >= 0) {
// t2 is the smaller, obviously...
// float t1 = (-B + sqrt(D)) / (2*A);
// float t2 = (-B - sqrt(D)) / (2*A);
- // float t = min(t1, t2);
-
+ // float t = min(t1, t2);
+
float t = (-B - sqrt(D)) / (2*A);
-
+
// intersection data
float3 p = pc + pd*t;
float3 n = normalize(p - ps);
float3 l = normalize(pl - p);
-
+
// mapping the image onto the sphere
- tex = acos(-n)/PI;
-
+ tex = acos(-n)/PI;
+
// rotate it
tex.x = frac(tex.x + frac(clock/10));
-
+
// diffuse + specular
c0 = tex2D(s0, tex) * dot(n, l) + cl * pow(max(dot(l, reflect(pd, n)), 0), 50);
}
-
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/spotlight.psh b/src/apps/mplayerc/res/shaders/spotlight.psh
index e6fae3aa0..746475064 100644
--- a/src/apps/mplayerc/res/shaders/spotlight.psh
+++ b/src/apps/mplayerc/res/shaders/spotlight.psh
@@ -7,12 +7,11 @@ float4 p0 : register(c0);
#define PI acos(-1)
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = tex2D(s0, tex);
float3 lightsrc = float3(sin(clock*PI/1.5)/2+0.5,cos(clock*PI)/2+0.5,1);
float3 light = normalize(lightsrc - float3(tex.x,tex.y,0));
c0 *= pow(dot(light, float3(0,0,1)), 50);
-
+
return c0;
}
diff --git a/src/apps/mplayerc/res/shaders/wave.psh b/src/apps/mplayerc/res/shaders/wave.psh
index 2bd7ff38d..16884aa8d 100644
--- a/src/apps/mplayerc/res/shaders/wave.psh
+++ b/src/apps/mplayerc/res/shaders/wave.psh
@@ -5,17 +5,15 @@ float4 p0 : register(c0);
#define height (p0[1])
#define clock (p0[3])
-float4 main(float2 tex : TEXCOORD0) : COLOR
-{
+float4 main(float2 tex : TEXCOORD0) : COLOR {
float4 c0 = 0;
-
+
tex.x += sin(tex.x+clock/0.3)/20;
tex.y += sin(tex.x+clock/0.3)/20;
-
- if(tex.x >= 0 && tex.x <= 1 && tex.y >= 0 && tex.y <= 1)
- {
+
+ if (tex.x >= 0 && tex.x <= 1 && tex.y >= 0 && tex.y <= 1) {
c0 = tex2D(s0, tex);
}
-
+
return c0;
}