decoder-svideo-to-rgb
This shader takes an input S-Video signal (with separate luma and chroma components) and converts it into an RGB color.
For more information, refer to Decoding A Fake NTSC Signal.
Index
Input Textures/Samplers
Uniform Buffer Values
Input Textures/Samplers
- g_sourceTexture
-
g_sourceTexture
Type
texture
(platform-specific)Description
This is a 2- or 4-component texture that contains either a single luma, chroma sample pair or two luma, chroma pairs of S-Video-like signal. It is 2 components if we have no temporal artifact reduction (we're not blending two versions of the same frame), 4 if we do. - g_sourceSampler
-
g_sourceSampler
Type
sampler
(platform-specific, does not exist on some platforms)Description
The sampler to use to sample g_sourceTexture.
This sampler should be set up for linear filtering and clamped addressing.
- g_modulatedChromaTexture
-
g_modulatedChromaTexture
Type
texture
(platform-specific)Description
This is a 2- or 4-component texture that contains the output of the svideo-to-modulated-chroma shader (the chroma portions of the input signal modulated with the carrier quadrature). Basically, it's
float4(chromaA * sin, chromaA * cos, chromaB * sin, chromaB * cos)
.This has been modulated in a separate pass for efficiency - otherwise this shader would need to do a bunch of sines and cosines per texel.
- g_modulatedChromaSampler
-
g_modulatedChromaSampler
Type
sampler
(platform-specific, does not exist on some platforms)Description
The sampler to use to sample g_modulatedChromaTexture.
This sampler should be set up for linear filtering and clamped addressing.
Uniform Buffer Values
- g_samplesPerColorburstCycle
-
uint g_samplesPerColorburstCycle
Type
uint
Description
How many samples (horizontal texels) there are per each color wave cycle. - g_saturation
-
float g_saturation
Type
float
Description
This is a value representing how saturated we want the output to be.
0
basically means we'll decode as a grayscale image,1
means fully saturated color (i.e. the intended input saturation), and you could even set values greater than1
to oversaturate.This corresponds to the saturation dial of a CRT TV.
NOTE: This value should be pre-scaled by the
g_brightness
value, so that if brightness is0
, saturation is always0
- otherwise, you get weird output values where there should have been nothing visible but instead you get a pure color instead. - g_brightness
-
float g_brightness
Type
float
Description
This is a value representing the brightness of the output. a value of
0
means the shader will output pure black, and1
means "the intended brightness based on the input signal". Values above1
will over-brighten the output.This corresponds to the brightness dial of a CRT TV.
- g_blackLevel
-
float g_blackLevel
Type
float
Description
This is the luma value of the input signal that represents black. For our synthetic signals it's typically
0.0
, but from a real NTSC signal this can be some other voltage level, since a voltage of0
typically indicates a horizontal or vertical blank instead.This is calculated from/generated with the composite or S-Video signal the decoder is given.
- g_whiteLevel
-
float g_whiteLevel
Type
float
Description
This is the luma value of the input signal that represents brightest white. For our synthetic signals it's typically
1.0
, but from a real NTSC signal it could be some other value.This is calculated from/generated with the composite or S-Video signal the decoder is given.
- g_temporalArtifactReduction
-
float g_temporalArtifactReduction
Type
float
Description
A [0..1] value indicating how much we want to blend in an alternate version of the generated signal to adjust for any aliasing between successive frames.
A value of
0
means we only have (or want to use) a single input luma/chroma pair. A value greater than0
means we are going to blend the results of two parallel-computed versions of our RGB values, with a value of1.0
being a pure average of the two. - g_inputWidth
-
uint g_inputWidth
Type
uint
Description
The width of the input signal (including any side padding) - g_outputWidth
-
uint g_outputWidth
Type
uint
Description
The width of the output RGB image (should be the width of the input signal minus the side padding).