diff options
author | beliyaal <beliyaal@users.sourceforge.net> | 2009-05-21 22:25:11 +0400 |
---|---|---|
committer | beliyaal <beliyaal@users.sourceforge.net> | 2009-05-21 22:25:11 +0400 |
commit | 96ab8cc2bf0a3e7da62702249e5adf3a22b10cfe (patch) | |
tree | 20be4be0439af54dcd2b01e2704a5d0605f6fa4e /src/apps/mplayerc/res | |
parent | da2d551b82be73988efe85dc4f50e185b5f10ac9 (diff) |
Fixed: All resizers should now output correct image. All tested to be exactly accurate at 1:1 pixel mapping and high magnification such as 64x32 at 1920x1080.
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1117 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/res')
-rw-r--r-- | src/apps/mplayerc/res/shaders/resizer.psh | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/apps/mplayerc/res/shaders/resizer.psh b/src/apps/mplayerc/res/shaders/resizer.psh index 1c31f7653..e90aacec2 100644 --- a/src/apps/mplayerc/res/shaders/resizer.psh +++ b/src/apps/mplayerc/res/shaders/resizer.psh @@ -5,10 +5,11 @@ sampler s2 : register(s2); sampler s3 : register(s3);
sampler s4 : register(s4);
-float4 p0 : register(c0);
+float4 dxdy05 : register(c0);
float2 dxdy : register(c1);
float2 dx : register(c2);
float2 dy : register(c3);
+float2 TexSize : register(c4);
#define A _The_Value_Of_A_Is_Set_Here_
@@ -27,11 +28,15 @@ struct PS_INPUT float4 main_bilinear(PS_INPUT input) : COLOR
{
- float2 dd = frac(input.t4);
+ float2 inputt0 = input.t0;
+ float2 PixelPos = inputt0 * TexSize;
+ float2 ExactPixel = floor(PixelPos);
+ float2 dd = PixelPos - ExactPixel;
+ float2 samplePos = ExactPixel*dxdy + dxdy05;
float4 c = lerp(
- lerp(tex2D(s0, input.t0), tex2D(s1, input.t1), dd.x),
- lerp(tex2D(s2, input.t2), tex2D(s3, input.t3), dd.x),
+ 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;
@@ -78,9 +83,12 @@ float4 SampleY(float4 tx, float4 ty, float2 t0) float4 main_bicubic1pass(PS_INPUT input) : COLOR
{
- float2 dd = frac(input.t1);
- return SampleY(taps(dd.x), taps(dd.y), input.t0);
- // return SampleY(tex1D(s1, dd.x), tex1D(s1, dd.y), input.t0);
+ float2 inputt0 = input.t0;
+ float2 PixelPos = inputt0 * TexSize;
+ float2 ExactPixel = floor(PixelPos);
+ float2 dd = PixelPos - ExactPixel;
+ float2 samplePos = ExactPixel*dxdy + dxdy05;
+ return SampleY(taps(dd.x), taps(dd.y), samplePos);
}
float4 Sample(float4 t, PS_INPUT input)
|