Unverified Commit 3b1d4dd6 authored by hizzlekizzle's avatar hizzlekizzle Committed by GitHub
Browse files

Merge pull request #184 from Tatsuya79/master

update ntsc-tate and some ntsc presets
parents 8524a42d 3075c3c3
Pipeline #42118 passed with stage
in 21 seconds
......@@ -11,4 +11,4 @@ shader1 = shaders/ntsc-adaptive-tate/ntsc-tate-pass2.slang
scale_type1 = source
scale_x1 = 1.0
scale_y1 = 0.5
filter_linear1 = false
filter_linear1 = true
......@@ -11,4 +11,4 @@ shader1 = shaders/ntsc-adaptive/ntsc-pass2.slang
scale_type1 = source
scale_x1 = 0.5
scale_y1 = 1.0
filter_linear1 = false
filter_linear1 = true
......@@ -10,14 +10,17 @@ layout(std140, set = 0, binding = 0) uniform UBO
vec4 OriginalSize;
vec4 SourceSize;
uint FrameCount;
float quality, ntsc_sat, cust_fringing, cust_artifacting, ntsc_bright;
float quality, ntsc_sat, cust_fringing, cust_artifacting, ntsc_bright, ntsc_scale, ntsc_fields, ntsc_phase;
} global;
#pragma parameter quality "Presets (Svideo=0 Composite=1 RF=2 Custom=-1)" 0.0 -1.0 2.0 1.0
#pragma parameter ntsc_sat "Color Saturation" 1.0 0.0 2.0 0.01
#pragma parameter ntsc_bright "Brightness" 1.0 0.0 1.5 0.01
#pragma parameter cust_fringing "Custom Fringing Value" 0.0 0.0 5.0 0.1
#pragma parameter cust_artifacting "Custom Artifacting Value" 0.0 0.0 5.0 0.1
#pragma parameter quality "NTSC Preset (Svideo=0 Composite=1 RF=2 Custom=-1)" 1.0 -1.0 2.0 1.0
#pragma parameter ntsc_fields "NTSC Merge Fields" 0.0 0.0 1.0 1.0
#pragma parameter ntsc_phase "NTSC Phase: Auto | 2 phase | 3 phase" 1.0 1.0 3.0 1.0
#pragma parameter ntsc_scale "NTSC Resolution Scaling" 1.0 0.20 3.0 0.05
#pragma parameter ntsc_sat "NTSC Color Saturation" 1.0 0.0 2.0 0.01
#pragma parameter ntsc_bright "NTSC Brightness" 1.0 0.0 1.5 0.01
#pragma parameter cust_fringing "NTSC Custom Fringing Value" 0.0 0.0 5.0 0.1
#pragma parameter cust_artifacting "NTSC Custom Artifacting Value" 0.0 0.0 5.0 0.1
#define PI 3.14159265
......@@ -32,18 +35,28 @@ layout(location = 4) out float SATURATION;
layout(location = 5) out float FRINGING;
layout(location = 6) out float ARTIFACTING;
layout(location = 7) out float CHROMA_MOD_FREQ;
layout(location = 8) out float MERGE;
void main()
{
float res = global.ntsc_scale;
float OriginalSize = global.OriginalSize.y;
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
pix_no = TexCoord * global.SourceSize.xy * (global.OutputSize.xy / global.SourceSize.xy);
phase = (global.OriginalSize.x > 300.0) ? 2.0 : 3.0;
if (res < 1.0) pix_no = TexCoord * global.SourceSize.xy * (res * global.OutputSize.xy / global.SourceSize.xy); else
pix_no = TexCoord * global.SourceSize.xy * ( global.OutputSize.xy / global.SourceSize.xy);
phase = (global.ntsc_phase < 1.5) ? ((OriginalSize > 300.0) ? 2.0 : 3.0) : ((global.ntsc_phase > 2.5) ? 3.0 : 2.0);
res = max(res, 1.0);
CHROMA_MOD_FREQ = (phase < 2.5) ? (4.0 * PI / 15.0) : (PI / 3.0);
ARTIFACTING = (global.quality > -0.5) ? global.quality : global.cust_artifacting;
ARTIFACTING = (global.quality > -0.5) ? global.quality * 0.5*(res+1.0) : global.cust_artifacting;
FRINGING = (global.quality > -0.5) ? global.quality : global.cust_fringing;
SATURATION = global.ntsc_sat;
BRIGHTNESS = global.ntsc_bright;
BRIGHTNESS = global.ntsc_bright;
pix_no.y = pix_no.y * res;
MERGE = (int(global.quality) == 2 || phase < 2.5) ? 0.0 : 1.0;
MERGE = (int(global.quality) == -1) ? global.ntsc_fields : MERGE;
}
#pragma stage fragment
......@@ -55,6 +68,7 @@ layout(location = 4) in float SATURATION;
layout(location = 5) in float FRINGING;
layout(location = 6) in float ARTIFACTING;
layout(location = 7) in float CHROMA_MOD_FREQ;
layout(location = 8) in float MERGE;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;
......@@ -85,9 +99,23 @@ void main()
{
vec3 col = texture(Source, vTexCoord).rgb;
vec3 yiq = rgb2yiq(col);
vec3 yiq2 = yiq;
float chroma_phase = (phase < 2.5) ? PI * (mod(pix_no.x, 2.0) + mod(global.FrameCount, 2.)) : 0.6667 * PI * (mod(pix_no.x, 3.0) + mod(global.FrameCount, 2.));
float mod1 = 2.0;
float mod2 = 3.0;
if (MERGE > 0.5)
{
float chroma_phase2 = (phase < 2.5) ? PI * (mod(pix_no.x, mod1) + mod(global.FrameCount+1, 2.)) : 0.6667 * PI * (mod(pix_no.x, mod2) + mod(global.FrameCount+1, 2.));
float mod_phase2 = chroma_phase2 + pix_no.y * CHROMA_MOD_FREQ;
float i_mod2 = cos(mod_phase2);
float q_mod2 = sin(mod_phase2);
yiq2.yz *= vec2(i_mod2, q_mod2); // Modulate.
yiq2 *= mix_mat; // Cross-talk.
yiq2.yz *= vec2(i_mod2, q_mod2); // Demodulate.
}
float chroma_phase = (phase < 2.5) ? PI * (mod(pix_no.x, mod1) + mod(global.FrameCount, 2.)) : 0.6667 * PI * (mod(pix_no.x, mod2) + mod(global.FrameCount, 2.));
float mod_phase = chroma_phase + pix_no.y * CHROMA_MOD_FREQ;
float i_mod = cos(mod_phase);
......@@ -96,5 +124,8 @@ void main()
yiq.yz *= vec2(i_mod, q_mod); // Modulate.
yiq *= mix_mat; // Cross-talk.
yiq.yz *= vec2(i_mod, q_mod); // Demodulate.
yiq = (MERGE < 0.5) ? yiq : 0.5*(yiq+yiq2);
FragColor = vec4(yiq, 1.0);
}
......@@ -10,9 +10,14 @@ layout(std140, set = 0, binding = 0) uniform UBO
vec4 OriginalSize;
vec4 SourceSize;
float linearize;
float ntsc_scale;
float ntsc_phase;
float auto_res;
} global;
#pragma parameter linearize "Linearize Output Gamma" 0.0 0.0 1.0 1.0
#pragma parameter ntsc_scale "NTSC Resolution Scaling" 1.0 0.20 3.0 0.05
#pragma parameter ntsc_phase "NTSC Phase: Auto | 2 phase | 3 phase" 1.0 1.0 3.0 1.0
#pragma parameter linearize "NTSC Linearize Output Gamma" 0.0 0.0 1.0 1.0
#pragma stage vertex
layout(location = 0) in vec4 Position;
......@@ -184,9 +189,11 @@ const float chroma_filter_3_phase[25] = float[25](
void main()
{
float phase = (global.OriginalSize.y > 300.0) ? 2.0 : 3.0;
float one_y = global.SourceSize.w;
float res = global.ntsc_scale;
float OriginalSize = global.OriginalSize.y;
float one_y = global.SourceSize.w / res;
vec3 signal = vec3(0.0);
float phase = (global.ntsc_phase < 1.5) ? ((OriginalSize > 300.0) ? 2.0 : 3.0) : ((global.ntsc_phase > 2.5) ? 3.0 : 2.0);
if(phase < 2.5)
{
......
......@@ -22,7 +22,7 @@ scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "4.000000"
shader2 = "../ntsc/shaders/ntsc-adaptive-tate/ntsc-tate-pass2.slang"
filter_linear2 = "false"
filter_linear2 = "true"
wrap_mode2 = "clamp_to_border"
mipmap_input2 = "false"
alias2 = ""
......
......@@ -22,7 +22,7 @@ scale_x1 = "4.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = "../ntsc/shaders/ntsc-adaptive/ntsc-pass2.slang"
filter_linear2 = "false"
filter_linear2 = "true"
wrap_mode2 = "clamp_to_border"
mipmap_input2 = "false"
alias2 = ""
......
shaders = "6"
shader0 = "../misc/ntsc-colors.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "../ntsc/shaders/ntsc-adaptive-tate/ntsc-tate-pass1.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = ""
float_framebuffer1 = "true"
srgb_framebuffer1 = "false"
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "4.000000"
shader2 = "../ntsc/shaders/ntsc-adaptive-tate/ntsc-tate-pass2.slang"
filter_linear2 = "true"
wrap_mode2 = "clamp_to_border"
mipmap_input2 = "false"
alias2 = ""
float_framebuffer2 = "false"
srgb_framebuffer2 = "false"
scale_type_x2 = "source"
scale_x2 = "1.000000"
scale_type_y2 = "source"
scale_y2 = "0.500000"
shader3 = "../warp/shaders/smart-morph.slang"
wrap_mode3 = "clamp_to_border"
mipmap_input3 = "false"
alias3 = ""
float_framebuffer3 = "false"
srgb_framebuffer3 = "false"
scale_type_x3 = "source"
scale_x3 = "1.000000"
scale_type_y3 = "source"
scale_y3 = "1.000000"
shader4 = "../sharpen/shaders/fast-sharpen.slang"
wrap_mode4 = "clamp_to_border"
mipmap_input4 = "false"
alias4 = ""
float_framebuffer4 = "false"
srgb_framebuffer4 = "false"
scale_type_x4 = "source"
scale_x4 = "1.000000"
scale_type_y4 = "source"
scale_y4 = "1.000000"
shader5 = "../crt/shaders/crt-geom.slang"
wrap_mode5 = "clamp_to_border"
mipmap_input5 = "false"
alias5 = ""
float_framebuffer5 = "false"
srgb_framebuffer5 = "false"
intensity = "0.0"
quality = "0.0"
ntsc_scale = "1.5"
SM_RANGE = "2.0"
SM_PWR = "1.1"
CONTR = "0.15"
CRTgamma = "2.2"
CURVATURE = "1.0"
d = "1.5"
R = "1.8"
cornersize = "0.0155"
y_tilt = "-0.05"
scanline_weight = "0.25"
DOTMASK = "0.0"
lum = "0.15"
interlace_detect = "0.0"
vertical_scanlines = "1.0"
shaders = "6"
shader0 = "../misc/ntsc-colors.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "../ntsc/shaders/ntsc-adaptive/ntsc-pass1.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = ""
float_framebuffer1 = "true"
srgb_framebuffer1 = "false"
scale_type_x1 = "source"
scale_x1 = "4.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = "../ntsc/shaders/ntsc-adaptive/ntsc-pass2.slang"
filter_linear2 = "true"
wrap_mode2 = "clamp_to_border"
mipmap_input2 = "false"
alias2 = ""
float_framebuffer2 = "false"
srgb_framebuffer2 = "false"
scale_type_x2 = "source"
scale_x2 = "0.500000"
scale_type_y2 = "source"
scale_y2 = "1.000000"
shader3 = "../warp/shaders/smart-morph.slang"
wrap_mode3 = "clamp_to_border"
mipmap_input3 = "false"
alias3 = ""
float_framebuffer3 = "false"
srgb_framebuffer3 = "false"
scale_type_x3 = "source"
scale_x3 = "1.000000"
scale_type_y3 = "source"
scale_y3 = "1.000000"
shader4 = "../sharpen/shaders/fast-sharpen.slang"
wrap_mode4 = "clamp_to_border"
mipmap_input4 = "false"
alias4 = ""
float_framebuffer4 = "false"
srgb_framebuffer4 = "false"
scale_type_x4 = "source"
scale_x4 = "1.000000"
scale_type_y4 = "source"
scale_y4 = "1.000000"
shader5 = "../crt/shaders/crt-geom.slang"
wrap_mode5 = "clamp_to_border"
mipmap_input5 = "false"
alias5 = ""
float_framebuffer5 = "false"
srgb_framebuffer5 = "false"
intensity = "0.0"
quality = "0.0"
ntsc_scale = "1.5"
SM_RANGE = "1.0"
SM_PWR = "1.1"
CONTR = "0.15"
CRTgamma = "2.2"
CURVATURE = "1.0"
d = "1.5"
R = "1.8"
cornersize = "0.0155"
y_tilt = "-0.05"
scanline_weight = "0.25"
DOTMASK = "0.0"
lum = "0.15"
interlace_detect = "0.0"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment