dot/config/mpv/shaders/Anime4K_Restore_CNN_Light_S...

138 lines
17 KiB
GLSL

// MIT License
// Copyright (c) 2019-2021 bloc97
// 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-v4.0-Restore-CNN-Light-(S)-Conv-4x3x3x3
//!HOOK MAIN
//!BIND MAIN
//!SAVE conv2d_tf
//!WIDTH MAIN.w
//!HEIGHT MAIN.h
//!COMPONENTS 4
#define go_0(x_off, y_off) (MAIN_texOff(vec2(x_off, y_off)))
vec4 hook() {
vec4 result = mat4(-0.16838393, -0.07399383, 0.10765397, -0.040146094, -0.10835741, -0.0992893, -0.015185093, -0.066940084, 0.0947453, -0.04034427, 0.15071523, -0.0969503, 0.0, 0.0, 0.0, 0.0) * go_0(-1.0, -1.0);
result += mat4(-0.22102526, 0.07499922, -0.42595702, 0.17391782, -0.43037644, -0.20812218, -0.32549328, 0.20609863, -0.2668482, 0.027931925, -0.26960263, 0.006871194, 0.0, 0.0, 0.0, 0.0) * go_0(-1.0, 0.0);
result += mat4(0.2670128, -0.060415365, -0.0689305, -0.2946205, 0.04626281, -0.24177264, -0.1905531, -0.095709525, 0.07490327, -0.026623333, -0.0019660168, -0.007212901, 0.0, 0.0, 0.0, 0.0) * go_0(-1.0, 1.0);
result += mat4(-0.3559218, 0.0066808867, 0.17373922, -0.17249261, -0.37774932, -0.07649783, 0.4759939, 0.055186976, -0.2725474, -0.09866672, -0.046783093, 0.059152212, 0.0, 0.0, 0.0, 0.0) * go_0(0.0, -1.0);
result += mat4(-0.0073040873, 0.012487223, 0.42290178, 0.043212075, -0.27963015, 1.1790652, 0.043568484, -0.09842046, 0.09045271, 0.08731861, 0.21712914, 0.07564517, 0.0, 0.0, 0.0, 0.0) * go_0(0.0, 0.0);
result += mat4(0.15672483, 0.03850097, -0.19825538, -0.055702195, 0.5003658, 0.22627586, -0.027484676, -0.35066563, 0.17605118, -0.024900516, -0.08680337, -0.21547073, 0.0, 0.0, 0.0, 0.0) * go_0(0.0, 1.0);
result += mat4(0.15729232, -0.040113423, -0.14070296, -0.38378295, 0.12924847, -0.26784506, -0.12578902, -0.23881449, 0.11105549, 0.13027173, -0.008668824, -0.15471211, 0.0, 0.0, 0.0, 0.0) * go_0(1.0, -1.0);
result += mat4(0.25071403, 0.12557605, 0.044081423, 0.21278714, 0.38039258, 0.07482958, 0.2666685, 0.35249576, 0.04861388, -0.07249691, -0.017757991, 0.03494166, 0.0, 0.0, 0.0, 0.0) * go_0(1.0, 0.0);
result += mat4(-0.09005357, -0.07771796, 0.07462757, 0.118054695, 0.14307103, -0.1822244, -0.10668158, -0.08178619, -0.053235218, -0.00893349, 0.06147608, 0.14268243, 0.0, 0.0, 0.0, 0.0) * go_0(1.0, 1.0);
result += vec4(0.023228912, -0.012588063, 0.03333425, 0.3900646);
return result;
}
//!DESC Anime4K-v4.0-Restore-CNN-Light-(S)-Conv-4x3x3x8
//!HOOK MAIN
//!BIND conv2d_tf
//!SAVE conv2d_1_tf
//!WIDTH conv2d_tf.w
//!HEIGHT conv2d_tf.h
//!COMPONENTS 4
#define go_0(x_off, y_off) (max((conv2d_tf_texOff(vec2(x_off, y_off))), 0.0))
#define go_1(x_off, y_off) (max(-(conv2d_tf_texOff(vec2(x_off, y_off))), 0.0))
vec4 hook() {
vec4 result = mat4(-0.10962185, -0.0029799026, -0.023365824, -0.05949956, 0.11836285, 0.12343753, -0.41918522, 0.100843705, -0.10701484, 0.039537143, -0.11907678, -0.07042709, 0.090918, -0.048232414, -0.10948059, -0.21550386) * go_0(-1.0, -1.0);
result += mat4(0.1196565, -0.029596835, 0.30613193, -0.076757185, -0.20367719, -0.15274593, 0.37518305, 0.15462935, -0.066351786, -0.10156744, -0.06343881, 0.16096751, -0.034099203, -0.018446054, 0.27928472, 0.021821478) * go_0(-1.0, 0.0);
result += mat4(0.03879286, 0.08928867, -0.091816604, -0.05558396, 0.042130366, 0.11184571, -0.14041558, 0.12179159, 0.21014646, 0.09571276, 0.16234225, 0.07396897, -0.053449914, 0.0020039193, -0.1247851, -0.1921406) * go_0(-1.0, 1.0);
result += mat4(-0.1454479, 0.02688604, 0.1374109, 0.2750885, 0.056577697, 0.00068957737, 0.08951344, -0.19170307, -0.2566394, 0.15536527, 0.011363225, -0.19125825, 0.14476708, 0.012303602, 0.08633467, 0.123737104) * go_0(0.0, -1.0);
result += mat4(0.10018441, -0.150802, -0.494996, -0.06321261, -0.1772114, -0.015925756, 0.2788914, 0.06576026, -0.02746058, -0.092062995, 0.079264104, 0.09511396, 0.19690435, 0.29281628, -0.008475318, 0.07288112) * go_0(0.0, 0.0);
result += mat4(0.1318277, 0.22562557, -0.20167945, 0.0900918, 0.07201384, 0.11255668, -0.017271755, 0.2034658, -0.020830879, -0.100098945, 0.28810334, 0.011123141, -0.10913534, 0.23514095, -0.04093111, 0.12905177) * go_0(0.0, 1.0);
result += mat4(-0.13585168, 0.045926165, -0.1284494, 0.087741815, -0.014709302, 0.038507286, 0.111312084, -0.35840037, 0.027209414, 0.4209976, -0.21238972, -0.1669646, 0.01144398, -0.04928185, 0.03198713, 0.053089313) * go_0(1.0, -1.0);
result += mat4(0.124122605, 0.15388283, -0.45052525, 0.043266464, 0.03367098, 0.026657835, 0.1144629, -0.09829795, 0.43976367, 0.44795233, -0.35646713, -0.08222959, -0.2059708, 0.042031478, -0.0677869, -0.15776987) * go_0(1.0, 0.0);
result += mat4(0.08893339, 0.059706207, 0.123072654, 0.021033978, 0.1257634, -0.068486854, -0.277087, 0.05513776, 0.015888589, -0.2153309, -0.061073612, -0.3145063, 0.13208842, 0.24596474, -0.04214658, 0.14688271) * go_0(1.0, 1.0);
result += mat4(-0.13339332, 0.10515062, 0.2569816, 0.0822907, -0.007305685, -0.5423081, -0.03215613, 0.2576847, -0.02492217, 0.23880321, 0.22286284, -0.20403163, -0.1214273, 0.2674894, 0.12061079, 0.03220654) * go_1(-1.0, -1.0);
result += mat4(0.11567793, 0.053781405, -0.51326084, 0.08610824, 0.31249923, -0.12749122, -0.07940706, 0.046616964, 0.24616456, 0.31051433, 0.060803372, -0.14730448, 0.053428583, 0.29475692, -0.44927725, -0.07258236) * go_1(-1.0, 0.0);
result += mat4(0.005443844, -0.026218072, 0.064258896, 0.09733516, -0.17794758, 0.04813496, 0.15956113, -0.2444805, -0.14004774, 0.02392624, 0.017019942, 0.07148293, 0.06932758, -0.092744075, 0.060305513, 0.23718198) * go_1(-1.0, 1.0);
result += mat4(0.22789483, -0.06421205, -0.07393693, -0.23964411, 0.2858886, -0.46467757, 0.21599637, 0.35302728, 0.016082808, -0.03738096, -0.04063366, 0.20734447, -0.1865332, -0.22278418, -0.09424149, -0.04247503) * go_1(0.0, -1.0);
result += mat4(0.2535761, 0.3633529, -0.26105365, 0.019230563, 0.5739685, -0.2751457, -0.058909632, 0.28880042, -0.039476026, 0.25039223, -0.2948966, -0.20114218, -0.20842642, -0.24843977, 0.021974754, -0.18207197) * go_1(0.0, 0.0);
result += mat4(0.14669445, -0.16197711, 0.13286394, 0.038203888, -0.4508675, -0.14597829, 0.04077447, -0.28335747, 0.37308663, 0.5445506, -0.019328654, -0.10912687, 0.050193176, -0.2041695, 0.105989024, -0.040875886) * go_1(0.0, 1.0);
result += mat4(0.1363549, -0.07234217, -0.020701662, 0.07981576, -0.24890432, -0.11027347, 0.5874201, 0.18878014, 0.031327054, -0.3231114, 0.21285434, 0.119426124, -0.0552746, 0.11463724, -0.0559732, 0.07003216) * go_1(1.0, -1.0);
result += mat4(0.1842374, -0.20694533, 0.123377316, 0.018888218, -0.37444904, 0.19275035, -0.15791546, 0.12425125, -0.599771, -0.36792365, 0.008179364, 0.574463, 0.28631294, 0.061126087, -0.1435254, 0.15464944) * go_1(1.0, 0.0);
result += mat4(-0.10790473, -0.07452393, -0.06736163, 0.0010307827, -0.057898067, -0.052630797, -0.045277733, 0.044451468, 0.23487647, 0.48825783, 0.20998475, -0.00096689916, -0.0660962, -0.21198359, 0.014667098, -0.20903115) * go_1(1.0, 1.0);
result += vec4(-0.14014654, -0.003989888, -0.043535326, 0.04363413);
return result;
}
//!DESC Anime4K-v4.0-Restore-CNN-Light-(S)-Conv-4x3x3x8
//!HOOK MAIN
//!BIND conv2d_1_tf
//!SAVE conv2d_2_tf
//!WIDTH conv2d_1_tf.w
//!HEIGHT conv2d_1_tf.h
//!COMPONENTS 4
#define go_0(x_off, y_off) (max((conv2d_1_tf_texOff(vec2(x_off, y_off))), 0.0))
#define go_1(x_off, y_off) (max(-(conv2d_1_tf_texOff(vec2(x_off, y_off))), 0.0))
vec4 hook() {
vec4 result = mat4(0.06860109, -0.22307408, -0.119000964, -0.019293373, -0.16280931, 0.15832534, 0.47991621, -0.16065678, 0.3586349, -0.3052269, -0.3468301, -0.029765083, 0.03637299, -0.034228053, 0.1366816, -0.11353166) * go_0(-1.0, -1.0);
result += mat4(-0.07626909, 0.014709065, 0.058718752, -0.091898814, -0.03196295, -0.23828115, 0.15992726, 0.019005725, 0.3626557, -0.08662889, 0.20499149, -0.2817072, 0.035642564, -0.0014251606, -0.10474601, -0.0075064655) * go_0(-1.0, 0.0);
result += mat4(-0.07240965, 0.11469676, 0.11161988, 0.025265949, 0.0838281, -0.24525258, -0.055010766, 0.016816804, 0.0055700648, 0.022781353, -0.067389295, -0.11399501, 0.011786951, -0.16014479, -0.025843753, 0.055856075) * go_0(-1.0, 1.0);
result += mat4(-0.08875284, -0.49246928, -0.05639631, -0.055599947, -0.0004297358, -7.922949e-05, 0.10042455, 0.0074902754, 0.2948893, -0.1060635, 0.107871026, 0.15465264, -0.04875605, 0.012797352, 0.056751307, 0.024159411) * go_0(0.0, -1.0);
result += mat4(-0.1415634, 0.11381453, 0.14060831, -0.016251462, -0.06800356, -0.104888454, -0.17873403, -0.05459492, -0.97425336, -0.32030496, -0.07802678, 0.14640819, -0.18400052, -0.077593155, -0.19233833, 0.09678532) * go_0(0.0, 0.0);
result += mat4(-0.3491819, -0.025045807, -0.08085913, 0.048120003, 0.0359846, -0.2910878, -0.094684884, 0.11796641, 0.104657814, -0.2577761, -0.36614105, -0.060952082, 0.086422846, -0.12152233, -0.03917068, -0.11262581) * go_0(0.0, 1.0);
result += mat4(0.18023857, 0.07511465, 0.062111333, 0.280575, 0.15618746, 0.16769035, -0.11130592, 0.28843468, 0.17886172, 0.24595198, -0.084060654, 0.050409116, 0.003308582, 0.14350188, 0.016553251, 0.29074904) * go_0(1.0, -1.0);
result += mat4(0.05041217, -0.069437526, -0.10702358, 0.22887972, 0.06803064, 0.29692116, -0.10372111, 0.107224286, 0.33899847, 0.0183973, -0.28651136, 0.2397003, 0.21022974, 0.32439056, -0.056398317, 0.2063751) * go_0(1.0, 0.0);
result += mat4(0.1435449, 0.13990986, -0.018177286, -0.015929827, -0.29771507, 0.27085993, -0.017208885, -0.14844052, 0.32839882, 0.12937985, -0.10113406, 0.0072387415, -0.025876924, 0.1333921, -0.061627384, -0.07525379) * go_0(1.0, 1.0);
result += mat4(-0.3966087, -0.014369434, -0.05270457, 0.23646712, 0.031172995, -0.21834248, -0.34596613, 0.073179096, -0.074325696, 0.047319703, -0.096507035, 0.07541293, -0.03637483, 0.0019641656, 0.11082705, 0.1281278) * go_1(-1.0, -1.0);
result += mat4(-0.14917625, 0.17592464, -0.056782737, 0.19513474, -0.1674049, 0.07751513, 0.0033022733, 0.14773755, 0.11514765, -0.06977646, -0.29910892, 0.09908598, -0.05963784, -0.18382244, -0.020593222, -0.19491525) * go_1(-1.0, 0.0);
result += mat4(0.06869795, -0.14378455, -0.09756, 0.052556444, -0.31736895, 0.28572652, 0.23576652, 0.061206914, 0.1891024, -0.08254225, -0.09238423, 0.013368974, -0.45201135, 0.5092041, 0.14716014, -0.098917484) * go_1(-1.0, 1.0);
result += mat4(-0.14541371, 0.02430168, -0.15545768, 0.16055955, -0.1127217, 0.26870123, 0.14589804, -0.009680334, 0.06314588, -0.019071314, -0.24090584, 0.11179489, 0.00473911, 0.20536782, 0.15277746, 0.3628317) * go_1(0.0, -1.0);
result += mat4(0.26486307, 0.072391406, 0.40177062, 0.13350938, -0.058910567, -0.88781524, 0.18842989, 0.5629525, 0.38428438, 0.53440577, 0.018202629, -0.18152817, 0.27468565, -0.020607917, 0.071919985, -0.26525116) * go_1(0.0, 0.0);
result += mat4(-0.021828521, 0.13273492, 0.2355708, 0.19482781, -0.2999111, 0.1320113, 0.16634502, -0.09536145, 0.2531071, 0.22949213, 0.052790716, -0.07548418, -0.15073608, -0.20853189, -0.12715234, -0.1656967) * go_1(0.0, 1.0);
result += mat4(-0.1335416, -0.21159695, 0.0991769, -0.14366277, -0.29104885, 0.028651, 0.15253887, -0.10728744, 0.0050040013, -0.17823236, -0.030847553, -0.014184854, -0.15098482, -0.14861467, 0.08396364, 0.27557498) * go_1(1.0, -1.0);
result += mat4(-0.46334285, -0.12170294, 0.39929175, -0.38420856, -0.15792593, 0.08314284, 0.014052525, -0.15239465, -0.070270956, -0.09934035, 0.14567307, -0.1818495, -0.16970426, -0.03906719, -0.055568833, 0.53916764) * go_1(1.0, 0.0);
result += mat4(-0.31435746, -0.22179253, 0.051074944, 0.10301049, -0.008803406, -0.27885324, 0.051881388, 0.15728879, -0.14889908, -0.068201154, 0.078146234, 0.022170171, -0.16572808, 0.1924863, -0.16989416, 0.06521089) * go_1(1.0, 1.0);
result += vec4(0.03417357, -0.061734118, -0.092811376, -0.08959484);
return result;
}
//!DESC Anime4K-v4.0-Restore-CNN-Light-(S)-Conv-3x3x3x8
//!HOOK MAIN
//!BIND MAIN
//!BIND conv2d_2_tf
//!SAVE MAIN
//!WIDTH conv2d_2_tf.w
//!HEIGHT conv2d_2_tf.h
#define go_0(x_off, y_off) (max((conv2d_2_tf_texOff(vec2(x_off, y_off))), 0.0))
#define go_1(x_off, y_off) (max(-(conv2d_2_tf_texOff(vec2(x_off, y_off))), 0.0))
vec4 hook() {
vec4 result = mat4(0.11125011, 0.121156566, 0.08852433, 0.0, -0.036322284, -0.0463784, -0.049412448, 0.0, 0.005945653, 0.0053671296, 0.010802364, 0.0, 0.006810587, 0.002918198, -0.0012105652, 0.0) * go_0(-1.0, -1.0);
result += mat4(0.026287436, 0.02520165, 0.019351153, 0.0, -0.07238988, -0.083715804, -0.09264778, 0.0, -0.011077921, -0.011035651, -0.012050601, 0.0, 0.029185535, 0.038216114, 0.02774746, 0.0) * go_0(-1.0, 0.0);
result += mat4(0.070927575, 0.08593877, 0.07682078, 0.0, 0.021360587, 0.018740527, 0.01970568, 0.0, -0.0204519, -0.011934785, -0.026966887, 0.0, 0.069858775, 0.08951965, 0.0798647, 0.0) * go_0(-1.0, 1.0);
result += mat4(0.025820248, 0.021244338, 0.024957014, 0.0, 0.013424227, 0.013827067, 0.003138973, 0.0, 0.013583181, 0.011409091, 0.010586885, 0.0, 0.0041268608, -0.0019551108, 0.00880615, 0.0) * go_0(0.0, -1.0);
result += mat4(-0.2479287, -0.26959884, -0.24274161, 0.0, 0.3302587, 0.339357, 0.31258872, 0.0, -0.06390575, -0.07348261, -0.06203407, 0.0, 0.00026586142, 0.02257619, 0.012444497, 0.0) * go_0(0.0, 0.0);
result += mat4(-0.006633193, -0.010010113, -0.0077116624, 0.0, -0.1419069, -0.16616994, -0.14144665, 0.0, 0.08545714, 0.08505806, 0.083317466, 0.0, -0.13238458, -0.15451205, -0.12798728, 0.0) * go_0(0.0, 1.0);
result += mat4(0.045070663, 0.04542016, 0.046998166, 0.0, -0.05112643, -0.057206195, -0.05738539, 0.0, 0.011283726, 0.010138602, 0.01235735, 0.0, -0.03427927, -0.03262737, -0.031668015, 0.0) * go_0(1.0, -1.0);
result += mat4(-0.07257391, -0.0776162, -0.057399552, 0.0, 0.04470343, 0.051169496, 0.039849825, 0.0, -0.11307614, -0.12380827, -0.09820596, 0.0, 0.056911424, 0.055741813, 0.05127505, 0.0) * go_0(1.0, 0.0);
result += mat4(0.048344582, 0.059534755, 0.05646843, 0.0, -0.07796629, -0.08116981, -0.06715556, 0.0, 0.17091493, 0.14715673, 0.15351047, 0.0, -0.024886549, -0.026329398, -0.018384507, 0.0) * go_0(1.0, 1.0);
result += mat4(0.0014123452, 0.0058744787, 0.0154064745, 0.0, 0.010318075, 0.016603762, 0.014627689, 0.0, -0.044145256, -0.03925848, -0.032770663, 0.0, -0.004119773, 0.012201151, 0.009369247, 0.0) * go_1(-1.0, -1.0);
result += mat4(0.0052950038, 0.007013206, 0.009790427, 0.0, -0.004198126, -0.011440633, 0.00010739416, 0.0, -0.0006839748, 0.011816718, 0.013014471, 0.0, -0.038273178, -0.0360404, -0.03597751, 0.0) * go_1(-1.0, 0.0);
result += mat4(-0.045604456, -0.060279388, -0.0517499, 0.0, -0.010862894, -0.015798926, -0.016425012, 0.0, -0.013401246, -0.01610259, -0.0063702716, 0.0, -0.0717101, -0.08254595, -0.086501, 0.0) * go_1(-1.0, 1.0);
result += mat4(-0.0017826704, 0.0006922891, -0.005519086, 0.0, 0.0036474997, -0.0007020761, 0.0053626, 0.0, -0.016065974, -0.014424729, -0.010033392, 0.0, -0.058783714, -0.073306486, -0.074446484, 0.0) * go_1(0.0, -1.0);
result += mat4(0.0018922655, 0.0043800087, -0.0067219627, 0.0, -0.1608797, -0.17974356, -0.15880819, 0.0, 0.079822324, 0.074915655, 0.069596596, 0.0, 0.25801206, 0.22806509, 0.22776394, 0.0) * go_1(0.0, 0.0);
result += mat4(0.0023111713, 0.0064282003, 0.0023720514, 0.0, 0.09614474, 0.11259233, 0.09459624, 0.0, -0.15301032, -0.17444262, -0.15507716, 0.0, 0.09142753, 0.11829936, 0.09456856, 0.0) * go_1(0.0, 1.0);
result += mat4(-0.025954379, -0.036987886, -0.03818303, 0.0, 0.03597379, 0.038673062, 0.04338409, 0.0, -0.029713225, -0.03456757, -0.03287668, 0.0, -0.06803377, -0.09797115, -0.08405575, 0.0) * go_1(1.0, -1.0);
result += mat4(0.05548964, 0.06232078, 0.042324547, 0.0, -0.053952005, -0.04580321, -0.035208277, 0.0, 0.060002126, 0.061372478, 0.04656402, 0.0, -0.097082764, -0.102050945, -0.096662015, 0.0) * go_1(1.0, 0.0);
result += mat4(0.0395022, 0.044642884, 0.041112803, 0.0, 0.04506878, 0.046839535, 0.03812893, 0.0, 0.12657519, 0.14717592, 0.11737227, 0.0, 0.007753313, 0.017000297, 0.014676179, 0.0) * go_1(1.0, 1.0);
result += vec4(-0.0002519086, -0.0004349181, 5.6093828e-05, 0.0);
return result + MAIN_tex(MAIN_pos);
}