summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
authorGravatarGravatar Ryan Holtz <rholtz@batcountryentertainment.com>2011-05-31 14:43:47 +0000
committerGravatarGravatar Ryan Holtz <rholtz@batcountryentertainment.com>2011-05-31 14:43:47 +0000
commit61eda625cbd1475063c428975e9672c3db43e245 (patch)
tree09fee96f00fe16400fbbb6e825a3fccc9b6325b3 /hlsl
parentf42b5ccda0d819869951538876e8cb8a0433d77b (diff)
NWN: Fixing the NTSC codec. Oops.
Diffstat (limited to 'hlsl')
-rw-r--r--hlsl/yiq_decode.fx9
-rw-r--r--hlsl/yiq_encode.fx20
2 files changed, 17 insertions, 12 deletions
diff --git a/hlsl/yiq_decode.fx b/hlsl/yiq_decode.fx
index a85590d998f..346f316464f 100644
--- a/hlsl/yiq_decode.fx
+++ b/hlsl/yiq_decode.fx
@@ -114,13 +114,16 @@ float4 ps_main(PS_INPUT Input) : COLOR
float PI = 3.1415926535897932384626433832795;
float PI2 = 2.0f * PI;
float PI2Length = PI2 / 42.0f;
+ float4 NOffset = float4(0.0f, 1.0f, 2.0f, 3.0f);
+ float W = PI2 * CCValue * ScanTime;
for(float n = -21.0f; n < 22.0f; n += 4.0f)
{
- float4 n4 = float4(n + 0.0f, n + 1.0f, n + 2.0f, n + 3.0f);
+ float4 n4 = n + NOffset;
float4 CoordX = Input.Coord0.x + Input.Coord0.z * n4 * 0.25f;
float4 CoordY = Input.Coord0.y;
- float4 C = tex2D(CompositeSampler, float2(CoordX.r, CoordY.r)) * CRange + MinC;
- float4 WT = PI2 * CCValue * ScanTime * (CoordX * WidthRatio + AValue * CoordY * 2.0f * (RawHeight / HeightRatio) + BValue) + OValue;
+ float2 TexCoord = float2(CoordX.r, CoordY.r);
+ float4 C = tex2D(CompositeSampler, TexCoord) * CRange + MinC;
+ float4 WT = W * (CoordX * WidthRatio + AValue * CoordY * 2.0f * (RawHeight / HeightRatio) + BValue) + OValue;
float4 SincYIn = PI2 * Fc_y * n4;
float4 IdealY = 2.0f * Fc_y * ((SincYIn != 0.0f) ? (sin(SincYIn) / SincYIn) : 1.0f);
diff --git a/hlsl/yiq_encode.fx b/hlsl/yiq_encode.fx
index 119a9169bf8..c1c0079dd1a 100644
--- a/hlsl/yiq_encode.fx
+++ b/hlsl/yiq_encode.fx
@@ -92,15 +92,17 @@ float4 ps_main(PS_INPUT Input) : COLOR
{
float2 Scaler = float2(RawWidth, RawHeight);
float2 InvRatios = float2(1.0f / WidthRatio, 1.0f / HeightRatio);
- float3 Texel0 = tex2D(DiffuseSampler, Input.Coord0 + float2(PValue * 0.00f + 0.5f, 0.5f) / Scaler).rgb;
- float3 Texel1 = tex2D(DiffuseSampler, Input.Coord1 + float2(PValue * 0.25f + 0.5f, 0.5f) / Scaler).rgb;
- float3 Texel2 = tex2D(DiffuseSampler, Input.Coord2 + float2(PValue * 0.50f + 0.5f, 0.5f) / Scaler).rgb;
- float3 Texel3 = tex2D(DiffuseSampler, Input.Coord3 + float2(PValue * 0.75f + 0.5f, 0.5f) / Scaler).rgb;
-
- float2 Coord0 = (Input.Coord0.xy + float2(0.00f / RawWidth, 0.0f));
- float2 Coord1 = (Input.Coord1.xy + float2(0.25f / RawWidth, 0.0f));
- float2 Coord2 = (Input.Coord2.xy + float2(0.50f / RawWidth, 0.0f));
- float2 Coord3 = (Input.Coord3.xy + float2(0.75f / RawWidth, 0.0f));
+
+ float2 Coord0 = Input.Coord0 + float2(0.00f, 0.0f) / Scaler;
+ float2 Coord1 = Input.Coord1 + float2(0.25f, 0.0f) / Scaler;
+ float2 Coord2 = Input.Coord2 + float2(0.50f, 0.0f) / Scaler;
+ float2 Coord3 = Input.Coord3 + float2(0.75f, 0.0f) / Scaler;
+
+ float2 TexelOffset = 0.5f / Scaler;
+ float3 Texel0 = tex2D(DiffuseSampler, Coord0 + TexelOffset).rgb;
+ float3 Texel1 = tex2D(DiffuseSampler, Coord1 + TexelOffset).rgb;
+ float3 Texel2 = tex2D(DiffuseSampler, Coord2 + TexelOffset).rgb;
+ float3 Texel3 = tex2D(DiffuseSampler, Coord3 + TexelOffset).rgb;
float PI = 3.1415926535897932384626433832795;
float W = PI * 2.0f * CCValue * ScanTime;