From 3bef75fbe9d7f9212b1efee24b9312544bf1d6de Mon Sep 17 00:00:00 2001 From: bloc97 Date: Thu, 26 Mar 2020 02:28:08 -0400 Subject: [PATCH] v2.1a Hotfix Hotfix: Perform downscaling before applying the x4 prescaler. 720p scaled to x4 is bigger than 4K, which is unecessary and slows the algorithm down. Added L version that contains a larger prescaler. Significant improvements to low resolution anime (eg. 480p) --- glsl/Anime4K_Hybrid_v2.1a.glsl | 1045 ++++++++++++++++ glsl/Anime4K_Hybrid_v2.1a_L.glsl | 1908 ++++++++++++++++++++++++++++++ 2 files changed, 2953 insertions(+) create mode 100644 glsl/Anime4K_Hybrid_v2.1a.glsl create mode 100644 glsl/Anime4K_Hybrid_v2.1a_L.glsl diff --git a/glsl/Anime4K_Hybrid_v2.1a.glsl b/glsl/Anime4K_Hybrid_v2.1a.glsl new file mode 100644 index 00000000..41c76d71 --- /dev/null +++ b/glsl/Anime4K_Hybrid_v2.1a.glsl @@ -0,0 +1,1045 @@ +//Anime4K Hybrid GLSL v2.1a + +// MIT License + +// Copyright (c) 2019-2020 bloc97, DextroseRe +// All rights reserved. + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +//!DESC Anime4K-Hybrid-Chroma-Upscale-v2.1a +//!HOOK CHROMA +//!BIND HOOKED +//!BIND LUMA +//!WHEN CHROMA.w LUMA.w < +//!WIDTH CHROMA.w 2 * +//!HEIGHT CHROMA.h 2 * + +/* ---------------------- BILATERAL FILTERING SETTINGS ---------------------- */ + +#define STRENGTH 0.1 +#define SPREAD_STRENGTH 2.0 + +/* --- MOST OF THE OTHER SETTINGS CAN BE FOUND AT THE END --- */ + +#define KERNELSIZE 3 +#define KERNELHALFSIZE 1 +#define KERNELLEN 9 + + +float gaussian(float x, float s, float m) { + return (1 / (s * sqrt(2 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0)); +} + +vec4 hook() { + vec2 d = HOOKED_pt; + + float vc = LUMA_tex(HOOKED_pos).x; + + float s = vc * STRENGTH + 0.0001; + float ss = SPREAD_STRENGTH + 0.0001; + + vec4 valsum = vec4(0); + float normsum = 0.000001; //Avoid divide by zero + + for (int i=0; i maxw) { + maxw = histogram_w[i]; + maxv = histogram_v[i]; + } + } + + return maxv; +} + +vec4 hook() { + vec2 d = HOOKED_pt; + + float sharpval = clamp(HOOKED_size.x / 1920, 0, 1); + + + vec4 histogram_v[KERNELLEN]; + float histogram_w[KERNELLEN]; + float histogram_wn[KERNELLEN]; + + float vc = HOOKED_tex(HOOKED_pos).x; + + float s = vc * STRENGTH + 0.0001; + float ss = SPREAD_STRENGTH * sharpval + 0.0001; + + + for (int i=0; i OUTPUT.h LUMA.h / 1.400 > * +//!SAVE LUMAN0 +//!COMPONENTS 4 + + +vec4 hook() { + vec2 dp = HOOKED_pt; + float a = HOOKED_tex(HOOKED_pos + vec2(-dp.x, -dp.y)).x; + float b = HOOKED_tex(HOOKED_pos + vec2(-dp.x, 0)).x; + float c = HOOKED_tex(HOOKED_pos + vec2(-dp.x, dp.y)).x; + float d = HOOKED_tex(HOOKED_pos + vec2(0, -dp.y)).x; + float e = HOOKED_tex(HOOKED_pos + vec2(0, 0)).x; + float f = HOOKED_tex(HOOKED_pos + vec2(0, dp.y)).x; + float g = HOOKED_tex(HOOKED_pos + vec2(dp.x, -dp.y)).x; + float h = HOOKED_tex(HOOKED_pos + vec2(dp.x, 0)).x; + float i = HOOKED_tex(HOOKED_pos + vec2(dp.x, dp.y)).x; + + float s = 0.06518857*a + -0.0118667185*b + -0.07614037*c + -0.46956885*d + 0.2812869*e + 0.4135128*f + -0.117597*g + -0.43488324*h + 0.33814532*i; + float o = s+0.018250784; + s = 0.004705962*a + 0.064553976*b + -0.07471142*c + -0.12856083*d + 0.15492548*e + 0.7035231*f + 0.16384916*g + -0.8741586*h + -0.012426951*i; + float p = s+0.0018347593; + s = -0.002186087*a + 0.08980697*b + -0.075706676*c + 0.21820599*d + -1.4773877*e + 0.39514637*f + -0.049297944*g + 0.3549184*h + 0.5490852*i; + float q = s+0.0019366593; + s = -0.0019400899*a + 0.02402473*b + -0.07429219*c + 0.16930206*d + -0.2798244*e + 0.08784747*f + -0.018798571*g + 0.039233245*h + 0.053139925*i; + float r = s+0.0028748403; + return vec4(o, p, q, r); +} + + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.400 > OUTPUT.h LUMA.h / 1.400 > * +//!BIND LUMAN0 +//!SAVE LUMAN0 +//!COMPONENTS 4 + +#define L_tex LUMAN0_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + + float s = -0.078850485*a.x + 0.008778143*b.x + 0.09409134*c.x + 0.17980288*d.x + -0.13836896*e.x + 0.041511726*f.x + 0.111073226*g.x + 0.24465907*h.x + -0.2613636*i.x; + float t = 0.04978624*a.y + -0.043356195*b.y + -0.08137738*c.y + -0.028674556*d.y + -0.0042590224*e.y + -0.06741321*f.y + 0.04029311*g.y + -0.069561794*h.y + 0.067619696*i.y; + float u = -0.0061189956*a.z + 0.051833455*b.z + -0.042832106*c.z + 0.26535267*d.z + 0.36819696*e.z + 0.03438765*f.z + 0.22989632*g.z + -0.487135*h.z + 0.15665813*i.z; + float v = -0.13148193*a.w + -0.12638648*b.w + 0.03605439*c.w + 0.0974745*d.w + -0.10980721*e.w + -0.21564873*f.w + 0.34306243*g.w + 0.69539255*h.w + -0.03078458*i.w; + float w = 0.1898412*na.x + 0.05917433*nb.x + -0.15381081*nc.x + -0.15773135*nd.x + 0.29555428*ne.x + 0.096428104*nf.x + 0.090633914*ng.x + -0.31970337*nh.x + 0.18953186*ni.x; + float x = -0.26538706*na.y + 0.13089244*nb.y + 0.16604574*nc.y + -0.5723114*nd.y + -0.16346131*ne.y + -0.014951056*nf.y + 0.09785819*ng.y + -0.017660556*nh.y + -0.09167879*ni.y; + float y = 0.009693713*na.z + 0.010756051*nb.z + 0.017140212*nc.z + -0.533805*nd.z + -0.5435189*ne.z + -0.064089194*nf.z + -0.31916615*ng.z + 0.5331712*nh.z + -0.13033615*ni.z; + float z = 0.35296175*na.w + 0.25480655*nb.w + 0.035030134*nc.w + 0.15741913*nd.w + 0.060176335*ne.w + 0.05028458*nf.w + -0.12958519*ng.w + 0.028535347*nh.w + 0.15037805*ni.w; + float o = s+t+u+v+w+x+y+z+-0.00046534537; + s = -0.10862142*a.x + 0.23951219*b.x + 0.2839895*c.x + -0.05217377*d.x + -0.40397635*e.x + 0.049454965*f.x + 0.052400503*g.x + 0.118543915*h.x + 0.06852737*i.x; + t = 0.4241042*a.y + -0.12584575*b.y + -0.102870226*c.y + 0.28188303*d.y + 0.49546632*e.y + 0.117695816*f.y + -0.08839783*g.y + -0.14269592*h.y + -0.03292176*i.y; + u = 0.007181128*a.z + -0.40109172*b.z + -0.24221501*c.z + -0.06402019*d.z + 0.60842943*e.z + -0.10117115*f.z + -0.14966127*g.z + -0.14179903*h.z + -0.03214188*i.z; + v = 0.049681976*a.w + -0.18726541*b.w + -0.13386123*c.w + -0.43944734*d.w + -0.7732026*e.w + -0.19998854*f.w + 0.0016352575*g.w + -0.15936574*h.w + 0.11486744*i.w; + w = 0.034904238*na.x + -0.3936257*nb.x + -0.3924321*nc.x + 0.13237436*nd.x + 0.41971052*ne.x + -0.17690897*nf.x + -0.104041904*ng.x + -0.10885315*nh.x + -0.07546228*ni.x; + x = 0.19798991*na.y + 0.4755196*nb.y + 0.1685174*nc.y + -0.056067895*nd.y + -0.3281361*ne.y + -0.060975373*nf.y + 0.15498285*ng.y + 0.23860317*nh.y + 0.078440316*ni.y; + y = 0.22032484*na.z + 0.45825586*nb.z + 0.24928105*nc.z + 0.0740922*nd.z + -0.83567154*ne.z + 0.1469111*nf.z + 0.1061305*ng.z + 0.054175954*nh.z + 0.023593672*ni.z; + z = 0.02721891*na.w + -0.40433592*nb.w + -0.20104738*nc.w + -0.090347335*nd.w + 0.32021475*ne.w + -0.2523179*nf.w + 0.18747182*ng.w + -0.042044852*nh.w + -0.28740782*ni.w; + float p = s+t+u+v+w+x+y+z+-0.0048994347; + s = 0.03506187*a.x + -0.19858655*b.x + 0.12969843*c.x + -0.10771284*d.x + -0.09441664*e.x + 0.45179757*f.x + 0.0192464*g.x + 0.08926137*h.x + -0.06842973*i.x; + t = -0.06226018*a.y + -0.032557767*b.y + -0.16808012*c.y + -0.05757842*d.y + 0.16631629*e.y + -0.34194738*f.y + 0.005270219*g.y + 0.02339046*h.y + 0.079298474*i.y; + u = 0.125203*a.z + 0.11796023*b.z + 0.13894552*c.z + 0.122039534*d.z + 0.093743816*e.z + -0.36432076*f.z + 0.024767118*g.z + 0.05475351*h.z + 0.025071215*i.z; + v = -0.18731116*a.w + 0.12831227*b.w + -0.17373508*c.w + -0.3514785*d.w + -0.6449611*e.w + -0.13499886*f.w + 0.010178755*g.w + -0.49852073*h.w + 0.0992664*i.w; + w = -0.047569968*na.x + 0.107844934*nb.x + -0.34977105*nc.x + 0.123500414*nd.x + 0.055304836*ne.x + -0.48315105*nf.x + 0.0026811515*ng.x + -0.08091307*nh.x + 0.0610684*ni.x; + x = 0.15171343*na.y + 0.57235277*nb.y + 0.255104*nc.y + 0.031828027*nd.y + -0.07049035*ne.y + 0.40309858*nf.y + -0.027855068*ng.y + 0.033779*nh.y + -0.08337315*ni.y; + y = -0.05789993*na.z + 0.15511025*nb.z + -0.18869878*nc.z + -0.124532856*nd.z + -0.1330072*ne.z + 0.37427673*nf.z + -0.041740254*ng.z + -0.08676065*nh.z + -0.007624626*ni.z; + z = -0.040559176*na.w + -0.035778075*nb.w + 0.071473464*nc.w + 0.23743495*nd.w + -0.32282174*ne.w + 0.105933495*nf.w + 0.04571244*ng.w + 0.5551143*nh.w + -0.093935035*ni.w; + float q = s+t+u+v+w+x+y+z+-0.0033313776; + s = 0.075606935*a.x + 0.12968872*b.x + -0.17267832*c.x + -0.017534962*d.x + -0.21092632*e.x + 0.6039601*f.x + 0.0006366408*g.x + -0.3433534*h.x + 0.4382395*i.x; + t = -0.31210127*a.y + -0.24801569*b.y + 0.14311266*c.y + 0.266147*d.y + 0.20114625*e.y + -0.40220937*f.y + -0.2854783*g.y + -0.13323757*h.y + -0.1416884*i.y; + u = -0.08245917*a.z + -0.04328727*b.z + 0.011549445*c.z + 0.03169343*d.z + 0.30852476*e.z + -0.14224593*f.z + -0.2026233*g.z + 0.49105433*h.z + -0.27598178*i.z; + v = -0.03321247*a.w + -0.18208264*b.w + 0.0034254584*c.w + 0.093554296*d.w + -0.8836113*e.w + -0.21680102*f.w + -0.27222317*g.w + -1.0443908*h.w + -0.5674947*i.w; + w = -0.01619753*na.x + -0.12963338*nb.x + 0.17563225*nc.x + 0.004585129*nd.x + -0.3158967*ne.x + -0.872042*nf.x + -0.03607397*ng.x + 0.21791828*nh.x + -0.39065713*ni.x; + x = 0.20459439*na.y + 0.14653577*nb.y + -0.20970102*nc.y + -0.22334248*nd.y + -0.1049179*ne.y + 0.4063564*nf.y + -0.004260764*ng.y + 0.0077243396*nh.y + 0.19195783*ni.y; + y = 0.14778891*na.z + 0.08660305*nb.z + 0.069295146*nc.z + 0.085611*nd.z + 0.37579855*ne.z + 0.29285663*nf.z + 0.17906432*ng.z + -0.37996793*nh.z + 0.23048665*ni.z; + z = -0.30503413*na.w + -0.008632153*nb.w + -0.03432621*nc.w + -0.6234461*nd.w + 0.2332829*ne.w + -0.15835847*nf.w + 0.17630823*ng.w + -0.004949296*nh.w + 0.10454355*ni.w; + float r = s+t+u+v+w+x+y+z+-0.006210959; + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.400 > OUTPUT.h LUMA.h / 1.400 > * +//!BIND LUMAN0 +//!SAVE LUMAN0 +//!COMPONENTS 4 + +#define L_tex LUMAN0_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + + float s = -0.076375276*a.x + -0.16192478*b.x + -0.3435801*c.x + -0.102615885*d.x + -0.34291154*e.x + -0.3715771*f.x + -0.040065594*g.x + -0.031282134*h.x + -0.14007968*i.x; + float t = 0.0672231*a.y + -0.04764941*b.y + 0.098419875*c.y + 0.25985655*d.y + -0.38082376*e.y + 0.49276826*f.y + 0.08231613*g.y + 0.110389665*h.y + 0.12316233*i.y; + float u = 0.062234916*a.z + -0.08981316*b.z + 0.035350677*c.z + 0.3298534*d.z + -0.53112257*e.z + 0.07900975*f.z + -0.5878461*g.z + 0.3894751*h.z + 0.14318523*i.z; + float v = -0.067861155*a.w + 0.5679219*b.w + -0.20925492*c.w + -0.10364462*d.w + 0.04910827*e.w + 0.05719115*f.w + -0.030506052*g.w + 0.19142777*h.w + 0.029463196*i.w; + float w = -0.06478752*na.x + -0.35909376*nb.x + -0.049066383*nc.x + -0.06414304*nd.x + -0.13888775*ne.x + -0.059843887*nf.x + -0.076657444*ng.x + -0.20727734*nh.x + 0.037852272*ni.x; + float x = 0.0111666415*na.y + 0.11577456*nb.y + -0.07413471*nc.y + -0.020178368*nd.y + 0.16065867*ne.y + 0.114819236*nf.y + 0.102682814*ng.y + -0.026029458*nh.y + 0.09669771*ni.y; + float y = -0.07489544*na.z + -0.16045223*nb.z + -0.09865632*nc.z + 0.033090383*nd.z + -0.31668448*ne.z + -0.10984895*nf.z + 0.072489046*ng.z + -0.082067624*nh.z + -0.021043802*ni.z; + float z = 0.15612242*na.w + 0.25616717*nb.w + 0.15281045*nc.w + 0.12763329*nd.w + 0.44922253*ne.w + 0.069874264*nf.w + 0.049967453*ng.w + -0.016834527*nh.w + 0.076151155*ni.w; + float o = s+t+u+v+w+x+y+z+0.004368779; + s = -0.047799945*a.x + -0.11515582*b.x + -0.40791252*c.x + 0.018251693*d.x + 0.14576633*e.x + -0.11556127*f.x + -0.03873749*g.x + 0.060810573*h.x + -0.07200133*i.x; + t = 0.16543166*a.y + 0.011941809*b.y + 0.047324877*c.y + 0.04958495*d.y + -0.1651876*e.y + 0.43078738*f.y + -0.02519319*g.y + 0.20227197*h.y + 0.025999023*i.y; + u = 0.033441387*a.z + 0.016795462*b.z + 0.057281017*c.z + 1.5043137*d.z + 0.31060156*e.z + 0.07275219*f.z + -1.1843078*g.z + -0.6761157*h.z + 0.0029731095*i.z; + v = 0.4444829*a.w + -0.42409083*b.w + -0.26248664*c.w + -0.01794927*d.w + -0.018550927*e.w + 0.017927665*f.w + -0.032345075*g.w + 0.20667751*h.w + 0.0010150699*i.w; + w = 0.099501655*na.x + -0.28775364*nb.x + 0.32228288*nc.x + -0.00772114*nd.x + -0.23449002*ne.x + -0.09296215*nf.x + -0.054157354*ng.x + -0.27360436*nh.x + -0.03951609*ni.x; + x = -0.028245373*na.y + -0.121913314*nb.y + 0.07654564*nc.y + -0.049665563*nd.y + 0.7794895*ne.y + -0.1505789*nf.y + -0.03943592*ng.y + -0.34458607*nh.y + 0.084370665*ni.y; + y = -0.08433866*na.z + 0.051757183*nb.z + -0.020638762*nc.z + -0.33128256*nd.z + -0.650777*ne.z + -0.11522274*nf.z + 0.26052502*ng.z + 0.34106*nh.z + 0.014920869*ni.z; + z = 0.04507247*na.w + -0.103196636*nb.w + 0.13806596*nc.w + 0.08855919*nd.w + 0.19656824*ne.w + 0.09237863*nf.w + 0.046644468*ng.w + -0.04016784*nh.w + 0.04972401*ni.w; + float p = s+t+u+v+w+x+y+z+0.0046657724; + s = -0.056063537*a.x + 0.31379348*b.x + 0.08083433*c.x + -0.07988621*d.x + -0.28616846*e.x + -0.08654294*f.x + 0.113976635*g.x + 0.06516338*h.x + 0.018438872*i.x; + t = -0.11620833*a.y + 0.21208929*b.y + -0.11346605*c.y + -0.067703396*d.y + -0.43201342*e.y + -0.5345245*f.y + 0.07686346*g.y + 0.6436457*h.y + 0.26798856*i.y; + u = -0.06619781*a.z + -0.10010958*b.z + -0.07167439*c.z + -0.13878949*d.z + 0.0575283*e.z + -0.01815303*f.z + -0.076679595*g.z + 0.25056645*h.z + -0.030564506*i.z; + v = 0.12286161*a.w + -0.31997183*b.w + 0.4049721*c.w + -0.014453491*d.w + -0.12128047*e.w + -0.20630093*f.w + 0.064631835*g.w + 0.06505699*h.w + -0.04836569*i.w; + w = 0.030468628*na.x + -0.9605534*nb.x + 0.31949607*nc.x + -0.028109128*nd.x + 0.17402208*ne.x + 0.40973142*nf.x + -0.030756505*ng.x + -0.06860691*nh.x + 0.078861415*ni.x; + x = -0.018858679*na.y + 0.01308505*nb.y + 0.0344467*nc.y + -0.16346104*nd.y + 0.16348976*ne.y + -0.08839573*nf.y + 0.015383088*ng.y + -0.14421648*nh.y + -0.12157047*ni.y; + y = -0.2401164*na.z + 0.12919497*nb.z + -0.026884526*nc.z + 0.011329444*nd.z + -0.11406845*ne.z + -0.029941153*nf.z + 0.2084126*ng.z + -0.15498434*nh.z + 0.02121424*ni.z; + z = 0.11573471*na.w + -0.03703832*nb.w + 0.019915955*nc.w + -0.08166001*nd.w + 0.09089532*ne.w + 0.016573701*nf.w + -0.093835354*ng.w + -0.03263581*nh.w + 0.07502409*ni.w; + float q = s+t+u+v+w+x+y+z+0.0028720675; + s = -0.09465834*a.x + -0.07953802*b.x + -0.17295821*c.x + -0.08021209*d.x + -0.1958469*e.x + -0.24971394*f.x + -0.12543827*g.x + -0.034206524*h.x + -0.042293545*i.x; + t = 0.017930178*a.y + -0.022108268*b.y + 0.09107495*c.y + 0.2796261*d.y + 0.26334488*e.y + 0.3403926*f.y + 0.0052007795*g.y + 0.00029919678*h.y + 0.2550915*i.y; + u = 0.026925193*a.z + -0.04275811*b.z + -0.0047453125*c.z + -0.11763906*d.z + -0.169145*e.z + 0.07742117*f.z + 0.07685529*g.z + -0.040824294*h.z + 0.07746296*i.z; + v = -0.345795*a.w + 0.43350878*b.w + -0.3304852*c.w + -0.06460919*d.w + 0.029501494*e.w + 0.088321574*f.w + -0.03855111*g.w + 0.14674814*h.w + 0.08218873*i.w; + w = -0.051307168*na.x + -0.19062272*nb.x + -0.385643*nc.x + -0.059386916*nd.x + -0.32816103*ne.x + -0.039611306*nf.x + 0.02802185*ng.x + -0.12741719*nh.x + -0.03717902*ni.x; + x = 0.047177624*na.y + 0.09041485*nb.y + -0.051103875*nc.y + 0.1100884*nd.y + -0.19083166*ne.y + 0.2213158*nf.y + 0.07442079*ng.y + 0.3593766*nh.y + -0.24011746*ni.y; + y = -0.076973915*na.z + -0.19071229*nb.z + -0.055816684*nc.z + -0.11463048*nd.z + -0.07194704*ne.z + -0.14436463*nf.z + -0.35647246*ng.z + 0.14373139*nh.z + 0.08208823*ni.z; + z = 0.16350232*na.w + 0.24001768*nb.w + 0.1772575*nc.w + 0.08607296*nd.w + -0.08327933*ne.w + 0.33616975*nf.w + 0.09244664*ng.w + -0.026265353*nh.w + 0.04598941*ni.w; + float r = s+t+u+v+w+x+y+z+0.00076911174; + + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.400 > OUTPUT.h LUMA.h / 1.400 > * +//!BIND LUMAN0 +//!SAVE LUMAN0 +//!COMPONENTS 4 + +#define L_tex LUMAN0_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + + float s = 0.07986198*a.x + 0.11342182*b.x + -0.0030975514*c.x + -0.19796455*d.x + 0.013101459*e.x + -0.04200098*f.x + 0.017225444*g.x + -0.0014372912*h.x + 0.008370759*i.x; + float t = 0.014841376*a.y + -0.041046176*b.y + 0.03788454*c.y + 0.054837294*d.y + 0.13426651*e.y + -0.0080451695*f.y + -0.029857455*g.y + -0.012871764*h.y + -0.03441029*i.y; + float u = 0.06245403*a.z + -0.012831481*b.z + 0.061856076*c.z + 0.064062476*d.z + -0.066138364*e.z + -0.0026366066*f.z + 0.011879*g.z + -0.011122004*h.z + 0.0017384114*i.z; + float v = -0.05975413*a.w + -0.17485596*b.w + 0.025911752*c.w + 0.118029304*d.w + 0.04408629*e.w + 0.008907612*f.w + 0.01642477*g.w + -0.0092969695*h.w + -0.000769117*i.w; + float w = 0.051101964*na.x + -0.18510687*nb.x + 0.028513199*nc.x + 0.14805903*nd.x + -0.20142192*ne.x + 0.056813676*nf.x + 0.0017134928*ng.x + 0.054168973*nh.x + -0.021714801*ni.x; + float x = -0.020875074*na.y + 0.0048777545*nb.y + -0.06269994*nc.y + -0.03472058*nd.y + 0.048265714*ne.y + 0.0035236937*nf.y + 0.005227413*ng.y + -0.027124068*nh.y + 0.018154047*ni.y; + float y = -0.01159801*na.z + 0.033479054*nb.z + -0.038438387*nc.z + -0.052317906*nd.z + -0.17036878*ne.z + 0.030379958*nf.z + 0.00838193*ng.z + 0.056501616*nh.z + 0.012519291*ni.z; + float z = -0.09538882*na.w + 0.26771805*nb.w + -0.043541078*nc.w + -0.032106128*nd.w + 0.0934046*ne.w + -0.01805561*nf.w + -0.04645964*ng.w + -0.0036514637*nh.w + 0.008913154*ni.w; + float o = s+t+u+v+w+x+y+z+-0.00044684345; + s = -0.011545017*a.x + -0.014384322*b.x + 0.017081236*c.x + -0.08324924*d.x + 0.21428387*e.x + -0.013944155*f.x + -0.02362489*g.x + -0.048795808*h.x + -0.028883195*i.x; + t = 0.018386116*a.y + -0.026253551*b.y + 0.0118806455*c.y + 0.037654113*d.y + -0.06835073*e.y + 0.032385923*f.y + 0.0026887117*g.y + 0.10095452*h.y + 0.0022080252*i.y; + u = 0.007332604*a.z + -0.093728594*b.z + -0.0092954915*c.z + 0.10711502*d.z + 0.067041464*e.z + 0.029980924*f.z + 0.018776521*g.z + -0.010771681*h.z + 0.010082272*i.z; + v = 0.08082619*a.w + -0.049494464*b.w + -0.002847315*c.w + -0.032200564*d.w + -0.106779605*e.w + -0.00017057461*f.w + 0.046220686*g.w + -0.010086206*h.w + 0.014189474*i.w; + w = 0.01763419*na.x + -0.07704289*nb.x + 0.014544706*nc.x + 0.26217622*nd.x + -0.27793178*ne.x + 0.049043182*nf.x + -0.032387003*ng.x + -0.00079001323*nh.x + 0.021493236*ni.x; + x = -0.006099039*na.y + 0.07619911*nb.y + -0.004682871*nc.y + -0.039725974*nd.y + -0.0956842*ne.y + -0.047193985*nf.y + 0.012972832*ng.y + -0.029965244*nh.y + 0.01117153*ni.y; + y = -0.0047858395*na.z + 0.009432101*nb.z + -0.00970283*nc.z + -0.050967053*nd.z + 0.0416414*ne.z + 0.006567818*nf.z + -0.019049477*ng.z + -0.055457648*nh.z + -0.0084786*ni.z; + z = -0.020594368*na.w + 0.119097516*nb.w + -0.026706293*nc.w + -0.26399305*nd.w + 0.24297448*ne.w + -0.02357126*nf.w + 0.055582974*ng.w + 0.026176132*nh.w + -0.0049385377*ni.w; + float p = s+t+u+v+w+x+y+z+-0.0005098261; + s = 0.007989906*a.x + 0.16948476*b.x + -0.020900989*c.x + 0.047029756*d.x + -0.3106828*e.x + 0.044901974*f.x + -0.022907237*g.x + 0.05710629*h.x + 0.052065603*i.x; + t = -0.017990815*a.y + 0.017270472*b.y + 0.010282366*c.y + -0.011884632*d.y + 0.23191552*e.y + -0.043236367*f.y + 0.0016425329*g.y + -0.055511087*h.y + -0.026324613*i.y; + u = 0.0019120462*a.z + 0.08208013*b.z + 0.034132402*c.z + -0.018370727*d.z + 0.07797786*e.z + -0.060526185*f.z + -0.0018448521*g.z + -0.00033979217*h.z + 0.00335727*i.z; + v = -0.07492346*a.w + -0.12594028*b.w + 0.014072716*c.w + 0.08883091*d.w + 0.10869792*e.w + -0.008024153*f.w + -0.0085559655*g.w + -0.026130557*h.w + -0.038244307*i.w; + w = -0.043121733*na.x + 0.03908438*nb.x + -0.04203372*nc.x + -0.06984061*nd.x + 0.22654058*ne.x + -0.0677497*nf.x + 0.023323534*ng.x + -0.007752401*nh.x + -0.04204327*ni.x; + x = 0.0063822027*na.y + -0.06692327*nb.y + -0.024546446*nc.y + 0.011857771*nd.y + -0.10809846*ne.y + 0.10203533*nf.y + 0.00044697413*ng.y + 0.00013562286*nh.y + 0.0015593648*ni.y; + y = -0.0045949556*na.z + 0.0020794072*nb.z + -0.01384561*nc.z + -0.028907942*nd.z + -0.1312241*ne.z + -0.021974247*nf.z + 0.016818015*ng.z + 0.048700895*nh.z + 0.013344767*ni.z; + z = 0.09069866*na.w + -0.07002809*nb.w + 0.024288913*nc.w + 0.03665063*nd.w + -0.04747613*ne.w + 0.025434596*nf.w + -0.040272254*ng.w + -0.007083052*nh.w + 0.033061597*ni.w; + float q = s+t+u+v+w+x+y+z+-5.6695724e-05; + s = -0.030995423*a.x + 0.016910668*b.x + 0.016467795*c.x + 0.0036362244*d.x + 0.06715467*e.x + 0.034928087*f.x + 0.00294668*g.x + -0.08859904*h.x + 0.019238671*i.x; + t = -0.0014795385*a.y + 0.007169236*b.y + -0.003910267*c.y + -0.013714315*d.y + 0.047127932*e.y + -0.032306857*f.y + 0.009032661*g.y + 0.07451486*h.y + 0.011209902*i.y; + u = -0.028070455*a.z + -0.056255367*b.z + -0.01941142*c.z + -0.014563226*d.z + 0.23374811*e.z + -0.005298336*f.z + -0.0015773315*g.z + 0.010755963*h.z + 0.010304858*i.z; + v = 0.010758766*a.w + -0.0016641767*b.w + -0.0072932625*c.w + 0.04894674*d.w + -0.13094418*e.w + -0.013401469*f.w + 0.011060128*g.w + 0.0017654237*h.w + -0.007799787*i.w; + w = -0.0068978816*na.x + -0.011936246*nb.x + -0.04713535*nc.x + -0.02783707*nd.x + 0.24141848*ne.x + -0.07389717*nf.x + -0.013193195*ng.x + 0.0112745045*nh.x + -0.01864954*ni.x; + x = 0.0038846259*na.y + 0.033482198*nb.y + 0.02776248*nc.y + 0.02706673*nd.y + -0.22279294*ne.y + 0.009941126*nf.y + 0.009544681*ng.y + -0.025446441*nh.y + 0.011225284*ni.y; + y = 0.002453317*na.z + -0.0026645362*nb.z + -0.0037308321*nc.z + -0.026038155*nd.z + 0.027270524*ne.z + 0.009217475*nf.z + -0.015977709*ng.z + -0.023630898*nh.z + -0.03964392*ni.z; + z = 0.0229635*na.w + 0.0007620235*nb.w + 0.03816787*nc.w + 0.012008527*nd.w + -0.16997801*ne.w + 0.048762847*nf.w + 0.0011025064*ng.w + 0.064071506*nh.w + 0.0049902974*ni.w; + float r = s+t+u+v+w+x+y+z+-0.00035512418; + + return vec4(o, p, q, r); +} + +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.400 > OUTPUT.h LUMA.h / 1.400 > * +//!WIDTH LUMA.w 2 * +//!HEIGHT LUMA.h 2 * +//!DESC Anime4K-Hybrid-ML-Upscale(x2)-v2.1 +//!BIND LUMAN0 + + +vec4 hook() { + vec2 f = fract(LUMAN0_pos * LUMAN0_size); + ivec2 i = ivec2(f * vec2(2)); + vec4 residual = LUMAN0_tex((vec2(0.5) - f) * LUMAN0_pt + LUMAN0_pos); + return vec4(residual[i.y * 2 + i.x] + HOOKED_tex(HOOKED_pos).x, HOOKED_tex(HOOKED_pos).yz, 0); +} + +/* ---------------------- x4 PRESCALER ---------------------- */ + + +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!WIDTH LUMA.w 2 * +//!HEIGHT LUMA.h 2 * +//!DESC Anime4K-Hybrid-Chroma-Upscale(x2)-v2.1 + +#define STRENGTH 0.1 +#define SPREAD_STRENGTH 2.0 + +/* --- MOST OF THE OTHER SETTINGS CAN BE FOUND AT THE END --- */ + +#define KERNELSIZE 3 +#define KERNELHALFSIZE 1 +#define KERNELLEN 9 + + +float gaussian(float x, float s, float m) { + return (1 / (s * sqrt(2 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0)); +} + +vec4 hook() { + vec2 d = HOOKED_pt; + + vec4 vc = HOOKED_tex(HOOKED_pos); + + float s = vc.x * STRENGTH + 0.0001; + float ss = SPREAD_STRENGTH + 0.0001; + + vec4 valsum = vec4(0); + float normsum = 0.000001; //Avoid divide by zero + + for (int i=0; i OUTPUT.h LUMA.h / 2.400 > * * +//!WIDTH OUTPUT.w 2 / +//!HEIGHT OUTPUT.h 2 / + +vec4 hook() { + return HOOKED_tex(HOOKED_pos); +} + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x1-v2.1a +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!SAVE LUMAN1 +//!COMPONENTS 4 + + +vec4 hook() { + vec2 dp = HOOKED_pt; + float a = HOOKED_tex(HOOKED_pos + vec2(-dp.x, -dp.y)).x; + float b = HOOKED_tex(HOOKED_pos + vec2(-dp.x, 0)).x; + float c = HOOKED_tex(HOOKED_pos + vec2(-dp.x, dp.y)).x; + float d = HOOKED_tex(HOOKED_pos + vec2(0, -dp.y)).x; + float e = HOOKED_tex(HOOKED_pos + vec2(0, 0)).x; + float f = HOOKED_tex(HOOKED_pos + vec2(0, dp.y)).x; + float g = HOOKED_tex(HOOKED_pos + vec2(dp.x, -dp.y)).x; + float h = HOOKED_tex(HOOKED_pos + vec2(dp.x, 0)).x; + float i = HOOKED_tex(HOOKED_pos + vec2(dp.x, dp.y)).x; + + float s = 0.06518857*a + -0.0118667185*b + -0.07614037*c + -0.46956885*d + 0.2812869*e + 0.4135128*f + -0.117597*g + -0.43488324*h + 0.33814532*i; + float o = s+0.018250784; + s = 0.004705962*a + 0.064553976*b + -0.07471142*c + -0.12856083*d + 0.15492548*e + 0.7035231*f + 0.16384916*g + -0.8741586*h + -0.012426951*i; + float p = s+0.0018347593; + s = -0.002186087*a + 0.08980697*b + -0.075706676*c + 0.21820599*d + -1.4773877*e + 0.39514637*f + -0.049297944*g + 0.3549184*h + 0.5490852*i; + float q = s+0.0019366593; + s = -0.0019400899*a + 0.02402473*b + -0.07429219*c + 0.16930206*d + -0.2798244*e + 0.08784747*f + -0.018798571*g + 0.039233245*h + 0.053139925*i; + float r = s+0.0028748403; + return vec4(o, p, q, r); +} + + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN1 +//!SAVE LUMAN1 +//!COMPONENTS 4 + +#define L_tex LUMAN1_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + + float s = -0.078850485*a.x + 0.008778143*b.x + 0.09409134*c.x + 0.17980288*d.x + -0.13836896*e.x + 0.041511726*f.x + 0.111073226*g.x + 0.24465907*h.x + -0.2613636*i.x; + float t = 0.04978624*a.y + -0.043356195*b.y + -0.08137738*c.y + -0.028674556*d.y + -0.0042590224*e.y + -0.06741321*f.y + 0.04029311*g.y + -0.069561794*h.y + 0.067619696*i.y; + float u = -0.0061189956*a.z + 0.051833455*b.z + -0.042832106*c.z + 0.26535267*d.z + 0.36819696*e.z + 0.03438765*f.z + 0.22989632*g.z + -0.487135*h.z + 0.15665813*i.z; + float v = -0.13148193*a.w + -0.12638648*b.w + 0.03605439*c.w + 0.0974745*d.w + -0.10980721*e.w + -0.21564873*f.w + 0.34306243*g.w + 0.69539255*h.w + -0.03078458*i.w; + float w = 0.1898412*na.x + 0.05917433*nb.x + -0.15381081*nc.x + -0.15773135*nd.x + 0.29555428*ne.x + 0.096428104*nf.x + 0.090633914*ng.x + -0.31970337*nh.x + 0.18953186*ni.x; + float x = -0.26538706*na.y + 0.13089244*nb.y + 0.16604574*nc.y + -0.5723114*nd.y + -0.16346131*ne.y + -0.014951056*nf.y + 0.09785819*ng.y + -0.017660556*nh.y + -0.09167879*ni.y; + float y = 0.009693713*na.z + 0.010756051*nb.z + 0.017140212*nc.z + -0.533805*nd.z + -0.5435189*ne.z + -0.064089194*nf.z + -0.31916615*ng.z + 0.5331712*nh.z + -0.13033615*ni.z; + float z = 0.35296175*na.w + 0.25480655*nb.w + 0.035030134*nc.w + 0.15741913*nd.w + 0.060176335*ne.w + 0.05028458*nf.w + -0.12958519*ng.w + 0.028535347*nh.w + 0.15037805*ni.w; + float o = s+t+u+v+w+x+y+z+-0.00046534537; + s = -0.10862142*a.x + 0.23951219*b.x + 0.2839895*c.x + -0.05217377*d.x + -0.40397635*e.x + 0.049454965*f.x + 0.052400503*g.x + 0.118543915*h.x + 0.06852737*i.x; + t = 0.4241042*a.y + -0.12584575*b.y + -0.102870226*c.y + 0.28188303*d.y + 0.49546632*e.y + 0.117695816*f.y + -0.08839783*g.y + -0.14269592*h.y + -0.03292176*i.y; + u = 0.007181128*a.z + -0.40109172*b.z + -0.24221501*c.z + -0.06402019*d.z + 0.60842943*e.z + -0.10117115*f.z + -0.14966127*g.z + -0.14179903*h.z + -0.03214188*i.z; + v = 0.049681976*a.w + -0.18726541*b.w + -0.13386123*c.w + -0.43944734*d.w + -0.7732026*e.w + -0.19998854*f.w + 0.0016352575*g.w + -0.15936574*h.w + 0.11486744*i.w; + w = 0.034904238*na.x + -0.3936257*nb.x + -0.3924321*nc.x + 0.13237436*nd.x + 0.41971052*ne.x + -0.17690897*nf.x + -0.104041904*ng.x + -0.10885315*nh.x + -0.07546228*ni.x; + x = 0.19798991*na.y + 0.4755196*nb.y + 0.1685174*nc.y + -0.056067895*nd.y + -0.3281361*ne.y + -0.060975373*nf.y + 0.15498285*ng.y + 0.23860317*nh.y + 0.078440316*ni.y; + y = 0.22032484*na.z + 0.45825586*nb.z + 0.24928105*nc.z + 0.0740922*nd.z + -0.83567154*ne.z + 0.1469111*nf.z + 0.1061305*ng.z + 0.054175954*nh.z + 0.023593672*ni.z; + z = 0.02721891*na.w + -0.40433592*nb.w + -0.20104738*nc.w + -0.090347335*nd.w + 0.32021475*ne.w + -0.2523179*nf.w + 0.18747182*ng.w + -0.042044852*nh.w + -0.28740782*ni.w; + float p = s+t+u+v+w+x+y+z+-0.0048994347; + s = 0.03506187*a.x + -0.19858655*b.x + 0.12969843*c.x + -0.10771284*d.x + -0.09441664*e.x + 0.45179757*f.x + 0.0192464*g.x + 0.08926137*h.x + -0.06842973*i.x; + t = -0.06226018*a.y + -0.032557767*b.y + -0.16808012*c.y + -0.05757842*d.y + 0.16631629*e.y + -0.34194738*f.y + 0.005270219*g.y + 0.02339046*h.y + 0.079298474*i.y; + u = 0.125203*a.z + 0.11796023*b.z + 0.13894552*c.z + 0.122039534*d.z + 0.093743816*e.z + -0.36432076*f.z + 0.024767118*g.z + 0.05475351*h.z + 0.025071215*i.z; + v = -0.18731116*a.w + 0.12831227*b.w + -0.17373508*c.w + -0.3514785*d.w + -0.6449611*e.w + -0.13499886*f.w + 0.010178755*g.w + -0.49852073*h.w + 0.0992664*i.w; + w = -0.047569968*na.x + 0.107844934*nb.x + -0.34977105*nc.x + 0.123500414*nd.x + 0.055304836*ne.x + -0.48315105*nf.x + 0.0026811515*ng.x + -0.08091307*nh.x + 0.0610684*ni.x; + x = 0.15171343*na.y + 0.57235277*nb.y + 0.255104*nc.y + 0.031828027*nd.y + -0.07049035*ne.y + 0.40309858*nf.y + -0.027855068*ng.y + 0.033779*nh.y + -0.08337315*ni.y; + y = -0.05789993*na.z + 0.15511025*nb.z + -0.18869878*nc.z + -0.124532856*nd.z + -0.1330072*ne.z + 0.37427673*nf.z + -0.041740254*ng.z + -0.08676065*nh.z + -0.007624626*ni.z; + z = -0.040559176*na.w + -0.035778075*nb.w + 0.071473464*nc.w + 0.23743495*nd.w + -0.32282174*ne.w + 0.105933495*nf.w + 0.04571244*ng.w + 0.5551143*nh.w + -0.093935035*ni.w; + float q = s+t+u+v+w+x+y+z+-0.0033313776; + s = 0.075606935*a.x + 0.12968872*b.x + -0.17267832*c.x + -0.017534962*d.x + -0.21092632*e.x + 0.6039601*f.x + 0.0006366408*g.x + -0.3433534*h.x + 0.4382395*i.x; + t = -0.31210127*a.y + -0.24801569*b.y + 0.14311266*c.y + 0.266147*d.y + 0.20114625*e.y + -0.40220937*f.y + -0.2854783*g.y + -0.13323757*h.y + -0.1416884*i.y; + u = -0.08245917*a.z + -0.04328727*b.z + 0.011549445*c.z + 0.03169343*d.z + 0.30852476*e.z + -0.14224593*f.z + -0.2026233*g.z + 0.49105433*h.z + -0.27598178*i.z; + v = -0.03321247*a.w + -0.18208264*b.w + 0.0034254584*c.w + 0.093554296*d.w + -0.8836113*e.w + -0.21680102*f.w + -0.27222317*g.w + -1.0443908*h.w + -0.5674947*i.w; + w = -0.01619753*na.x + -0.12963338*nb.x + 0.17563225*nc.x + 0.004585129*nd.x + -0.3158967*ne.x + -0.872042*nf.x + -0.03607397*ng.x + 0.21791828*nh.x + -0.39065713*ni.x; + x = 0.20459439*na.y + 0.14653577*nb.y + -0.20970102*nc.y + -0.22334248*nd.y + -0.1049179*ne.y + 0.4063564*nf.y + -0.004260764*ng.y + 0.0077243396*nh.y + 0.19195783*ni.y; + y = 0.14778891*na.z + 0.08660305*nb.z + 0.069295146*nc.z + 0.085611*nd.z + 0.37579855*ne.z + 0.29285663*nf.z + 0.17906432*ng.z + -0.37996793*nh.z + 0.23048665*ni.z; + z = -0.30503413*na.w + -0.008632153*nb.w + -0.03432621*nc.w + -0.6234461*nd.w + 0.2332829*ne.w + -0.15835847*nf.w + 0.17630823*ng.w + -0.004949296*nh.w + 0.10454355*ni.w; + float r = s+t+u+v+w+x+y+z+-0.006210959; + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN1 +//!SAVE LUMAN1 +//!COMPONENTS 4 + +#define L_tex LUMAN1_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + + float s = -0.076375276*a.x + -0.16192478*b.x + -0.3435801*c.x + -0.102615885*d.x + -0.34291154*e.x + -0.3715771*f.x + -0.040065594*g.x + -0.031282134*h.x + -0.14007968*i.x; + float t = 0.0672231*a.y + -0.04764941*b.y + 0.098419875*c.y + 0.25985655*d.y + -0.38082376*e.y + 0.49276826*f.y + 0.08231613*g.y + 0.110389665*h.y + 0.12316233*i.y; + float u = 0.062234916*a.z + -0.08981316*b.z + 0.035350677*c.z + 0.3298534*d.z + -0.53112257*e.z + 0.07900975*f.z + -0.5878461*g.z + 0.3894751*h.z + 0.14318523*i.z; + float v = -0.067861155*a.w + 0.5679219*b.w + -0.20925492*c.w + -0.10364462*d.w + 0.04910827*e.w + 0.05719115*f.w + -0.030506052*g.w + 0.19142777*h.w + 0.029463196*i.w; + float w = -0.06478752*na.x + -0.35909376*nb.x + -0.049066383*nc.x + -0.06414304*nd.x + -0.13888775*ne.x + -0.059843887*nf.x + -0.076657444*ng.x + -0.20727734*nh.x + 0.037852272*ni.x; + float x = 0.0111666415*na.y + 0.11577456*nb.y + -0.07413471*nc.y + -0.020178368*nd.y + 0.16065867*ne.y + 0.114819236*nf.y + 0.102682814*ng.y + -0.026029458*nh.y + 0.09669771*ni.y; + float y = -0.07489544*na.z + -0.16045223*nb.z + -0.09865632*nc.z + 0.033090383*nd.z + -0.31668448*ne.z + -0.10984895*nf.z + 0.072489046*ng.z + -0.082067624*nh.z + -0.021043802*ni.z; + float z = 0.15612242*na.w + 0.25616717*nb.w + 0.15281045*nc.w + 0.12763329*nd.w + 0.44922253*ne.w + 0.069874264*nf.w + 0.049967453*ng.w + -0.016834527*nh.w + 0.076151155*ni.w; + float o = s+t+u+v+w+x+y+z+0.004368779; + s = -0.047799945*a.x + -0.11515582*b.x + -0.40791252*c.x + 0.018251693*d.x + 0.14576633*e.x + -0.11556127*f.x + -0.03873749*g.x + 0.060810573*h.x + -0.07200133*i.x; + t = 0.16543166*a.y + 0.011941809*b.y + 0.047324877*c.y + 0.04958495*d.y + -0.1651876*e.y + 0.43078738*f.y + -0.02519319*g.y + 0.20227197*h.y + 0.025999023*i.y; + u = 0.033441387*a.z + 0.016795462*b.z + 0.057281017*c.z + 1.5043137*d.z + 0.31060156*e.z + 0.07275219*f.z + -1.1843078*g.z + -0.6761157*h.z + 0.0029731095*i.z; + v = 0.4444829*a.w + -0.42409083*b.w + -0.26248664*c.w + -0.01794927*d.w + -0.018550927*e.w + 0.017927665*f.w + -0.032345075*g.w + 0.20667751*h.w + 0.0010150699*i.w; + w = 0.099501655*na.x + -0.28775364*nb.x + 0.32228288*nc.x + -0.00772114*nd.x + -0.23449002*ne.x + -0.09296215*nf.x + -0.054157354*ng.x + -0.27360436*nh.x + -0.03951609*ni.x; + x = -0.028245373*na.y + -0.121913314*nb.y + 0.07654564*nc.y + -0.049665563*nd.y + 0.7794895*ne.y + -0.1505789*nf.y + -0.03943592*ng.y + -0.34458607*nh.y + 0.084370665*ni.y; + y = -0.08433866*na.z + 0.051757183*nb.z + -0.020638762*nc.z + -0.33128256*nd.z + -0.650777*ne.z + -0.11522274*nf.z + 0.26052502*ng.z + 0.34106*nh.z + 0.014920869*ni.z; + z = 0.04507247*na.w + -0.103196636*nb.w + 0.13806596*nc.w + 0.08855919*nd.w + 0.19656824*ne.w + 0.09237863*nf.w + 0.046644468*ng.w + -0.04016784*nh.w + 0.04972401*ni.w; + float p = s+t+u+v+w+x+y+z+0.0046657724; + s = -0.056063537*a.x + 0.31379348*b.x + 0.08083433*c.x + -0.07988621*d.x + -0.28616846*e.x + -0.08654294*f.x + 0.113976635*g.x + 0.06516338*h.x + 0.018438872*i.x; + t = -0.11620833*a.y + 0.21208929*b.y + -0.11346605*c.y + -0.067703396*d.y + -0.43201342*e.y + -0.5345245*f.y + 0.07686346*g.y + 0.6436457*h.y + 0.26798856*i.y; + u = -0.06619781*a.z + -0.10010958*b.z + -0.07167439*c.z + -0.13878949*d.z + 0.0575283*e.z + -0.01815303*f.z + -0.076679595*g.z + 0.25056645*h.z + -0.030564506*i.z; + v = 0.12286161*a.w + -0.31997183*b.w + 0.4049721*c.w + -0.014453491*d.w + -0.12128047*e.w + -0.20630093*f.w + 0.064631835*g.w + 0.06505699*h.w + -0.04836569*i.w; + w = 0.030468628*na.x + -0.9605534*nb.x + 0.31949607*nc.x + -0.028109128*nd.x + 0.17402208*ne.x + 0.40973142*nf.x + -0.030756505*ng.x + -0.06860691*nh.x + 0.078861415*ni.x; + x = -0.018858679*na.y + 0.01308505*nb.y + 0.0344467*nc.y + -0.16346104*nd.y + 0.16348976*ne.y + -0.08839573*nf.y + 0.015383088*ng.y + -0.14421648*nh.y + -0.12157047*ni.y; + y = -0.2401164*na.z + 0.12919497*nb.z + -0.026884526*nc.z + 0.011329444*nd.z + -0.11406845*ne.z + -0.029941153*nf.z + 0.2084126*ng.z + -0.15498434*nh.z + 0.02121424*ni.z; + z = 0.11573471*na.w + -0.03703832*nb.w + 0.019915955*nc.w + -0.08166001*nd.w + 0.09089532*ne.w + 0.016573701*nf.w + -0.093835354*ng.w + -0.03263581*nh.w + 0.07502409*ni.w; + float q = s+t+u+v+w+x+y+z+0.0028720675; + s = -0.09465834*a.x + -0.07953802*b.x + -0.17295821*c.x + -0.08021209*d.x + -0.1958469*e.x + -0.24971394*f.x + -0.12543827*g.x + -0.034206524*h.x + -0.042293545*i.x; + t = 0.017930178*a.y + -0.022108268*b.y + 0.09107495*c.y + 0.2796261*d.y + 0.26334488*e.y + 0.3403926*f.y + 0.0052007795*g.y + 0.00029919678*h.y + 0.2550915*i.y; + u = 0.026925193*a.z + -0.04275811*b.z + -0.0047453125*c.z + -0.11763906*d.z + -0.169145*e.z + 0.07742117*f.z + 0.07685529*g.z + -0.040824294*h.z + 0.07746296*i.z; + v = -0.345795*a.w + 0.43350878*b.w + -0.3304852*c.w + -0.06460919*d.w + 0.029501494*e.w + 0.088321574*f.w + -0.03855111*g.w + 0.14674814*h.w + 0.08218873*i.w; + w = -0.051307168*na.x + -0.19062272*nb.x + -0.385643*nc.x + -0.059386916*nd.x + -0.32816103*ne.x + -0.039611306*nf.x + 0.02802185*ng.x + -0.12741719*nh.x + -0.03717902*ni.x; + x = 0.047177624*na.y + 0.09041485*nb.y + -0.051103875*nc.y + 0.1100884*nd.y + -0.19083166*ne.y + 0.2213158*nf.y + 0.07442079*ng.y + 0.3593766*nh.y + -0.24011746*ni.y; + y = -0.076973915*na.z + -0.19071229*nb.z + -0.055816684*nc.z + -0.11463048*nd.z + -0.07194704*ne.z + -0.14436463*nf.z + -0.35647246*ng.z + 0.14373139*nh.z + 0.08208823*ni.z; + z = 0.16350232*na.w + 0.24001768*nb.w + 0.1772575*nc.w + 0.08607296*nd.w + -0.08327933*ne.w + 0.33616975*nf.w + 0.09244664*ng.w + -0.026265353*nh.w + 0.04598941*ni.w; + float r = s+t+u+v+w+x+y+z+0.00076911174; + + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN1 +//!SAVE LUMAN1 +//!COMPONENTS 4 + +#define L_tex LUMAN1_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + + float s = 0.07986198*a.x + 0.11342182*b.x + -0.0030975514*c.x + -0.19796455*d.x + 0.013101459*e.x + -0.04200098*f.x + 0.017225444*g.x + -0.0014372912*h.x + 0.008370759*i.x; + float t = 0.014841376*a.y + -0.041046176*b.y + 0.03788454*c.y + 0.054837294*d.y + 0.13426651*e.y + -0.0080451695*f.y + -0.029857455*g.y + -0.012871764*h.y + -0.03441029*i.y; + float u = 0.06245403*a.z + -0.012831481*b.z + 0.061856076*c.z + 0.064062476*d.z + -0.066138364*e.z + -0.0026366066*f.z + 0.011879*g.z + -0.011122004*h.z + 0.0017384114*i.z; + float v = -0.05975413*a.w + -0.17485596*b.w + 0.025911752*c.w + 0.118029304*d.w + 0.04408629*e.w + 0.008907612*f.w + 0.01642477*g.w + -0.0092969695*h.w + -0.000769117*i.w; + float w = 0.051101964*na.x + -0.18510687*nb.x + 0.028513199*nc.x + 0.14805903*nd.x + -0.20142192*ne.x + 0.056813676*nf.x + 0.0017134928*ng.x + 0.054168973*nh.x + -0.021714801*ni.x; + float x = -0.020875074*na.y + 0.0048777545*nb.y + -0.06269994*nc.y + -0.03472058*nd.y + 0.048265714*ne.y + 0.0035236937*nf.y + 0.005227413*ng.y + -0.027124068*nh.y + 0.018154047*ni.y; + float y = -0.01159801*na.z + 0.033479054*nb.z + -0.038438387*nc.z + -0.052317906*nd.z + -0.17036878*ne.z + 0.030379958*nf.z + 0.00838193*ng.z + 0.056501616*nh.z + 0.012519291*ni.z; + float z = -0.09538882*na.w + 0.26771805*nb.w + -0.043541078*nc.w + -0.032106128*nd.w + 0.0934046*ne.w + -0.01805561*nf.w + -0.04645964*ng.w + -0.0036514637*nh.w + 0.008913154*ni.w; + float o = s+t+u+v+w+x+y+z+-0.00044684345; + s = -0.011545017*a.x + -0.014384322*b.x + 0.017081236*c.x + -0.08324924*d.x + 0.21428387*e.x + -0.013944155*f.x + -0.02362489*g.x + -0.048795808*h.x + -0.028883195*i.x; + t = 0.018386116*a.y + -0.026253551*b.y + 0.0118806455*c.y + 0.037654113*d.y + -0.06835073*e.y + 0.032385923*f.y + 0.0026887117*g.y + 0.10095452*h.y + 0.0022080252*i.y; + u = 0.007332604*a.z + -0.093728594*b.z + -0.0092954915*c.z + 0.10711502*d.z + 0.067041464*e.z + 0.029980924*f.z + 0.018776521*g.z + -0.010771681*h.z + 0.010082272*i.z; + v = 0.08082619*a.w + -0.049494464*b.w + -0.002847315*c.w + -0.032200564*d.w + -0.106779605*e.w + -0.00017057461*f.w + 0.046220686*g.w + -0.010086206*h.w + 0.014189474*i.w; + w = 0.01763419*na.x + -0.07704289*nb.x + 0.014544706*nc.x + 0.26217622*nd.x + -0.27793178*ne.x + 0.049043182*nf.x + -0.032387003*ng.x + -0.00079001323*nh.x + 0.021493236*ni.x; + x = -0.006099039*na.y + 0.07619911*nb.y + -0.004682871*nc.y + -0.039725974*nd.y + -0.0956842*ne.y + -0.047193985*nf.y + 0.012972832*ng.y + -0.029965244*nh.y + 0.01117153*ni.y; + y = -0.0047858395*na.z + 0.009432101*nb.z + -0.00970283*nc.z + -0.050967053*nd.z + 0.0416414*ne.z + 0.006567818*nf.z + -0.019049477*ng.z + -0.055457648*nh.z + -0.0084786*ni.z; + z = -0.020594368*na.w + 0.119097516*nb.w + -0.026706293*nc.w + -0.26399305*nd.w + 0.24297448*ne.w + -0.02357126*nf.w + 0.055582974*ng.w + 0.026176132*nh.w + -0.0049385377*ni.w; + float p = s+t+u+v+w+x+y+z+-0.0005098261; + s = 0.007989906*a.x + 0.16948476*b.x + -0.020900989*c.x + 0.047029756*d.x + -0.3106828*e.x + 0.044901974*f.x + -0.022907237*g.x + 0.05710629*h.x + 0.052065603*i.x; + t = -0.017990815*a.y + 0.017270472*b.y + 0.010282366*c.y + -0.011884632*d.y + 0.23191552*e.y + -0.043236367*f.y + 0.0016425329*g.y + -0.055511087*h.y + -0.026324613*i.y; + u = 0.0019120462*a.z + 0.08208013*b.z + 0.034132402*c.z + -0.018370727*d.z + 0.07797786*e.z + -0.060526185*f.z + -0.0018448521*g.z + -0.00033979217*h.z + 0.00335727*i.z; + v = -0.07492346*a.w + -0.12594028*b.w + 0.014072716*c.w + 0.08883091*d.w + 0.10869792*e.w + -0.008024153*f.w + -0.0085559655*g.w + -0.026130557*h.w + -0.038244307*i.w; + w = -0.043121733*na.x + 0.03908438*nb.x + -0.04203372*nc.x + -0.06984061*nd.x + 0.22654058*ne.x + -0.0677497*nf.x + 0.023323534*ng.x + -0.007752401*nh.x + -0.04204327*ni.x; + x = 0.0063822027*na.y + -0.06692327*nb.y + -0.024546446*nc.y + 0.011857771*nd.y + -0.10809846*ne.y + 0.10203533*nf.y + 0.00044697413*ng.y + 0.00013562286*nh.y + 0.0015593648*ni.y; + y = -0.0045949556*na.z + 0.0020794072*nb.z + -0.01384561*nc.z + -0.028907942*nd.z + -0.1312241*ne.z + -0.021974247*nf.z + 0.016818015*ng.z + 0.048700895*nh.z + 0.013344767*ni.z; + z = 0.09069866*na.w + -0.07002809*nb.w + 0.024288913*nc.w + 0.03665063*nd.w + -0.04747613*ne.w + 0.025434596*nf.w + -0.040272254*ng.w + -0.007083052*nh.w + 0.033061597*ni.w; + float q = s+t+u+v+w+x+y+z+-5.6695724e-05; + s = -0.030995423*a.x + 0.016910668*b.x + 0.016467795*c.x + 0.0036362244*d.x + 0.06715467*e.x + 0.034928087*f.x + 0.00294668*g.x + -0.08859904*h.x + 0.019238671*i.x; + t = -0.0014795385*a.y + 0.007169236*b.y + -0.003910267*c.y + -0.013714315*d.y + 0.047127932*e.y + -0.032306857*f.y + 0.009032661*g.y + 0.07451486*h.y + 0.011209902*i.y; + u = -0.028070455*a.z + -0.056255367*b.z + -0.01941142*c.z + -0.014563226*d.z + 0.23374811*e.z + -0.005298336*f.z + -0.0015773315*g.z + 0.010755963*h.z + 0.010304858*i.z; + v = 0.010758766*a.w + -0.0016641767*b.w + -0.0072932625*c.w + 0.04894674*d.w + -0.13094418*e.w + -0.013401469*f.w + 0.011060128*g.w + 0.0017654237*h.w + -0.007799787*i.w; + w = -0.0068978816*na.x + -0.011936246*nb.x + -0.04713535*nc.x + -0.02783707*nd.x + 0.24141848*ne.x + -0.07389717*nf.x + -0.013193195*ng.x + 0.0112745045*nh.x + -0.01864954*ni.x; + x = 0.0038846259*na.y + 0.033482198*nb.y + 0.02776248*nc.y + 0.02706673*nd.y + -0.22279294*ne.y + 0.009941126*nf.y + 0.009544681*ng.y + -0.025446441*nh.y + 0.011225284*ni.y; + y = 0.002453317*na.z + -0.0026645362*nb.z + -0.0037308321*nc.z + -0.026038155*nd.z + 0.027270524*ne.z + 0.009217475*nf.z + -0.015977709*ng.z + -0.023630898*nh.z + -0.03964392*ni.z; + z = 0.0229635*na.w + 0.0007620235*nb.w + 0.03816787*nc.w + 0.012008527*nd.w + -0.16997801*ne.w + 0.048762847*nf.w + 0.0011025064*ng.w + 0.064071506*nh.w + 0.0049902974*ni.w; + float r = s+t+u+v+w+x+y+z+-0.00035512418; + + return vec4(o, p, q, r); +} + +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!WIDTH LUMA.w 4 * +//!HEIGHT LUMA.h 4 * +//!DESC Anime4K-Hybrid-ML-Upscale(x4)-v2.1 +//!BIND LUMAN1 + +vec4 hook() { + vec2 f = fract(LUMAN1_pos * LUMAN1_size); + ivec2 i = ivec2(f * vec2(2)); + vec4 residual = LUMAN1_tex((vec2(0.5) - f) * LUMAN1_pt + LUMAN1_pos); + return vec4(residual[i.y * 2 + i.x] + HOOKED_tex(HOOKED_pos).x, HOOKED_tex(HOOKED_pos).yz, 0); +} + +/* ---------------------- Gradient Push ---------------------- */ + + +//!DESC Anime4K-Hybrid-ComputeGradientX-v2.1a +//!HOOK SCALED +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!SAVE LUMAD +//!COMPONENTS 2 + +float getLum(vec4 rgb) { + return 0.299*rgb.r + 0.587*rgb.g + 0.114*rgb.b; +} + +vec4 hook() { + vec2 d = HOOKED_pt; + + //[tl t tr] + //[ l c r] + //[bl b br] + float l = getLum(HOOKED_tex(HOOKED_pos + vec2(-d.x, 0))); + float c = getLum(HOOKED_tex(HOOKED_pos)); + float r = getLum(HOOKED_tex(HOOKED_pos + vec2(d.x, 0))); + + + //Horizontal Gradient + //[-1 0 1] + //[-2 0 2] + //[-1 0 1] + float xgrad = (-l + r); + + //Vertical Gradient + //[-1 -2 -1] + //[ 0 0 0] + //[ 1 2 1] + float ygrad = (l + c + c + r); + + //Computes the luminance's gradient + return vec4(xgrad, ygrad, 0, 0); +} + + +//!DESC Anime4K-Hybrid-ComputeGradientY-v2.1a +//!HOOK SCALED +//!BIND HOOKED +//!BIND LUMA +//!BIND LUMAD +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!SAVE LUMAD +//!COMPONENTS 2 + + +/* --------------------- SETTINGS --------------------- */ + +//Strength of edge refinement, good values are between 0.2 and 4 +#define REFINE_STRENGTH 1 + + +/* --- MODIFY THESE SETTINGS BELOW AT YOUR OWN RISK --- */ + +//Bias of the refinement function, good values are between 0 and 1 +#define REFINE_BIAS 0 + +//Polynomial fit obtained by minimizing MSE error on image +#define P5 ( 11.68129591) +#define P4 (-42.46906057) +#define P3 ( 60.28286266) +#define P2 (-41.84451327) +#define P1 ( 14.05517353) +#define P0 (-1.081521930) + +//Power curve used to ease in upscaling smaller than 2x upscaling factors. +#define UPSCALE_RATIO_HYSTERESIS 1 + +/* ----------------- END OF SETTINGS ----------------- */ + +float power_function(float x) { + float x2 = x * x; + float x3 = x2 * x; + float x4 = x2 * x2; + float x5 = x2 * x3; + + return P5*x5 + P4*x4 + P3*x3 + P2*x2 + P1*x + P0; +} + +vec4 hook() { + vec2 d = HOOKED_pt; + + //[tl t tr] + //[ l cc r] + //[bl b br] + float tx = LUMAD_tex(HOOKED_pos + vec2(0, -d.y)).x; + float cx = LUMAD_tex(HOOKED_pos).x; + float bx = LUMAD_tex(HOOKED_pos + vec2(0, d.y)).x; + + + float ty = LUMAD_tex(HOOKED_pos + vec2(0, -d.y)).y; + //float cy = LUMAD_tex(HOOKED_pos).y; + float by = LUMAD_tex(HOOKED_pos + vec2(0, d.y)).y; + + + //Horizontal Gradient + //[-1 0 1] + //[-2 0 2] + //[-1 0 1] + float xgrad = (tx + cx + cx + bx); + + //Vertical Gradient + //[-1 -2 -1] + //[ 0 0 0] + //[ 1 2 1] + float ygrad = (-ty + by); + + //Computes the luminance's gradient + float sobel_norm = clamp(sqrt(xgrad * xgrad + ygrad * ygrad), 0, 1); + + float upratio = clamp(SCALED_size.x / LUMA_size.x - 1, 0, 6); + + float dval = clamp(power_function(clamp(sobel_norm * max(pow(upratio, UPSCALE_RATIO_HYSTERESIS), 1), 0, 1)) * REFINE_STRENGTH + REFINE_BIAS, 0, 1); + + if (upratio < 1) { + dval = dval * pow(upratio, UPSCALE_RATIO_HYSTERESIS); + } + + return vec4(sobel_norm, dval, 0, 0); +} + +//!DESC Anime4K-Hybrid-ComputeSecondGradientX-v2.1a +//!HOOK SCALED +//!BIND HOOKED +//!BIND LUMAD +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!SAVE LUMAMM +//!COMPONENTS 2 + + +vec4 hook() { + vec2 d = HOOKED_pt; + + if (LUMAD_tex(HOOKED_pos).y < 0.1) { + return vec4(0); + } + + //[tl t tr] + //[ l c r] + //[bl b br] + float l = LUMAD_tex(HOOKED_pos + vec2(-d.x, 0)).x; + float c = LUMAD_tex(HOOKED_pos).x; + float r = LUMAD_tex(HOOKED_pos + vec2(d.x, 0)).x; + + //Horizontal Gradient + //[-1 0 1] + //[-2 0 2] + //[-1 0 1] + float xgrad = (-l + r); + + //Vertical Gradient + //[-1 -2 -1] + //[ 0 0 0] + //[ 1 2 1] + float ygrad = (l + c + c + r); + + + return vec4(xgrad, ygrad, 0, 0); +} + + +//!DESC Anime4K-Hybrid-ComputeSecondGradientY-v2.1a +//!HOOK SCALED +//!BIND HOOKED +//!BIND LUMAD +//!BIND LUMAMM +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!SAVE LUMAMM +//!COMPONENTS 2 + +vec4 hook() { + vec2 d = HOOKED_pt; + + if (LUMAD_tex(HOOKED_pos).y < 0.1) { + return vec4(0); + } + + //[tl t tr] + //[ l cc r] + //[bl b br] + float tx = LUMAMM_tex(HOOKED_pos + vec2(0, -d.y)).x; + float cx = LUMAMM_tex(HOOKED_pos).x; + float bx = LUMAMM_tex(HOOKED_pos + vec2(0, d.y)).x; + + float ty = LUMAMM_tex(HOOKED_pos + vec2(0, -d.y)).y; + //float cy = LUMAMM_tex(HOOKED_pos).y; + float by = LUMAMM_tex(HOOKED_pos + vec2(0, d.y)).y; + + //Horizontal Gradient + //[-1 0 1] + //[-2 0 2] + //[-1 0 1] + float xgrad = (tx + cx + cx + bx); + + //Vertical Gradient + //[-1 -2 -1] + //[ 0 0 0] + //[ 1 2 1] + float ygrad = (-ty + by); + + float norm = sqrt(xgrad * xgrad + ygrad * ygrad); + if (norm <= 0.001) { + xgrad = 0; + ygrad = 0; + norm = 1; + } + + return vec4(xgrad/norm, ygrad/norm, 0, 0); +} + +//!DESC Anime4K-Hybrid-Refine-v2.1a +//!HOOK SCALED +//!BIND HOOKED +//!BIND LUMA +//!BIND LUMAD +//!BIND LUMAMM +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * + +#define SHARPNESS_FACTOR 0.9 //Algorithm strength + +vec4 hook() { + vec2 d = HOOKED_pt; + + float dval = LUMAD_tex(HOOKED_pos).y * SHARPNESS_FACTOR; + + if (dval < 0.1) { + return SCALED_tex(HOOKED_pos); + } + + vec4 dc = LUMAMM_tex(HOOKED_pos); + if (abs(dc.x + dc.y) <= 0.0001) {return SCALED_tex(HOOKED_pos); + } + + float xpos = -sign(dc.x); + float ypos = -sign(dc.y); + + vec4 xval = SCALED_tex(HOOKED_pos + vec2(d.x * xpos, 0)); + vec4 yval = SCALED_tex(HOOKED_pos + vec2(0, d.y * ypos)); + + float xyratio = abs(dc.x) / (abs(dc.x) + abs(dc.y)); + + vec4 avg = xyratio * xval + (1-xyratio) * yval; + + return avg * dval + SCALED_tex(HOOKED_pos) * (1 - dval); +} + diff --git a/glsl/Anime4K_Hybrid_v2.1a_L.glsl b/glsl/Anime4K_Hybrid_v2.1a_L.glsl new file mode 100644 index 00000000..9a990b91 --- /dev/null +++ b/glsl/Anime4K_Hybrid_v2.1a_L.glsl @@ -0,0 +1,1908 @@ +//Anime4K Hybrid GLSL v2.1a (L) + +// MIT License + +// Copyright (c) 2019-2020 bloc97, DextroseRe +// All rights reserved. + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + + +//!DESC Anime4K-Hybrid-Chroma-Upscale-v2.1a-(L) +//!HOOK CHROMA +//!BIND HOOKED +//!BIND LUMA +//!WHEN CHROMA.w LUMA.w < +//!WIDTH CHROMA.w 2 * +//!HEIGHT CHROMA.h 2 * + +/* ---------------------- BILATERAL FILTERING SETTINGS ---------------------- */ + +#define STRENGTH 0.1 +#define SPREAD_STRENGTH 2.0 + +/* --- MOST OF THE OTHER SETTINGS CAN BE FOUND AT THE END --- */ + +#define KERNELSIZE 3 +#define KERNELHALFSIZE 1 +#define KERNELLEN 9 + + +float gaussian(float x, float s, float m) { + return (1 / (s * sqrt(2 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0)); +} + +vec4 hook() { + vec2 d = HOOKED_pt; + + float vc = LUMA_tex(HOOKED_pos).x; + + float s = vc * STRENGTH + 0.0001; + float ss = SPREAD_STRENGTH + 0.0001; + + vec4 valsum = vec4(0); + float normsum = 0.000001; //Avoid divide by zero + + for (int i=0; i OUTPUT.h LUMA.h / 1.200 > * +//!SAVE LUMAN0 +//!COMPONENTS 4 + + +vec4 hook() { + vec2 dp = HOOKED_pt; + float a = HOOKED_tex(HOOKED_pos + vec2(-dp.x, -dp.y)).x; + float b = HOOKED_tex(HOOKED_pos + vec2(-dp.x, 0)).x; + float c = HOOKED_tex(HOOKED_pos + vec2(-dp.x, dp.y)).x; + float d = HOOKED_tex(HOOKED_pos + vec2(0, -dp.y)).x; + float e = HOOKED_tex(HOOKED_pos + vec2(0, 0)).x; + float f = HOOKED_tex(HOOKED_pos + vec2(0, dp.y)).x; + float g = HOOKED_tex(HOOKED_pos + vec2(dp.x, -dp.y)).x; + float h = HOOKED_tex(HOOKED_pos + vec2(dp.x, 0)).x; + float i = HOOKED_tex(HOOKED_pos + vec2(dp.x, dp.y)).x; + +float s = -0.20137449*a + -0.0015731218*b + 0.05501119*c + 0.1565948*d + 0.6737233*e + -0.23572952*f + 0.18099797*g + -0.7995735*h + 0.13067944*i; +float o = s+-0.027419055; +s = 0.51490134*a + -0.25941947*b + -0.07724701*c + 0.5250881*d + -0.54380083*e + -0.05643802*f + -0.101760834*g + -0.034337673*h + 0.054615285*i; +float p = s+-0.012926701; +s = -0.53016037*a + 0.61940545*b + -0.20846693*c + 0.639486*d + -0.032331035*e + -0.15247229*f + -0.1443841*g + -0.2677867*h + 0.04309905*i; +float q = s+0.056758612; +s = 0.026444327*a + 0.14535855*b + 0.011089705*c + -0.041422866*d + 0.13639577*e + 0.71558315*f + 0.118795045*g + -0.83810943*h + -0.27118593*i; +float r = s+0.019607993; + + return vec4(o, p, q, r); +} + + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!BIND LUMAN0 +//!SAVE LUMAN1 +//!COMPONENTS 4 + +#define L_tex LUMAN0_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = -0.14129105*a.x + -0.3267071*b.x + 0.050059587*c.x + -0.3987618*d.x + 0.72525537*e.x + 0.4873099*f.x + 0.008632439*g.x + 0.015846651*h.x + 0.2593738*i.x; +float t = 0.13931245*a.y + -0.16447836*b.y + -0.35802507*c.y + -0.074192844*d.y + 0.070096076*e.y + 0.42356202*f.y + -0.10464654*g.y + 0.22069831*h.y + 0.60978895*i.y; +float u = -0.008347766*a.z + 0.25076723*b.z + 0.09202788*c.z + 0.43199953*d.z + 0.11726567*e.z + -0.18873338*f.z + 0.011628617*g.z + 0.19094141*h.z + 0.13027532*i.z; +float v = 0.09801981*a.w + 0.1172482*b.w + 0.033339277*c.w + -0.10594379*d.w + 0.44982854*e.w + 0.04813419*f.w + -0.31859815*g.w + 0.045677304*h.w + 0.025485627*i.w; +float w = 0.08831363*na.x + 0.073816575*nb.x + 0.007407972*nc.x + 0.14349033*nd.x + -0.22767976*ne.x + -0.12758991*nf.x + 0.02673382*ng.x + -0.04628971*nh.x + -0.04612809*ni.x; +float x = -0.26549712*na.y + 0.014268674*nb.y + -0.10447855*nc.y + 0.18266474*nd.y + -0.121571824*ne.y + -0.21750784*nf.y + -0.18120421*ng.y + 0.022351112*nh.y + 0.42605555*ni.y; +float y = -0.48064795*na.z + -0.27713984*nb.z + -0.377774*nc.z + -0.41632155*nd.z + -0.13041303*ne.z + 0.36084685*nf.z + -0.4065425*ng.z + 0.08281877*nh.z + -0.006921882*ni.z; +float z = 0.019636001*na.w + -0.43382022*nb.w + -0.12121368*nc.w + 0.36083665*nd.w + 0.2515448*ne.w + 0.09338429*nf.w + 0.16182008*ng.w + 0.20439956*nh.w + 0.07576254*ni.w; +float o = s+t+u+v+w+x+y+z+-0.08090411; +s = -0.5596512*a.x + -0.22780022*b.x + 0.29604053*c.x + -0.2262779*d.x + -0.3262377*e.x + 0.04412409*f.x + 0.13768737*g.x + 0.22867353*h.x + -0.17862745*i.x; +t = 0.0732342*a.y + 0.3564334*b.y + -0.39165732*c.y + 0.20254353*d.y + -0.38930947*e.y + 0.16037573*f.y + -0.35927212*g.y + 0.044125237*h.y + -0.118192345*i.y; +u = -0.26556936*a.z + 0.3948796*b.z + 0.20452352*c.z + 0.64263874*d.z + 0.18677169*e.z + -0.26447296*f.z + -0.01685825*g.z + -0.6205177*h.z + 0.33575967*i.z; +v = -0.2797471*a.w + 0.24474439*b.w + 0.018175174*c.w + -0.09123516*d.w + 0.15797856*e.w + -0.11215085*f.w + 0.105207905*g.w + -0.056100324*h.w + 0.08030639*i.w; +w = 0.095356405*na.x + -0.24610977*nb.x + -0.27622896*nc.x + -0.2714281*nd.x + 0.5328526*ne.x + 0.27557987*nf.x + -0.076188155*ng.x + -0.052882478*nh.x + -0.24295144*ni.x; +x = -0.037961688*na.y + -0.20192467*nb.y + 0.08267803*nc.y + -0.06314137*nd.y + -0.19090079*ne.y + -0.17327274*nf.y + 0.18970968*ng.y + -0.40528792*nh.y + 0.29918918*ni.y; +y = -0.47416848*na.z + -0.2253893*nb.z + -0.20096573*nc.z + -0.1839484*nd.z + -0.59042126*ne.z + -0.18943088*nf.z + -0.11804083*ng.z + 0.46977147*nh.z + -0.43911412*ni.z; +z = 0.25877675*na.w + -0.040961746*nb.w + -0.114371866*nc.w + 0.20108926*nd.w + -0.1710303*ne.w + -0.04906647*nf.w + 0.047613766*ng.w + 0.09393413*nh.w + -0.025410969*ni.w; +float p = s+t+u+v+w+x+y+z+-0.0232261; +s = 0.042152505*a.x + 0.124352075*b.x + -0.15299827*c.x + 0.076720685*d.x + -0.5936962*e.x + -0.16264623*f.x + 0.0751963*g.x + 0.21087258*h.x + 0.087068826*i.x; +t = 0.13203055*a.y + -0.21751995*b.y + 0.102787286*c.y + -0.04261077*d.y + 0.24920644*e.y + -0.3904809*f.y + -0.01861381*g.y + 0.11063001*h.y + -0.33896104*i.y; +u = 0.13566086*a.z + -0.15204215*b.z + -0.06522728*c.z + 0.02795511*d.z + -0.12559515*e.z + -0.22700462*f.z + 0.045314662*g.z + -0.06447111*h.z + -0.023562785*i.z; +v = -0.012940961*a.w + 0.17664224*b.w + -0.13506661*c.w + -0.31622937*d.w + -0.19290186*e.w + -0.2040087*f.w + -0.08477456*g.w + -0.28838873*h.w + -0.0007962985*i.w; +w = -0.10869244*na.x + -0.013948862*nb.x + 0.08358129*nc.x + -0.14885941*nd.x + 0.7998457*ne.x + 0.12156752*nf.x + -0.076742455*ng.x + -0.25815073*nh.x + -0.08542834*ni.x; +x = -0.13441303*na.y + 0.20238511*nb.y + 0.08224897*nc.y + -0.010210874*nd.y + -0.03487017*ne.y + 0.39563382*nf.y + 0.09157946*ng.y + -0.06792968*nh.y + 0.12066758*ni.y; +y = -0.017056683*na.z + 0.1785987*nb.z + 0.1171316*nc.z + -0.11710175*nd.z + 0.0712623*ne.z + 0.25886774*nf.z + 0.05486281*ng.z + -0.1529871*nh.z + 0.15849307*ni.z; +z = -0.020291181*na.w + -0.28317827*nb.w + 0.16094936*nc.w + 0.20585804*nd.w + 0.06271287*ne.w + 0.14694595*nf.w + 0.043701086*ng.w + 0.17774133*nh.w + -0.041670833*ni.w; +float q = s+t+u+v+w+x+y+z+0.04867063; +s = -0.0058139246*a.x + 0.15043332*b.x + -0.07965552*c.x + 0.11808298*d.x + -1.1223365*e.x + -0.069821276*f.x + 0.28140724*g.x + 0.03647986*h.x + -0.07226243*i.x; +t = 0.29900336*a.y + 0.12805878*b.y + -0.27058625*c.y + -0.17272973*d.y + 0.28348306*e.y + 0.1458832*f.y + -0.112658225*g.y + 0.38952753*h.y + 0.13744369*i.y; +u = 0.1466236*a.z + 0.24080378*b.z + 0.03769503*c.z + 0.56650436*d.z + 0.7019031*e.z + -0.19276479*f.z + -0.036904544*g.z + -0.04124473*h.z + 0.06124861*i.z; +v = -0.1575896*a.w + 0.54908395*b.w + 0.00678282*c.w + -0.08224296*d.w + 0.15022741*e.w + -0.02417491*f.w + -0.4050065*g.w + 0.15074316*h.w + 0.019433346*i.w; +w = -0.24696513*na.x + -0.03472175*nb.x + -0.20431255*nc.x + 0.033554032*nd.x + 0.56146866*ne.x + 0.17596567*nf.x + -0.2548159*ng.x + -0.040759873*nh.x + 0.06852269*ni.x; +x = -0.26326358*na.y + -0.24154663*nb.y + 0.07214328*nc.y + 0.10916958*nd.y + -0.39659327*ne.y + -0.12247558*nf.y + -0.086615376*ng.y + -0.5583507*nh.y + 0.0013726334*ni.y; +y = -0.101812646*na.z + -0.13131523*nb.z + -0.10259561*nc.z + -0.49369317*nd.z + -0.9012248*ne.z + 0.13316403*nf.z + -0.12572874*ng.z + 0.13881488*nh.z + -0.366776*ni.z; +z = 0.1856694*na.w + -0.42709678*nb.w + 0.0012039911*nc.w + 0.12610117*nd.w + -0.12763858*ne.w + 0.07929683*nf.w + 0.38419572*ng.w + -0.08046531*nh.w + -0.071193114*ni.w; +float r = s+t+u+v+w+x+y+z+-0.064905606; + + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!BIND LUMAN1 +//!SAVE LUMAN2 +//!COMPONENTS 4 + +#define L_tex LUMAN1_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = 0.032612294*a.x + 0.05217593*b.x + -0.02602478*c.x + -0.009559186*d.x + -0.079142615*e.x + 0.033658437*f.x + -0.0003904447*g.x + -0.00393343*h.x + 0.033885516*i.x; +float t = 0.061017875*a.y + -0.098877706*b.y + 0.05585482*c.y + -0.035129443*d.y + 0.12216023*e.y + 0.057924557*f.y + 0.015355803*g.y + -0.031289008*h.y + 0.10955242*i.y; +float u = -0.12501575*a.z + -0.7668215*b.z + -0.034347016*c.z + 0.11531521*d.z + 0.019248677*e.z + -0.07903687*f.z + -0.001764687*g.z + -0.072031766*h.z + 0.018513018*i.z; +float v = -0.033876896*a.w + 0.027925316*b.w + -0.18709126*c.w + 0.020055901*d.w + 0.024774212*e.w + -0.27249435*f.w + -0.034731038*g.w + 0.07663543*h.w + -0.11558825*i.w; +float w = 0.06519397*na.x + 0.0331511*nb.x + -0.054034784*nc.x + 0.0075163264*nd.x + -0.001542763*ne.x + -0.0917449*nf.x + 0.09966738*ng.x + 0.038908098*nh.x + 0.0090232305*ni.x; +float x = 0.016811963*na.y + 0.17261356*nb.y + -0.024686288*nc.y + -0.00812083*nd.y + -0.05404446*ne.y + -0.06075245*nf.y + -0.008939404*ng.y + 0.037180316*nh.y + -0.035045687*ni.y; +float y = 0.04337472*na.z + 0.6101578*nb.z + 0.043000907*nc.z + -0.24797978*nd.z + -0.016052783*ne.z + -0.034820344*nf.z + 0.020345103*ng.z + 0.050275795*nh.z + -0.038051497*ni.z; +float z = -0.06555474*na.w + -0.12544599*nb.w + 0.14026481*nc.w + 0.022938378*nd.w + 0.057652634*ne.w + 0.23248044*nf.w + 0.026928442*ng.w + -0.13955502*nh.w + 0.08018777*ni.w; +float o = s+t+u+v+w+x+y+z+0.007096717; +s = 0.070175104*a.x + 0.026934043*b.x + -0.11168141*c.x + 0.052653495*d.x + 0.2502083*e.x + -0.10245655*f.x + -0.083555*g.x + -0.058119163*h.x + -0.01430314*i.x; +t = -0.14417876*a.y + -0.049951375*b.y + 0.0031790363*c.y + -0.123292364*d.y + -0.08040413*e.y + 0.08017731*f.y + -0.07188208*g.y + -0.07165127*h.y + 0.066209696*i.y; +u = 0.11506684*a.z + 0.056563217*b.z + 0.013236115*c.z + 0.005375116*d.z + 0.4933083*e.z + 0.05078023*f.z + 0.0040291706*g.z + 0.1195088*h.z + -0.057157863*i.z; +v = 0.084459215*a.w + 0.23846485*b.w + -0.1787906*c.w + 0.0026718122*d.w + -0.06350751*e.w + -0.0736151*f.w + 0.04560096*g.w + 0.054295734*h.w + 0.08193043*i.w; +w = -0.16390061*na.x + 0.024693243*nb.x + -0.10875575*nc.x + -0.19704798*nd.x + -0.47012472*ne.x + -0.115844*nf.x + -0.15765278*ng.x + -0.1904334*nh.x + -0.037494563*ni.x; +x = -0.052733094*na.y + -0.13094877*nb.y + -0.063023366*nc.y + -0.018412994*nd.y + -0.022808932*ne.y + -0.21223338*nf.y + -0.06307555*ng.y + -0.074405074*nh.y + -0.11978439*ni.y; +y = -0.030998258*na.z + 0.34119913*nb.z + 0.14216462*nc.z + 0.056921523*nd.z + -0.38311502*ne.z + 0.030159246*nf.z + 0.03274096*ng.z + -0.112698905*nh.z + -0.00559805*ni.z; +z = 0.093809724*na.w + 0.0130590405*nb.w + 0.12439662*nc.w + 0.033985734*nd.w + -0.106709905*ne.w + 0.2098205*nf.w + 0.10431874*ng.w + 0.029808752*nh.w + 0.0690988*ni.w; +float p = s+t+u+v+w+x+y+z+0.018288346; +s = 0.030913495*a.x + -0.055390634*b.x + 0.0305267*c.x + 0.0840251*d.x + -0.03700207*e.x + 0.022972062*f.x + -0.02562781*g.x + 0.07376483*h.x + -0.0057966607*i.x; +t = -0.039614934*a.y + 0.032148097*b.y + -0.009177332*c.y + -0.080749884*d.y + 0.19763118*e.y + -0.0043069613*f.y + -0.029675886*g.y + -0.024654273*h.y + -0.049254663*i.y; +u = -0.013614931*a.z + -0.021588244*b.z + 0.08528718*c.z + -0.080027096*d.z + 0.475552*e.z + -0.08054753*f.z + -0.05154587*g.z + 0.04575436*h.z + 0.08808983*i.z; +v = -0.00074710255*a.w + 0.05044622*b.w + -0.062176898*c.w + -0.018731745*d.w + 0.44010788*e.w + 0.113552585*f.w + 0.0220549*g.w + 0.06840997*h.w + -0.041619394*i.w; +w = -0.033529628*na.x + -0.059398584*nb.x + 0.014590189*nc.x + -0.13532208*nd.x + 0.064755216*ne.x + 0.06675328*nf.x + 0.0015940395*ng.x + -0.08915571*nh.x + -0.0068714074*ni.x; +x = 0.07003029*na.y + 0.013044286*nb.y + -0.029886862*nc.y + 0.16379917*nd.y + -0.07380016*ne.y + 0.043533467*nf.y + 0.04203622*ng.y + 0.043748695*nh.y + -0.00037391373*ni.y; +y = 0.17161192*na.z + 0.12119758*nb.z + -0.05507015*nc.z + 0.23696932*nd.z + -0.37112424*ne.z + 0.16631237*nf.z + 0.07787611*ng.z + -0.020840107*nh.z + -0.051018443*ni.z; +z = 0.021311974*na.w + -0.026781572*nb.w + 0.076363504*nc.w + -0.048298333*nd.w + -0.35880986*ne.w + -0.1461427*nf.w + -0.010461222*ng.w + 0.09168808*nh.w + 0.094090536*ni.w; +float q = s+t+u+v+w+x+y+z+0.014029579; +s = 0.09174196*a.x + 0.07052517*b.x + -0.29162827*c.x + -0.021870576*d.x + -0.002509641*e.x + -0.19107112*f.x + -0.15377358*g.x + -0.08518833*h.x + -0.09038428*i.x; +t = -0.1929897*a.y + -0.16091655*b.y + -0.21550833*c.y + -0.27975655*d.y + -0.17653279*e.y + -0.022304881*f.y + -0.34821656*g.y + -0.47514176*h.y + -0.26265174*i.y; +u = -0.10271849*a.z + 0.5251805*b.z + -0.007373478*c.z + -0.016816907*d.z + 0.061570857*e.z + -0.004462915*f.z + 0.03178182*g.z + 0.35734412*h.z + -0.21102871*i.z; +v = -0.13658017*a.w + 0.019961396*b.w + 0.06720452*c.w + 0.046866085*d.w + 0.14927907*e.w + 0.26567248*f.w + 0.098352484*g.w + 0.22969297*h.w + 0.3724897*i.w; +w = -0.1897536*na.x + -0.12503573*nb.x + -0.061884925*nc.x + -0.022893375*nd.x + -0.20404188*ne.x + 0.26847282*nf.x + -0.041824773*ng.x + -0.21760957*nh.x + 0.25753418*ni.x; +x = -0.036535677*na.y + -0.47319165*nb.y + -0.33732957*nc.y + 0.120873824*nd.y + -0.094053686*ne.y + -0.29922247*nf.y + -0.030908285*ng.y + -0.19555575*nh.y + -0.1243202*ni.y; +y = 0.49426192*na.z + 0.13055071*nb.z + 0.24546814*nc.z + 0.3889015*nd.z + 0.06801324*ne.z + -0.0065246974*nf.z + 0.008800961*ng.z + -0.22768481*nh.z + 0.2125067*ni.z; +z = 0.061227813*na.w + 0.5359894*nb.w + 0.04199768*nc.w + 0.067231*nd.w + 0.48234966*ne.w + 0.26923954*nf.w + 0.0010526689*ng.w + 0.45139587*nh.w + -0.17767063*ni.w; +float r = s+t+u+v+w+x+y+z+-0.02181448; + + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!BIND LUMAN2 +//!SAVE LUMAN3 +//!COMPONENTS 4 + +#define L_tex LUMAN2_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = 0.068182245*a.x + -0.0069326297*b.x + -0.0068673254*c.x + 0.1446591*d.x + 0.08378788*e.x + -0.024598965*f.x + 0.19779426*g.x + 0.22334065*h.x + -0.17073439*i.x; +float t = 0.052008606*a.y + -0.09981899*b.y + 0.045335636*c.y + 0.4641581*d.y + -0.30441022*e.y + 0.065797105*f.y + -0.06673349*g.y + 0.05047059*h.y + 0.14085476*i.y; +float u = -0.095972836*a.z + 0.06938335*b.z + 0.023006218*c.z + 0.04296836*d.z + -0.5235048*e.z + -0.13616344*f.z + 0.07304454*g.z + 0.021639258*h.z + -0.082134925*i.z; +float v = 0.0039542993*a.w + 0.030448513*b.w + 0.0056515886*c.w + -0.015603467*d.w + 0.04000018*e.w + 0.019579457*f.w + 0.03468758*g.w + 0.064087056*h.w + 0.0637572*i.w; +float w = -0.009597599*na.x + -0.034681395*nb.x + 0.008819513*nc.x + -0.23583642*nd.x + -0.19022557*ne.x + -0.07082865*nf.x + -0.28032404*ng.x + -0.1894551*nh.x + -0.057351723*ni.x; +float x = -0.052311067*na.y + 0.096409045*nb.y + -0.021489013*nc.y + -0.21232702*nd.y + 0.14487296*ne.y + 0.0988029*nf.y + -0.14207268*ng.y + -0.007024724*nh.y + 0.061669156*ni.y; +float y = 0.12396183*na.z + 0.094103426*nb.z + 0.014976676*nc.z + 0.1022844*nd.z + 0.5648246*ne.z + -0.0019599644*nf.z + -0.07683154*ng.z + 0.1774352*nh.z + -0.06120524*ni.z; +float z = 0.022139082*na.w + -0.037577357*nb.w + -0.018552171*nc.w + -0.038497932*nd.w + -0.059160978*ne.w + -0.11457565*nf.w + 0.037502605*ng.w + -0.13693711*nh.w + -0.07921285*ni.w; +float o = s+t+u+v+w+x+y+z+0.036297474; +s = 0.030342456*a.x + -0.039990284*b.x + -0.051424503*c.x + -0.01925225*d.x + 0.067412555*e.x + -0.21604383*f.x + -0.0020571705*g.x + 0.25279602*h.x + -0.27639088*i.x; +t = -0.03908301*a.y + -0.045734208*b.y + 0.10134631*c.y + 0.2410097*d.y + -0.43210924*e.y + -0.16147915*f.y + -0.012620945*g.y + -0.34035906*h.y + 0.052142452*i.y; +u = -0.02866191*a.z + 0.06388197*b.z + 0.057335388*c.z + 0.14824343*d.z + 0.6416834*e.z + 0.06821673*f.z + 0.03743971*g.z + 0.18295285*h.z + 0.04697344*i.z; +v = -0.03343023*a.w + -0.079723164*b.w + 0.03642854*c.w + -0.038039494*d.w + 0.039648112*e.w + -0.043636594*f.w + -0.010268333*g.w + 0.024739685*h.w + 0.00081523776*i.w; +w = -0.09762364*na.x + -0.006970587*nb.x + 0.014912876*nc.x + -0.15211417*nd.x + -0.18897301*ne.x + -0.043132078*nf.x + 0.0028474038*ng.x + -0.13173929*nh.x + -0.05366025*ni.x; +x = -0.10488946*na.y + -0.24978034*nb.y + -0.1766879*nc.y + -0.37264153*nd.y + -0.3725847*ne.y + 0.076726876*nf.y + -0.11259801*ng.y + -0.089243226*nh.y + -0.05743071*ni.y; +y = 0.14855608*na.z + 0.3853075*nb.z + 0.21802635*nc.z + 0.035635523*nd.z + -0.5255814*ne.z + 0.102061756*nf.z + 0.07461161*ng.z + 0.08270974*nh.z + 0.020047894*ni.z; +z = 0.060506634*na.w + -0.085323684*nb.w + -0.10522424*nc.w + -0.06939555*nd.w + -0.030670958*ne.w + -0.1347938*nf.w + -0.04364923*ng.w + -0.22535971*nh.w + -0.1260532*ni.w; +float p = s+t+u+v+w+x+y+z+0.0011173683; +s = -0.2886164*a.x + -0.039442055*b.x + -0.119450465*c.x + -0.08216093*d.x + -0.12066674*e.x + -0.15919133*f.x + -0.011250222*g.x + 0.43053594*h.x + 0.17991881*i.x; +t = 0.20882308*a.y + 0.20928346*b.y + 0.040051226*c.y + 0.21490368*d.y + -0.3356241*e.y + -0.014074006*f.y + 0.043512017*g.y + -0.033526454*h.y + -0.07192943*i.y; +u = -0.10531477*a.z + 0.11221637*b.z + -0.044584915*c.z + -0.030554214*d.z + -0.27166846*e.z + 0.34410188*f.z + -0.08278726*g.z + 0.07188203*h.z + 0.15507501*i.z; +v = 0.06288188*a.w + 0.007277631*b.w + 0.00835027*c.w + -0.06512135*d.w + 0.014785896*e.w + 0.021930214*f.w + 0.0679963*g.w + -0.020125564*h.w + -0.045264993*i.w; +w = -0.0233952*na.x + -0.058059644*nb.x + -0.01975237*nc.x + -0.0822563*nd.x + 0.44361475*ne.x + 0.17630681*nf.x + -0.09909648*ng.x + -0.21179818*nh.x + -0.02568658*ni.x; +x = -0.12951021*na.y + -0.07323426*nb.y + 0.04261375*nc.y + -0.15913828*nd.y + 0.26871887*ne.y + 0.17697291*nf.y + 0.044695046*ng.y + 0.18078054*nh.y + 0.04070223*ni.y; +y = -0.03723856*na.z + -0.2979322*nb.z + -0.1473217*nc.z + -0.07408114*nd.z + 0.047217175*ne.z + -0.3361624*nf.z + -0.025131147*ng.z + -0.2811756*nh.z + -0.14700879*ni.z; +z = -0.12900047*na.w + -0.010641486*nb.w + -0.07854108*nc.w + -0.036000077*nd.w + -0.08317402*ne.w + -0.17458077*nf.w + -0.15476076*ng.w + -0.03235207*nh.w + -0.13961978*ni.w; +float q = s+t+u+v+w+x+y+z+0.037814062; +s = 0.020756973*a.x + 0.015390638*b.x + 0.043090865*c.x + 0.08841533*d.x + -0.19133459*e.x + -0.16933541*f.x + 0.30225596*g.x + 0.11427444*h.x + 0.27772912*i.x; +t = 0.02536484*a.y + -0.0004002329*b.y + 0.029193876*c.y + -0.39861244*d.y + 0.35136107*e.y + 0.05067285*f.y + 0.005052226*g.y + 0.042477284*h.y + -0.20685747*i.y; +u = -0.018153053*a.z + -0.19031128*b.z + -0.056764916*c.z + -0.017804828*d.z + -0.03774716*e.z + 0.18117753*f.z + 0.08817886*g.z + 0.12940311*h.z + 0.03569621*i.z; +v = 0.062839195*a.w + 0.059374023*b.w + 0.013266348*c.w + 0.05202128*d.w + -0.0008739606*e.w + -0.034207083*f.w + -0.042441506*g.w + -0.06247998*h.w + -0.03395565*i.w; +w = -0.041048154*na.x + -0.096378066*nb.x + -0.0060394043*nc.x + 0.23021935*nd.x + -0.03567368*ne.x + -0.07556478*nf.x + 0.027616454*ng.x + -0.17390789*nh.x + -0.09462824*ni.x; +x = 0.20173015*na.y + 0.23087224*nb.y + 0.05620477*nc.y + 0.28254738*nd.y + 0.32470715*ne.y + -0.001229216*nf.y + 0.0070387186*ng.y + 0.0444028*nh.y + 0.01803496*ni.y; +y = -0.011506164*na.z + -0.003746743*nb.z + -0.16230682*nc.z + -0.1605967*nd.z + 0.007417641*ne.z + -0.50437224*nf.z + -0.14216262*ng.z + -0.34027475*nh.z + -0.036389288*ni.z; +z = -0.058344644*na.w + 0.007358692*nb.w + 0.12710094*nc.w + 0.086862125*nd.w + 0.050703943*ne.w + 0.17140628*nf.w + 0.09142634*ng.w + 0.10521998*nh.w + 0.15967377*ni.w; +float r = s+t+u+v+w+x+y+z+-0.006030648; + + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!BIND LUMAN3 +//!SAVE LUMAN4 +//!COMPONENTS 4 + +#define L_tex LUMAN3_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = 0.048230067*a.x + -0.42263728*b.x + -0.05921926*c.x + -0.088975295*d.x + 0.24947134*e.x + 0.16823104*f.x + -0.05084739*g.x + 0.08282743*h.x + -0.046297412*i.x; +float t = -0.0235629*a.y + -0.10767638*b.y + -0.21025816*c.y + -0.072625*d.y + -0.6413158*e.y + -0.14511408*f.y + -0.12454647*g.y + -0.24404605*h.y + -0.14415233*i.y; +float u = -0.06777078*a.z + -0.1568683*b.z + -0.111800335*c.z + -0.3228502*d.z + -0.09292451*e.z + 0.019032603*f.z + 0.03934283*g.z + 0.1701896*h.z + -0.0023586492*i.z; +float v = 0.09126801*a.w + -0.18657513*b.w + 0.058995068*c.w + -0.21916303*d.w + 0.09420629*e.w + 0.17089719*f.w + -0.007123415*g.w + -0.024507599*h.w + 0.0695694*i.w; +float w = -5.4803168e-06*na.x + 0.2469564*nb.x + 0.061382506*nc.x + 0.11132984*nd.x + -0.32624033*ne.x + -0.17797688*nf.x + -0.047510166*ng.x + -0.07942387*nh.x + 0.05104685*ni.x; +float x = -0.044642057*na.y + 0.08329546*nb.y + 0.07915247*nc.y + 0.024007931*nd.y + 0.46257478*ne.y + -0.023874717*nf.y + 0.038643204*ng.y + 0.08541271*nh.y + -0.06372369*ni.y; +float y = 0.18184829*na.z + 0.20526642*nb.z + 0.117526315*nc.z + 0.3205227*nd.z + 0.82127017*ne.z + 0.2338787*nf.z + 0.018578304*ng.z + 0.033611953*nh.z + 0.026004096*ni.z; +float z = -0.22122066*na.w + -0.34077403*nb.w + -0.0987134*nc.w + -0.09387926*nd.w + -0.43525234*ne.w + 0.06897393*nf.w + -0.09023409*ng.w + 0.07649014*nh.w + 0.059964593*ni.w; +float o = s+t+u+v+w+x+y+z+0.04746201; +s = -0.0609278*a.x + -0.124526285*b.x + 0.040558368*c.x + 0.02920562*d.x + 0.43226016*e.x + 0.007736719*f.x + -0.045732774*g.x + -0.21000056*h.x + -0.01909662*i.x; +t = 0.075398505*a.y + -0.014759317*b.y + 0.03340105*c.y + 0.019959217*d.y + 0.00073818647*e.y + -0.009558637*f.y + -0.051698968*g.y + -0.04936909*h.y + 0.078152694*i.y; +u = -0.08797453*a.z + 0.014516099*b.z + -0.0026656354*c.z + -0.13679133*d.z + 0.1784666*e.z + -0.05366639*f.z + -0.14755291*g.z + -0.19421436*h.z + 0.030637378*i.z; +v = -0.04317806*a.w + 0.13140467*b.w + -0.013824895*c.w + 0.040707123*d.w + 0.046062354*e.w + -0.086281985*f.w + 0.093628705*g.w + 0.21932063*h.w + 0.019165266*i.w; +w = -0.008172591*na.x + -0.0013425662*nb.x + -0.07983483*nc.x + -0.0586211*nd.x + -0.7670969*ne.x + -0.038597383*nf.x + -0.03701823*ng.x + -0.10454827*nh.x + 0.066349894*ni.x; +x = 0.03359823*na.y + -0.013909608*nb.y + 0.054118548*nc.y + -0.08334272*nd.y + 0.24947649*ne.y + 0.12218821*nf.y + -0.0011804885*ng.y + -0.112565316*nh.y + -0.066528544*ni.y; +y = 0.0077338414*na.z + 0.039621096*nb.z + -0.045150734*nc.z + 0.042783856*nd.z + 0.06879951*ne.z + 0.07736978*nf.z + 0.104744904*ng.z + 0.26520234*nh.z + 0.055557467*ni.z; +z = 0.06725432*na.w + -0.0120222205*nb.w + 0.08446934*nc.w + -0.21304506*nd.w + -0.12236847*ne.w + -0.009406547*nf.w + -0.07522782*ng.w + -0.06918206*nh.w + -0.02407468*ni.w; +float p = s+t+u+v+w+x+y+z+0.013105106; +s = 0.09606797*a.x + 0.26801774*b.x + 0.38528687*c.x + -0.033458263*d.x + -0.094360515*e.x + 0.17535272*f.x + 0.08612117*g.x + 0.101069264*h.x + 0.30121186*i.x; +t = 0.04130504*a.y + -0.10888163*b.y + -0.025934525*c.y + -0.2313813*d.y + 0.16775173*e.y + -0.2829665*f.y + -0.1147368*g.y + -0.17855766*h.y + -0.10940871*i.y; +u = 0.19734505*a.z + 0.1825279*b.z + 0.008681866*c.z + 0.19881345*d.z + 0.08605107*e.z + 0.095323235*f.z + 0.043618903*g.z + 0.1269982*h.z + -0.03947344*i.z; +v = 0.1809144*a.w + 0.12532294*b.w + 0.011504376*c.w + -0.04944015*d.w + -0.3193654*e.w + 0.12856814*f.w + -0.03260216*g.w + -0.1002888*h.w + -0.16131914*i.w; +w = 0.099288195*na.x + 0.094406046*nb.x + 0.044961385*nc.x + 0.03221726*nd.x + 0.2957754*ne.x + 0.31199598*nf.x + -0.065622605*ng.x + 0.06802184*nh.x + 0.028152851*ni.x; +x = -0.24367987*na.y + -0.32990378*nb.y + -0.15500629*nc.y + 0.15390204*nd.y + -0.0627898*ne.y + -0.12582815*nf.y + 0.04443404*ng.y + -0.047507934*nh.y + -0.0044361954*ni.y; +y = -0.100849345*na.z + -0.103607*nb.z + -0.26905012*nc.z + -0.07474063*nd.z + -0.30452257*ne.z + -0.10853125*nf.z + 0.038971826*ng.z + 0.0039860113*nh.z + -0.035304386*ni.z; +z = -0.17392951*na.w + -0.28403047*nb.w + -0.082352*nc.w + -0.16155533*nd.w + 0.24052507*ne.w + -0.20501983*nf.w + -0.11249354*ng.w + 0.12755366*nh.w + -0.143913*ni.w; +float q = s+t+u+v+w+x+y+z+-0.05712435; +s = -0.027302353*a.x + 0.22600543*b.x + -0.037439924*c.x + 0.15801683*d.x + -0.37959543*e.x + 0.3041045*f.x + -0.08002065*g.x + 0.0007808028*h.x + 0.14770354*i.x; +t = 0.07015344*a.y + -0.087105654*b.y + 0.21174876*c.y + -0.036831304*d.y + 0.12957153*e.y + 0.018486293*f.y + 0.10093886*g.y + 0.040975522*h.y + 0.10091543*i.y; +u = 0.08547321*a.z + 0.037870534*b.z + 0.023255348*c.z + 0.1279023*d.z + -0.34048262*e.z + 0.12057997*f.z + 0.13344525*g.z + 0.1766302*h.z + 0.111266665*i.z; +v = 0.08767202*a.w + 0.11616925*b.w + -0.08949242*c.w + 0.100917585*d.w + -0.42854437*e.w + -0.2048292*f.w + 0.008561434*g.w + -0.11210022*h.w + -0.26163608*i.w; +w = -0.03646608*na.x + -0.36505622*nb.x + -0.072367385*nc.x + -0.11446202*nd.x + 0.12389367*ne.x + 0.086974755*nf.x + 0.06081468*ng.x + 0.03095262*nh.x + -0.012839366*ni.x; +x = -0.005128397*na.y + 0.03486762*nb.y + -0.05089381*nc.y + -0.027967067*nd.y + 0.12170837*ne.y + 0.16238582*nf.y + -0.10135618*ng.y + 0.08811323*nh.y + 0.16895714*ni.y; +y = -0.20304015*na.z + 0.07805401*nb.z + -0.14665946*nc.z + -0.099000685*nd.z + 0.20953001*ne.z + -0.24556011*nf.z + -0.122780815*ng.z + -0.049269713*nh.z + -0.12757607*ni.z; +z = 0.05312388*na.w + -0.049571194*nb.w + 0.17178075*nc.w + -0.09628881*nd.w + 0.36055982*ne.w + 0.16550559*nf.w + -0.008175776*ng.w + 0.06055481*nh.w + 0.06663687*ni.w; +float r = s+t+u+v+w+x+y+z+-0.00031198887; + + return vec4(o, p, q, r); +} +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!BIND LUMAN4 +//!SAVE LUMAN5 +//!COMPONENTS 4 + +#define L_tex LUMAN4_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = -0.23736142*a.x + -0.07218535*b.x + -0.041852955*c.x + -0.13868336*d.x + 0.06536255*e.x + 0.020406319*f.x + -0.04352483*g.x + -0.01555337*h.x + -0.053436838*i.x; +float t = 0.2501992*a.y + 0.1750244*b.y + -0.08502407*c.y + 0.24857952*d.y + 0.38473672*e.y + 0.056191485*f.y + -0.01006061*g.y + -0.10007007*h.y + -0.0479506*i.y; +float u = 0.017966108*a.z + 0.26390254*b.z + -0.028323011*c.z + 0.22920771*d.z + 0.047793668*e.z + 0.013393411*f.z + -0.073934786*g.z + -0.056867246*h.z + -0.04472224*i.z; +float v = 0.010295026*a.w + -0.0070827785*b.w + -0.0605245*c.w + 0.40797722*d.w + 0.06890839*e.w + 0.07854928*f.w + 0.018070232*g.w + 0.021921515*h.w + -0.008295515*i.w; +float w = 0.029440459*na.x + -0.20338938*nb.x + 0.03608712*nc.x + -0.0560404*nd.x + 0.36486238*ne.x + -0.09077097*nf.x + -0.0034382194*ng.x + -0.024092315*nh.x + -0.05651802*ni.x; +float x = -0.2387615*na.y + 0.0044211205*nb.y + 0.12196596*nc.y + 0.0018719662*nd.y + -0.38291648*ne.y + -0.10927817*nf.y + 0.0048800204*ng.y + 0.09223615*nh.y + 0.023671495*ni.y; +float y = 0.20535934*na.z + 0.22635183*nb.z + -0.085040614*nc.z + -0.057296805*nd.z + 0.07193608*ne.z + 0.033450443*nf.z + 0.006347363*ng.z + 0.1395266*nh.z + 0.15212502*ni.z; +float z = 0.16476941*na.w + 0.010561869*nb.w + 0.047739767*nc.w + -0.31139913*nd.w + -0.041548803*ne.w + -0.13348936*nf.w + 0.036977705*ng.w + 0.078561224*nh.w + -0.012039407*ni.w; +float o = s+t+u+v+w+x+y+z+0.00016827008; +s = -0.21815544*a.x + -0.22552536*b.x + -0.014158144*c.x + -0.1469778*d.x + -0.22121194*e.x + 0.1927943*f.x + 0.07618134*g.x + 0.118853584*h.x + 0.084942676*i.x; +t = 0.09981943*a.y + 0.317503*b.y + 0.11764991*c.y + -0.12422285*d.y + -0.41523558*e.y + 0.22392312*f.y + -0.11520103*g.y + -0.036089357*h.y + -0.07009806*i.y; +u = -0.11028566*a.z + 0.063099*b.z + 0.0011026734*c.z + -0.05991797*d.z + 0.031247668*e.z + 0.06179971*f.z + 0.060390536*g.z + -0.17191845*h.z + -0.11775279*i.z; +v = 0.018726178*a.w + 0.10752489*b.w + 0.06660048*c.w + -0.03201065*d.w + -0.020206233*e.w + 0.0040159496*f.w + 0.090588436*g.w + 0.09415488*h.w + -1.9609928e-05*i.w; +w = -0.11624948*na.x + 0.013627785*nb.x + 0.101627775*nc.x + 0.17473437*nd.x + 0.30876297*ne.x + -0.13975826*nf.x + 0.00321659*ng.x + -0.21238185*nh.x + -0.08992147*ni.x; +x = 0.020274088*na.y + 0.11817761*nb.y + -0.046248425*nc.y + -0.013413451*nd.y + 0.51850814*ne.y + -0.33153027*nf.y + 0.02177672*ng.y + -0.14238566*nh.y + -0.058259398*ni.y; +y = 0.06913359*na.z + -0.0730094*nb.z + 0.034377456*nc.z + -0.06265757*nd.z + -0.3582522*ne.z + 0.23046972*nf.z + -0.20418762*ng.z + 0.28414622*nh.z + 0.102955386*ni.z; +z = 0.19727987*na.w + 0.013151639*nb.w + -0.052902214*nc.w + 0.013973513*nd.w + -0.4215461*ne.w + -0.27328232*nf.w + -0.06751392*ng.w + -0.3127529*nh.w + -0.09204359*ni.w; +float p = s+t+u+v+w+x+y+z+-0.014182568; +s = -0.34736773*a.x + -0.06972397*b.x + -0.093938254*c.x + -0.14630365*d.x + 0.31515175*e.x + -0.20766215*f.x + -0.0856241*g.x + -0.22420011*h.x + -0.038271178*i.x; +t = 0.43770784*a.y + 0.5205272*b.y + 0.60971767*c.y + -0.04235381*d.y + -0.45357496*e.y + 0.25804746*f.y + 0.0661562*g.y + 0.037322108*h.y + 0.36651894*i.y; +u = 0.2540414*a.z + 0.06414321*b.z + 0.20214534*c.z + -0.061477356*d.z + 0.46545136*e.z + 0.040708408*f.z + 0.14445019*g.z + 0.13169329*h.z + -0.013906265*i.z; +v = -0.071563356*a.w + -0.46953747*b.w + -0.07348474*c.w + -0.23013033*d.w + 0.66805875*e.w + -0.049183927*f.w + -0.09653315*g.w + -0.016621599*h.w + 0.0780333*i.w; +w = 0.16968212*na.x + 0.07696688*nb.x + 0.0023496426*nc.x + 0.08955071*nd.x + 0.0962585*ne.x + -0.25464457*nf.x + 0.016729543*ng.x + 0.08757559*nh.x + 0.1538975*ni.x; +x = -0.3273305*na.y + -0.7855914*nb.y + -0.6899803*nc.y + 0.2045796*nd.y + 1.0804114*ne.y + -0.33822098*nf.y + 0.023830544*ng.y + 0.14510773*nh.y + -0.12344188*ni.y; +y = -0.19701853*na.z + 0.11734899*nb.z + -0.098853715*nc.z + 0.23651646*nd.z + -0.31984463*ne.z + -0.058276266*nf.z + -0.33509082*ng.z + -0.24884325*nh.z + -0.10013402*ni.z; +z = 0.11899618*na.w + -0.0014200769*nb.w + -0.020905564*nc.w + -0.0048010163*nd.w + 0.067089334*ne.w + -0.3352517*nf.w + 0.014445478*ng.w + -0.24828255*nh.w + -0.23759487*ni.w; +float q = s+t+u+v+w+x+y+z+0.039896414; +s = -0.18826365*a.x + -0.1262751*b.x + 0.0012199389*c.x + 0.32116702*d.x + -0.15126537*e.x + 0.119023114*f.x + 0.122457586*g.x + -0.26248026*h.x + -0.0900313*i.x; +t = 0.009903687*a.y + 0.45216253*b.y + 0.36279002*c.y + -0.28200477*d.y + 0.5746711*e.y + 0.53097457*f.y + -0.037697855*g.y + 0.30157155*h.y + 0.22841716*i.y; +u = 0.100869104*a.z + 0.017624957*b.z + 0.0500802*c.z + -0.11950842*d.z + 0.2338097*e.z + -0.04010958*f.z + -0.095233254*g.z + 0.26625177*h.z + 0.054554105*i.z; +v = -0.14044476*a.w + -0.14132117*b.w + 0.09139059*c.w + 0.3790963*d.w + -0.39034823*e.w + -0.09687614*f.w + 0.23206231*g.w + 0.23774491*h.w + -0.0620743*i.w; +w = 0.051436502*na.x + -0.10351269*nb.x + -0.12424041*nc.x + -0.13205881*nd.x + 0.4174902*ne.x + 0.11938382*nf.x + -0.17207816*ng.x + 0.040287893*nh.x + -0.04307966*ni.x; +x = 0.07150747*na.y + -0.019303028*nb.y + -0.010330274*nc.y + 0.27761045*nd.y + -0.2827331*ne.y + -0.012934963*nf.y + -0.029257378*ng.y + -0.24158573*nh.y + -0.1251036*ni.y; +y = -0.07031341*na.z + -0.20601816*nb.z + 0.027196145*nc.z + -0.32718003*nd.z + -0.45986757*ne.z + -0.054294366*nf.z + -0.19018301*ng.z + -0.38746485*nh.z + -0.25102594*ni.z; +z = 0.28564107*na.w + 0.20524764*nb.w + -0.22631782*nc.w + -0.30496415*nd.w + -0.030522099*ne.w + 0.020686796*nf.w + -0.24285361*ng.w + -0.3129688*nh.w + -0.07113108*ni.w; +float r = s+t+u+v+w+x+y+z+0.032977853; + + return vec4(o, p, q, r); +} +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!BIND LUMAN5 +//!SAVE LUMAN6 +//!COMPONENTS 4 + +#define L_tex LUMAN5_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = -0.067909904*a.x + 0.07213549*b.x + -0.094183326*c.x + -0.06924379*d.x + 0.2571301*e.x + -0.46907106*f.x + 0.06106735*g.x + 0.43571764*h.x + 0.018382015*i.x; +float t = 0.038453694*a.y + 0.070749596*b.y + 0.12662974*c.y + 0.045585748*d.y + -0.22559148*e.y + 0.21860053*f.y + 0.14745311*g.y + 0.14422727*h.y + 0.10621522*i.y; +float u = 0.027353777*a.z + 0.0947764*b.z + -0.020315602*c.z + -0.09068284*d.z + -0.09481788*e.z + 0.0399462*f.z + -0.06848305*g.z + 0.05451147*h.z + 0.12830889*i.z; +float v = -0.017329251*a.w + -0.22565089*b.w + -0.03577357*c.w + 0.16699958*d.w + 0.2857703*e.w + -0.05621418*f.w + -0.12263181*g.w + 0.035624128*h.w + 0.098450504*i.w; +float w = -0.11008944*na.x + -0.032715656*nb.x + -0.19416767*nc.x + 0.10495246*nd.x + -0.20974365*ne.x + 0.09771243*nf.x + 0.1782856*ng.x + -0.6445777*nh.x + 0.35234386*ni.x; +float x = 0.12738033*na.y + -0.021345*nb.y + 0.034855936*nc.y + 0.16406639*nd.y + 0.06260629*ne.y + -0.06154745*nf.y + -0.014285338*ng.y + 0.04438198*nh.y + 0.018522695*ni.y; +float y = 0.01981837*na.z + -0.07107509*nb.z + 0.014212223*nc.z + 0.038926024*nd.z + 0.02662531*ne.z + -0.017613089*nf.z + 0.22900726*ng.z + -0.08041844*nh.z + -0.053036153*ni.z; +float z = 0.08012285*na.w + -0.1880344*nb.w + 0.22340271*nc.w + -0.14709368*nd.w + -0.477094*ne.w + 0.004010439*nf.w + -0.23062769*ng.w + 0.06085517*nh.w + -0.017255455*ni.w; +float o = s+t+u+v+w+x+y+z+-0.005476496; +s = 0.03128976*a.x + 0.048691068*b.x + -0.16704744*c.x + 0.052490477*d.x + -0.010417827*e.x + -0.35721236*f.x + -0.062215216*g.x + 0.069990575*h.x + 0.025897821*i.x; +t = 0.019374669*a.y + -0.09289878*b.y + -0.11491471*c.y + 0.0504223*d.y + 0.41783842*e.y + 0.030758737*f.y + -0.023466952*g.y + 0.04662583*h.y + 0.17263764*i.y; +u = -0.041566227*a.z + 0.08646238*b.z + 0.038279615*c.z + -0.029459285*d.z + -0.21637337*e.z + 0.057596713*f.z + 0.014723775*g.z + -0.040119793*h.z + 0.07505516*i.z; +v = 0.05442971*a.w + 0.35998514*b.w + -0.032617625*c.w + -0.054452963*d.w + 0.12532572*e.w + 0.054044265*f.w + 0.031627756*g.w + -0.024870658*h.w + 0.009759014*i.w; +w = 0.11309484*na.x + 0.13073945*nb.x + -0.017153215*nc.x + 0.062964156*nd.x + 0.3064872*ne.x + 0.89749384*nf.x + -0.014941189*ng.x + 0.04061171*nh.x + 0.04307252*ni.x; +x = -0.09723544*na.y + -0.18721382*nb.y + 0.08974929*nc.y + -0.13141121*nd.y + -0.24614644*ne.y + -0.15122154*nf.y + -0.025932945*ng.y + -0.026936408*nh.y + -0.04128235*ni.y; +y = 0.077459246*na.z + 0.0019004345*nb.z + -0.017349463*nc.z + 0.13129182*nd.z + 0.2890425*ne.z + -0.043319378*nf.z + -0.031585578*ng.z + -0.036145695*nh.z + -0.06365771*ni.z; +z = -0.05868564*na.w + -0.10292573*nb.w + -0.11193662*nc.w + 0.029683325*nd.w + -0.080804676*ne.w + 0.035416897*nf.w + -0.023600047*ng.w + 0.037216198*nh.w + 0.013627157*ni.w; +float p = s+t+u+v+w+x+y+z+0.009361195; +s = -0.026526103*a.x + -0.06499592*b.x + -0.104355484*c.x + 0.035101574*d.x + -0.03543982*e.x + 0.39250267*f.x + -0.14073984*g.x + 0.16316575*h.x + 0.08285205*i.x; +t = 0.14270076*a.y + 0.039099913*b.y + -0.17372009*c.y + -0.068915255*d.y + 0.49224404*e.y + -0.31714916*f.y + -0.057546906*g.y + 0.10885324*h.y + 0.044575803*i.y; +u = -0.059490874*a.z + 0.08805799*b.z + 0.04008782*c.z + -0.049980417*d.z + -0.029328382*e.z + 0.09776825*f.z + -0.022992231*g.z + 0.056644473*h.z + 0.027138319*i.z; +v = -0.050222095*a.w + 0.49353465*b.w + -0.3180605*c.w + -0.0696022*d.w + 0.45647475*e.w + 0.18439499*f.w + 0.0922146*g.w + 0.07370147*h.w + 0.038871787*i.w; +w = 0.17216796*na.x + 0.18544932*nb.x + 0.16354512*nc.x + 0.124834314*nd.x + 0.5177341*ne.x + 0.11601982*nf.x + 0.14106567*ng.x + -0.15066552*nh.x + 0.2752277*ni.x; +x = -0.089706264*na.y + 0.030901134*nb.y + 0.094932005*nc.y + 0.10596548*nd.y + -0.51201296*ne.y + 0.14549367*nf.y + -0.022412537*ng.y + -0.06421315*nh.y + 0.014773879*ni.y; +y = 0.0039442857*na.z + -0.01359784*nb.z + -0.0077657327*nc.z + 1.3297267e-05*nd.z + -0.10430566*ne.z + -0.0976933*nf.z + 0.16459519*ng.z + 0.00894974*nh.z + -0.003830634*ni.z; +z = 0.0015719028*na.w + -0.28026047*nb.w + -0.36019176*nc.w + 0.1383878*nd.w + -0.22607847*ne.w + -0.1801225*nf.w + -0.058388997*ng.w + -0.06023031*nh.w + -0.027819455*ni.w; +float q = s+t+u+v+w+x+y+z+0.013245013; +s = -0.029822456*a.x + 0.02616777*b.x + 0.16269188*c.x + 0.2650373*d.x + -0.20996052*e.x + -0.19660734*f.x + 0.010681584*g.x + -0.2076851*h.x + -0.07318369*i.x; +t = 0.018541846*a.y + -0.110020824*b.y + -0.012463573*c.y + -0.04147079*d.y + 0.38140774*e.y + -0.31021866*f.y + -0.07057189*g.y + -0.14601971*h.y + 0.19790615*i.y; +u = 0.06816025*a.z + -0.061384227*b.z + -0.030079572*c.z + 0.18603177*d.z + -0.109502144*e.z + -0.12123356*f.z + -0.07845297*g.z + 0.07252925*h.z + 0.042517964*i.z; +v = 0.10004405*a.w + -0.08016953*b.w + 0.24316287*c.w + -0.27154508*d.w + -0.25279948*e.w + -0.4734194*f.w + 0.07504428*g.w + 0.36581865*h.w + 0.059888706*i.w; +w = -0.017077083*na.x + -0.16063982*nb.x + -0.20941*nc.x + -0.23890181*nd.x + 0.21951643*ne.x + -0.15276802*nf.x + -0.06637867*ng.x + 0.15567715*nh.x + -0.26517457*ni.x; +x = 0.060620476*na.y + 0.009859245*nb.y + -0.10916809*nc.y + -0.12375652*nd.y + -0.017984862*ne.y + 0.011606493*nf.y + 0.029722044*ng.y + -0.053293683*nh.y + -0.033251602*ni.y; +y = 0.006202991*na.z + -0.05648056*nb.z + 0.05449007*nc.z + -0.2502469*nd.z + 0.3130384*ne.z + 0.06463737*nf.z + 0.096328795*ng.z + 0.053917795*nh.z + -0.02201758*ni.z; +z = -0.114404194*na.w + 0.17056693*nb.w + 0.28854623*nc.w + 0.16990852*nd.w + 0.14654322*ne.w + -0.17926534*nf.w + -0.006071123*ng.w + -0.005394441*nh.w + -0.030667707*ni.w; +float r = s+t+u+v+w+x+y+z+0.015945297; + + return vec4(o, p, q, r); +} +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!BIND LUMAN6 +//!SAVE LUMAN7 +//!COMPONENTS 4 + +#define L_tex LUMAN6_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = -0.022006217*a.x + -0.012059591*b.x + 0.002695222*c.x + 0.2576513*d.x + 0.17261067*e.x + 0.551913*f.x + 0.16155578*g.x + -0.011060458*h.x + -0.1789373*i.x; +float t = 0.017821372*a.y + -0.03557644*b.y + -0.025035575*c.y + -0.00046598774*d.y + -0.005887852*e.y + 0.02186709*f.y + 0.09394631*g.y + 0.6164006*h.y + 0.057507005*i.y; +float u = 0.01876147*a.z + 0.13257372*b.z + -0.015636649*c.z + -0.020908952*d.z + -0.083034806*e.z + 0.061008565*f.z + -0.25211054*g.z + 0.78378326*h.z + -0.27476925*i.z; +float v = 0.08554834*a.w + 0.19410893*b.w + -0.11100018*c.w + -0.45933402*d.w + -0.45409277*e.w + -0.22796273*f.w + -0.30464834*g.w + 0.27696005*h.w + -0.00104187*i.w; +float w = 0.04166939*na.x + 0.035488285*nb.x + 0.059535887*nc.x + 0.07787493*nd.x + -0.61595035*ne.x + -0.42177302*nf.x + 0.20006934*ng.x + 0.06433011*nh.x + -0.055998996*ni.x; +float x = -0.0391015*na.y + 0.07890093*nb.y + 0.06986402*nc.y + 0.31180015*nd.y + -0.1622192*ne.y + 0.18821925*nf.y + 0.39657065*ng.y + -0.46719238*nh.y + 0.04969611*ni.y; +float y = -0.06516754*na.z + 0.03271396*nb.z + 0.090906225*nc.z + -0.08948881*nd.z + 0.07813701*ne.z + 0.09922489*nf.z + -0.18747891*ng.z + -0.21690096*nh.z + 0.077256404*ni.z; +float z = 0.016168253*na.w + -0.109046705*nb.w + -0.0824996*nc.w + 0.27986673*nd.w + -0.16506442*ne.w + 0.004419541*nf.w + -0.2717686*ng.w + 0.054969583*nh.w + -0.092781425*ni.w; +float o = s+t+u+v+w+x+y+z+-0.0217535; +s = 0.026437651*a.x + 0.19232419*b.x + -0.16422936*c.x + 0.10565235*d.x + -0.4384296*e.x + -0.16493015*f.x + -0.009258224*g.x + -0.030529829*h.x + -0.21317522*i.x; +t = -0.014095936*a.y + -0.120850965*b.y + 0.01888561*c.y + -0.026737496*d.y + -0.46870494*e.y + 0.08376613*f.y + -0.13321276*g.y + 0.26880193*h.y + -0.35832718*i.y; +u = -0.018054884*a.z + 0.1128491*b.z + 0.08324391*c.z + -0.11279875*d.z + 0.3183996*e.z + -0.37253928*f.z + -0.0629084*g.z + -0.034786735*h.z + -0.17558128*i.z; +v = 0.144636*a.w + -0.04298588*b.w + 0.3045897*c.w + 0.060445797*d.w + -0.0109159695*e.w + 0.2132298*f.w + 0.11611239*g.w + -0.1384314*h.w + -0.09235996*i.w; +w = 0.006147015*na.x + -0.21667369*nb.x + 0.22838773*nc.x + -0.17819536*nd.x + 0.45146102*ne.x + 0.47918588*nf.x + -0.03318283*ng.x + 0.21985787*nh.x + 0.34009728*ni.x; +x = -0.05652136*na.y + 0.111011945*nb.y + -0.0047198976*nc.y + 0.12144599*nd.y + 0.75757605*ne.y + 0.16439566*nf.y + -0.12620859*ng.y + 0.12846243*nh.y + 0.15831694*ni.y; +y = -0.041052956*na.z + -0.119683154*nb.z + 0.020893274*nc.z + 0.070517935*nd.z + -0.23697676*ne.z + 0.46840355*nf.z + -0.04892725*ng.z + -0.40944007*nh.z + 0.11688477*ni.z; +z = -0.02054659*na.w + -0.00066506985*nb.w + -0.042663135*nc.w + 0.26056388*nd.w + 0.15477341*ne.w + 0.13709357*nf.w + 0.057354145*ng.w + 0.03006045*nh.w + -0.007384721*ni.w; +float p = s+t+u+v+w+x+y+z+-0.031859096; +s = 0.04254209*a.x + -0.05705047*b.x + -0.031575847*c.x + 0.072901934*d.x + -0.07428205*e.x + 0.2967097*f.x + 0.008193591*g.x + -0.12431064*h.x + -0.13841611*i.x; +t = -0.012525338*a.y + 0.05161677*b.y + -0.111752085*c.y + -0.055839147*d.y + -0.44907176*e.y + -0.017132394*f.y + -0.10912194*g.y + 0.02698117*h.y + -0.20205373*i.y; +u = -0.03701457*a.z + 0.02593559*b.z + 0.14975408*c.z + 0.0016469631*d.z + -0.34274974*e.z + -0.29361588*f.z + -0.104992904*g.z + 0.2013144*h.z + -0.075109854*i.z; +v = 0.00077759114*a.w + 0.09272906*b.w + 0.076870516*c.w + -0.02691178*d.w + -0.0090563195*e.w + -0.053631466*f.w + 0.013198984*g.w + -0.0065912423*h.w + -0.012886208*i.w; +w = -0.033076394*na.x + -0.088810526*nb.x + 0.019279992*nc.x + -0.047951225*nd.x + -0.24586865*ne.x + -0.13228649*nf.x + -0.0016290849*ng.x + 0.04638423*nh.x + 0.13236308*ni.x; +x = -0.03492093*na.y + -0.109798424*nb.y + 0.024642663*nc.y + 0.20577587*nd.y + 0.2853186*ne.y + 0.15427849*nf.y + 0.149058*ng.y + -0.116264075*nh.y + 0.05439114*ni.y; +y = -0.014611719*na.z + -0.017545976*nb.z + -0.17590396*nc.z + -0.0046303673*nd.z + 0.5373067*ne.z + 0.46450424*nf.z + -0.11478988*ng.z + -0.16745853*nh.z + 0.049644347*ni.z; +z = 0.007340767*na.w + -0.009529236*nb.w + -0.07292183*nc.w + 0.121002674*nd.w + -0.14519809*ne.w + 0.24597451*nf.w + 0.053762082*ng.w + 0.085299775*nh.w + -0.09269121*ni.w; +float q = s+t+u+v+w+x+y+z+-0.0019213319; +s = 0.09813327*a.x + -0.12780574*b.x + 0.006625495*c.x + 0.0867255*d.x + 0.14296821*e.x + 0.09746561*f.x + -0.030963046*g.x + -0.031599507*h.x + 0.07171259*i.x; +t = -0.02695436*a.y + -0.06334176*b.y + 0.038783036*c.y + -0.0043491386*d.y + 0.049357355*e.y + -0.08089158*f.y + -0.026594585*g.y + -0.2797346*h.y + -0.020938909*i.y; +u = -0.18745422*a.z + -0.31568372*b.z + -0.012768946*c.z + 0.10063372*d.z + 0.2662484*e.z + -0.11729661*f.z + -0.16505139*g.z + -0.26203063*h.z + 0.033530373*i.z; +v = -0.04269229*a.w + -0.25492373*b.w + 0.23321919*c.w + 0.38466015*d.w + 0.9420985*e.w + 0.28590629*f.w + 0.4087332*g.w + 0.27309123*h.w + 0.102289595*i.w; +w = -0.17433798*na.x + 0.16236849*nb.x + 0.15976915*nc.x + 0.02497057*nd.x + -0.19628315*ne.x + -0.06265425*nf.x + -0.046286214*ng.x + 0.010435635*nh.x + 0.074468784*ni.x; +x = 0.025122926*na.y + 0.26216775*nb.y + 0.0848261*nc.y + 0.4296719*nd.y + -0.6394346*ne.y + -0.3245584*nf.y + -0.33212742*ng.y + -0.014895529*nh.y + -0.17663886*ni.y; +y = -0.018905697*na.z + 0.016177211*nb.z + -0.24340479*nc.z + -0.4919266*nd.z + -0.5344714*ne.z + -0.094090745*nf.z + 0.08073831*ng.z + -0.09079831*nh.z + -0.024821006*ni.z; +z = -0.13918148*na.w + 0.2543219*nb.w + 0.18887864*nc.w + 0.06735778*nd.w + -0.15226458*ne.w + 0.108695254*nf.w + 0.06763557*ng.w + -0.013376045*nh.w + -0.0071781515*ni.w; +float r = s+t+u+v+w+x+y+z+-0.03213358; + + return vec4(o, p, q, r); +} +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!BIND LUMAN7 +//!SAVE LUMAN8 +//!COMPONENTS 4 + +#define L_tex LUMAN7_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = -0.090979576*a.x + 0.26158786*b.x + -0.25845823*c.x + 0.11686225*d.x + 0.7249228*e.x + 0.22422317*f.x + -0.0016817157*g.x + -0.045406442*h.x + -0.0153964255*i.x; +float t = 0.020251293*a.y + 0.12992781*b.y + -0.26349863*c.y + 0.03556678*d.y + 0.23429622*e.y + 0.35104224*f.y + -0.11499256*g.y + 0.109316014*h.y + -0.14154646*i.y; +float u = -0.07613151*a.z + 0.26030222*b.z + 0.041128322*c.z + -0.2946645*d.z + -0.3431931*e.z + -0.22281167*f.z + 0.05490744*g.z + -0.12693247*h.z + 0.030528152*i.z; +float v = 0.068428345*a.w + -0.04550164*b.w + 0.28332227*c.w + 0.03758558*d.w + 0.31537637*e.w + -0.88547385*f.w + 0.14168099*g.w + 0.2672414*h.w + 0.29484844*i.w; +float w = 0.03971598*na.x + -0.15292329*nb.x + 0.20590727*nc.x + 0.0030272854*nd.x + -0.073130965*ne.x + -0.20384851*nf.x + -0.07106073*ng.x + -0.101229355*nh.x + 0.05182081*ni.x; +float x = -0.05639171*na.y + 0.13405822*nb.y + 0.051922694*nc.y + -0.20046455*nd.y + -0.42624408*ne.y + -0.3261027*nf.y + 0.11790978*ng.y + 0.11581271*nh.y + 0.2400041*ni.y; +float y = -0.07396325*na.z + 0.49679124*nb.z + 0.026551519*nc.z + 0.61899525*nd.z + -0.25464156*ne.z + 0.3430776*nf.z + -0.112355895*ng.z + 0.36447346*nh.z + 0.19507225*ni.z; +float z = 0.040693846*na.w + -0.024500126*nb.w + 0.07946955*nc.w + 0.08976172*nd.w + -0.24011669*ne.w + -0.2528033*nf.w + -0.14805055*ng.w + 0.112328075*nh.w + -0.0047488576*ni.w; +float o = s+t+u+v+w+x+y+z+-0.030780189; +s = -0.028054465*a.x + -0.044692505*b.x + 0.20362917*c.x + -0.100096725*d.x + -0.061864212*e.x + 0.03544999*f.x + 0.04018204*g.x + 0.06835267*h.x + -0.018371353*i.x; +t = -0.05103254*a.y + -0.13975304*b.y + 0.08319163*c.y + 0.3038626*d.y + 0.27844998*e.y + -0.046875928*f.y + -0.0034036317*g.y + 0.09696977*h.y + -0.04449184*i.y; +u = -0.10114778*a.z + -0.107570395*b.z + -0.15081966*c.z + 0.2479526*d.z + -0.20912926*e.z + 0.024067253*f.z + -0.3417179*g.z + -0.07706387*h.z + 0.007355439*i.z; +v = -0.04988727*a.w + 0.18736894*b.w + 0.17245813*c.w + -0.07175973*d.w + -0.85888803*e.w + -0.3613071*f.w + 0.24460877*g.w + 0.8859543*h.w + -0.13769223*i.w; +w = -0.038889136*na.x + 0.09344554*nb.x + 0.22336337*nc.x + 0.25991657*nd.x + 0.33309814*ne.x + 0.045674607*nf.x + -0.10420427*ng.x + 0.035547618*nh.x + 0.018530225*ni.x; +x = 0.2756573*na.y + 0.32226437*nb.y + 0.025734236*nc.y + -0.16104288*nd.y + -0.40601286*ne.y + 0.09831973*nf.y + 0.35679048*ng.y + 0.25575617*nh.y + 0.20090733*ni.y; +y = 0.09818739*na.z + 0.16135061*nb.z + 0.017967097*nc.z + -0.39471382*nd.z + -0.90883625*ne.z + -0.4241856*nf.z + -0.11843628*ng.z + 0.39857107*nh.z + 0.12109732*ni.z; +z = -0.022406828*na.w + -0.008107861*nb.w + 0.008098971*nc.w + 0.19073384*nd.w + 0.37782744*ne.w + 0.20523809*nf.w + -0.027150735*ng.w + 0.21531254*nh.w + -0.13412546*ni.w; +float p = s+t+u+v+w+x+y+z+-0.01892319; +s = 0.35650992*a.x + -0.8653189*b.x + 0.03990455*c.x + -0.08822504*d.x + -0.45795453*e.x + -0.13031328*f.x + 0.09203946*g.x + -0.29639995*h.x + 0.06788846*i.x; +t = 0.062216192*a.y + -0.12972717*b.y + 0.055175733*c.y + -0.18075024*d.y + 0.019622922*e.y + -0.09647325*f.y + -0.03200571*g.y + -0.15787482*h.y + 0.0042678057*i.y; +u = 0.14833425*a.z + 0.25882515*b.z + 0.063659094*c.z + -0.49287808*d.z + -0.06723707*e.z + 0.10271336*f.z + 0.24586615*g.z + 0.14865553*h.z + -0.116240144*i.z; +v = -0.0792519*a.w + 0.32723862*b.w + 0.07915708*c.w + 0.23290725*d.w + -0.43134773*e.w + 0.25607985*f.w + 0.27738905*g.w + -0.047513194*h.w + 0.024800982*i.w; +w = -0.24938466*na.x + 0.35974526*nb.x + -0.12741408*nc.x + -0.08949298*nd.x + 0.59076357*ne.x + 0.111327894*nf.x + 0.040771488*ng.x + -0.05842803*nh.x + -0.08034774*ni.x; +x = 0.037412044*na.y + -0.20272894*nb.y + -0.06831999*nc.y + -0.4714889*nd.y + -0.3838717*ne.y + 0.058825877*nf.y + 0.06995256*ng.y + -0.14386222*nh.y + -0.081692964*ni.y; +y = 0.12876076*na.z + 0.20346333*nb.z + 0.07815222*nc.z + -0.4048683*nd.z + 0.8882211*ne.z + 0.13583338*nf.z + 0.575287*ng.z + -0.16988589*nh.z + 0.19699658*ni.z; +z = 0.052144192*na.w + 0.031341515*nb.w + 0.0136394845*nc.w + 0.047928814*nd.w + 0.34520543*ne.w + -0.2240882*nf.w + -0.09696316*ng.w + -0.062464975*nh.w + 0.05087205*ni.w; +float q = s+t+u+v+w+x+y+z+0.024297409; +s = -0.16852628*a.x + 0.09809276*b.x + 0.22396*c.x + 0.080930464*d.x + -0.33478954*e.x + -0.33829704*f.x + -0.007273387*g.x + 0.11371913*h.x + 0.10754754*i.x; +t = 0.06576919*a.y + 0.24384294*b.y + 0.28421602*c.y + 0.03653487*d.y + -0.28440398*e.y + -0.5122065*f.y + -0.04945199*g.y + 0.14481378*h.y + 0.21009488*i.y; +u = -0.18703452*a.z + -0.2927576*b.z + -0.31313953*c.z + -0.07285863*d.z + 0.20641851*e.z + 0.38029015*f.z + 0.17704949*g.z + -0.1293435*h.z + -0.36630917*i.z; +v = 0.077824086*a.w + -0.19499196*b.w + -0.13373896*c.w + -0.09556833*d.w + 0.1321527*e.w + -0.04833771*f.w + -0.05258668*g.w + -0.070803344*h.w + 0.16116437*i.w; +w = 0.107823074*na.x + 0.2909979*nb.x + 0.18573105*nc.x + 0.24895737*nd.x + 0.8293185*ne.x + 0.5999831*nf.x + -0.20711009*ng.x + -0.2071418*nh.x + -0.21046878*ni.x; +x = -0.04392347*na.y + -0.20879328*nb.y + -0.080248356*nc.y + 0.17260192*nd.y + 0.5676353*ne.y + 0.3880135*nf.y + 0.06297885*ng.y + -0.029866349*nh.y + -0.04889006*ni.y; +y = -0.14178613*na.z + -0.12998302*nb.z + 0.1562837*nc.z + 0.2894252*nd.z + 0.28852552*ne.z + -0.5431766*nf.z + -0.018923528*ng.z + -0.25701952*nh.z + 0.13423893*ni.z; +z = 0.077071175*na.w + 0.10650166*nb.w + -0.104624994*nc.w + 0.09795779*nd.w + 0.20976487*ne.w + 0.29659525*nf.w + -0.12783296*ng.w + -0.25428843*nh.w + -0.019792268*ni.w; +float r = s+t+u+v+w+x+y+z+-0.028622074; + + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-5x1x1x72-v2.1a-(L) +//!HOOK LUMA +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!BIND LUMAN0 +//!BIND LUMAN1 +//!BIND LUMAN2 +//!BIND LUMAN3 +//!BIND LUMAN4 +//!BIND LUMAN5 +//!BIND LUMAN6 +//!BIND LUMAN7 +//!BIND LUMAN8 +//!SAVE LUMAN0 +//!COMPONENTS 4 + +#define L_tex LUMAN8_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = LUMAN0_tex(HOOKED_pos); + vec4 b = LUMAN1_tex(HOOKED_pos); + vec4 c = LUMAN2_tex(HOOKED_pos); + vec4 d = LUMAN3_tex(HOOKED_pos); + vec4 e = LUMAN4_tex(HOOKED_pos); + vec4 f = LUMAN5_tex(HOOKED_pos); + vec4 g = LUMAN6_tex(HOOKED_pos); + vec4 h = LUMAN7_tex(HOOKED_pos); + vec4 i = LUMAN8_tex(HOOKED_pos); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float o = 0.016885867*a.x + 0.046275508*a.y + -0.002548845*a.z + -0.0036128832*a.w + 0.03724025*b.x + 0.024534246*b.y + 0.061686493*b.z + -0.024180291*b.w + -0.07351123*c.x + -0.0032643469*c.y + -0.06198006*c.z + 0.0019208151*c.w + -0.0050309473*d.x + -0.07710412*d.y + -0.044080913*d.z + -0.032088976*d.w + -0.039627064*e.x + -0.0755259*e.y + 0.014249692*e.z + -0.017667277*e.w + 0.06635247*f.x + -0.17981255*f.y + -0.030311016*f.z + 0.14224172*f.w + 0.18823496*g.x + 0.15706189*g.y + -0.1300641*g.z + -0.034661684*g.w + 0.07448457*h.x + 0.020709032*h.y + -0.07573852*h.z + -0.090263546*h.w + -0.040318064*i.x + 0.05574537*i.y + 0.07446265*i.z + -0.022002082*i.w + -0.0687863*na.x + -0.08193518*na.y + 0.031677037*na.z + -0.0077320607*na.w + -0.024414517*nb.x + 0.014907232*nb.y + -0.020390427*nb.z + 0.048062213*nb.w + -0.00605564*nc.x + 0.02761477*nc.y + 0.1975337*nc.z + 0.0015166273*nc.w + 0.0320424*nd.x + 0.011832504*nd.y + 0.026225777*nd.z + -0.2019032*nd.w + 0.119912304*ne.x + -0.01836036*ne.y + 0.005017364*ne.z + 0.088221684*ne.w + -0.0735611*nf.x + -0.06006883*nf.y + 0.060761195*nf.z + -0.01694692*nf.w + -0.0966928*ng.x + 0.06081417*ng.y + 0.016560802*ng.z + 0.15959227*ng.w + -0.036181692*nh.x + 0.054725073*nh.y + -0.01582938*nh.z + -0.042625222*nh.w + 0.044871956*ni.x + -0.18472537*ni.y + -0.19192328*ni.z + 0.24313739*ni.w + 0.0056005213; +float p = 0.10122024*a.x + 0.009013353*a.y + -0.079185255*a.z + -0.022577854*a.w + 0.017786987*b.x + -0.0044460474*b.y + 0.038255103*b.z + 0.06852989*b.w + -0.037540313*c.x + -0.024483606*c.y + -0.060457204*c.z + 0.008208255*c.w + 0.10506395*d.x + -0.10918799*d.y + 0.0024290022*d.z + 0.028659703*d.w + -0.036873445*e.x + -0.04777761*e.y + 0.037514273*e.z + 0.02106696*e.w + 0.0355307*f.x + -0.10925304*f.y + -0.076339185*f.z + -0.14641297*f.w + 0.4269761*g.x + -0.024972297*g.y + 0.00043523175*g.z + 0.028613552*g.w + -0.09744465*h.x + -0.047286086*h.y + 0.07950336*h.z + 0.0331076*h.w + -0.04132422*i.x + -0.04611622*i.y + -0.03012942*i.z + 0.0015597334*i.w + -0.06825223*na.x + -0.06776767*na.y + 0.07088692*na.z + 0.020398268*na.w + -0.01647635*nb.x + 0.025414415*nb.y + -0.00040916045*nb.z + 0.009997192*nb.w + 0.003176333*nc.x + 0.029960362*nc.y + 0.05490353*nc.z + 0.0057089655*nc.w + -0.04524216*nd.x + -0.02972447*nd.y + 0.019471187*nd.z + -0.15544881*nd.w + 0.012991984*ne.x + -0.029754944*ne.y + 0.021750188*ne.z + 0.05023415*ne.w + 0.0460487*nf.x + -0.0074485326*nf.y + 0.007808842*nf.z + 0.0050014053*nf.w + -0.06944166*ng.x + 0.024812013*ng.y + -0.07313965*ng.z + 0.05142984*ng.w + 0.12944002*nh.x + 0.0038473085*nh.y + 0.06375067*nh.z + 0.076042116*nh.w + -0.054415874*ni.x + 0.20547464*ni.y + -0.066312514*ni.z + -0.27718043*ni.w + 0.0073262304; +float q = 0.07165155*a.x + 0.016282482*a.y + -0.0755284*a.z + -0.057094567*a.w + 0.010499061*b.x + 0.044993453*b.y + 0.009832754*b.z + 0.035309795*b.w + -0.09954656*c.x + -0.007337344*c.y + -0.04127519*c.z + -0.0168086*c.w + 0.07503995*d.x + -0.09394142*d.y + 0.028956652*d.z + 0.010161553*d.w + -0.08834079*e.x + -0.12903136*e.y + -0.1396115*e.z + -0.100337654*e.w + 0.018166749*f.x + -0.010528762*f.y + -0.04319865*f.z + 0.20262095*f.w + -0.18123764*g.x + 0.09017963*g.y + 0.09083577*g.z + 0.030754533*g.w + -0.18661265*h.x + -0.07488591*h.y + 0.11152151*h.z + -0.09857111*h.w + 0.19065167*i.x + -0.05214327*i.y + -0.011917154*i.z + -0.02628262*i.w + -0.051253464*na.x + -0.016850019*na.y + 0.080229335*na.z + 0.005362246*na.w + 0.018979054*nb.x + 0.021625564*nb.y + 0.0601448*nb.z + 0.0023157557*nb.w + 0.04790784*nc.x + -0.07263248*nc.y + -0.04542804*nc.z + 0.05196972*nc.w + -0.09942659*nd.x + 0.039653614*nd.y + 0.038100686*nd.z + -0.060198136*nd.w + 0.06327745*ne.x + 0.01759228*ne.y + 0.080639675*ne.z + 0.024707427*ne.w + -0.08681871*nf.x + -0.0046041547*nf.y + 0.11898749*nf.z + -0.04837889*nf.w + 0.07214983*ng.x + 0.03850557*ng.y + -0.08791204*ng.z + 0.02814183*ng.w + 0.10511739*nh.x + 0.15158683*nh.y + -0.4341295*nh.z + 0.105929375*nh.w + -0.11776578*ni.x + -0.09376781*ni.y + 0.11989495*ni.z + 0.254987*ni.w + 0.008396086; +float r = 0.045564942*a.x + -0.03419365*a.y + -0.10012808*a.z + -0.08574549*a.w + -0.0047195284*b.x + -0.014133889*b.y + -0.0052942014*b.z + 0.14866596*b.w + -0.022166757*c.x + -0.072412185*c.y + -0.0003714175*c.z + -0.040883984*c.w + 0.11360617*d.x + -0.12701546*d.y + 0.043022666*d.z + 0.08209777*d.w + -0.056664243*e.x + -0.050801404*e.y + -0.0463481*e.z + -0.011171822*e.w + 0.045977*f.x + 0.10907696*f.y + -0.052183993*f.z + 0.01923395*f.w + -0.116869815*g.x + 0.09466439*g.y + 0.1376351*g.z + 0.13010791*g.w + 0.20518136*h.x + -0.011971838*h.y + 0.1729419*h.z + 0.0018733321*h.w + -0.07899665*i.x + -0.084723875*i.y + 0.036292665*i.z + 0.023502793*i.w + 0.007908565*na.x + 0.05505959*na.y + 0.11442343*na.z + 0.025596732*na.w + -0.00093543297*nb.x + 0.01238046*nb.y + 0.1094715*nb.z + -0.016205456*nb.w + 0.038828447*nc.x + -0.0912666*nc.y + -0.13580854*nc.z + 0.03265067*nc.w + -0.100696385*nd.x + 0.020130597*nd.y + -0.035411533*nd.z + 0.02844439*nd.w + -0.02738409*ne.x + -0.03230527*ne.y + 0.054703213*ne.z + 0.023416441*ne.w + -0.1554482*nf.x + 0.12072812*nf.y + 0.016804868*nf.z + 0.001143662*nf.w + 0.09983937*ng.x + -0.092101745*ng.y + -0.2277122*ng.z + -0.2239213*ng.w + 0.02129851*nh.x + 0.1715038*nh.y + -0.26232228*nh.z + 0.038821537*nh.w + -0.0045500016*ni.x + 0.23054405*ni.y + 0.02692771*ni.z + -0.21184772*ni.w + -0.0036547435; + +float oo = -0.018809512*a.x + 0.010670327*a.y + -0.00824726*a.z + -0.0013437107*a.w + 0.005091081*b.x + 0.011520226*b.y + 0.034261033*b.z + 0.03064754*b.w + -0.017336003*c.x + -0.066918716*c.y + -0.020906765*c.z + 0.005316979*c.w + 0.09518458*d.x + -0.096665494*d.y + 0.04538189*d.z + -0.034607723*d.w + -0.0473297*e.x + -0.12172123*e.y + -0.024985144*e.z + -0.07162522*e.w + 0.026515657*f.x + -0.022308977*f.y + -0.041618045*f.z + 0.037533067*f.w + 0.088171676*g.x + 0.03103262*g.y + 0.07121279*g.z + 0.079160064*g.w + -0.03990838*h.x + -0.010683694*h.y + 0.09863001*h.z + -0.06637193*h.w + 0.0129789*i.x + -0.02429924*i.y + 0.018866336*i.z + -0.0027682844*i.w + -0.008679747*na.x + 0.014632188*na.y + 0.016659852*na.z + 0.011889224*na.w + -0.0058282344*nb.x + -0.0045387107*nb.y + 0.013490616*nb.z + -0.048750147*nb.w + 0.009104728*nc.x + -0.007074725*nc.y + -0.02057848*nc.z + 0.023461971*nc.w + 0.035868544*nd.x + 0.06788529*nd.y + 0.23750551*nd.z + 0.0064159986*nd.w + 0.046270985*ne.x + -0.018257186*ne.y + 0.025571529*ne.z + -0.10155261*ne.w + -0.04462234*nf.x + -0.033172693*nf.y + 0.023921944*nf.z + 0.04234701*nf.w + -0.0012737011*ng.x + 0.07112644*ng.y + -0.1945164*ng.z + -0.018535018*ng.w + 0.07102353*nh.x + 0.12712991*nh.y + -0.21089678*nh.z + 0.072553955*nh.w + -0.029867975*ni.x + 0.029737562*ni.y + -0.036139317*ni.z + 0.014916579*ni.w + -0.003636893; + + return vec4(o, p, q, r) + vec4(oo); +} + +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!WIDTH LUMA.w 2 * +//!HEIGHT LUMA.h 2 * +//!DESC Anime4K-Hybrid-ML-Upscale(x2)-v2.1 +//!BIND LUMAN0 + + +vec4 hook() { + vec2 f = fract(LUMAN0_pos * LUMAN0_size); + ivec2 i = ivec2(f * vec2(2)); + vec4 residual = LUMAN0_tex((vec2(0.5) - f) * LUMAN0_pt + LUMAN0_pos); + return vec4(residual[i.y * 2 + i.x] + HOOKED_tex(HOOKED_pos).x, HOOKED_tex(HOOKED_pos).yz, 0); +} + + +/* ---------------------- x4 PRESCALER ---------------------- */ + + +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!WIDTH LUMA.w 2 * +//!HEIGHT LUMA.h 2 * +//!DESC Anime4K-Hybrid-Chroma-Upscale(x2)-v2.1 + +#define STRENGTH 0.1 +#define SPREAD_STRENGTH 2.0 + +/* --- MOST OF THE OTHER SETTINGS CAN BE FOUND AT THE END --- */ + +#define KERNELSIZE 3 +#define KERNELHALFSIZE 1 +#define KERNELLEN 9 + + +float gaussian(float x, float s, float m) { + return (1 / (s * sqrt(2 * 3.14159))) * exp(-0.5 * pow(abs(x - m) / s, 2.0)); +} + +vec4 hook() { + vec2 d = HOOKED_pt; + + vec4 vc = HOOKED_tex(HOOKED_pos); + + float s = vc.x * STRENGTH + 0.0001; + float ss = SPREAD_STRENGTH + 0.0001; + + vec4 valsum = vec4(0); + float normsum = 0.000001; //Avoid divide by zero + + for (int i=0; i OUTPUT.h LUMA.h / 2.400 > * * +//!WIDTH OUTPUT.w 2 / +//!HEIGHT OUTPUT.h 2 / + +vec4 hook() { + return HOOKED_tex(HOOKED_pos); +} + + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x1-v2.1a-(L) +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!SAVE LUMAN10 +//!COMPONENTS 4 + + +vec4 hook() { + vec2 dp = HOOKED_pt; + float a = HOOKED_tex(HOOKED_pos + vec2(-dp.x, -dp.y)).x; + float b = HOOKED_tex(HOOKED_pos + vec2(-dp.x, 0)).x; + float c = HOOKED_tex(HOOKED_pos + vec2(-dp.x, dp.y)).x; + float d = HOOKED_tex(HOOKED_pos + vec2(0, -dp.y)).x; + float e = HOOKED_tex(HOOKED_pos + vec2(0, 0)).x; + float f = HOOKED_tex(HOOKED_pos + vec2(0, dp.y)).x; + float g = HOOKED_tex(HOOKED_pos + vec2(dp.x, -dp.y)).x; + float h = HOOKED_tex(HOOKED_pos + vec2(dp.x, 0)).x; + float i = HOOKED_tex(HOOKED_pos + vec2(dp.x, dp.y)).x; + +float s = -0.20137449*a + -0.0015731218*b + 0.05501119*c + 0.1565948*d + 0.6737233*e + -0.23572952*f + 0.18099797*g + -0.7995735*h + 0.13067944*i; +float o = s+-0.027419055; +s = 0.51490134*a + -0.25941947*b + -0.07724701*c + 0.5250881*d + -0.54380083*e + -0.05643802*f + -0.101760834*g + -0.034337673*h + 0.054615285*i; +float p = s+-0.012926701; +s = -0.53016037*a + 0.61940545*b + -0.20846693*c + 0.639486*d + -0.032331035*e + -0.15247229*f + -0.1443841*g + -0.2677867*h + 0.04309905*i; +float q = s+0.056758612; +s = 0.026444327*a + 0.14535855*b + 0.011089705*c + -0.041422866*d + 0.13639577*e + 0.71558315*f + 0.118795045*g + -0.83810943*h + -0.27118593*i; +float r = s+0.019607993; + + return vec4(o, p, q, r); +} + + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN10 +//!SAVE LUMAN11 +//!COMPONENTS 4 + +#define L_tex LUMAN10_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = -0.14129105*a.x + -0.3267071*b.x + 0.050059587*c.x + -0.3987618*d.x + 0.72525537*e.x + 0.4873099*f.x + 0.008632439*g.x + 0.015846651*h.x + 0.2593738*i.x; +float t = 0.13931245*a.y + -0.16447836*b.y + -0.35802507*c.y + -0.074192844*d.y + 0.070096076*e.y + 0.42356202*f.y + -0.10464654*g.y + 0.22069831*h.y + 0.60978895*i.y; +float u = -0.008347766*a.z + 0.25076723*b.z + 0.09202788*c.z + 0.43199953*d.z + 0.11726567*e.z + -0.18873338*f.z + 0.011628617*g.z + 0.19094141*h.z + 0.13027532*i.z; +float v = 0.09801981*a.w + 0.1172482*b.w + 0.033339277*c.w + -0.10594379*d.w + 0.44982854*e.w + 0.04813419*f.w + -0.31859815*g.w + 0.045677304*h.w + 0.025485627*i.w; +float w = 0.08831363*na.x + 0.073816575*nb.x + 0.007407972*nc.x + 0.14349033*nd.x + -0.22767976*ne.x + -0.12758991*nf.x + 0.02673382*ng.x + -0.04628971*nh.x + -0.04612809*ni.x; +float x = -0.26549712*na.y + 0.014268674*nb.y + -0.10447855*nc.y + 0.18266474*nd.y + -0.121571824*ne.y + -0.21750784*nf.y + -0.18120421*ng.y + 0.022351112*nh.y + 0.42605555*ni.y; +float y = -0.48064795*na.z + -0.27713984*nb.z + -0.377774*nc.z + -0.41632155*nd.z + -0.13041303*ne.z + 0.36084685*nf.z + -0.4065425*ng.z + 0.08281877*nh.z + -0.006921882*ni.z; +float z = 0.019636001*na.w + -0.43382022*nb.w + -0.12121368*nc.w + 0.36083665*nd.w + 0.2515448*ne.w + 0.09338429*nf.w + 0.16182008*ng.w + 0.20439956*nh.w + 0.07576254*ni.w; +float o = s+t+u+v+w+x+y+z+-0.08090411; +s = -0.5596512*a.x + -0.22780022*b.x + 0.29604053*c.x + -0.2262779*d.x + -0.3262377*e.x + 0.04412409*f.x + 0.13768737*g.x + 0.22867353*h.x + -0.17862745*i.x; +t = 0.0732342*a.y + 0.3564334*b.y + -0.39165732*c.y + 0.20254353*d.y + -0.38930947*e.y + 0.16037573*f.y + -0.35927212*g.y + 0.044125237*h.y + -0.118192345*i.y; +u = -0.26556936*a.z + 0.3948796*b.z + 0.20452352*c.z + 0.64263874*d.z + 0.18677169*e.z + -0.26447296*f.z + -0.01685825*g.z + -0.6205177*h.z + 0.33575967*i.z; +v = -0.2797471*a.w + 0.24474439*b.w + 0.018175174*c.w + -0.09123516*d.w + 0.15797856*e.w + -0.11215085*f.w + 0.105207905*g.w + -0.056100324*h.w + 0.08030639*i.w; +w = 0.095356405*na.x + -0.24610977*nb.x + -0.27622896*nc.x + -0.2714281*nd.x + 0.5328526*ne.x + 0.27557987*nf.x + -0.076188155*ng.x + -0.052882478*nh.x + -0.24295144*ni.x; +x = -0.037961688*na.y + -0.20192467*nb.y + 0.08267803*nc.y + -0.06314137*nd.y + -0.19090079*ne.y + -0.17327274*nf.y + 0.18970968*ng.y + -0.40528792*nh.y + 0.29918918*ni.y; +y = -0.47416848*na.z + -0.2253893*nb.z + -0.20096573*nc.z + -0.1839484*nd.z + -0.59042126*ne.z + -0.18943088*nf.z + -0.11804083*ng.z + 0.46977147*nh.z + -0.43911412*ni.z; +z = 0.25877675*na.w + -0.040961746*nb.w + -0.114371866*nc.w + 0.20108926*nd.w + -0.1710303*ne.w + -0.04906647*nf.w + 0.047613766*ng.w + 0.09393413*nh.w + -0.025410969*ni.w; +float p = s+t+u+v+w+x+y+z+-0.0232261; +s = 0.042152505*a.x + 0.124352075*b.x + -0.15299827*c.x + 0.076720685*d.x + -0.5936962*e.x + -0.16264623*f.x + 0.0751963*g.x + 0.21087258*h.x + 0.087068826*i.x; +t = 0.13203055*a.y + -0.21751995*b.y + 0.102787286*c.y + -0.04261077*d.y + 0.24920644*e.y + -0.3904809*f.y + -0.01861381*g.y + 0.11063001*h.y + -0.33896104*i.y; +u = 0.13566086*a.z + -0.15204215*b.z + -0.06522728*c.z + 0.02795511*d.z + -0.12559515*e.z + -0.22700462*f.z + 0.045314662*g.z + -0.06447111*h.z + -0.023562785*i.z; +v = -0.012940961*a.w + 0.17664224*b.w + -0.13506661*c.w + -0.31622937*d.w + -0.19290186*e.w + -0.2040087*f.w + -0.08477456*g.w + -0.28838873*h.w + -0.0007962985*i.w; +w = -0.10869244*na.x + -0.013948862*nb.x + 0.08358129*nc.x + -0.14885941*nd.x + 0.7998457*ne.x + 0.12156752*nf.x + -0.076742455*ng.x + -0.25815073*nh.x + -0.08542834*ni.x; +x = -0.13441303*na.y + 0.20238511*nb.y + 0.08224897*nc.y + -0.010210874*nd.y + -0.03487017*ne.y + 0.39563382*nf.y + 0.09157946*ng.y + -0.06792968*nh.y + 0.12066758*ni.y; +y = -0.017056683*na.z + 0.1785987*nb.z + 0.1171316*nc.z + -0.11710175*nd.z + 0.0712623*ne.z + 0.25886774*nf.z + 0.05486281*ng.z + -0.1529871*nh.z + 0.15849307*ni.z; +z = -0.020291181*na.w + -0.28317827*nb.w + 0.16094936*nc.w + 0.20585804*nd.w + 0.06271287*ne.w + 0.14694595*nf.w + 0.043701086*ng.w + 0.17774133*nh.w + -0.041670833*ni.w; +float q = s+t+u+v+w+x+y+z+0.04867063; +s = -0.0058139246*a.x + 0.15043332*b.x + -0.07965552*c.x + 0.11808298*d.x + -1.1223365*e.x + -0.069821276*f.x + 0.28140724*g.x + 0.03647986*h.x + -0.07226243*i.x; +t = 0.29900336*a.y + 0.12805878*b.y + -0.27058625*c.y + -0.17272973*d.y + 0.28348306*e.y + 0.1458832*f.y + -0.112658225*g.y + 0.38952753*h.y + 0.13744369*i.y; +u = 0.1466236*a.z + 0.24080378*b.z + 0.03769503*c.z + 0.56650436*d.z + 0.7019031*e.z + -0.19276479*f.z + -0.036904544*g.z + -0.04124473*h.z + 0.06124861*i.z; +v = -0.1575896*a.w + 0.54908395*b.w + 0.00678282*c.w + -0.08224296*d.w + 0.15022741*e.w + -0.02417491*f.w + -0.4050065*g.w + 0.15074316*h.w + 0.019433346*i.w; +w = -0.24696513*na.x + -0.03472175*nb.x + -0.20431255*nc.x + 0.033554032*nd.x + 0.56146866*ne.x + 0.17596567*nf.x + -0.2548159*ng.x + -0.040759873*nh.x + 0.06852269*ni.x; +x = -0.26326358*na.y + -0.24154663*nb.y + 0.07214328*nc.y + 0.10916958*nd.y + -0.39659327*ne.y + -0.12247558*nf.y + -0.086615376*ng.y + -0.5583507*nh.y + 0.0013726334*ni.y; +y = -0.101812646*na.z + -0.13131523*nb.z + -0.10259561*nc.z + -0.49369317*nd.z + -0.9012248*ne.z + 0.13316403*nf.z + -0.12572874*ng.z + 0.13881488*nh.z + -0.366776*ni.z; +z = 0.1856694*na.w + -0.42709678*nb.w + 0.0012039911*nc.w + 0.12610117*nd.w + -0.12763858*ne.w + 0.07929683*nf.w + 0.38419572*ng.w + -0.08046531*nh.w + -0.071193114*ni.w; +float r = s+t+u+v+w+x+y+z+-0.064905606; + + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN11 +//!SAVE LUMAN12 +//!COMPONENTS 4 + +#define L_tex LUMAN11_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = 0.032612294*a.x + 0.05217593*b.x + -0.02602478*c.x + -0.009559186*d.x + -0.079142615*e.x + 0.033658437*f.x + -0.0003904447*g.x + -0.00393343*h.x + 0.033885516*i.x; +float t = 0.061017875*a.y + -0.098877706*b.y + 0.05585482*c.y + -0.035129443*d.y + 0.12216023*e.y + 0.057924557*f.y + 0.015355803*g.y + -0.031289008*h.y + 0.10955242*i.y; +float u = -0.12501575*a.z + -0.7668215*b.z + -0.034347016*c.z + 0.11531521*d.z + 0.019248677*e.z + -0.07903687*f.z + -0.001764687*g.z + -0.072031766*h.z + 0.018513018*i.z; +float v = -0.033876896*a.w + 0.027925316*b.w + -0.18709126*c.w + 0.020055901*d.w + 0.024774212*e.w + -0.27249435*f.w + -0.034731038*g.w + 0.07663543*h.w + -0.11558825*i.w; +float w = 0.06519397*na.x + 0.0331511*nb.x + -0.054034784*nc.x + 0.0075163264*nd.x + -0.001542763*ne.x + -0.0917449*nf.x + 0.09966738*ng.x + 0.038908098*nh.x + 0.0090232305*ni.x; +float x = 0.016811963*na.y + 0.17261356*nb.y + -0.024686288*nc.y + -0.00812083*nd.y + -0.05404446*ne.y + -0.06075245*nf.y + -0.008939404*ng.y + 0.037180316*nh.y + -0.035045687*ni.y; +float y = 0.04337472*na.z + 0.6101578*nb.z + 0.043000907*nc.z + -0.24797978*nd.z + -0.016052783*ne.z + -0.034820344*nf.z + 0.020345103*ng.z + 0.050275795*nh.z + -0.038051497*ni.z; +float z = -0.06555474*na.w + -0.12544599*nb.w + 0.14026481*nc.w + 0.022938378*nd.w + 0.057652634*ne.w + 0.23248044*nf.w + 0.026928442*ng.w + -0.13955502*nh.w + 0.08018777*ni.w; +float o = s+t+u+v+w+x+y+z+0.007096717; +s = 0.070175104*a.x + 0.026934043*b.x + -0.11168141*c.x + 0.052653495*d.x + 0.2502083*e.x + -0.10245655*f.x + -0.083555*g.x + -0.058119163*h.x + -0.01430314*i.x; +t = -0.14417876*a.y + -0.049951375*b.y + 0.0031790363*c.y + -0.123292364*d.y + -0.08040413*e.y + 0.08017731*f.y + -0.07188208*g.y + -0.07165127*h.y + 0.066209696*i.y; +u = 0.11506684*a.z + 0.056563217*b.z + 0.013236115*c.z + 0.005375116*d.z + 0.4933083*e.z + 0.05078023*f.z + 0.0040291706*g.z + 0.1195088*h.z + -0.057157863*i.z; +v = 0.084459215*a.w + 0.23846485*b.w + -0.1787906*c.w + 0.0026718122*d.w + -0.06350751*e.w + -0.0736151*f.w + 0.04560096*g.w + 0.054295734*h.w + 0.08193043*i.w; +w = -0.16390061*na.x + 0.024693243*nb.x + -0.10875575*nc.x + -0.19704798*nd.x + -0.47012472*ne.x + -0.115844*nf.x + -0.15765278*ng.x + -0.1904334*nh.x + -0.037494563*ni.x; +x = -0.052733094*na.y + -0.13094877*nb.y + -0.063023366*nc.y + -0.018412994*nd.y + -0.022808932*ne.y + -0.21223338*nf.y + -0.06307555*ng.y + -0.074405074*nh.y + -0.11978439*ni.y; +y = -0.030998258*na.z + 0.34119913*nb.z + 0.14216462*nc.z + 0.056921523*nd.z + -0.38311502*ne.z + 0.030159246*nf.z + 0.03274096*ng.z + -0.112698905*nh.z + -0.00559805*ni.z; +z = 0.093809724*na.w + 0.0130590405*nb.w + 0.12439662*nc.w + 0.033985734*nd.w + -0.106709905*ne.w + 0.2098205*nf.w + 0.10431874*ng.w + 0.029808752*nh.w + 0.0690988*ni.w; +float p = s+t+u+v+w+x+y+z+0.018288346; +s = 0.030913495*a.x + -0.055390634*b.x + 0.0305267*c.x + 0.0840251*d.x + -0.03700207*e.x + 0.022972062*f.x + -0.02562781*g.x + 0.07376483*h.x + -0.0057966607*i.x; +t = -0.039614934*a.y + 0.032148097*b.y + -0.009177332*c.y + -0.080749884*d.y + 0.19763118*e.y + -0.0043069613*f.y + -0.029675886*g.y + -0.024654273*h.y + -0.049254663*i.y; +u = -0.013614931*a.z + -0.021588244*b.z + 0.08528718*c.z + -0.080027096*d.z + 0.475552*e.z + -0.08054753*f.z + -0.05154587*g.z + 0.04575436*h.z + 0.08808983*i.z; +v = -0.00074710255*a.w + 0.05044622*b.w + -0.062176898*c.w + -0.018731745*d.w + 0.44010788*e.w + 0.113552585*f.w + 0.0220549*g.w + 0.06840997*h.w + -0.041619394*i.w; +w = -0.033529628*na.x + -0.059398584*nb.x + 0.014590189*nc.x + -0.13532208*nd.x + 0.064755216*ne.x + 0.06675328*nf.x + 0.0015940395*ng.x + -0.08915571*nh.x + -0.0068714074*ni.x; +x = 0.07003029*na.y + 0.013044286*nb.y + -0.029886862*nc.y + 0.16379917*nd.y + -0.07380016*ne.y + 0.043533467*nf.y + 0.04203622*ng.y + 0.043748695*nh.y + -0.00037391373*ni.y; +y = 0.17161192*na.z + 0.12119758*nb.z + -0.05507015*nc.z + 0.23696932*nd.z + -0.37112424*ne.z + 0.16631237*nf.z + 0.07787611*ng.z + -0.020840107*nh.z + -0.051018443*ni.z; +z = 0.021311974*na.w + -0.026781572*nb.w + 0.076363504*nc.w + -0.048298333*nd.w + -0.35880986*ne.w + -0.1461427*nf.w + -0.010461222*ng.w + 0.09168808*nh.w + 0.094090536*ni.w; +float q = s+t+u+v+w+x+y+z+0.014029579; +s = 0.09174196*a.x + 0.07052517*b.x + -0.29162827*c.x + -0.021870576*d.x + -0.002509641*e.x + -0.19107112*f.x + -0.15377358*g.x + -0.08518833*h.x + -0.09038428*i.x; +t = -0.1929897*a.y + -0.16091655*b.y + -0.21550833*c.y + -0.27975655*d.y + -0.17653279*e.y + -0.022304881*f.y + -0.34821656*g.y + -0.47514176*h.y + -0.26265174*i.y; +u = -0.10271849*a.z + 0.5251805*b.z + -0.007373478*c.z + -0.016816907*d.z + 0.061570857*e.z + -0.004462915*f.z + 0.03178182*g.z + 0.35734412*h.z + -0.21102871*i.z; +v = -0.13658017*a.w + 0.019961396*b.w + 0.06720452*c.w + 0.046866085*d.w + 0.14927907*e.w + 0.26567248*f.w + 0.098352484*g.w + 0.22969297*h.w + 0.3724897*i.w; +w = -0.1897536*na.x + -0.12503573*nb.x + -0.061884925*nc.x + -0.022893375*nd.x + -0.20404188*ne.x + 0.26847282*nf.x + -0.041824773*ng.x + -0.21760957*nh.x + 0.25753418*ni.x; +x = -0.036535677*na.y + -0.47319165*nb.y + -0.33732957*nc.y + 0.120873824*nd.y + -0.094053686*ne.y + -0.29922247*nf.y + -0.030908285*ng.y + -0.19555575*nh.y + -0.1243202*ni.y; +y = 0.49426192*na.z + 0.13055071*nb.z + 0.24546814*nc.z + 0.3889015*nd.z + 0.06801324*ne.z + -0.0065246974*nf.z + 0.008800961*ng.z + -0.22768481*nh.z + 0.2125067*ni.z; +z = 0.061227813*na.w + 0.5359894*nb.w + 0.04199768*nc.w + 0.067231*nd.w + 0.48234966*ne.w + 0.26923954*nf.w + 0.0010526689*ng.w + 0.45139587*nh.w + -0.17767063*ni.w; +float r = s+t+u+v+w+x+y+z+-0.02181448; + + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN12 +//!SAVE LUMAN13 +//!COMPONENTS 4 + +#define L_tex LUMAN12_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = 0.068182245*a.x + -0.0069326297*b.x + -0.0068673254*c.x + 0.1446591*d.x + 0.08378788*e.x + -0.024598965*f.x + 0.19779426*g.x + 0.22334065*h.x + -0.17073439*i.x; +float t = 0.052008606*a.y + -0.09981899*b.y + 0.045335636*c.y + 0.4641581*d.y + -0.30441022*e.y + 0.065797105*f.y + -0.06673349*g.y + 0.05047059*h.y + 0.14085476*i.y; +float u = -0.095972836*a.z + 0.06938335*b.z + 0.023006218*c.z + 0.04296836*d.z + -0.5235048*e.z + -0.13616344*f.z + 0.07304454*g.z + 0.021639258*h.z + -0.082134925*i.z; +float v = 0.0039542993*a.w + 0.030448513*b.w + 0.0056515886*c.w + -0.015603467*d.w + 0.04000018*e.w + 0.019579457*f.w + 0.03468758*g.w + 0.064087056*h.w + 0.0637572*i.w; +float w = -0.009597599*na.x + -0.034681395*nb.x + 0.008819513*nc.x + -0.23583642*nd.x + -0.19022557*ne.x + -0.07082865*nf.x + -0.28032404*ng.x + -0.1894551*nh.x + -0.057351723*ni.x; +float x = -0.052311067*na.y + 0.096409045*nb.y + -0.021489013*nc.y + -0.21232702*nd.y + 0.14487296*ne.y + 0.0988029*nf.y + -0.14207268*ng.y + -0.007024724*nh.y + 0.061669156*ni.y; +float y = 0.12396183*na.z + 0.094103426*nb.z + 0.014976676*nc.z + 0.1022844*nd.z + 0.5648246*ne.z + -0.0019599644*nf.z + -0.07683154*ng.z + 0.1774352*nh.z + -0.06120524*ni.z; +float z = 0.022139082*na.w + -0.037577357*nb.w + -0.018552171*nc.w + -0.038497932*nd.w + -0.059160978*ne.w + -0.11457565*nf.w + 0.037502605*ng.w + -0.13693711*nh.w + -0.07921285*ni.w; +float o = s+t+u+v+w+x+y+z+0.036297474; +s = 0.030342456*a.x + -0.039990284*b.x + -0.051424503*c.x + -0.01925225*d.x + 0.067412555*e.x + -0.21604383*f.x + -0.0020571705*g.x + 0.25279602*h.x + -0.27639088*i.x; +t = -0.03908301*a.y + -0.045734208*b.y + 0.10134631*c.y + 0.2410097*d.y + -0.43210924*e.y + -0.16147915*f.y + -0.012620945*g.y + -0.34035906*h.y + 0.052142452*i.y; +u = -0.02866191*a.z + 0.06388197*b.z + 0.057335388*c.z + 0.14824343*d.z + 0.6416834*e.z + 0.06821673*f.z + 0.03743971*g.z + 0.18295285*h.z + 0.04697344*i.z; +v = -0.03343023*a.w + -0.079723164*b.w + 0.03642854*c.w + -0.038039494*d.w + 0.039648112*e.w + -0.043636594*f.w + -0.010268333*g.w + 0.024739685*h.w + 0.00081523776*i.w; +w = -0.09762364*na.x + -0.006970587*nb.x + 0.014912876*nc.x + -0.15211417*nd.x + -0.18897301*ne.x + -0.043132078*nf.x + 0.0028474038*ng.x + -0.13173929*nh.x + -0.05366025*ni.x; +x = -0.10488946*na.y + -0.24978034*nb.y + -0.1766879*nc.y + -0.37264153*nd.y + -0.3725847*ne.y + 0.076726876*nf.y + -0.11259801*ng.y + -0.089243226*nh.y + -0.05743071*ni.y; +y = 0.14855608*na.z + 0.3853075*nb.z + 0.21802635*nc.z + 0.035635523*nd.z + -0.5255814*ne.z + 0.102061756*nf.z + 0.07461161*ng.z + 0.08270974*nh.z + 0.020047894*ni.z; +z = 0.060506634*na.w + -0.085323684*nb.w + -0.10522424*nc.w + -0.06939555*nd.w + -0.030670958*ne.w + -0.1347938*nf.w + -0.04364923*ng.w + -0.22535971*nh.w + -0.1260532*ni.w; +float p = s+t+u+v+w+x+y+z+0.0011173683; +s = -0.2886164*a.x + -0.039442055*b.x + -0.119450465*c.x + -0.08216093*d.x + -0.12066674*e.x + -0.15919133*f.x + -0.011250222*g.x + 0.43053594*h.x + 0.17991881*i.x; +t = 0.20882308*a.y + 0.20928346*b.y + 0.040051226*c.y + 0.21490368*d.y + -0.3356241*e.y + -0.014074006*f.y + 0.043512017*g.y + -0.033526454*h.y + -0.07192943*i.y; +u = -0.10531477*a.z + 0.11221637*b.z + -0.044584915*c.z + -0.030554214*d.z + -0.27166846*e.z + 0.34410188*f.z + -0.08278726*g.z + 0.07188203*h.z + 0.15507501*i.z; +v = 0.06288188*a.w + 0.007277631*b.w + 0.00835027*c.w + -0.06512135*d.w + 0.014785896*e.w + 0.021930214*f.w + 0.0679963*g.w + -0.020125564*h.w + -0.045264993*i.w; +w = -0.0233952*na.x + -0.058059644*nb.x + -0.01975237*nc.x + -0.0822563*nd.x + 0.44361475*ne.x + 0.17630681*nf.x + -0.09909648*ng.x + -0.21179818*nh.x + -0.02568658*ni.x; +x = -0.12951021*na.y + -0.07323426*nb.y + 0.04261375*nc.y + -0.15913828*nd.y + 0.26871887*ne.y + 0.17697291*nf.y + 0.044695046*ng.y + 0.18078054*nh.y + 0.04070223*ni.y; +y = -0.03723856*na.z + -0.2979322*nb.z + -0.1473217*nc.z + -0.07408114*nd.z + 0.047217175*ne.z + -0.3361624*nf.z + -0.025131147*ng.z + -0.2811756*nh.z + -0.14700879*ni.z; +z = -0.12900047*na.w + -0.010641486*nb.w + -0.07854108*nc.w + -0.036000077*nd.w + -0.08317402*ne.w + -0.17458077*nf.w + -0.15476076*ng.w + -0.03235207*nh.w + -0.13961978*ni.w; +float q = s+t+u+v+w+x+y+z+0.037814062; +s = 0.020756973*a.x + 0.015390638*b.x + 0.043090865*c.x + 0.08841533*d.x + -0.19133459*e.x + -0.16933541*f.x + 0.30225596*g.x + 0.11427444*h.x + 0.27772912*i.x; +t = 0.02536484*a.y + -0.0004002329*b.y + 0.029193876*c.y + -0.39861244*d.y + 0.35136107*e.y + 0.05067285*f.y + 0.005052226*g.y + 0.042477284*h.y + -0.20685747*i.y; +u = -0.018153053*a.z + -0.19031128*b.z + -0.056764916*c.z + -0.017804828*d.z + -0.03774716*e.z + 0.18117753*f.z + 0.08817886*g.z + 0.12940311*h.z + 0.03569621*i.z; +v = 0.062839195*a.w + 0.059374023*b.w + 0.013266348*c.w + 0.05202128*d.w + -0.0008739606*e.w + -0.034207083*f.w + -0.042441506*g.w + -0.06247998*h.w + -0.03395565*i.w; +w = -0.041048154*na.x + -0.096378066*nb.x + -0.0060394043*nc.x + 0.23021935*nd.x + -0.03567368*ne.x + -0.07556478*nf.x + 0.027616454*ng.x + -0.17390789*nh.x + -0.09462824*ni.x; +x = 0.20173015*na.y + 0.23087224*nb.y + 0.05620477*nc.y + 0.28254738*nd.y + 0.32470715*ne.y + -0.001229216*nf.y + 0.0070387186*ng.y + 0.0444028*nh.y + 0.01803496*ni.y; +y = -0.011506164*na.z + -0.003746743*nb.z + -0.16230682*nc.z + -0.1605967*nd.z + 0.007417641*ne.z + -0.50437224*nf.z + -0.14216262*ng.z + -0.34027475*nh.z + -0.036389288*ni.z; +z = -0.058344644*na.w + 0.007358692*nb.w + 0.12710094*nc.w + 0.086862125*nd.w + 0.050703943*ne.w + 0.17140628*nf.w + 0.09142634*ng.w + 0.10521998*nh.w + 0.15967377*ni.w; +float r = s+t+u+v+w+x+y+z+-0.006030648; + + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN13 +//!SAVE LUMAN14 +//!COMPONENTS 4 + +#define L_tex LUMAN13_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = 0.048230067*a.x + -0.42263728*b.x + -0.05921926*c.x + -0.088975295*d.x + 0.24947134*e.x + 0.16823104*f.x + -0.05084739*g.x + 0.08282743*h.x + -0.046297412*i.x; +float t = -0.0235629*a.y + -0.10767638*b.y + -0.21025816*c.y + -0.072625*d.y + -0.6413158*e.y + -0.14511408*f.y + -0.12454647*g.y + -0.24404605*h.y + -0.14415233*i.y; +float u = -0.06777078*a.z + -0.1568683*b.z + -0.111800335*c.z + -0.3228502*d.z + -0.09292451*e.z + 0.019032603*f.z + 0.03934283*g.z + 0.1701896*h.z + -0.0023586492*i.z; +float v = 0.09126801*a.w + -0.18657513*b.w + 0.058995068*c.w + -0.21916303*d.w + 0.09420629*e.w + 0.17089719*f.w + -0.007123415*g.w + -0.024507599*h.w + 0.0695694*i.w; +float w = -5.4803168e-06*na.x + 0.2469564*nb.x + 0.061382506*nc.x + 0.11132984*nd.x + -0.32624033*ne.x + -0.17797688*nf.x + -0.047510166*ng.x + -0.07942387*nh.x + 0.05104685*ni.x; +float x = -0.044642057*na.y + 0.08329546*nb.y + 0.07915247*nc.y + 0.024007931*nd.y + 0.46257478*ne.y + -0.023874717*nf.y + 0.038643204*ng.y + 0.08541271*nh.y + -0.06372369*ni.y; +float y = 0.18184829*na.z + 0.20526642*nb.z + 0.117526315*nc.z + 0.3205227*nd.z + 0.82127017*ne.z + 0.2338787*nf.z + 0.018578304*ng.z + 0.033611953*nh.z + 0.026004096*ni.z; +float z = -0.22122066*na.w + -0.34077403*nb.w + -0.0987134*nc.w + -0.09387926*nd.w + -0.43525234*ne.w + 0.06897393*nf.w + -0.09023409*ng.w + 0.07649014*nh.w + 0.059964593*ni.w; +float o = s+t+u+v+w+x+y+z+0.04746201; +s = -0.0609278*a.x + -0.124526285*b.x + 0.040558368*c.x + 0.02920562*d.x + 0.43226016*e.x + 0.007736719*f.x + -0.045732774*g.x + -0.21000056*h.x + -0.01909662*i.x; +t = 0.075398505*a.y + -0.014759317*b.y + 0.03340105*c.y + 0.019959217*d.y + 0.00073818647*e.y + -0.009558637*f.y + -0.051698968*g.y + -0.04936909*h.y + 0.078152694*i.y; +u = -0.08797453*a.z + 0.014516099*b.z + -0.0026656354*c.z + -0.13679133*d.z + 0.1784666*e.z + -0.05366639*f.z + -0.14755291*g.z + -0.19421436*h.z + 0.030637378*i.z; +v = -0.04317806*a.w + 0.13140467*b.w + -0.013824895*c.w + 0.040707123*d.w + 0.046062354*e.w + -0.086281985*f.w + 0.093628705*g.w + 0.21932063*h.w + 0.019165266*i.w; +w = -0.008172591*na.x + -0.0013425662*nb.x + -0.07983483*nc.x + -0.0586211*nd.x + -0.7670969*ne.x + -0.038597383*nf.x + -0.03701823*ng.x + -0.10454827*nh.x + 0.066349894*ni.x; +x = 0.03359823*na.y + -0.013909608*nb.y + 0.054118548*nc.y + -0.08334272*nd.y + 0.24947649*ne.y + 0.12218821*nf.y + -0.0011804885*ng.y + -0.112565316*nh.y + -0.066528544*ni.y; +y = 0.0077338414*na.z + 0.039621096*nb.z + -0.045150734*nc.z + 0.042783856*nd.z + 0.06879951*ne.z + 0.07736978*nf.z + 0.104744904*ng.z + 0.26520234*nh.z + 0.055557467*ni.z; +z = 0.06725432*na.w + -0.0120222205*nb.w + 0.08446934*nc.w + -0.21304506*nd.w + -0.12236847*ne.w + -0.009406547*nf.w + -0.07522782*ng.w + -0.06918206*nh.w + -0.02407468*ni.w; +float p = s+t+u+v+w+x+y+z+0.013105106; +s = 0.09606797*a.x + 0.26801774*b.x + 0.38528687*c.x + -0.033458263*d.x + -0.094360515*e.x + 0.17535272*f.x + 0.08612117*g.x + 0.101069264*h.x + 0.30121186*i.x; +t = 0.04130504*a.y + -0.10888163*b.y + -0.025934525*c.y + -0.2313813*d.y + 0.16775173*e.y + -0.2829665*f.y + -0.1147368*g.y + -0.17855766*h.y + -0.10940871*i.y; +u = 0.19734505*a.z + 0.1825279*b.z + 0.008681866*c.z + 0.19881345*d.z + 0.08605107*e.z + 0.095323235*f.z + 0.043618903*g.z + 0.1269982*h.z + -0.03947344*i.z; +v = 0.1809144*a.w + 0.12532294*b.w + 0.011504376*c.w + -0.04944015*d.w + -0.3193654*e.w + 0.12856814*f.w + -0.03260216*g.w + -0.1002888*h.w + -0.16131914*i.w; +w = 0.099288195*na.x + 0.094406046*nb.x + 0.044961385*nc.x + 0.03221726*nd.x + 0.2957754*ne.x + 0.31199598*nf.x + -0.065622605*ng.x + 0.06802184*nh.x + 0.028152851*ni.x; +x = -0.24367987*na.y + -0.32990378*nb.y + -0.15500629*nc.y + 0.15390204*nd.y + -0.0627898*ne.y + -0.12582815*nf.y + 0.04443404*ng.y + -0.047507934*nh.y + -0.0044361954*ni.y; +y = -0.100849345*na.z + -0.103607*nb.z + -0.26905012*nc.z + -0.07474063*nd.z + -0.30452257*ne.z + -0.10853125*nf.z + 0.038971826*ng.z + 0.0039860113*nh.z + -0.035304386*ni.z; +z = -0.17392951*na.w + -0.28403047*nb.w + -0.082352*nc.w + -0.16155533*nd.w + 0.24052507*ne.w + -0.20501983*nf.w + -0.11249354*ng.w + 0.12755366*nh.w + -0.143913*ni.w; +float q = s+t+u+v+w+x+y+z+-0.05712435; +s = -0.027302353*a.x + 0.22600543*b.x + -0.037439924*c.x + 0.15801683*d.x + -0.37959543*e.x + 0.3041045*f.x + -0.08002065*g.x + 0.0007808028*h.x + 0.14770354*i.x; +t = 0.07015344*a.y + -0.087105654*b.y + 0.21174876*c.y + -0.036831304*d.y + 0.12957153*e.y + 0.018486293*f.y + 0.10093886*g.y + 0.040975522*h.y + 0.10091543*i.y; +u = 0.08547321*a.z + 0.037870534*b.z + 0.023255348*c.z + 0.1279023*d.z + -0.34048262*e.z + 0.12057997*f.z + 0.13344525*g.z + 0.1766302*h.z + 0.111266665*i.z; +v = 0.08767202*a.w + 0.11616925*b.w + -0.08949242*c.w + 0.100917585*d.w + -0.42854437*e.w + -0.2048292*f.w + 0.008561434*g.w + -0.11210022*h.w + -0.26163608*i.w; +w = -0.03646608*na.x + -0.36505622*nb.x + -0.072367385*nc.x + -0.11446202*nd.x + 0.12389367*ne.x + 0.086974755*nf.x + 0.06081468*ng.x + 0.03095262*nh.x + -0.012839366*ni.x; +x = -0.005128397*na.y + 0.03486762*nb.y + -0.05089381*nc.y + -0.027967067*nd.y + 0.12170837*ne.y + 0.16238582*nf.y + -0.10135618*ng.y + 0.08811323*nh.y + 0.16895714*ni.y; +y = -0.20304015*na.z + 0.07805401*nb.z + -0.14665946*nc.z + -0.099000685*nd.z + 0.20953001*ne.z + -0.24556011*nf.z + -0.122780815*ng.z + -0.049269713*nh.z + -0.12757607*ni.z; +z = 0.05312388*na.w + -0.049571194*nb.w + 0.17178075*nc.w + -0.09628881*nd.w + 0.36055982*ne.w + 0.16550559*nf.w + -0.008175776*ng.w + 0.06055481*nh.w + 0.06663687*ni.w; +float r = s+t+u+v+w+x+y+z+-0.00031198887; + + return vec4(o, p, q, r); +} +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN14 +//!SAVE LUMAN15 +//!COMPONENTS 4 + +#define L_tex LUMAN14_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = -0.23736142*a.x + -0.07218535*b.x + -0.041852955*c.x + -0.13868336*d.x + 0.06536255*e.x + 0.020406319*f.x + -0.04352483*g.x + -0.01555337*h.x + -0.053436838*i.x; +float t = 0.2501992*a.y + 0.1750244*b.y + -0.08502407*c.y + 0.24857952*d.y + 0.38473672*e.y + 0.056191485*f.y + -0.01006061*g.y + -0.10007007*h.y + -0.0479506*i.y; +float u = 0.017966108*a.z + 0.26390254*b.z + -0.028323011*c.z + 0.22920771*d.z + 0.047793668*e.z + 0.013393411*f.z + -0.073934786*g.z + -0.056867246*h.z + -0.04472224*i.z; +float v = 0.010295026*a.w + -0.0070827785*b.w + -0.0605245*c.w + 0.40797722*d.w + 0.06890839*e.w + 0.07854928*f.w + 0.018070232*g.w + 0.021921515*h.w + -0.008295515*i.w; +float w = 0.029440459*na.x + -0.20338938*nb.x + 0.03608712*nc.x + -0.0560404*nd.x + 0.36486238*ne.x + -0.09077097*nf.x + -0.0034382194*ng.x + -0.024092315*nh.x + -0.05651802*ni.x; +float x = -0.2387615*na.y + 0.0044211205*nb.y + 0.12196596*nc.y + 0.0018719662*nd.y + -0.38291648*ne.y + -0.10927817*nf.y + 0.0048800204*ng.y + 0.09223615*nh.y + 0.023671495*ni.y; +float y = 0.20535934*na.z + 0.22635183*nb.z + -0.085040614*nc.z + -0.057296805*nd.z + 0.07193608*ne.z + 0.033450443*nf.z + 0.006347363*ng.z + 0.1395266*nh.z + 0.15212502*ni.z; +float z = 0.16476941*na.w + 0.010561869*nb.w + 0.047739767*nc.w + -0.31139913*nd.w + -0.041548803*ne.w + -0.13348936*nf.w + 0.036977705*ng.w + 0.078561224*nh.w + -0.012039407*ni.w; +float o = s+t+u+v+w+x+y+z+0.00016827008; +s = -0.21815544*a.x + -0.22552536*b.x + -0.014158144*c.x + -0.1469778*d.x + -0.22121194*e.x + 0.1927943*f.x + 0.07618134*g.x + 0.118853584*h.x + 0.084942676*i.x; +t = 0.09981943*a.y + 0.317503*b.y + 0.11764991*c.y + -0.12422285*d.y + -0.41523558*e.y + 0.22392312*f.y + -0.11520103*g.y + -0.036089357*h.y + -0.07009806*i.y; +u = -0.11028566*a.z + 0.063099*b.z + 0.0011026734*c.z + -0.05991797*d.z + 0.031247668*e.z + 0.06179971*f.z + 0.060390536*g.z + -0.17191845*h.z + -0.11775279*i.z; +v = 0.018726178*a.w + 0.10752489*b.w + 0.06660048*c.w + -0.03201065*d.w + -0.020206233*e.w + 0.0040159496*f.w + 0.090588436*g.w + 0.09415488*h.w + -1.9609928e-05*i.w; +w = -0.11624948*na.x + 0.013627785*nb.x + 0.101627775*nc.x + 0.17473437*nd.x + 0.30876297*ne.x + -0.13975826*nf.x + 0.00321659*ng.x + -0.21238185*nh.x + -0.08992147*ni.x; +x = 0.020274088*na.y + 0.11817761*nb.y + -0.046248425*nc.y + -0.013413451*nd.y + 0.51850814*ne.y + -0.33153027*nf.y + 0.02177672*ng.y + -0.14238566*nh.y + -0.058259398*ni.y; +y = 0.06913359*na.z + -0.0730094*nb.z + 0.034377456*nc.z + -0.06265757*nd.z + -0.3582522*ne.z + 0.23046972*nf.z + -0.20418762*ng.z + 0.28414622*nh.z + 0.102955386*ni.z; +z = 0.19727987*na.w + 0.013151639*nb.w + -0.052902214*nc.w + 0.013973513*nd.w + -0.4215461*ne.w + -0.27328232*nf.w + -0.06751392*ng.w + -0.3127529*nh.w + -0.09204359*ni.w; +float p = s+t+u+v+w+x+y+z+-0.014182568; +s = -0.34736773*a.x + -0.06972397*b.x + -0.093938254*c.x + -0.14630365*d.x + 0.31515175*e.x + -0.20766215*f.x + -0.0856241*g.x + -0.22420011*h.x + -0.038271178*i.x; +t = 0.43770784*a.y + 0.5205272*b.y + 0.60971767*c.y + -0.04235381*d.y + -0.45357496*e.y + 0.25804746*f.y + 0.0661562*g.y + 0.037322108*h.y + 0.36651894*i.y; +u = 0.2540414*a.z + 0.06414321*b.z + 0.20214534*c.z + -0.061477356*d.z + 0.46545136*e.z + 0.040708408*f.z + 0.14445019*g.z + 0.13169329*h.z + -0.013906265*i.z; +v = -0.071563356*a.w + -0.46953747*b.w + -0.07348474*c.w + -0.23013033*d.w + 0.66805875*e.w + -0.049183927*f.w + -0.09653315*g.w + -0.016621599*h.w + 0.0780333*i.w; +w = 0.16968212*na.x + 0.07696688*nb.x + 0.0023496426*nc.x + 0.08955071*nd.x + 0.0962585*ne.x + -0.25464457*nf.x + 0.016729543*ng.x + 0.08757559*nh.x + 0.1538975*ni.x; +x = -0.3273305*na.y + -0.7855914*nb.y + -0.6899803*nc.y + 0.2045796*nd.y + 1.0804114*ne.y + -0.33822098*nf.y + 0.023830544*ng.y + 0.14510773*nh.y + -0.12344188*ni.y; +y = -0.19701853*na.z + 0.11734899*nb.z + -0.098853715*nc.z + 0.23651646*nd.z + -0.31984463*ne.z + -0.058276266*nf.z + -0.33509082*ng.z + -0.24884325*nh.z + -0.10013402*ni.z; +z = 0.11899618*na.w + -0.0014200769*nb.w + -0.020905564*nc.w + -0.0048010163*nd.w + 0.067089334*ne.w + -0.3352517*nf.w + 0.014445478*ng.w + -0.24828255*nh.w + -0.23759487*ni.w; +float q = s+t+u+v+w+x+y+z+0.039896414; +s = -0.18826365*a.x + -0.1262751*b.x + 0.0012199389*c.x + 0.32116702*d.x + -0.15126537*e.x + 0.119023114*f.x + 0.122457586*g.x + -0.26248026*h.x + -0.0900313*i.x; +t = 0.009903687*a.y + 0.45216253*b.y + 0.36279002*c.y + -0.28200477*d.y + 0.5746711*e.y + 0.53097457*f.y + -0.037697855*g.y + 0.30157155*h.y + 0.22841716*i.y; +u = 0.100869104*a.z + 0.017624957*b.z + 0.0500802*c.z + -0.11950842*d.z + 0.2338097*e.z + -0.04010958*f.z + -0.095233254*g.z + 0.26625177*h.z + 0.054554105*i.z; +v = -0.14044476*a.w + -0.14132117*b.w + 0.09139059*c.w + 0.3790963*d.w + -0.39034823*e.w + -0.09687614*f.w + 0.23206231*g.w + 0.23774491*h.w + -0.0620743*i.w; +w = 0.051436502*na.x + -0.10351269*nb.x + -0.12424041*nc.x + -0.13205881*nd.x + 0.4174902*ne.x + 0.11938382*nf.x + -0.17207816*ng.x + 0.040287893*nh.x + -0.04307966*ni.x; +x = 0.07150747*na.y + -0.019303028*nb.y + -0.010330274*nc.y + 0.27761045*nd.y + -0.2827331*ne.y + -0.012934963*nf.y + -0.029257378*ng.y + -0.24158573*nh.y + -0.1251036*ni.y; +y = -0.07031341*na.z + -0.20601816*nb.z + 0.027196145*nc.z + -0.32718003*nd.z + -0.45986757*ne.z + -0.054294366*nf.z + -0.19018301*ng.z + -0.38746485*nh.z + -0.25102594*ni.z; +z = 0.28564107*na.w + 0.20524764*nb.w + -0.22631782*nc.w + -0.30496415*nd.w + -0.030522099*ne.w + 0.020686796*nf.w + -0.24285361*ng.w + -0.3129688*nh.w + -0.07113108*ni.w; +float r = s+t+u+v+w+x+y+z+0.032977853; + + return vec4(o, p, q, r); +} +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN15 +//!SAVE LUMAN16 +//!COMPONENTS 4 + +#define L_tex LUMAN15_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = -0.067909904*a.x + 0.07213549*b.x + -0.094183326*c.x + -0.06924379*d.x + 0.2571301*e.x + -0.46907106*f.x + 0.06106735*g.x + 0.43571764*h.x + 0.018382015*i.x; +float t = 0.038453694*a.y + 0.070749596*b.y + 0.12662974*c.y + 0.045585748*d.y + -0.22559148*e.y + 0.21860053*f.y + 0.14745311*g.y + 0.14422727*h.y + 0.10621522*i.y; +float u = 0.027353777*a.z + 0.0947764*b.z + -0.020315602*c.z + -0.09068284*d.z + -0.09481788*e.z + 0.0399462*f.z + -0.06848305*g.z + 0.05451147*h.z + 0.12830889*i.z; +float v = -0.017329251*a.w + -0.22565089*b.w + -0.03577357*c.w + 0.16699958*d.w + 0.2857703*e.w + -0.05621418*f.w + -0.12263181*g.w + 0.035624128*h.w + 0.098450504*i.w; +float w = -0.11008944*na.x + -0.032715656*nb.x + -0.19416767*nc.x + 0.10495246*nd.x + -0.20974365*ne.x + 0.09771243*nf.x + 0.1782856*ng.x + -0.6445777*nh.x + 0.35234386*ni.x; +float x = 0.12738033*na.y + -0.021345*nb.y + 0.034855936*nc.y + 0.16406639*nd.y + 0.06260629*ne.y + -0.06154745*nf.y + -0.014285338*ng.y + 0.04438198*nh.y + 0.018522695*ni.y; +float y = 0.01981837*na.z + -0.07107509*nb.z + 0.014212223*nc.z + 0.038926024*nd.z + 0.02662531*ne.z + -0.017613089*nf.z + 0.22900726*ng.z + -0.08041844*nh.z + -0.053036153*ni.z; +float z = 0.08012285*na.w + -0.1880344*nb.w + 0.22340271*nc.w + -0.14709368*nd.w + -0.477094*ne.w + 0.004010439*nf.w + -0.23062769*ng.w + 0.06085517*nh.w + -0.017255455*ni.w; +float o = s+t+u+v+w+x+y+z+-0.005476496; +s = 0.03128976*a.x + 0.048691068*b.x + -0.16704744*c.x + 0.052490477*d.x + -0.010417827*e.x + -0.35721236*f.x + -0.062215216*g.x + 0.069990575*h.x + 0.025897821*i.x; +t = 0.019374669*a.y + -0.09289878*b.y + -0.11491471*c.y + 0.0504223*d.y + 0.41783842*e.y + 0.030758737*f.y + -0.023466952*g.y + 0.04662583*h.y + 0.17263764*i.y; +u = -0.041566227*a.z + 0.08646238*b.z + 0.038279615*c.z + -0.029459285*d.z + -0.21637337*e.z + 0.057596713*f.z + 0.014723775*g.z + -0.040119793*h.z + 0.07505516*i.z; +v = 0.05442971*a.w + 0.35998514*b.w + -0.032617625*c.w + -0.054452963*d.w + 0.12532572*e.w + 0.054044265*f.w + 0.031627756*g.w + -0.024870658*h.w + 0.009759014*i.w; +w = 0.11309484*na.x + 0.13073945*nb.x + -0.017153215*nc.x + 0.062964156*nd.x + 0.3064872*ne.x + 0.89749384*nf.x + -0.014941189*ng.x + 0.04061171*nh.x + 0.04307252*ni.x; +x = -0.09723544*na.y + -0.18721382*nb.y + 0.08974929*nc.y + -0.13141121*nd.y + -0.24614644*ne.y + -0.15122154*nf.y + -0.025932945*ng.y + -0.026936408*nh.y + -0.04128235*ni.y; +y = 0.077459246*na.z + 0.0019004345*nb.z + -0.017349463*nc.z + 0.13129182*nd.z + 0.2890425*ne.z + -0.043319378*nf.z + -0.031585578*ng.z + -0.036145695*nh.z + -0.06365771*ni.z; +z = -0.05868564*na.w + -0.10292573*nb.w + -0.11193662*nc.w + 0.029683325*nd.w + -0.080804676*ne.w + 0.035416897*nf.w + -0.023600047*ng.w + 0.037216198*nh.w + 0.013627157*ni.w; +float p = s+t+u+v+w+x+y+z+0.009361195; +s = -0.026526103*a.x + -0.06499592*b.x + -0.104355484*c.x + 0.035101574*d.x + -0.03543982*e.x + 0.39250267*f.x + -0.14073984*g.x + 0.16316575*h.x + 0.08285205*i.x; +t = 0.14270076*a.y + 0.039099913*b.y + -0.17372009*c.y + -0.068915255*d.y + 0.49224404*e.y + -0.31714916*f.y + -0.057546906*g.y + 0.10885324*h.y + 0.044575803*i.y; +u = -0.059490874*a.z + 0.08805799*b.z + 0.04008782*c.z + -0.049980417*d.z + -0.029328382*e.z + 0.09776825*f.z + -0.022992231*g.z + 0.056644473*h.z + 0.027138319*i.z; +v = -0.050222095*a.w + 0.49353465*b.w + -0.3180605*c.w + -0.0696022*d.w + 0.45647475*e.w + 0.18439499*f.w + 0.0922146*g.w + 0.07370147*h.w + 0.038871787*i.w; +w = 0.17216796*na.x + 0.18544932*nb.x + 0.16354512*nc.x + 0.124834314*nd.x + 0.5177341*ne.x + 0.11601982*nf.x + 0.14106567*ng.x + -0.15066552*nh.x + 0.2752277*ni.x; +x = -0.089706264*na.y + 0.030901134*nb.y + 0.094932005*nc.y + 0.10596548*nd.y + -0.51201296*ne.y + 0.14549367*nf.y + -0.022412537*ng.y + -0.06421315*nh.y + 0.014773879*ni.y; +y = 0.0039442857*na.z + -0.01359784*nb.z + -0.0077657327*nc.z + 1.3297267e-05*nd.z + -0.10430566*ne.z + -0.0976933*nf.z + 0.16459519*ng.z + 0.00894974*nh.z + -0.003830634*ni.z; +z = 0.0015719028*na.w + -0.28026047*nb.w + -0.36019176*nc.w + 0.1383878*nd.w + -0.22607847*ne.w + -0.1801225*nf.w + -0.058388997*ng.w + -0.06023031*nh.w + -0.027819455*ni.w; +float q = s+t+u+v+w+x+y+z+0.013245013; +s = -0.029822456*a.x + 0.02616777*b.x + 0.16269188*c.x + 0.2650373*d.x + -0.20996052*e.x + -0.19660734*f.x + 0.010681584*g.x + -0.2076851*h.x + -0.07318369*i.x; +t = 0.018541846*a.y + -0.110020824*b.y + -0.012463573*c.y + -0.04147079*d.y + 0.38140774*e.y + -0.31021866*f.y + -0.07057189*g.y + -0.14601971*h.y + 0.19790615*i.y; +u = 0.06816025*a.z + -0.061384227*b.z + -0.030079572*c.z + 0.18603177*d.z + -0.109502144*e.z + -0.12123356*f.z + -0.07845297*g.z + 0.07252925*h.z + 0.042517964*i.z; +v = 0.10004405*a.w + -0.08016953*b.w + 0.24316287*c.w + -0.27154508*d.w + -0.25279948*e.w + -0.4734194*f.w + 0.07504428*g.w + 0.36581865*h.w + 0.059888706*i.w; +w = -0.017077083*na.x + -0.16063982*nb.x + -0.20941*nc.x + -0.23890181*nd.x + 0.21951643*ne.x + -0.15276802*nf.x + -0.06637867*ng.x + 0.15567715*nh.x + -0.26517457*ni.x; +x = 0.060620476*na.y + 0.009859245*nb.y + -0.10916809*nc.y + -0.12375652*nd.y + -0.017984862*ne.y + 0.011606493*nf.y + 0.029722044*ng.y + -0.053293683*nh.y + -0.033251602*ni.y; +y = 0.006202991*na.z + -0.05648056*nb.z + 0.05449007*nc.z + -0.2502469*nd.z + 0.3130384*ne.z + 0.06463737*nf.z + 0.096328795*ng.z + 0.053917795*nh.z + -0.02201758*ni.z; +z = -0.114404194*na.w + 0.17056693*nb.w + 0.28854623*nc.w + 0.16990852*nd.w + 0.14654322*ne.w + -0.17926534*nf.w + -0.006071123*ng.w + -0.005394441*nh.w + -0.030667707*ni.w; +float r = s+t+u+v+w+x+y+z+0.015945297; + + return vec4(o, p, q, r); +} +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN16 +//!SAVE LUMAN17 +//!COMPONENTS 4 + +#define L_tex LUMAN16_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = -0.022006217*a.x + -0.012059591*b.x + 0.002695222*c.x + 0.2576513*d.x + 0.17261067*e.x + 0.551913*f.x + 0.16155578*g.x + -0.011060458*h.x + -0.1789373*i.x; +float t = 0.017821372*a.y + -0.03557644*b.y + -0.025035575*c.y + -0.00046598774*d.y + -0.005887852*e.y + 0.02186709*f.y + 0.09394631*g.y + 0.6164006*h.y + 0.057507005*i.y; +float u = 0.01876147*a.z + 0.13257372*b.z + -0.015636649*c.z + -0.020908952*d.z + -0.083034806*e.z + 0.061008565*f.z + -0.25211054*g.z + 0.78378326*h.z + -0.27476925*i.z; +float v = 0.08554834*a.w + 0.19410893*b.w + -0.11100018*c.w + -0.45933402*d.w + -0.45409277*e.w + -0.22796273*f.w + -0.30464834*g.w + 0.27696005*h.w + -0.00104187*i.w; +float w = 0.04166939*na.x + 0.035488285*nb.x + 0.059535887*nc.x + 0.07787493*nd.x + -0.61595035*ne.x + -0.42177302*nf.x + 0.20006934*ng.x + 0.06433011*nh.x + -0.055998996*ni.x; +float x = -0.0391015*na.y + 0.07890093*nb.y + 0.06986402*nc.y + 0.31180015*nd.y + -0.1622192*ne.y + 0.18821925*nf.y + 0.39657065*ng.y + -0.46719238*nh.y + 0.04969611*ni.y; +float y = -0.06516754*na.z + 0.03271396*nb.z + 0.090906225*nc.z + -0.08948881*nd.z + 0.07813701*ne.z + 0.09922489*nf.z + -0.18747891*ng.z + -0.21690096*nh.z + 0.077256404*ni.z; +float z = 0.016168253*na.w + -0.109046705*nb.w + -0.0824996*nc.w + 0.27986673*nd.w + -0.16506442*ne.w + 0.004419541*nf.w + -0.2717686*ng.w + 0.054969583*nh.w + -0.092781425*ni.w; +float o = s+t+u+v+w+x+y+z+-0.0217535; +s = 0.026437651*a.x + 0.19232419*b.x + -0.16422936*c.x + 0.10565235*d.x + -0.4384296*e.x + -0.16493015*f.x + -0.009258224*g.x + -0.030529829*h.x + -0.21317522*i.x; +t = -0.014095936*a.y + -0.120850965*b.y + 0.01888561*c.y + -0.026737496*d.y + -0.46870494*e.y + 0.08376613*f.y + -0.13321276*g.y + 0.26880193*h.y + -0.35832718*i.y; +u = -0.018054884*a.z + 0.1128491*b.z + 0.08324391*c.z + -0.11279875*d.z + 0.3183996*e.z + -0.37253928*f.z + -0.0629084*g.z + -0.034786735*h.z + -0.17558128*i.z; +v = 0.144636*a.w + -0.04298588*b.w + 0.3045897*c.w + 0.060445797*d.w + -0.0109159695*e.w + 0.2132298*f.w + 0.11611239*g.w + -0.1384314*h.w + -0.09235996*i.w; +w = 0.006147015*na.x + -0.21667369*nb.x + 0.22838773*nc.x + -0.17819536*nd.x + 0.45146102*ne.x + 0.47918588*nf.x + -0.03318283*ng.x + 0.21985787*nh.x + 0.34009728*ni.x; +x = -0.05652136*na.y + 0.111011945*nb.y + -0.0047198976*nc.y + 0.12144599*nd.y + 0.75757605*ne.y + 0.16439566*nf.y + -0.12620859*ng.y + 0.12846243*nh.y + 0.15831694*ni.y; +y = -0.041052956*na.z + -0.119683154*nb.z + 0.020893274*nc.z + 0.070517935*nd.z + -0.23697676*ne.z + 0.46840355*nf.z + -0.04892725*ng.z + -0.40944007*nh.z + 0.11688477*ni.z; +z = -0.02054659*na.w + -0.00066506985*nb.w + -0.042663135*nc.w + 0.26056388*nd.w + 0.15477341*ne.w + 0.13709357*nf.w + 0.057354145*ng.w + 0.03006045*nh.w + -0.007384721*ni.w; +float p = s+t+u+v+w+x+y+z+-0.031859096; +s = 0.04254209*a.x + -0.05705047*b.x + -0.031575847*c.x + 0.072901934*d.x + -0.07428205*e.x + 0.2967097*f.x + 0.008193591*g.x + -0.12431064*h.x + -0.13841611*i.x; +t = -0.012525338*a.y + 0.05161677*b.y + -0.111752085*c.y + -0.055839147*d.y + -0.44907176*e.y + -0.017132394*f.y + -0.10912194*g.y + 0.02698117*h.y + -0.20205373*i.y; +u = -0.03701457*a.z + 0.02593559*b.z + 0.14975408*c.z + 0.0016469631*d.z + -0.34274974*e.z + -0.29361588*f.z + -0.104992904*g.z + 0.2013144*h.z + -0.075109854*i.z; +v = 0.00077759114*a.w + 0.09272906*b.w + 0.076870516*c.w + -0.02691178*d.w + -0.0090563195*e.w + -0.053631466*f.w + 0.013198984*g.w + -0.0065912423*h.w + -0.012886208*i.w; +w = -0.033076394*na.x + -0.088810526*nb.x + 0.019279992*nc.x + -0.047951225*nd.x + -0.24586865*ne.x + -0.13228649*nf.x + -0.0016290849*ng.x + 0.04638423*nh.x + 0.13236308*ni.x; +x = -0.03492093*na.y + -0.109798424*nb.y + 0.024642663*nc.y + 0.20577587*nd.y + 0.2853186*ne.y + 0.15427849*nf.y + 0.149058*ng.y + -0.116264075*nh.y + 0.05439114*ni.y; +y = -0.014611719*na.z + -0.017545976*nb.z + -0.17590396*nc.z + -0.0046303673*nd.z + 0.5373067*ne.z + 0.46450424*nf.z + -0.11478988*ng.z + -0.16745853*nh.z + 0.049644347*ni.z; +z = 0.007340767*na.w + -0.009529236*nb.w + -0.07292183*nc.w + 0.121002674*nd.w + -0.14519809*ne.w + 0.24597451*nf.w + 0.053762082*ng.w + 0.085299775*nh.w + -0.09269121*ni.w; +float q = s+t+u+v+w+x+y+z+-0.0019213319; +s = 0.09813327*a.x + -0.12780574*b.x + 0.006625495*c.x + 0.0867255*d.x + 0.14296821*e.x + 0.09746561*f.x + -0.030963046*g.x + -0.031599507*h.x + 0.07171259*i.x; +t = -0.02695436*a.y + -0.06334176*b.y + 0.038783036*c.y + -0.0043491386*d.y + 0.049357355*e.y + -0.08089158*f.y + -0.026594585*g.y + -0.2797346*h.y + -0.020938909*i.y; +u = -0.18745422*a.z + -0.31568372*b.z + -0.012768946*c.z + 0.10063372*d.z + 0.2662484*e.z + -0.11729661*f.z + -0.16505139*g.z + -0.26203063*h.z + 0.033530373*i.z; +v = -0.04269229*a.w + -0.25492373*b.w + 0.23321919*c.w + 0.38466015*d.w + 0.9420985*e.w + 0.28590629*f.w + 0.4087332*g.w + 0.27309123*h.w + 0.102289595*i.w; +w = -0.17433798*na.x + 0.16236849*nb.x + 0.15976915*nc.x + 0.02497057*nd.x + -0.19628315*ne.x + -0.06265425*nf.x + -0.046286214*ng.x + 0.010435635*nh.x + 0.074468784*ni.x; +x = 0.025122926*na.y + 0.26216775*nb.y + 0.0848261*nc.y + 0.4296719*nd.y + -0.6394346*ne.y + -0.3245584*nf.y + -0.33212742*ng.y + -0.014895529*nh.y + -0.17663886*ni.y; +y = -0.018905697*na.z + 0.016177211*nb.z + -0.24340479*nc.z + -0.4919266*nd.z + -0.5344714*ne.z + -0.094090745*nf.z + 0.08073831*ng.z + -0.09079831*nh.z + -0.024821006*ni.z; +z = -0.13918148*na.w + 0.2543219*nb.w + 0.18887864*nc.w + 0.06735778*nd.w + -0.15226458*ne.w + 0.108695254*nf.w + 0.06763557*ng.w + -0.013376045*nh.w + -0.0071781515*ni.w; +float r = s+t+u+v+w+x+y+z+-0.03213358; + + return vec4(o, p, q, r); +} +//!DESC Anime4K-Hybrid-ML-Conv-4x3x3x8-v2.1a-(L) +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN17 +//!SAVE LUMAN18 +//!COMPONENTS 4 + +#define L_tex LUMAN17_tex + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = L_tex(HOOKED_pos + vec2(-dp.x, -dp.y)); + vec4 b = L_tex(HOOKED_pos + vec2(-dp.x, 0)); + vec4 c = L_tex(HOOKED_pos + vec2(-dp.x, dp.y)); + vec4 d = L_tex(HOOKED_pos + vec2(0, -dp.y)); + vec4 e = L_tex(HOOKED_pos + vec2(0, 0)); + vec4 f = L_tex(HOOKED_pos + vec2(0, dp.y)); + vec4 g = L_tex(HOOKED_pos + vec2(dp.x, -dp.y)); + vec4 h = L_tex(HOOKED_pos + vec2(dp.x, 0)); + vec4 i = L_tex(HOOKED_pos + vec2(dp.x, dp.y)); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float s = -0.090979576*a.x + 0.26158786*b.x + -0.25845823*c.x + 0.11686225*d.x + 0.7249228*e.x + 0.22422317*f.x + -0.0016817157*g.x + -0.045406442*h.x + -0.0153964255*i.x; +float t = 0.020251293*a.y + 0.12992781*b.y + -0.26349863*c.y + 0.03556678*d.y + 0.23429622*e.y + 0.35104224*f.y + -0.11499256*g.y + 0.109316014*h.y + -0.14154646*i.y; +float u = -0.07613151*a.z + 0.26030222*b.z + 0.041128322*c.z + -0.2946645*d.z + -0.3431931*e.z + -0.22281167*f.z + 0.05490744*g.z + -0.12693247*h.z + 0.030528152*i.z; +float v = 0.068428345*a.w + -0.04550164*b.w + 0.28332227*c.w + 0.03758558*d.w + 0.31537637*e.w + -0.88547385*f.w + 0.14168099*g.w + 0.2672414*h.w + 0.29484844*i.w; +float w = 0.03971598*na.x + -0.15292329*nb.x + 0.20590727*nc.x + 0.0030272854*nd.x + -0.073130965*ne.x + -0.20384851*nf.x + -0.07106073*ng.x + -0.101229355*nh.x + 0.05182081*ni.x; +float x = -0.05639171*na.y + 0.13405822*nb.y + 0.051922694*nc.y + -0.20046455*nd.y + -0.42624408*ne.y + -0.3261027*nf.y + 0.11790978*ng.y + 0.11581271*nh.y + 0.2400041*ni.y; +float y = -0.07396325*na.z + 0.49679124*nb.z + 0.026551519*nc.z + 0.61899525*nd.z + -0.25464156*ne.z + 0.3430776*nf.z + -0.112355895*ng.z + 0.36447346*nh.z + 0.19507225*ni.z; +float z = 0.040693846*na.w + -0.024500126*nb.w + 0.07946955*nc.w + 0.08976172*nd.w + -0.24011669*ne.w + -0.2528033*nf.w + -0.14805055*ng.w + 0.112328075*nh.w + -0.0047488576*ni.w; +float o = s+t+u+v+w+x+y+z+-0.030780189; +s = -0.028054465*a.x + -0.044692505*b.x + 0.20362917*c.x + -0.100096725*d.x + -0.061864212*e.x + 0.03544999*f.x + 0.04018204*g.x + 0.06835267*h.x + -0.018371353*i.x; +t = -0.05103254*a.y + -0.13975304*b.y + 0.08319163*c.y + 0.3038626*d.y + 0.27844998*e.y + -0.046875928*f.y + -0.0034036317*g.y + 0.09696977*h.y + -0.04449184*i.y; +u = -0.10114778*a.z + -0.107570395*b.z + -0.15081966*c.z + 0.2479526*d.z + -0.20912926*e.z + 0.024067253*f.z + -0.3417179*g.z + -0.07706387*h.z + 0.007355439*i.z; +v = -0.04988727*a.w + 0.18736894*b.w + 0.17245813*c.w + -0.07175973*d.w + -0.85888803*e.w + -0.3613071*f.w + 0.24460877*g.w + 0.8859543*h.w + -0.13769223*i.w; +w = -0.038889136*na.x + 0.09344554*nb.x + 0.22336337*nc.x + 0.25991657*nd.x + 0.33309814*ne.x + 0.045674607*nf.x + -0.10420427*ng.x + 0.035547618*nh.x + 0.018530225*ni.x; +x = 0.2756573*na.y + 0.32226437*nb.y + 0.025734236*nc.y + -0.16104288*nd.y + -0.40601286*ne.y + 0.09831973*nf.y + 0.35679048*ng.y + 0.25575617*nh.y + 0.20090733*ni.y; +y = 0.09818739*na.z + 0.16135061*nb.z + 0.017967097*nc.z + -0.39471382*nd.z + -0.90883625*ne.z + -0.4241856*nf.z + -0.11843628*ng.z + 0.39857107*nh.z + 0.12109732*ni.z; +z = -0.022406828*na.w + -0.008107861*nb.w + 0.008098971*nc.w + 0.19073384*nd.w + 0.37782744*ne.w + 0.20523809*nf.w + -0.027150735*ng.w + 0.21531254*nh.w + -0.13412546*ni.w; +float p = s+t+u+v+w+x+y+z+-0.01892319; +s = 0.35650992*a.x + -0.8653189*b.x + 0.03990455*c.x + -0.08822504*d.x + -0.45795453*e.x + -0.13031328*f.x + 0.09203946*g.x + -0.29639995*h.x + 0.06788846*i.x; +t = 0.062216192*a.y + -0.12972717*b.y + 0.055175733*c.y + -0.18075024*d.y + 0.019622922*e.y + -0.09647325*f.y + -0.03200571*g.y + -0.15787482*h.y + 0.0042678057*i.y; +u = 0.14833425*a.z + 0.25882515*b.z + 0.063659094*c.z + -0.49287808*d.z + -0.06723707*e.z + 0.10271336*f.z + 0.24586615*g.z + 0.14865553*h.z + -0.116240144*i.z; +v = -0.0792519*a.w + 0.32723862*b.w + 0.07915708*c.w + 0.23290725*d.w + -0.43134773*e.w + 0.25607985*f.w + 0.27738905*g.w + -0.047513194*h.w + 0.024800982*i.w; +w = -0.24938466*na.x + 0.35974526*nb.x + -0.12741408*nc.x + -0.08949298*nd.x + 0.59076357*ne.x + 0.111327894*nf.x + 0.040771488*ng.x + -0.05842803*nh.x + -0.08034774*ni.x; +x = 0.037412044*na.y + -0.20272894*nb.y + -0.06831999*nc.y + -0.4714889*nd.y + -0.3838717*ne.y + 0.058825877*nf.y + 0.06995256*ng.y + -0.14386222*nh.y + -0.081692964*ni.y; +y = 0.12876076*na.z + 0.20346333*nb.z + 0.07815222*nc.z + -0.4048683*nd.z + 0.8882211*ne.z + 0.13583338*nf.z + 0.575287*ng.z + -0.16988589*nh.z + 0.19699658*ni.z; +z = 0.052144192*na.w + 0.031341515*nb.w + 0.0136394845*nc.w + 0.047928814*nd.w + 0.34520543*ne.w + -0.2240882*nf.w + -0.09696316*ng.w + -0.062464975*nh.w + 0.05087205*ni.w; +float q = s+t+u+v+w+x+y+z+0.024297409; +s = -0.16852628*a.x + 0.09809276*b.x + 0.22396*c.x + 0.080930464*d.x + -0.33478954*e.x + -0.33829704*f.x + -0.007273387*g.x + 0.11371913*h.x + 0.10754754*i.x; +t = 0.06576919*a.y + 0.24384294*b.y + 0.28421602*c.y + 0.03653487*d.y + -0.28440398*e.y + -0.5122065*f.y + -0.04945199*g.y + 0.14481378*h.y + 0.21009488*i.y; +u = -0.18703452*a.z + -0.2927576*b.z + -0.31313953*c.z + -0.07285863*d.z + 0.20641851*e.z + 0.38029015*f.z + 0.17704949*g.z + -0.1293435*h.z + -0.36630917*i.z; +v = 0.077824086*a.w + -0.19499196*b.w + -0.13373896*c.w + -0.09556833*d.w + 0.1321527*e.w + -0.04833771*f.w + -0.05258668*g.w + -0.070803344*h.w + 0.16116437*i.w; +w = 0.107823074*na.x + 0.2909979*nb.x + 0.18573105*nc.x + 0.24895737*nd.x + 0.8293185*ne.x + 0.5999831*nf.x + -0.20711009*ng.x + -0.2071418*nh.x + -0.21046878*ni.x; +x = -0.04392347*na.y + -0.20879328*nb.y + -0.080248356*nc.y + 0.17260192*nd.y + 0.5676353*ne.y + 0.3880135*nf.y + 0.06297885*ng.y + -0.029866349*nh.y + -0.04889006*ni.y; +y = -0.14178613*na.z + -0.12998302*nb.z + 0.1562837*nc.z + 0.2894252*nd.z + 0.28852552*ne.z + -0.5431766*nf.z + -0.018923528*ng.z + -0.25701952*nh.z + 0.13423893*ni.z; +z = 0.077071175*na.w + 0.10650166*nb.w + -0.104624994*nc.w + 0.09795779*nd.w + 0.20976487*ne.w + 0.29659525*nf.w + -0.12783296*ng.w + -0.25428843*nh.w + -0.019792268*ni.w; +float r = s+t+u+v+w+x+y+z+-0.028622074; + + return vec4(o, p, q, r); +} + +//!DESC Anime4K-Hybrid-ML-Conv-5x1x1x72-v2.1a-(L) +//!HOOK NATIVE +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!BIND LUMAN10 +//!BIND LUMAN11 +//!BIND LUMAN12 +//!BIND LUMAN13 +//!BIND LUMAN14 +//!BIND LUMAN15 +//!BIND LUMAN16 +//!BIND LUMAN17 +//!BIND LUMAN18 +//!SAVE LUMAN10 +//!COMPONENTS 4 + +vec4 hook() { + vec2 dp = HOOKED_pt; + vec4 a = LUMAN10_tex(HOOKED_pos); + vec4 b = LUMAN11_tex(HOOKED_pos); + vec4 c = LUMAN12_tex(HOOKED_pos); + vec4 d = LUMAN13_tex(HOOKED_pos); + vec4 e = LUMAN14_tex(HOOKED_pos); + vec4 f = LUMAN15_tex(HOOKED_pos); + vec4 g = LUMAN16_tex(HOOKED_pos); + vec4 h = LUMAN17_tex(HOOKED_pos); + vec4 i = LUMAN18_tex(HOOKED_pos); + + vec4 na = -min(a, 0); + vec4 nb = -min(b, 0); + vec4 nc = -min(c, 0); + vec4 nd = -min(d, 0); + vec4 ne = -min(e, 0); + vec4 nf = -min(f, 0); + vec4 ng = -min(g, 0); + vec4 nh = -min(h, 0); + vec4 ni = -min(i, 0); + + a = max(a, 0); + b = max(b, 0); + c = max(c, 0); + d = max(d, 0); + e = max(e, 0); + f = max(f, 0); + g = max(g, 0); + h = max(h, 0); + i = max(i, 0); + +float o = 0.016885867*a.x + 0.046275508*a.y + -0.002548845*a.z + -0.0036128832*a.w + 0.03724025*b.x + 0.024534246*b.y + 0.061686493*b.z + -0.024180291*b.w + -0.07351123*c.x + -0.0032643469*c.y + -0.06198006*c.z + 0.0019208151*c.w + -0.0050309473*d.x + -0.07710412*d.y + -0.044080913*d.z + -0.032088976*d.w + -0.039627064*e.x + -0.0755259*e.y + 0.014249692*e.z + -0.017667277*e.w + 0.06635247*f.x + -0.17981255*f.y + -0.030311016*f.z + 0.14224172*f.w + 0.18823496*g.x + 0.15706189*g.y + -0.1300641*g.z + -0.034661684*g.w + 0.07448457*h.x + 0.020709032*h.y + -0.07573852*h.z + -0.090263546*h.w + -0.040318064*i.x + 0.05574537*i.y + 0.07446265*i.z + -0.022002082*i.w + -0.0687863*na.x + -0.08193518*na.y + 0.031677037*na.z + -0.0077320607*na.w + -0.024414517*nb.x + 0.014907232*nb.y + -0.020390427*nb.z + 0.048062213*nb.w + -0.00605564*nc.x + 0.02761477*nc.y + 0.1975337*nc.z + 0.0015166273*nc.w + 0.0320424*nd.x + 0.011832504*nd.y + 0.026225777*nd.z + -0.2019032*nd.w + 0.119912304*ne.x + -0.01836036*ne.y + 0.005017364*ne.z + 0.088221684*ne.w + -0.0735611*nf.x + -0.06006883*nf.y + 0.060761195*nf.z + -0.01694692*nf.w + -0.0966928*ng.x + 0.06081417*ng.y + 0.016560802*ng.z + 0.15959227*ng.w + -0.036181692*nh.x + 0.054725073*nh.y + -0.01582938*nh.z + -0.042625222*nh.w + 0.044871956*ni.x + -0.18472537*ni.y + -0.19192328*ni.z + 0.24313739*ni.w + 0.0056005213; +float p = 0.10122024*a.x + 0.009013353*a.y + -0.079185255*a.z + -0.022577854*a.w + 0.017786987*b.x + -0.0044460474*b.y + 0.038255103*b.z + 0.06852989*b.w + -0.037540313*c.x + -0.024483606*c.y + -0.060457204*c.z + 0.008208255*c.w + 0.10506395*d.x + -0.10918799*d.y + 0.0024290022*d.z + 0.028659703*d.w + -0.036873445*e.x + -0.04777761*e.y + 0.037514273*e.z + 0.02106696*e.w + 0.0355307*f.x + -0.10925304*f.y + -0.076339185*f.z + -0.14641297*f.w + 0.4269761*g.x + -0.024972297*g.y + 0.00043523175*g.z + 0.028613552*g.w + -0.09744465*h.x + -0.047286086*h.y + 0.07950336*h.z + 0.0331076*h.w + -0.04132422*i.x + -0.04611622*i.y + -0.03012942*i.z + 0.0015597334*i.w + -0.06825223*na.x + -0.06776767*na.y + 0.07088692*na.z + 0.020398268*na.w + -0.01647635*nb.x + 0.025414415*nb.y + -0.00040916045*nb.z + 0.009997192*nb.w + 0.003176333*nc.x + 0.029960362*nc.y + 0.05490353*nc.z + 0.0057089655*nc.w + -0.04524216*nd.x + -0.02972447*nd.y + 0.019471187*nd.z + -0.15544881*nd.w + 0.012991984*ne.x + -0.029754944*ne.y + 0.021750188*ne.z + 0.05023415*ne.w + 0.0460487*nf.x + -0.0074485326*nf.y + 0.007808842*nf.z + 0.0050014053*nf.w + -0.06944166*ng.x + 0.024812013*ng.y + -0.07313965*ng.z + 0.05142984*ng.w + 0.12944002*nh.x + 0.0038473085*nh.y + 0.06375067*nh.z + 0.076042116*nh.w + -0.054415874*ni.x + 0.20547464*ni.y + -0.066312514*ni.z + -0.27718043*ni.w + 0.0073262304; +float q = 0.07165155*a.x + 0.016282482*a.y + -0.0755284*a.z + -0.057094567*a.w + 0.010499061*b.x + 0.044993453*b.y + 0.009832754*b.z + 0.035309795*b.w + -0.09954656*c.x + -0.007337344*c.y + -0.04127519*c.z + -0.0168086*c.w + 0.07503995*d.x + -0.09394142*d.y + 0.028956652*d.z + 0.010161553*d.w + -0.08834079*e.x + -0.12903136*e.y + -0.1396115*e.z + -0.100337654*e.w + 0.018166749*f.x + -0.010528762*f.y + -0.04319865*f.z + 0.20262095*f.w + -0.18123764*g.x + 0.09017963*g.y + 0.09083577*g.z + 0.030754533*g.w + -0.18661265*h.x + -0.07488591*h.y + 0.11152151*h.z + -0.09857111*h.w + 0.19065167*i.x + -0.05214327*i.y + -0.011917154*i.z + -0.02628262*i.w + -0.051253464*na.x + -0.016850019*na.y + 0.080229335*na.z + 0.005362246*na.w + 0.018979054*nb.x + 0.021625564*nb.y + 0.0601448*nb.z + 0.0023157557*nb.w + 0.04790784*nc.x + -0.07263248*nc.y + -0.04542804*nc.z + 0.05196972*nc.w + -0.09942659*nd.x + 0.039653614*nd.y + 0.038100686*nd.z + -0.060198136*nd.w + 0.06327745*ne.x + 0.01759228*ne.y + 0.080639675*ne.z + 0.024707427*ne.w + -0.08681871*nf.x + -0.0046041547*nf.y + 0.11898749*nf.z + -0.04837889*nf.w + 0.07214983*ng.x + 0.03850557*ng.y + -0.08791204*ng.z + 0.02814183*ng.w + 0.10511739*nh.x + 0.15158683*nh.y + -0.4341295*nh.z + 0.105929375*nh.w + -0.11776578*ni.x + -0.09376781*ni.y + 0.11989495*ni.z + 0.254987*ni.w + 0.008396086; +float r = 0.045564942*a.x + -0.03419365*a.y + -0.10012808*a.z + -0.08574549*a.w + -0.0047195284*b.x + -0.014133889*b.y + -0.0052942014*b.z + 0.14866596*b.w + -0.022166757*c.x + -0.072412185*c.y + -0.0003714175*c.z + -0.040883984*c.w + 0.11360617*d.x + -0.12701546*d.y + 0.043022666*d.z + 0.08209777*d.w + -0.056664243*e.x + -0.050801404*e.y + -0.0463481*e.z + -0.011171822*e.w + 0.045977*f.x + 0.10907696*f.y + -0.052183993*f.z + 0.01923395*f.w + -0.116869815*g.x + 0.09466439*g.y + 0.1376351*g.z + 0.13010791*g.w + 0.20518136*h.x + -0.011971838*h.y + 0.1729419*h.z + 0.0018733321*h.w + -0.07899665*i.x + -0.084723875*i.y + 0.036292665*i.z + 0.023502793*i.w + 0.007908565*na.x + 0.05505959*na.y + 0.11442343*na.z + 0.025596732*na.w + -0.00093543297*nb.x + 0.01238046*nb.y + 0.1094715*nb.z + -0.016205456*nb.w + 0.038828447*nc.x + -0.0912666*nc.y + -0.13580854*nc.z + 0.03265067*nc.w + -0.100696385*nd.x + 0.020130597*nd.y + -0.035411533*nd.z + 0.02844439*nd.w + -0.02738409*ne.x + -0.03230527*ne.y + 0.054703213*ne.z + 0.023416441*ne.w + -0.1554482*nf.x + 0.12072812*nf.y + 0.016804868*nf.z + 0.001143662*nf.w + 0.09983937*ng.x + -0.092101745*ng.y + -0.2277122*ng.z + -0.2239213*ng.w + 0.02129851*nh.x + 0.1715038*nh.y + -0.26232228*nh.z + 0.038821537*nh.w + -0.0045500016*ni.x + 0.23054405*ni.y + 0.02692771*ni.z + -0.21184772*ni.w + -0.0036547435; + +float oo = -0.018809512*a.x + 0.010670327*a.y + -0.00824726*a.z + -0.0013437107*a.w + 0.005091081*b.x + 0.011520226*b.y + 0.034261033*b.z + 0.03064754*b.w + -0.017336003*c.x + -0.066918716*c.y + -0.020906765*c.z + 0.005316979*c.w + 0.09518458*d.x + -0.096665494*d.y + 0.04538189*d.z + -0.034607723*d.w + -0.0473297*e.x + -0.12172123*e.y + -0.024985144*e.z + -0.07162522*e.w + 0.026515657*f.x + -0.022308977*f.y + -0.041618045*f.z + 0.037533067*f.w + 0.088171676*g.x + 0.03103262*g.y + 0.07121279*g.z + 0.079160064*g.w + -0.03990838*h.x + -0.010683694*h.y + 0.09863001*h.z + -0.06637193*h.w + 0.0129789*i.x + -0.02429924*i.y + 0.018866336*i.z + -0.0027682844*i.w + -0.008679747*na.x + 0.014632188*na.y + 0.016659852*na.z + 0.011889224*na.w + -0.0058282344*nb.x + -0.0045387107*nb.y + 0.013490616*nb.z + -0.048750147*nb.w + 0.009104728*nc.x + -0.007074725*nc.y + -0.02057848*nc.z + 0.023461971*nc.w + 0.035868544*nd.x + 0.06788529*nd.y + 0.23750551*nd.z + 0.0064159986*nd.w + 0.046270985*ne.x + -0.018257186*ne.y + 0.025571529*ne.z + -0.10155261*ne.w + -0.04462234*nf.x + -0.033172693*nf.y + 0.023921944*nf.z + 0.04234701*nf.w + -0.0012737011*ng.x + 0.07112644*ng.y + -0.1945164*ng.z + -0.018535018*ng.w + 0.07102353*nh.x + 0.12712991*nh.y + -0.21089678*nh.z + 0.072553955*nh.w + -0.029867975*ni.x + 0.029737562*ni.y + -0.036139317*ni.z + 0.014916579*ni.w + -0.003636893; + + return vec4(o, p, q, r) + vec4(oo); +} + + + +//!HOOK NATIVE +//!BIND HOOKED +//!BIND LUMAN10 +//!WHEN OUTPUT.w LUMA.w / 2.400 > OUTPUT.h LUMA.h / 2.400 > * +//!WIDTH LUMAN10.w 2 * +//!HEIGHT LUMAN10.h 2 * +//!DESC Anime4K-Hybrid-ML-Upscale(x4)-v2.1 + +vec4 hook() { + vec2 f = fract(LUMAN10_pos * LUMAN10_size); + ivec2 i = ivec2(f * vec2(2)); + vec4 residual = LUMAN10_tex((vec2(0.5) - f) * LUMAN10_pt + LUMAN10_pos); + return vec4(residual[i.y * 2 + i.x] + HOOKED_tex(HOOKED_pos).x, HOOKED_tex(HOOKED_pos).yz, 0); +} + +/* ---------------------- Gradient Push ---------------------- */ + + +//!DESC Anime4K-Hybrid-ComputeGradientX-v2.1a-(L) +//!HOOK SCALED +//!BIND HOOKED +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!SAVE LUMAD +//!COMPONENTS 2 + +float getLum(vec4 rgb) { + return 0.299*rgb.r + 0.587*rgb.g + 0.114*rgb.b; +} + +vec4 hook() { + vec2 d = HOOKED_pt; + + //[tl t tr] + //[ l c r] + //[bl b br] + float l = getLum(HOOKED_tex(HOOKED_pos + vec2(-d.x, 0))); + float c = getLum(HOOKED_tex(HOOKED_pos)); + float r = getLum(HOOKED_tex(HOOKED_pos + vec2(d.x, 0))); + + + //Horizontal Gradient + //[-1 0 1] + //[-2 0 2] + //[-1 0 1] + float xgrad = (-l + r); + + //Vertical Gradient + //[-1 -2 -1] + //[ 0 0 0] + //[ 1 2 1] + float ygrad = (l + c + c + r); + + //Computes the luminance's gradient + return vec4(xgrad, ygrad, 0, 0); +} + + +//!DESC Anime4K-Hybrid-ComputeGradientY-v2.1a-(L) +//!HOOK SCALED +//!BIND HOOKED +//!BIND LUMA +//!BIND LUMAD +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!SAVE LUMAD +//!COMPONENTS 2 + + +/* --------------------- SETTINGS --------------------- */ + +//Strength of edge refinement, good values are between 0.2 and 4 +#define REFINE_STRENGTH 1 + + +/* --- MODIFY THESE SETTINGS BELOW AT YOUR OWN RISK --- */ + +//Bias of the refinement function +#define REFINE_BIAS 0 + +//Polynomial fit obtained by minimizing MSE error on image +#define P5 ( 11.68129591) +#define P4 (-42.46906057) +#define P3 ( 60.28286266) +#define P2 (-41.84451327) +#define P1 ( 14.05517353) +#define P0 (-1.081521930) + +//Power curve used to ease in upscaling smaller than 2x upscaling factors. +#define UPSCALE_RATIO_HYSTERESIS 1 + +/* ----------------- END OF SETTINGS ----------------- */ + +float power_function(float x) { + float x2 = x * x; + float x3 = x2 * x; + float x4 = x2 * x2; + float x5 = x2 * x3; + + return P5*x5 + P4*x4 + P3*x3 + P2*x2 + P1*x + P0; +} + +vec4 hook() { + vec2 d = HOOKED_pt; + + //[tl t tr] + //[ l cc r] + //[bl b br] + float tx = LUMAD_tex(HOOKED_pos + vec2(0, -d.y)).x; + float cx = LUMAD_tex(HOOKED_pos).x; + float bx = LUMAD_tex(HOOKED_pos + vec2(0, d.y)).x; + + + float ty = LUMAD_tex(HOOKED_pos + vec2(0, -d.y)).y; + //float cy = LUMAD_tex(HOOKED_pos).y; + float by = LUMAD_tex(HOOKED_pos + vec2(0, d.y)).y; + + + //Horizontal Gradient + //[-1 0 1] + //[-2 0 2] + //[-1 0 1] + float xgrad = (tx + cx + cx + bx); + + //Vertical Gradient + //[-1 -2 -1] + //[ 0 0 0] + //[ 1 2 1] + float ygrad = (-ty + by); + + //Computes the luminance's gradient + float sobel_norm = clamp(sqrt(xgrad * xgrad + ygrad * ygrad), 0, 1); + + float upratio = clamp(SCALED_size.x / LUMA_size.x - 1, 0, 6); + + float dval = clamp(power_function(clamp(sobel_norm * max(pow(upratio, UPSCALE_RATIO_HYSTERESIS), 1), 0, 1)) * REFINE_STRENGTH + REFINE_BIAS, 0, 1); + + if (upratio < 1) { + dval = dval * pow(upratio, UPSCALE_RATIO_HYSTERESIS); + } + + return vec4(sobel_norm, dval, 0, 0); +} + +//!DESC Anime4K-Hybrid-ComputeSecondGradientX-v2.1a-(L) +//!HOOK SCALED +//!BIND HOOKED +//!BIND LUMAD +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!SAVE LUMAMM +//!COMPONENTS 2 + +vec4 hook() { + vec2 d = HOOKED_pt; + + if (LUMAD_tex(HOOKED_pos).y < 0.1) { + return vec4(0); + } + + //[tl t tr] + //[ l c r] + //[bl b br] + float l = LUMAD_tex(HOOKED_pos + vec2(-d.x, 0)).x; + float c = LUMAD_tex(HOOKED_pos).x; + float r = LUMAD_tex(HOOKED_pos + vec2(d.x, 0)).x; + + //Horizontal Gradient + //[-1 0 1] + //[-2 0 2] + //[-1 0 1] + float xgrad = (-l + r); + + //Vertical Gradient + //[-1 -2 -1] + //[ 0 0 0] + //[ 1 2 1] + float ygrad = (l + c + c + r); + + + return vec4(xgrad, ygrad, 0, 0); +} + + +//!DESC Anime4K-Hybrid-ComputeSecondGradientY-v2.1a-(L) +//!HOOK SCALED +//!BIND HOOKED +//!BIND LUMAD +//!BIND LUMAMM +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * +//!SAVE LUMAMM +//!COMPONENTS 2 + + +vec4 hook() { + vec2 d = HOOKED_pt; + + if (LUMAD_tex(HOOKED_pos).y < 0.1) { + return vec4(0); + } + + //[tl t tr] + //[ l cc r] + //[bl b br] + float tx = LUMAMM_tex(HOOKED_pos + vec2(0, -d.y)).x; + float cx = LUMAMM_tex(HOOKED_pos).x; + float bx = LUMAMM_tex(HOOKED_pos + vec2(0, d.y)).x; + + float ty = LUMAMM_tex(HOOKED_pos + vec2(0, -d.y)).y; + //float cy = LUMAMM_tex(HOOKED_pos).y; + float by = LUMAMM_tex(HOOKED_pos + vec2(0, d.y)).y; + + //Horizontal Gradient + //[-1 0 1] + //[-2 0 2] + //[-1 0 1] + float xgrad = (tx + cx + cx + bx); + + //Vertical Gradient + //[-1 -2 -1] + //[ 0 0 0] + //[ 1 2 1] + float ygrad = (-ty + by); + + + float norm = sqrt(xgrad * xgrad + ygrad * ygrad); + if (norm <= 0.001) { + xgrad = 0; + ygrad = 0; + norm = 1; + } + + return vec4(xgrad/norm, ygrad/norm, 0, 0); +} + +//!DESC Anime4K-Hybrid-Refine-v2.1a-(L) +//!HOOK SCALED +//!BIND HOOKED +//!BIND LUMA +//!BIND LUMAD +//!BIND LUMAMM +//!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > * + +#define SHARPNESS_FACTOR 0.7 //Algorithm strength + +vec4 hook() { + vec2 d = HOOKED_pt; + + float dval = LUMAD_tex(HOOKED_pos).y * SHARPNESS_FACTOR; + + if (dval < 0.1) { + return SCALED_tex(HOOKED_pos); + } + + vec4 dc = LUMAMM_tex(HOOKED_pos); + if (abs(dc.x + dc.y) <= 0.0001) { + return SCALED_tex(HOOKED_pos); + } + + float xpos = -sign(dc.x); + float ypos = -sign(dc.y); + + vec4 xval = SCALED_tex(HOOKED_pos + vec2(d.x * xpos, 0)); + vec4 yval = SCALED_tex(HOOKED_pos + vec2(0, d.y * ypos)); + + float xyratio = abs(dc.x) / (abs(dc.x) + abs(dc.y)); + + vec4 avg = xyratio * xval + (1-xyratio) * yval; + + return avg * dval + SCALED_tex(HOOKED_pos) * (1 - dval); +} +