diff options
author | Ryan Holtz <rholtz@batcountryentertainment.com> | 2011-05-30 21:10:23 +0000 |
---|---|---|
committer | Ryan Holtz <rholtz@batcountryentertainment.com> | 2011-05-30 21:10:23 +0000 |
commit | 796e691522ba5c47fc0610da4f557514563f85b9 (patch) | |
tree | 961683497fd1e4d7369da812c579572f880b188a /hlsl/yiq_encode.fx | |
parent | e532e74a8a869af6da71222657f39684210b624e (diff) |
HLSL Updates: [Ryan Holtz, Bat Country Entertainment, austere, SoltanGris42]
- Added the ability to render screenshots at arbitrary resolutions.
- Added the ability to record AVI videos (albeit with no audio) at arbitrary resolutions.
- Added a 43-tap-wide FIR-based NTSC filter with tunable Y, I and Q frequency response.
- Updated scanlines to have a user-tunable pixel-height ratio in addition to the current screen-height ratio.
- Fixed a VRAM leak that was causing many dynamic-resolution drivers to run out of memory mid-run.
Diffstat (limited to 'hlsl/yiq_encode.fx')
-rw-r--r-- | hlsl/yiq_encode.fx | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/hlsl/yiq_encode.fx b/hlsl/yiq_encode.fx index b8ee1e22de5..119a9169bf8 100644 --- a/hlsl/yiq_encode.fx +++ b/hlsl/yiq_encode.fx @@ -82,35 +82,32 @@ VS_OUTPUT vs_main(VS_INPUT Input) // YIQ Encode Pixel Shader //----------------------------------------------------------------------------- -uniform float YSubsampleLength = 3.0f; -uniform float ISubsampleLength = 3.0f; -uniform float QSubsampleLength = 3.0f; - -uniform float WValue; -uniform float AValue; -uniform float BValue; - -uniform float FscScale; +uniform float AValue = 0.0f; +uniform float BValue = 0.0f; +uniform float CCValue = 3.04183f; +uniform float PValue = 1.0f; +uniform float ScanTime = 52.6f; 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(FscScale * 0.00f + 0.5f, 0.5f) / Scaler).rgb; - float3 Texel1 = tex2D(DiffuseSampler, Input.Coord1 + float2(FscScale * 0.25f + 0.5f, 0.5f) / Scaler).rgb; - float3 Texel2 = tex2D(DiffuseSampler, Input.Coord2 + float2(FscScale * 0.50f + 0.5f, 0.5f) / Scaler).rgb; - float3 Texel3 = tex2D(DiffuseSampler, Input.Coord3 + float2(FscScale * 0.75f + 0.5f, 0.5f) / Scaler).rgb; + 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)) * Scaler; - float2 Coord1 = (Input.Coord1.xy + float2(0.25f / RawWidth, 0.0f)) * Scaler; - float2 Coord2 = (Input.Coord2.xy + float2(0.50f / RawWidth, 0.0f)) * Scaler; - float2 Coord3 = (Input.Coord3.xy + float2(0.75f / RawWidth, 0.0f)) * Scaler; + 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)); - float W = WValue * 2.0f; - float T0 = Coord0.x + AValue * Coord0.y + BValue; - float T1 = Coord1.x + AValue * Coord1.y + BValue; - float T2 = Coord2.x + AValue * Coord2.y + BValue; - float T3 = Coord3.x + AValue * Coord3.y + BValue; + float PI = 3.1415926535897932384626433832795; + float W = PI * 2.0f * CCValue * ScanTime; + float T0 = Coord0.x * WidthRatio + AValue * Coord0.y * 2.0f * (RawHeight / HeightRatio) + BValue; + float T1 = Coord1.x * WidthRatio + AValue * Coord1.y * 2.0f * (RawHeight / HeightRatio) + BValue; + float T2 = Coord2.x * WidthRatio + AValue * Coord2.y * 2.0f * (RawHeight / HeightRatio) + BValue; + float T3 = Coord3.x * WidthRatio + AValue * Coord3.y * 2.0f * (RawHeight / HeightRatio) + BValue; float Y0 = dot(Texel0, float3(0.299f, 0.587f, 0.114f)); float I0 = dot(Texel0, float3(0.595716f, -0.274453f, -0.321263f)); @@ -132,10 +129,10 @@ float4 ps_main(PS_INPUT Input) : COLOR float MinC = -1.1183f; float CRange = MaxC - MinC; - float C0 = Y0 + I0 * sin(T0 * W) + Q0 * cos(T0 * W); - float C1 = Y1 + I1 * sin(T1 * W) + Q1 * cos(T1 * W); - float C2 = Y2 + I2 * sin(T2 * W) + Q2 * cos(T2 * W); - float C3 = Y3 + I3 * sin(T3 * W) + Q3 * cos(T3 * W); + float C0 = Y0 + I0 * cos(T0 * W) + Q0 * sin(T0 * W); + float C1 = Y1 + I1 * cos(T1 * W) + Q1 * sin(T1 * W); + float C2 = Y2 + I2 * cos(T2 * W) + Q2 * sin(T2 * W); + float C3 = Y3 + I3 * cos(T3 * W) + Q3 * sin(T3 * W); C0 = (C0 - MinC) / CRange; C1 = (C1 - MinC) / CRange; C2 = (C2 - MinC) / CRange; |