From fd7a110eba491ceaae928908d9c19b326701e314 Mon Sep 17 00:00:00 2001 From: Ryan Holtz Date: Fri, 20 May 2011 07:37:34 +0000 Subject: HLSL Updates [Ryan Holtz, Bat Country Entertainment] - Re-worked render target handling to align pixels better, reducing unintentional blurring - Made major fixes to CVBS simulation, significantly increasing color saturation --- hlsl/yiq_decode.fx | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'hlsl/yiq_decode.fx') diff --git a/hlsl/yiq_decode.fx b/hlsl/yiq_decode.fx index ee5d37bfa36..4fa190ed699 100644 --- a/hlsl/yiq_decode.fx +++ b/hlsl/yiq_decode.fx @@ -7,9 +7,9 @@ texture Diffuse; sampler DiffuseSampler = sampler_state { Texture = ; - MipFilter = LINEAR; - MinFilter = LINEAR; - MagFilter = LINEAR; + MipFilter = POINT; + MinFilter = POINT; + MagFilter = POINT; AddressU = CLAMP; AddressV = CLAMP; AddressW = CLAMP; @@ -70,20 +70,19 @@ VS_OUTPUT vs_main(VS_INPUT Input) Output.Position = float4(Input.Position.xyz, 1.0f); Output.Position.x /= TargetWidth; Output.Position.y /= TargetHeight; + //Output.Position.x /= WidthRatio; + //Output.Position.y /= HeightRatio; Output.Position.y = 1.0f - Output.Position.y; Output.Position.x -= 0.5f; Output.Position.y -= 0.5f; Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f); Output.Color = Input.Color; - float2 InvTexSize = float2(1.0f / TargetWidth, 1.0f / TargetHeight); - float2 Ratios = float2(WidthRatio, HeightRatio); - float2 TexCoord = (Input.Position.xy * InvTexSize) / Ratios; - Output.Coord0 = TexCoord + float2(0.0f / RawWidth, 0.0f); - Output.Coord1 = TexCoord + float2(0.25f / RawWidth, 0.0f); - Output.Coord2 = TexCoord + float2(0.5f / RawWidth, 0.0f); - Output.Coord3 = TexCoord + float2(0.75f / RawWidth, 0.0f); - Output.Coord4 = TexCoord + float2(1.0f / RawWidth, 0.0f); - Output.Coord5 = TexCoord + float2(1.25f / RawWidth, 0.0f); + Output.Coord0 = Input.TexCoord + float2(0.00f / RawWidth, 0.0f); + Output.Coord1 = Input.TexCoord + float2(0.25f / RawWidth, 0.0f); + Output.Coord2 = Input.TexCoord + float2(0.50f / RawWidth, 0.0f); + Output.Coord3 = Input.TexCoord + float2(0.75f / RawWidth, 0.0f); + Output.Coord4 = Input.TexCoord + float2(1.00f / RawWidth, 0.0f); + Output.Coord5 = Input.TexCoord + float2(1.25f / RawWidth, 0.0f); return Output; } @@ -102,6 +101,7 @@ uniform float BValue; float4 ps_main(PS_INPUT Input) : COLOR { + float2 RawDims = float2(RawWidth, RawHeight); float4 OrigC = tex2D(DiffuseSampler, Input.Coord0.xy); float4 OrigC2 = tex2D(DiffuseSampler, Input.Coord4.xy); float4 C = OrigC; @@ -116,8 +116,7 @@ float4 ps_main(PS_INPUT Input) : COLOR float PI = 3.14159265f; - float2 InvRatios = float2(1.0f / WidthRatio, 1.0f / HeightRatio); - float2 Scaler = float2(RawWidth, RawHeight) * InvRatios; + float2 Scaler = RawDims; float2 Coord0 = Input.Coord0.xy * Scaler; float2 Coord1 = Input.Coord1.xy * Scaler; float2 Coord2 = Input.Coord2.xy * Scaler; @@ -125,8 +124,8 @@ float4 ps_main(PS_INPUT Input) : COLOR float2 Coord4 = Input.Coord4.xy * Scaler; float2 Coord5 = Input.Coord5.xy * Scaler; - float W = WValue * 2.0f; - float YRatio = 0.5333f; + float W = WValue; + float YRatio = 1.0f; float T0 = Coord0.x + AValue * YRatio * Coord0.y + BValue; float T1 = Coord1.x + AValue * YRatio * Coord1.y + BValue; float T2 = Coord2.x + AValue * YRatio * Coord2.y + BValue; @@ -152,8 +151,6 @@ float4 ps_main(PS_INPUT Input) : COLOR float3 OutRGB = float3(dot(YIQ, float3(1.0f, 0.9563f, 0.6210f)), dot(YIQ, float3(1.0f, -0.2721f, -0.6474f)), dot(YIQ, float3(1.0f, -1.1070f, 1.7046f))); - // Debugging: return sin(W * Tc) * 0.5f + 0.5f; - // Debugging: return float4(0.5f + 0.5f * sin(W * float3(T0, T2, T4)), 1.0f); return float4(OutRGB, 1.0f); } -- cgit v1.2.3