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/YV12ChromaUpsampling.psh')
-rw-r--r--src/apps/mplayerc/res/shaders/YV12ChromaUpsampling.psh49
1 files changed, 23 insertions, 26 deletions
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);