From e9315c669e7154fe754c439eb4ba13f0fed1e1cc Mon Sep 17 00:00:00 2001 From: hunterk Date: Thu, 27 Jul 2017 09:44:14 -0500 Subject: [PATCH] add Hyllian's detail-preserving super-xbr parameters and presets --- xbr/shaders/super-xbr/super-xbr-pass0.slang | 6 +- xbr/shaders/super-xbr/super-xbr-pass1.slang | 15 +++- xbr/shaders/super-xbr/super-xbr-pass2.slang | 15 +++- xbr/super-xbr-2p-small-details.slangp | 18 ++++ ...super-xbr-3p-smoother-small-details.slangp | 24 ++++++ xbr/super-xbr-6p-small-details.slangp | 43 ++++++++++ ...super-xbr-deposterize-small-details.slangp | 83 +++++++++++++++++++ 7 files changed, 199 insertions(+), 5 deletions(-) create mode 100644 xbr/super-xbr-2p-small-details.slangp create mode 100644 xbr/super-xbr-3p-smoother-small-details.slangp create mode 100644 xbr/super-xbr-6p-small-details.slangp create mode 100644 xbr/super-xbr-deposterize-small-details.slangp diff --git a/xbr/shaders/super-xbr/super-xbr-pass0.slang b/xbr/shaders/super-xbr/super-xbr-pass0.slang index 14403be..d109566 100644 --- a/xbr/shaders/super-xbr/super-xbr-pass0.slang +++ b/xbr/shaders/super-xbr/super-xbr-pass0.slang @@ -35,11 +35,13 @@ layout(push_constant) uniform Push float XBR_EDGE_STR; float XBR_WEIGHT; float XBR_ANTI_RINGING; + float DETAILS; } params; #pragma parameter XBR_EDGE_STR "Xbr - Edge Strength p0" 0.6 0.0 5.0 0.2 #pragma parameter XBR_WEIGHT "Xbr - Filter Weight" 1.0 0.00 1.50 0.01 #pragma parameter XBR_ANTI_RINGING "Xbr - Anti-Ringing Level" 1.0 0.0 1.0 1.0 +#pragma parameter DETAILS "Xbr - Preserve Details" 0.0 0.0 1.0 1.0 #define XBR_EDGE_STR params.XBR_EDGE_STR #define XBR_WEIGHT params.XBR_WEIGHT @@ -55,7 +57,7 @@ layout(std140, set = 0, binding = 0) uniform UBO #define wp1 1.0 #define wp2 0.0 #define wp3 0.0 -#define wp4 2.0 +//#define wp4 2.0 #define wp5 -1.0 #define wp6 0.0 @@ -87,11 +89,13 @@ float df(float A, float B) float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) { + float wp4 = (params.DETAILS > 0.5) ? 1.0 : 2.0; return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); } float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) { + float wp4 = (params.DETAILS > 0.5) ? 1.0 : 2.0; return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); } diff --git a/xbr/shaders/super-xbr/super-xbr-pass1.slang b/xbr/shaders/super-xbr/super-xbr-pass1.slang index 820069b..a4b5e3d 100644 --- a/xbr/shaders/super-xbr/super-xbr-pass1.slang +++ b/xbr/shaders/super-xbr/super-xbr-pass1.slang @@ -36,8 +36,11 @@ layout(push_constant) uniform Push vec4 OriginalSize; vec4 OutputSize; uint FrameCount; + float DETAILS; } params; +#pragma parameter DETAILS "Xbr - Preserve Details" 0.0 0.0 1.0 1.0 + layout(std140, set = 0, binding = 0) uniform UBO { mat4 MVP; @@ -48,8 +51,8 @@ layout(std140, set = 0, binding = 0) uniform UBO #define wp1 1.0 #define wp2 0.0 #define wp3 0.0 -#define wp4 0.0 -#define wp5 0.0 +//#define wp4 0.0 +//#define wp5 0.0 #define wp6 0.0 #define weight1 (XBR_WEIGHT*1.75068/10.0) @@ -79,11 +82,19 @@ float df(float A, float B) float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) { + float wp4 = 0.0; + float wp5 = 0.0; + if(params.DETAILS > 0.5) + { + wp4 = 1.0; + wp5 = -1.0; + } return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); } float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) { + float wp4 = (params.DETAILS > 0.5) ? 1.0 : 0.0; return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); } diff --git a/xbr/shaders/super-xbr/super-xbr-pass2.slang b/xbr/shaders/super-xbr/super-xbr-pass2.slang index 92a795f..2434a75 100644 --- a/xbr/shaders/super-xbr/super-xbr-pass2.slang +++ b/xbr/shaders/super-xbr/super-xbr-pass2.slang @@ -36,8 +36,11 @@ layout(push_constant) uniform Push vec4 OriginalSize; vec4 OutputSize; uint FrameCount; + float DETAILS; } params; +#pragma parameter DETAILS "Xbr - Preserve Details" 0.0 0.0 1.0 1.0 + layout(std140, set = 0, binding = 0) uniform UBO { mat4 MVP; @@ -48,8 +51,8 @@ layout(std140, set = 0, binding = 0) uniform UBO #define wp1 1.0 #define wp2 0.0 #define wp3 0.0 -#define wp4 0.0 -#define wp5 0.0 +//#define wp4 0.0 +//#define wp5 0.0 #define wp6 0.0 #define weight1 (XBR_WEIGHT*1.29633/10.0) @@ -79,11 +82,19 @@ float df(float A, float B) float d_wd(float b0, float b1, float c0, float c1, float c2, float d0, float d1, float d2, float d3, float e1, float e2, float e3, float f2, float f3) { + float wp4 = 0.0; + float wp5 = 0.0; + if(params.DETAILS > 0.5) + { + wp4 = 1.0; + wp5 = -1.0; + } return (wp1*(df(c1,c2) + df(c1,c0) + df(e2,e1) + df(e2,e3)) + wp2*(df(d2,d3) + df(d0,d1)) + wp3*(df(d1,d3) + df(d0,d2)) + wp4*df(d1,d2) + wp5*(df(c0,c2) + df(e1,e3)) + wp6*(df(b0,b1) + df(f2,f3))); } float hv_wd(float i1, float i2, float i3, float i4, float e1, float e2, float e3, float e4) { + float wp4 = (params.DETAILS > 0.5) ? 1.0 : 0.0; return ( wp4*(df(i1,i2)+df(i3,i4)) + wp1*(df(i1,e1)+df(i2,e2)+df(i3,e3)+df(i4,e4)) + wp3*(df(i1,e2)+df(i3,e4)+df(e1,i2)+df(e3,i4))); } diff --git a/xbr/super-xbr-2p-small-details.slangp b/xbr/super-xbr-2p-small-details.slangp new file mode 100644 index 0000000..99f3202 --- /dev/null +++ b/xbr/super-xbr-2p-small-details.slangp @@ -0,0 +1,18 @@ +shaders = "3" +shader0 = "shaders/super-xbr/super-xbr-pass0.slang" +filter_linear0 = false +scale_type_x0 = "source" +scale_x0 = "1.000000" +scale_type_y0 = "source" +scale_y0 = "1.000000" +shader1 = "shaders/super-xbr/super-xbr-pass1.slang" +filter_linear1 = false +scale_type_x1 = "source" +scale_x1 = "2.000000" +scale_type_y1 = "source" +scale_y1 = "2.000000" +shader2 = "shaders/super-xbr/custom-jinc2-sharper.slang" +filter_linear2 = false + +parameters = "DETAILS" +DETAILS = "1.0" \ No newline at end of file diff --git a/xbr/super-xbr-3p-smoother-small-details.slangp b/xbr/super-xbr-3p-smoother-small-details.slangp new file mode 100644 index 0000000..a35ca01 --- /dev/null +++ b/xbr/super-xbr-3p-smoother-small-details.slangp @@ -0,0 +1,24 @@ +shaders = "4" +shader0 = "shaders/super-xbr/super-xbr-pass0.slang" +filter_linear0 = false +scale_type_x0 = "source" +scale_x0 = "1.000000" +scale_type_y0 = "source" +scale_y0 = "1.000000" +shader1 = "shaders/super-xbr/super-xbr-pass1.slang" +filter_linear1 = false +scale_type_x1 = "source" +scale_x1 = "2.000000" +scale_type_y1 = "source" +scale_y1 = "2.000000" +shader2 = "shaders/super-xbr/super-xbr-pass2.slang" +filter_linear2 = false +scale_type_x2 = "source" +scale_x2 = "1.000000" +scale_type_y2 = "source" +scale_y2 = "1.000000" +shader3 = "shaders/super-xbr/custom-jinc2-sharper.slang" +filter_linear3 = false + +parameters = "DETAILS" +DETAILS = "1.0" \ No newline at end of file diff --git a/xbr/super-xbr-6p-small-details.slangp b/xbr/super-xbr-6p-small-details.slangp new file mode 100644 index 0000000..86a3c8b --- /dev/null +++ b/xbr/super-xbr-6p-small-details.slangp @@ -0,0 +1,43 @@ +shaders = "7" +shader0 = "shaders/super-xbr/super-xbr-pass0.slang" +filter_linear0 = false +scale_type_x0 = "source" +scale_x0 = "1.000000" +scale_type_y0 = "source" +scale_y0 = "1.000000" +shader1 = "shaders/super-xbr/super-xbr-pass1.slang" +filter_linear1 = false +scale_type_x1 = "source" +scale_x1 = "2.000000" +scale_type_y1 = "source" +scale_y1 = "2.000000" +alias2 = "PassPrev2" +shader2 = "shaders/super-xbr/super-xbr-pass2.slang" +filter_linear2 = false +scale_type_x2 = "source" +scale_x2 = "1.000000" +scale_type_y2 = "source" +scale_y2 = "1.000000" +shader3 = "shaders/super-xbr/super-xbr-pass0.slang" +filter_linear3 = false +scale_type_x3 = "source" +scale_x3 = "1.000000" +scale_type_y3 = "source" +scale_y3 = "1.000000" +shader4 = "shaders/super-xbr/super-xbr-pass1b.slang" +filter_linear4 = false +scale_type_x4 = "source" +scale_x4 = "2.000000" +scale_type_y4 = "source" +scale_y4 = "2.000000" +shader5 = "shaders/super-xbr/super-xbr-pass2.slang" +filter_linear5 = false +scale_type_x5 = "source" +scale_x5 = "1.000000" +scale_type_y5 = "source" +scale_y5 = "1.000000" +shader6 = "shaders/super-xbr/custom-jinc2-sharper.slang" +filter_linear6 = false + +parameters = "DETAILS" +DETAILS = "1.0" diff --git a/xbr/super-xbr-deposterize-small-details.slangp b/xbr/super-xbr-deposterize-small-details.slangp new file mode 100644 index 0000000..e838c67 --- /dev/null +++ b/xbr/super-xbr-deposterize-small-details.slangp @@ -0,0 +1,83 @@ +shaders = "6" +shader0 = "..\misc\deposterize-pass0.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 = "..\misc\deposterize-pass1.slang" +filter_linear1 = "false" +wrap_mode1 = "clamp_to_border" +mipmap_input1 = "false" +alias1 = "" +float_framebuffer1 = "false" +srgb_framebuffer1 = "false" +scale_type_x1 = "source" +scale_x1 = "1.000000" +scale_type_y1 = "source" +scale_y1 = "1.000000" +shader2 = "..\xbr\shaders\super-xbr\super-xbr-pass0.slang" +filter_linear2 = "false" +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 = "1.000000" +shader3 = "..\xbr\shaders\super-xbr\super-xbr-pass1.slang" +filter_linear3 = "false" +wrap_mode3 = "clamp_to_border" +mipmap_input3 = "false" +alias3 = "" +float_framebuffer3 = "false" +srgb_framebuffer3 = "false" +scale_type_x3 = "source" +scale_x3 = "2.000000" +scale_type_y3 = "source" +scale_y3 = "2.000000" +shader4 = "..\xbr\shaders\super-xbr\super-xbr-pass2.slang" +filter_linear4 = "false" +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 = "..\xbr\shaders\super-xbr\custom-jinc2-sharper.slang" +filter_linear5 = "false" +wrap_mode5 = "clamp_to_border" +mipmap_input5 = "false" +alias5 = "" +float_framebuffer5 = "false" +srgb_framebuffer5 = "false" +parameters = "DETAILS;EQ_THRESH1;DIFF_THRESH1;EQ_THRESH2;DIFF_THRESH2;XBR_EDGE_STR;XBR_HV_EDGE_STR;XBR_WEIGHT;XBR_WEIGHT2;XBR_ANTI_RINGING;WP1;WP2;WP3;WP4;WP5;WP6;JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH" +EQ_THRESH1 = "0.010000" +DIFF_THRESH1 = "0.060000" +EQ_THRESH2 = "0.010000" +DIFF_THRESH2 = "0.060000" +XBR_EDGE_STR = "2.000000" +XBR_HV_EDGE_STR = "2.000000" +XBR_WEIGHT = "1.000000" +XBR_WEIGHT2 = "1.000000" +XBR_ANTI_RINGING = "0.000000" +WP1 = "2.000000" +WP2 = "1.000000" +WP3 = "-1.000000" +WP4 = "4.000000" +WP5 = "-1.000000" +WP6 = "1.000000" +JINC2_WINDOW_SINC = "0.420000" +JINC2_SINC = "0.920000" +JINC2_AR_STRENGTH = "0.000000" +DETAILS = "1.0"