modern_lisp-machine/.config/mpv/shaders/ravu-r4.hook

758 lines
197 KiB
Plaintext
Raw Permalink Normal View History

2024-06-01 05:00:40 +00:00
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//!DESC RAVU (step1, luma, r4)
//!HOOK LUMA
//!BIND HOOKED
//!BIND ravu_lut4
//!SAVE ravu_int11
//!WHEN HOOKED.w OUTPUT.w / 0.707106 < HOOKED.h OUTPUT.h / 0.707106 < *
vec4 hook() {
float sample0 = HOOKED_texOff(vec2(-3.0, -3.0)).x;
float sample1 = HOOKED_texOff(vec2(-3.0, -2.0)).x;
float sample2 = HOOKED_texOff(vec2(-3.0, -1.0)).x;
float sample3 = HOOKED_texOff(vec2(-3.0, 0.0)).x;
float sample4 = HOOKED_texOff(vec2(-3.0, 1.0)).x;
float sample5 = HOOKED_texOff(vec2(-3.0, 2.0)).x;
float sample6 = HOOKED_texOff(vec2(-3.0, 3.0)).x;
float sample7 = HOOKED_texOff(vec2(-3.0, 4.0)).x;
float sample8 = HOOKED_texOff(vec2(-2.0, -3.0)).x;
float sample9 = HOOKED_texOff(vec2(-2.0, -2.0)).x;
float sample10 = HOOKED_texOff(vec2(-2.0, -1.0)).x;
float sample11 = HOOKED_texOff(vec2(-2.0, 0.0)).x;
float sample12 = HOOKED_texOff(vec2(-2.0, 1.0)).x;
float sample13 = HOOKED_texOff(vec2(-2.0, 2.0)).x;
float sample14 = HOOKED_texOff(vec2(-2.0, 3.0)).x;
float sample15 = HOOKED_texOff(vec2(-2.0, 4.0)).x;
float sample16 = HOOKED_texOff(vec2(-1.0, -3.0)).x;
float sample17 = HOOKED_texOff(vec2(-1.0, -2.0)).x;
float sample18 = HOOKED_texOff(vec2(-1.0, -1.0)).x;
float sample19 = HOOKED_texOff(vec2(-1.0, 0.0)).x;
float sample20 = HOOKED_texOff(vec2(-1.0, 1.0)).x;
float sample21 = HOOKED_texOff(vec2(-1.0, 2.0)).x;
float sample22 = HOOKED_texOff(vec2(-1.0, 3.0)).x;
float sample23 = HOOKED_texOff(vec2(-1.0, 4.0)).x;
float sample24 = HOOKED_texOff(vec2(0.0, -3.0)).x;
float sample25 = HOOKED_texOff(vec2(0.0, -2.0)).x;
float sample26 = HOOKED_texOff(vec2(0.0, -1.0)).x;
float sample27 = HOOKED_texOff(vec2(0.0, 0.0)).x;
float sample28 = HOOKED_texOff(vec2(0.0, 1.0)).x;
float sample29 = HOOKED_texOff(vec2(0.0, 2.0)).x;
float sample30 = HOOKED_texOff(vec2(0.0, 3.0)).x;
float sample31 = HOOKED_texOff(vec2(0.0, 4.0)).x;
float sample32 = HOOKED_texOff(vec2(1.0, -3.0)).x;
float sample33 = HOOKED_texOff(vec2(1.0, -2.0)).x;
float sample34 = HOOKED_texOff(vec2(1.0, -1.0)).x;
float sample35 = HOOKED_texOff(vec2(1.0, 0.0)).x;
float sample36 = HOOKED_texOff(vec2(1.0, 1.0)).x;
float sample37 = HOOKED_texOff(vec2(1.0, 2.0)).x;
float sample38 = HOOKED_texOff(vec2(1.0, 3.0)).x;
float sample39 = HOOKED_texOff(vec2(1.0, 4.0)).x;
float sample40 = HOOKED_texOff(vec2(2.0, -3.0)).x;
float sample41 = HOOKED_texOff(vec2(2.0, -2.0)).x;
float sample42 = HOOKED_texOff(vec2(2.0, -1.0)).x;
float sample43 = HOOKED_texOff(vec2(2.0, 0.0)).x;
float sample44 = HOOKED_texOff(vec2(2.0, 1.0)).x;
float sample45 = HOOKED_texOff(vec2(2.0, 2.0)).x;
float sample46 = HOOKED_texOff(vec2(2.0, 3.0)).x;
float sample47 = HOOKED_texOff(vec2(2.0, 4.0)).x;
float sample48 = HOOKED_texOff(vec2(3.0, -3.0)).x;
float sample49 = HOOKED_texOff(vec2(3.0, -2.0)).x;
float sample50 = HOOKED_texOff(vec2(3.0, -1.0)).x;
float sample51 = HOOKED_texOff(vec2(3.0, 0.0)).x;
float sample52 = HOOKED_texOff(vec2(3.0, 1.0)).x;
float sample53 = HOOKED_texOff(vec2(3.0, 2.0)).x;
float sample54 = HOOKED_texOff(vec2(3.0, 3.0)).x;
float sample55 = HOOKED_texOff(vec2(3.0, 4.0)).x;
float sample56 = HOOKED_texOff(vec2(4.0, -3.0)).x;
float sample57 = HOOKED_texOff(vec2(4.0, -2.0)).x;
float sample58 = HOOKED_texOff(vec2(4.0, -1.0)).x;
float sample59 = HOOKED_texOff(vec2(4.0, 0.0)).x;
float sample60 = HOOKED_texOff(vec2(4.0, 1.0)).x;
float sample61 = HOOKED_texOff(vec2(4.0, 2.0)).x;
float sample62 = HOOKED_texOff(vec2(4.0, 3.0)).x;
float sample63 = HOOKED_texOff(vec2(4.0, 4.0)).x;
vec3 abd = vec3(0.0);
float gx, gy;
gx = (sample17-sample1)/2.0;
gy = (sample10-sample8)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
gx = (sample18-sample2)/2.0;
gy = (-sample12+8.0*sample11-8.0*sample9+sample8)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample19-sample3)/2.0;
gy = (-sample13+8.0*sample12-8.0*sample10+sample9)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample20-sample4)/2.0;
gy = (-sample14+8.0*sample13-8.0*sample11+sample10)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample21-sample5)/2.0;
gy = (-sample15+8.0*sample14-8.0*sample12+sample11)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample22-sample6)/2.0;
gy = (sample15-sample13)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
gx = (-sample33+8.0*sample25-8.0*sample9+sample1)/12.0;
gy = (sample18-sample16)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (-sample34+8.0*sample26-8.0*sample10+sample2)/12.0;
gy = (-sample20+8.0*sample19-8.0*sample17+sample16)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample35+8.0*sample27-8.0*sample11+sample3)/12.0;
gy = (-sample21+8.0*sample20-8.0*sample18+sample17)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample36+8.0*sample28-8.0*sample12+sample4)/12.0;
gy = (-sample22+8.0*sample21-8.0*sample19+sample18)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample37+8.0*sample29-8.0*sample13+sample5)/12.0;
gy = (-sample23+8.0*sample22-8.0*sample20+sample19)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample38+8.0*sample30-8.0*sample14+sample6)/12.0;
gy = (sample23-sample21)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (-sample41+8.0*sample33-8.0*sample17+sample9)/12.0;
gy = (sample26-sample24)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample42+8.0*sample34-8.0*sample18+sample10)/12.0;
gy = (-sample28+8.0*sample27-8.0*sample25+sample24)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample43+8.0*sample35-8.0*sample19+sample11)/12.0;
gy = (-sample29+8.0*sample28-8.0*sample26+sample25)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample44+8.0*sample36-8.0*sample20+sample12)/12.0;
gy = (-sample30+8.0*sample29-8.0*sample27+sample26)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample45+8.0*sample37-8.0*sample21+sample13)/12.0;
gy = (-sample31+8.0*sample30-8.0*sample28+sample27)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample46+8.0*sample38-8.0*sample22+sample14)/12.0;
gy = (sample31-sample29)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample49+8.0*sample41-8.0*sample25+sample17)/12.0;
gy = (sample34-sample32)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample50+8.0*sample42-8.0*sample26+sample18)/12.0;
gy = (-sample36+8.0*sample35-8.0*sample33+sample32)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample51+8.0*sample43-8.0*sample27+sample19)/12.0;
gy = (-sample37+8.0*sample36-8.0*sample34+sample33)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample52+8.0*sample44-8.0*sample28+sample20)/12.0;
gy = (-sample38+8.0*sample37-8.0*sample35+sample34)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample53+8.0*sample45-8.0*sample29+sample21)/12.0;
gy = (-sample39+8.0*sample38-8.0*sample36+sample35)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample54+8.0*sample46-8.0*sample30+sample22)/12.0;
gy = (sample39-sample37)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample57+8.0*sample49-8.0*sample33+sample25)/12.0;
gy = (sample42-sample40)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (-sample58+8.0*sample50-8.0*sample34+sample26)/12.0;
gy = (-sample44+8.0*sample43-8.0*sample41+sample40)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample59+8.0*sample51-8.0*sample35+sample27)/12.0;
gy = (-sample45+8.0*sample44-8.0*sample42+sample41)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample60+8.0*sample52-8.0*sample36+sample28)/12.0;
gy = (-sample46+8.0*sample45-8.0*sample43+sample42)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample61+8.0*sample53-8.0*sample37+sample29)/12.0;
gy = (-sample47+8.0*sample46-8.0*sample44+sample43)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample62+8.0*sample54-8.0*sample38+sample30)/12.0;
gy = (sample47-sample45)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample57-sample41)/2.0;
gy = (sample50-sample48)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
gx = (sample58-sample42)/2.0;
gy = (-sample52+8.0*sample51-8.0*sample49+sample48)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample59-sample43)/2.0;
gy = (-sample53+8.0*sample52-8.0*sample50+sample49)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample60-sample44)/2.0;
gy = (-sample54+8.0*sample53-8.0*sample51+sample50)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample61-sample45)/2.0;
gy = (-sample55+8.0*sample54-8.0*sample52+sample51)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample62-sample46)/2.0;
gy = (sample55-sample53)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
float a = abd.x, b = abd.y, d = abd.z;
float T = a + d, D = a * d - b * b;
float delta = sqrt(max(T * T / 4.0 - D, 0.0));
float L1 = T / 2.0 + delta, L2 = T / 2.0 - delta;
float sqrtL1 = sqrt(L1), sqrtL2 = sqrt(L2);
float theta = mix(mod(atan(L1 - a, b) + 3.141592653589793, 3.141592653589793), 0.0, abs(b) < 1.192092896e-7);
float lambda = sqrtL1;
float mu = mix((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2), 0.0, sqrtL1 + sqrtL2 < 1.192092896e-7);
float angle = floor(theta * 24.0 / 3.141592653589793);
float strength = clamp(floor(log2(lambda * 2000.0 + 1.192092896e-7)), 0.0, 8.0);
float coherence = mix(mix(0.0, 1.0, mu >= 0.25), 2.0, mu >= 0.5);
float coord_y = ((angle * 9.0 + strength) * 3.0 + coherence + 0.5) / 648.0;
float res = 0.0;
vec4 w;
w = texture(ravu_lut4, vec2(0.0625, coord_y));
res += (sample0 + sample63) * w[0];
res += (sample1 + sample62) * w[1];
res += (sample2 + sample61) * w[2];
res += (sample3 + sample60) * w[3];
w = texture(ravu_lut4, vec2(0.1875, coord_y));
res += (sample4 + sample59) * w[0];
res += (sample5 + sample58) * w[1];
res += (sample6 + sample57) * w[2];
res += (sample7 + sample56) * w[3];
w = texture(ravu_lut4, vec2(0.3125, coord_y));
res += (sample8 + sample55) * w[0];
res += (sample9 + sample54) * w[1];
res += (sample10 + sample53) * w[2];
res += (sample11 + sample52) * w[3];
w = texture(ravu_lut4, vec2(0.4375, coord_y));
res += (sample12 + sample51) * w[0];
res += (sample13 + sample50) * w[1];
res += (sample14 + sample49) * w[2];
res += (sample15 + sample48) * w[3];
w = texture(ravu_lut4, vec2(0.5625, coord_y));
res += (sample16 + sample47) * w[0];
res += (sample17 + sample46) * w[1];
res += (sample18 + sample45) * w[2];
res += (sample19 + sample44) * w[3];
w = texture(ravu_lut4, vec2(0.6875, coord_y));
res += (sample20 + sample43) * w[0];
res += (sample21 + sample42) * w[1];
res += (sample22 + sample41) * w[2];
res += (sample23 + sample40) * w[3];
w = texture(ravu_lut4, vec2(0.8125, coord_y));
res += (sample24 + sample39) * w[0];
res += (sample25 + sample38) * w[1];
res += (sample26 + sample37) * w[2];
res += (sample27 + sample36) * w[3];
w = texture(ravu_lut4, vec2(0.9375, coord_y));
res += (sample28 + sample35) * w[0];
res += (sample29 + sample34) * w[1];
res += (sample30 + sample33) * w[2];
res += (sample31 + sample32) * w[3];
res = clamp(res, 0.0, 1.0);
return vec4(res, 0.0, 0.0, 0.0);
}
//!DESC RAVU (step2, luma, r4)
//!HOOK LUMA
//!BIND HOOKED
//!BIND ravu_lut4
//!BIND ravu_int11
//!SAVE ravu_int10
//!WHEN HOOKED.w OUTPUT.w / 0.707106 < HOOKED.h OUTPUT.h / 0.707106 < *
vec4 hook() {
float sample0 = HOOKED_texOff(vec2(-3.0, 0.0)).x;
float sample16 = HOOKED_texOff(vec2(-2.0, -1.0)).x;
float sample9 = HOOKED_texOff(vec2(-2.0, 0.0)).x;
float sample2 = HOOKED_texOff(vec2(-2.0, 1.0)).x;
float sample32 = HOOKED_texOff(vec2(-1.0, -2.0)).x;
float sample25 = HOOKED_texOff(vec2(-1.0, -1.0)).x;
float sample18 = HOOKED_texOff(vec2(-1.0, 0.0)).x;
float sample11 = HOOKED_texOff(vec2(-1.0, 1.0)).x;
float sample4 = HOOKED_texOff(vec2(-1.0, 2.0)).x;
float sample48 = HOOKED_texOff(vec2(0.0, -3.0)).x;
float sample41 = HOOKED_texOff(vec2(0.0, -2.0)).x;
float sample34 = HOOKED_texOff(vec2(0.0, -1.0)).x;
float sample27 = HOOKED_texOff(vec2(0.0, 0.0)).x;
float sample20 = HOOKED_texOff(vec2(0.0, 1.0)).x;
float sample13 = HOOKED_texOff(vec2(0.0, 2.0)).x;
float sample6 = HOOKED_texOff(vec2(0.0, 3.0)).x;
float sample57 = HOOKED_texOff(vec2(1.0, -3.0)).x;
float sample50 = HOOKED_texOff(vec2(1.0, -2.0)).x;
float sample43 = HOOKED_texOff(vec2(1.0, -1.0)).x;
float sample36 = HOOKED_texOff(vec2(1.0, 0.0)).x;
float sample29 = HOOKED_texOff(vec2(1.0, 1.0)).x;
float sample22 = HOOKED_texOff(vec2(1.0, 2.0)).x;
float sample15 = HOOKED_texOff(vec2(1.0, 3.0)).x;
float sample59 = HOOKED_texOff(vec2(2.0, -2.0)).x;
float sample52 = HOOKED_texOff(vec2(2.0, -1.0)).x;
float sample45 = HOOKED_texOff(vec2(2.0, 0.0)).x;
float sample38 = HOOKED_texOff(vec2(2.0, 1.0)).x;
float sample31 = HOOKED_texOff(vec2(2.0, 2.0)).x;
float sample61 = HOOKED_texOff(vec2(3.0, -1.0)).x;
float sample54 = HOOKED_texOff(vec2(3.0, 0.0)).x;
float sample47 = HOOKED_texOff(vec2(3.0, 1.0)).x;
float sample63 = HOOKED_texOff(vec2(4.0, 0.0)).x;
float sample8 = ravu_int11_texOff(vec2(-3.0, -1.0)).x;
float sample1 = ravu_int11_texOff(vec2(-3.0, 0.0)).x;
float sample24 = ravu_int11_texOff(vec2(-2.0, -2.0)).x;
float sample17 = ravu_int11_texOff(vec2(-2.0, -1.0)).x;
float sample10 = ravu_int11_texOff(vec2(-2.0, 0.0)).x;
float sample3 = ravu_int11_texOff(vec2(-2.0, 1.0)).x;
float sample40 = ravu_int11_texOff(vec2(-1.0, -3.0)).x;
float sample33 = ravu_int11_texOff(vec2(-1.0, -2.0)).x;
float sample26 = ravu_int11_texOff(vec2(-1.0, -1.0)).x;
float sample19 = ravu_int11_texOff(vec2(-1.0, 0.0)).x;
float sample12 = ravu_int11_texOff(vec2(-1.0, 1.0)).x;
float sample5 = ravu_int11_texOff(vec2(-1.0, 2.0)).x;
float sample56 = ravu_int11_texOff(vec2(0.0, -4.0)).x;
float sample49 = ravu_int11_texOff(vec2(0.0, -3.0)).x;
float sample42 = ravu_int11_texOff(vec2(0.0, -2.0)).x;
float sample35 = ravu_int11_texOff(vec2(0.0, -1.0)).x;
float sample28 = ravu_int11_texOff(vec2(0.0, 0.0)).x;
float sample21 = ravu_int11_texOff(vec2(0.0, 1.0)).x;
float sample14 = ravu_int11_texOff(vec2(0.0, 2.0)).x;
float sample7 = ravu_int11_texOff(vec2(0.0, 3.0)).x;
float sample58 = ravu_int11_texOff(vec2(1.0, -3.0)).x;
float sample51 = ravu_int11_texOff(vec2(1.0, -2.0)).x;
float sample44 = ravu_int11_texOff(vec2(1.0, -1.0)).x;
float sample37 = ravu_int11_texOff(vec2(1.0, 0.0)).x;
float sample30 = ravu_int11_texOff(vec2(1.0, 1.0)).x;
float sample23 = ravu_int11_texOff(vec2(1.0, 2.0)).x;
float sample60 = ravu_int11_texOff(vec2(2.0, -2.0)).x;
float sample53 = ravu_int11_texOff(vec2(2.0, -1.0)).x;
float sample46 = ravu_int11_texOff(vec2(2.0, 0.0)).x;
float sample39 = ravu_int11_texOff(vec2(2.0, 1.0)).x;
float sample62 = ravu_int11_texOff(vec2(3.0, -1.0)).x;
float sample55 = ravu_int11_texOff(vec2(3.0, 0.0)).x;
vec3 abd = vec3(0.0);
float gx, gy;
gx = (sample17-sample1)/2.0;
gy = (sample10-sample8)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
gx = (sample18-sample2)/2.0;
gy = (-sample12+8.0*sample11-8.0*sample9+sample8)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample19-sample3)/2.0;
gy = (-sample13+8.0*sample12-8.0*sample10+sample9)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample20-sample4)/2.0;
gy = (-sample14+8.0*sample13-8.0*sample11+sample10)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample21-sample5)/2.0;
gy = (-sample15+8.0*sample14-8.0*sample12+sample11)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample22-sample6)/2.0;
gy = (sample15-sample13)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
gx = (-sample33+8.0*sample25-8.0*sample9+sample1)/12.0;
gy = (sample18-sample16)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (-sample34+8.0*sample26-8.0*sample10+sample2)/12.0;
gy = (-sample20+8.0*sample19-8.0*sample17+sample16)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample35+8.0*sample27-8.0*sample11+sample3)/12.0;
gy = (-sample21+8.0*sample20-8.0*sample18+sample17)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample36+8.0*sample28-8.0*sample12+sample4)/12.0;
gy = (-sample22+8.0*sample21-8.0*sample19+sample18)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample37+8.0*sample29-8.0*sample13+sample5)/12.0;
gy = (-sample23+8.0*sample22-8.0*sample20+sample19)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample38+8.0*sample30-8.0*sample14+sample6)/12.0;
gy = (sample23-sample21)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (-sample41+8.0*sample33-8.0*sample17+sample9)/12.0;
gy = (sample26-sample24)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample42+8.0*sample34-8.0*sample18+sample10)/12.0;
gy = (-sample28+8.0*sample27-8.0*sample25+sample24)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample43+8.0*sample35-8.0*sample19+sample11)/12.0;
gy = (-sample29+8.0*sample28-8.0*sample26+sample25)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample44+8.0*sample36-8.0*sample20+sample12)/12.0;
gy = (-sample30+8.0*sample29-8.0*sample27+sample26)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample45+8.0*sample37-8.0*sample21+sample13)/12.0;
gy = (-sample31+8.0*sample30-8.0*sample28+sample27)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample46+8.0*sample38-8.0*sample22+sample14)/12.0;
gy = (sample31-sample29)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample49+8.0*sample41-8.0*sample25+sample17)/12.0;
gy = (sample34-sample32)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample50+8.0*sample42-8.0*sample26+sample18)/12.0;
gy = (-sample36+8.0*sample35-8.0*sample33+sample32)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample51+8.0*sample43-8.0*sample27+sample19)/12.0;
gy = (-sample37+8.0*sample36-8.0*sample34+sample33)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample52+8.0*sample44-8.0*sample28+sample20)/12.0;
gy = (-sample38+8.0*sample37-8.0*sample35+sample34)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample53+8.0*sample45-8.0*sample29+sample21)/12.0;
gy = (-sample39+8.0*sample38-8.0*sample36+sample35)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample54+8.0*sample46-8.0*sample30+sample22)/12.0;
gy = (sample39-sample37)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample57+8.0*sample49-8.0*sample33+sample25)/12.0;
gy = (sample42-sample40)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (-sample58+8.0*sample50-8.0*sample34+sample26)/12.0;
gy = (-sample44+8.0*sample43-8.0*sample41+sample40)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample59+8.0*sample51-8.0*sample35+sample27)/12.0;
gy = (-sample45+8.0*sample44-8.0*sample42+sample41)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample60+8.0*sample52-8.0*sample36+sample28)/12.0;
gy = (-sample46+8.0*sample45-8.0*sample43+sample42)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample61+8.0*sample53-8.0*sample37+sample29)/12.0;
gy = (-sample47+8.0*sample46-8.0*sample44+sample43)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample62+8.0*sample54-8.0*sample38+sample30)/12.0;
gy = (sample47-sample45)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample57-sample41)/2.0;
gy = (sample50-sample48)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
gx = (sample58-sample42)/2.0;
gy = (-sample52+8.0*sample51-8.0*sample49+sample48)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample59-sample43)/2.0;
gy = (-sample53+8.0*sample52-8.0*sample50+sample49)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample60-sample44)/2.0;
gy = (-sample54+8.0*sample53-8.0*sample51+sample50)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample61-sample45)/2.0;
gy = (-sample55+8.0*sample54-8.0*sample52+sample51)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample62-sample46)/2.0;
gy = (sample55-sample53)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
float a = abd.x, b = abd.y, d = abd.z;
float T = a + d, D = a * d - b * b;
float delta = sqrt(max(T * T / 4.0 - D, 0.0));
float L1 = T / 2.0 + delta, L2 = T / 2.0 - delta;
float sqrtL1 = sqrt(L1), sqrtL2 = sqrt(L2);
float theta = mix(mod(atan(L1 - a, b) + 3.141592653589793, 3.141592653589793), 0.0, abs(b) < 1.192092896e-7);
float lambda = sqrtL1;
float mu = mix((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2), 0.0, sqrtL1 + sqrtL2 < 1.192092896e-7);
float angle = floor(theta * 24.0 / 3.141592653589793);
float strength = clamp(floor(log2(lambda * 2000.0 + 1.192092896e-7)), 0.0, 8.0);
float coherence = mix(mix(0.0, 1.0, mu >= 0.25), 2.0, mu >= 0.5);
float coord_y = ((angle * 9.0 + strength) * 3.0 + coherence + 0.5) / 648.0;
float res = 0.0;
vec4 w;
w = texture(ravu_lut4, vec2(0.0625, coord_y));
res += (sample0 + sample63) * w[0];
res += (sample1 + sample62) * w[1];
res += (sample2 + sample61) * w[2];
res += (sample3 + sample60) * w[3];
w = texture(ravu_lut4, vec2(0.1875, coord_y));
res += (sample4 + sample59) * w[0];
res += (sample5 + sample58) * w[1];
res += (sample6 + sample57) * w[2];
res += (sample7 + sample56) * w[3];
w = texture(ravu_lut4, vec2(0.3125, coord_y));
res += (sample8 + sample55) * w[0];
res += (sample9 + sample54) * w[1];
res += (sample10 + sample53) * w[2];
res += (sample11 + sample52) * w[3];
w = texture(ravu_lut4, vec2(0.4375, coord_y));
res += (sample12 + sample51) * w[0];
res += (sample13 + sample50) * w[1];
res += (sample14 + sample49) * w[2];
res += (sample15 + sample48) * w[3];
w = texture(ravu_lut4, vec2(0.5625, coord_y));
res += (sample16 + sample47) * w[0];
res += (sample17 + sample46) * w[1];
res += (sample18 + sample45) * w[2];
res += (sample19 + sample44) * w[3];
w = texture(ravu_lut4, vec2(0.6875, coord_y));
res += (sample20 + sample43) * w[0];
res += (sample21 + sample42) * w[1];
res += (sample22 + sample41) * w[2];
res += (sample23 + sample40) * w[3];
w = texture(ravu_lut4, vec2(0.8125, coord_y));
res += (sample24 + sample39) * w[0];
res += (sample25 + sample38) * w[1];
res += (sample26 + sample37) * w[2];
res += (sample27 + sample36) * w[3];
w = texture(ravu_lut4, vec2(0.9375, coord_y));
res += (sample28 + sample35) * w[0];
res += (sample29 + sample34) * w[1];
res += (sample30 + sample33) * w[2];
res += (sample31 + sample32) * w[3];
res = clamp(res, 0.0, 1.0);
return vec4(res, 0.0, 0.0, 0.0);
}
//!DESC RAVU (step3, luma, r4)
//!HOOK LUMA
//!BIND HOOKED
//!BIND ravu_lut4
//!BIND ravu_int11
//!SAVE ravu_int01
//!WHEN HOOKED.w OUTPUT.w / 0.707106 < HOOKED.h OUTPUT.h / 0.707106 < *
vec4 hook() {
float sample8 = HOOKED_texOff(vec2(-3.0, 0.0)).x;
float sample1 = HOOKED_texOff(vec2(-3.0, 1.0)).x;
float sample24 = HOOKED_texOff(vec2(-2.0, -1.0)).x;
float sample17 = HOOKED_texOff(vec2(-2.0, 0.0)).x;
float sample10 = HOOKED_texOff(vec2(-2.0, 1.0)).x;
float sample3 = HOOKED_texOff(vec2(-2.0, 2.0)).x;
float sample40 = HOOKED_texOff(vec2(-1.0, -2.0)).x;
float sample33 = HOOKED_texOff(vec2(-1.0, -1.0)).x;
float sample26 = HOOKED_texOff(vec2(-1.0, 0.0)).x;
float sample19 = HOOKED_texOff(vec2(-1.0, 1.0)).x;
float sample12 = HOOKED_texOff(vec2(-1.0, 2.0)).x;
float sample5 = HOOKED_texOff(vec2(-1.0, 3.0)).x;
float sample56 = HOOKED_texOff(vec2(0.0, -3.0)).x;
float sample49 = HOOKED_texOff(vec2(0.0, -2.0)).x;
float sample42 = HOOKED_texOff(vec2(0.0, -1.0)).x;
float sample35 = HOOKED_texOff(vec2(0.0, 0.0)).x;
float sample28 = HOOKED_texOff(vec2(0.0, 1.0)).x;
float sample21 = HOOKED_texOff(vec2(0.0, 2.0)).x;
float sample14 = HOOKED_texOff(vec2(0.0, 3.0)).x;
float sample7 = HOOKED_texOff(vec2(0.0, 4.0)).x;
float sample58 = HOOKED_texOff(vec2(1.0, -2.0)).x;
float sample51 = HOOKED_texOff(vec2(1.0, -1.0)).x;
float sample44 = HOOKED_texOff(vec2(1.0, 0.0)).x;
float sample37 = HOOKED_texOff(vec2(1.0, 1.0)).x;
float sample30 = HOOKED_texOff(vec2(1.0, 2.0)).x;
float sample23 = HOOKED_texOff(vec2(1.0, 3.0)).x;
float sample60 = HOOKED_texOff(vec2(2.0, -1.0)).x;
float sample53 = HOOKED_texOff(vec2(2.0, 0.0)).x;
float sample46 = HOOKED_texOff(vec2(2.0, 1.0)).x;
float sample39 = HOOKED_texOff(vec2(2.0, 2.0)).x;
float sample62 = HOOKED_texOff(vec2(3.0, 0.0)).x;
float sample55 = HOOKED_texOff(vec2(3.0, 1.0)).x;
float sample0 = ravu_int11_texOff(vec2(-4.0, 0.0)).x;
float sample16 = ravu_int11_texOff(vec2(-3.0, -1.0)).x;
float sample9 = ravu_int11_texOff(vec2(-3.0, 0.0)).x;
float sample2 = ravu_int11_texOff(vec2(-3.0, 1.0)).x;
float sample32 = ravu_int11_texOff(vec2(-2.0, -2.0)).x;
float sample25 = ravu_int11_texOff(vec2(-2.0, -1.0)).x;
float sample18 = ravu_int11_texOff(vec2(-2.0, 0.0)).x;
float sample11 = ravu_int11_texOff(vec2(-2.0, 1.0)).x;
float sample4 = ravu_int11_texOff(vec2(-2.0, 2.0)).x;
float sample48 = ravu_int11_texOff(vec2(-1.0, -3.0)).x;
float sample41 = ravu_int11_texOff(vec2(-1.0, -2.0)).x;
float sample34 = ravu_int11_texOff(vec2(-1.0, -1.0)).x;
float sample27 = ravu_int11_texOff(vec2(-1.0, 0.0)).x;
float sample20 = ravu_int11_texOff(vec2(-1.0, 1.0)).x;
float sample13 = ravu_int11_texOff(vec2(-1.0, 2.0)).x;
float sample6 = ravu_int11_texOff(vec2(-1.0, 3.0)).x;
float sample57 = ravu_int11_texOff(vec2(0.0, -3.0)).x;
float sample50 = ravu_int11_texOff(vec2(0.0, -2.0)).x;
float sample43 = ravu_int11_texOff(vec2(0.0, -1.0)).x;
float sample36 = ravu_int11_texOff(vec2(0.0, 0.0)).x;
float sample29 = ravu_int11_texOff(vec2(0.0, 1.0)).x;
float sample22 = ravu_int11_texOff(vec2(0.0, 2.0)).x;
float sample15 = ravu_int11_texOff(vec2(0.0, 3.0)).x;
float sample59 = ravu_int11_texOff(vec2(1.0, -2.0)).x;
float sample52 = ravu_int11_texOff(vec2(1.0, -1.0)).x;
float sample45 = ravu_int11_texOff(vec2(1.0, 0.0)).x;
float sample38 = ravu_int11_texOff(vec2(1.0, 1.0)).x;
float sample31 = ravu_int11_texOff(vec2(1.0, 2.0)).x;
float sample61 = ravu_int11_texOff(vec2(2.0, -1.0)).x;
float sample54 = ravu_int11_texOff(vec2(2.0, 0.0)).x;
float sample47 = ravu_int11_texOff(vec2(2.0, 1.0)).x;
float sample63 = ravu_int11_texOff(vec2(3.0, 0.0)).x;
vec3 abd = vec3(0.0);
float gx, gy;
gx = (sample17-sample1)/2.0;
gy = (sample10-sample8)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
gx = (sample18-sample2)/2.0;
gy = (-sample12+8.0*sample11-8.0*sample9+sample8)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample19-sample3)/2.0;
gy = (-sample13+8.0*sample12-8.0*sample10+sample9)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample20-sample4)/2.0;
gy = (-sample14+8.0*sample13-8.0*sample11+sample10)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample21-sample5)/2.0;
gy = (-sample15+8.0*sample14-8.0*sample12+sample11)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample22-sample6)/2.0;
gy = (sample15-sample13)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
gx = (-sample33+8.0*sample25-8.0*sample9+sample1)/12.0;
gy = (sample18-sample16)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (-sample34+8.0*sample26-8.0*sample10+sample2)/12.0;
gy = (-sample20+8.0*sample19-8.0*sample17+sample16)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample35+8.0*sample27-8.0*sample11+sample3)/12.0;
gy = (-sample21+8.0*sample20-8.0*sample18+sample17)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample36+8.0*sample28-8.0*sample12+sample4)/12.0;
gy = (-sample22+8.0*sample21-8.0*sample19+sample18)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample37+8.0*sample29-8.0*sample13+sample5)/12.0;
gy = (-sample23+8.0*sample22-8.0*sample20+sample19)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample38+8.0*sample30-8.0*sample14+sample6)/12.0;
gy = (sample23-sample21)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (-sample41+8.0*sample33-8.0*sample17+sample9)/12.0;
gy = (sample26-sample24)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample42+8.0*sample34-8.0*sample18+sample10)/12.0;
gy = (-sample28+8.0*sample27-8.0*sample25+sample24)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample43+8.0*sample35-8.0*sample19+sample11)/12.0;
gy = (-sample29+8.0*sample28-8.0*sample26+sample25)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample44+8.0*sample36-8.0*sample20+sample12)/12.0;
gy = (-sample30+8.0*sample29-8.0*sample27+sample26)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample45+8.0*sample37-8.0*sample21+sample13)/12.0;
gy = (-sample31+8.0*sample30-8.0*sample28+sample27)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample46+8.0*sample38-8.0*sample22+sample14)/12.0;
gy = (sample31-sample29)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample49+8.0*sample41-8.0*sample25+sample17)/12.0;
gy = (sample34-sample32)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample50+8.0*sample42-8.0*sample26+sample18)/12.0;
gy = (-sample36+8.0*sample35-8.0*sample33+sample32)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample51+8.0*sample43-8.0*sample27+sample19)/12.0;
gy = (-sample37+8.0*sample36-8.0*sample34+sample33)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample52+8.0*sample44-8.0*sample28+sample20)/12.0;
gy = (-sample38+8.0*sample37-8.0*sample35+sample34)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
gx = (-sample53+8.0*sample45-8.0*sample29+sample21)/12.0;
gy = (-sample39+8.0*sample38-8.0*sample36+sample35)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample54+8.0*sample46-8.0*sample30+sample22)/12.0;
gy = (sample39-sample37)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (-sample57+8.0*sample49-8.0*sample33+sample25)/12.0;
gy = (sample42-sample40)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (-sample58+8.0*sample50-8.0*sample34+sample26)/12.0;
gy = (-sample44+8.0*sample43-8.0*sample41+sample40)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample59+8.0*sample51-8.0*sample35+sample27)/12.0;
gy = (-sample45+8.0*sample44-8.0*sample42+sample41)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample60+8.0*sample52-8.0*sample36+sample28)/12.0;
gy = (-sample46+8.0*sample45-8.0*sample43+sample42)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
gx = (-sample61+8.0*sample53-8.0*sample37+sample29)/12.0;
gy = (-sample47+8.0*sample46-8.0*sample44+sample43)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
gx = (-sample62+8.0*sample54-8.0*sample38+sample30)/12.0;
gy = (sample47-sample45)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample57-sample41)/2.0;
gy = (sample50-sample48)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
gx = (sample58-sample42)/2.0;
gy = (-sample52+8.0*sample51-8.0*sample49+sample48)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample59-sample43)/2.0;
gy = (-sample53+8.0*sample52-8.0*sample50+sample49)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample60-sample44)/2.0;
gy = (-sample54+8.0*sample53-8.0*sample51+sample50)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
gx = (sample61-sample45)/2.0;
gy = (-sample55+8.0*sample54-8.0*sample52+sample51)/12.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
gx = (sample62-sample46)/2.0;
gy = (sample55-sample53)/2.0;
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
float a = abd.x, b = abd.y, d = abd.z;
float T = a + d, D = a * d - b * b;
float delta = sqrt(max(T * T / 4.0 - D, 0.0));
float L1 = T / 2.0 + delta, L2 = T / 2.0 - delta;
float sqrtL1 = sqrt(L1), sqrtL2 = sqrt(L2);
float theta = mix(mod(atan(L1 - a, b) + 3.141592653589793, 3.141592653589793), 0.0, abs(b) < 1.192092896e-7);
float lambda = sqrtL1;
float mu = mix((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2), 0.0, sqrtL1 + sqrtL2 < 1.192092896e-7);
float angle = floor(theta * 24.0 / 3.141592653589793);
float strength = clamp(floor(log2(lambda * 2000.0 + 1.192092896e-7)), 0.0, 8.0);
float coherence = mix(mix(0.0, 1.0, mu >= 0.25), 2.0, mu >= 0.5);
float coord_y = ((angle * 9.0 + strength) * 3.0 + coherence + 0.5) / 648.0;
float res = 0.0;
vec4 w;
w = texture(ravu_lut4, vec2(0.0625, coord_y));
res += (sample0 + sample63) * w[0];
res += (sample1 + sample62) * w[1];
res += (sample2 + sample61) * w[2];
res += (sample3 + sample60) * w[3];
w = texture(ravu_lut4, vec2(0.1875, coord_y));
res += (sample4 + sample59) * w[0];
res += (sample5 + sample58) * w[1];
res += (sample6 + sample57) * w[2];
res += (sample7 + sample56) * w[3];
w = texture(ravu_lut4, vec2(0.3125, coord_y));
res += (sample8 + sample55) * w[0];
res += (sample9 + sample54) * w[1];
res += (sample10 + sample53) * w[2];
res += (sample11 + sample52) * w[3];
w = texture(ravu_lut4, vec2(0.4375, coord_y));
res += (sample12 + sample51) * w[0];
res += (sample13 + sample50) * w[1];
res += (sample14 + sample49) * w[2];
res += (sample15 + sample48) * w[3];
w = texture(ravu_lut4, vec2(0.5625, coord_y));
res += (sample16 + sample47) * w[0];
res += (sample17 + sample46) * w[1];
res += (sample18 + sample45) * w[2];
res += (sample19 + sample44) * w[3];
w = texture(ravu_lut4, vec2(0.6875, coord_y));
res += (sample20 + sample43) * w[0];
res += (sample21 + sample42) * w[1];
res += (sample22 + sample41) * w[2];
res += (sample23 + sample40) * w[3];
w = texture(ravu_lut4, vec2(0.8125, coord_y));
res += (sample24 + sample39) * w[0];
res += (sample25 + sample38) * w[1];
res += (sample26 + sample37) * w[2];
res += (sample27 + sample36) * w[3];
w = texture(ravu_lut4, vec2(0.9375, coord_y));
res += (sample28 + sample35) * w[0];
res += (sample29 + sample34) * w[1];
res += (sample30 + sample33) * w[2];
res += (sample31 + sample32) * w[3];
res = clamp(res, 0.0, 1.0);
return vec4(res, 0.0, 0.0, 0.0);
}
//!DESC RAVU (step4, luma, r4)
//!HOOK LUMA
//!BIND HOOKED
//!BIND ravu_int01
//!BIND ravu_int10
//!BIND ravu_int11
//!WIDTH 2 HOOKED.w *
//!HEIGHT 2 HOOKED.h *
//!OFFSET -0.500000 -0.500000
//!WHEN HOOKED.w OUTPUT.w / 0.707106 < HOOKED.h OUTPUT.h / 0.707106 < *
vec4 hook() {
vec2 dir = fract(HOOKED_pos * HOOKED_size) - 0.5;
if (dir.x < 0.0) {
if (dir.y < 0.0)
return HOOKED_texOff(-dir);
return ravu_int01_texOff(-dir);
} else {
if (dir.y < 0.0)
return ravu_int10_texOff(-dir);
return ravu_int11_texOff(-dir);
}
}
//!TEXTURE ravu_lut4
//!SIZE 8 648
//!FORMAT rgba16f
//!FILTER NEAREST
5a208039bd0191ba378758ba8133533a650f3f3af7ea66baefad8fba2eef8d39e21bbdbac109dc3bdb8f85bbdac6dd3aa917e93a864d88bb72dfdd3be610daba96dc6fba39d8d1bbf233283c5867ec3b62eac23bdf8c243c8dc0e3bbe8be43baf97e5d3a3304773b0c88833c6dec563e9275623e071ca53cd46e983bf401a73a45544639986f13ba5b7901bb09d0323b83f5073b23d4daba7112a4b9dbf13c39904bddba2680cd3bd8c7bbbba062e73b62fbac3be7fb10bcb45ca13b1374afbad1498bbbcef635bce4c9063c0f28d93ce259d33c0fb7a33b0ef589bcf04202bc3f38953bec62003c7be27e3c8aa3123e69293b3ec717793d96bc1d3d8a49723cc0054738729ba1380b358f39fa854a3bf610373bc29c8db9c14aa2b9aa15d6371814a738b1a57dbb21b981bb5c19f83c2a64cd3cb95c8cbc3b34adbc55b728bad213f9ba6ae95bbde8cd90bb1e92a23d22bdab3d2a284fbc01ad1fbd065a4abbdb0495ba5cb2cfbc100ba3bc2c7fba3df96ef63d89b3cb3d37a51f3e85db883cb615d93889b455baa2895e394aad0fba1c7341ba70e19339859f57ba6d19c9388b8ea3baf50e453b6f0d06bbba40683b5879803b296418bb56ba4c3bc8deb0baea5152b9e8784bbbd5cef33b7622a5bcb99eabbcc948f43b129648bb853d9eb837aafb390ddf593b5ac25abced1b8a3e698d8d3e714b50bc374c6f3b46f92a3ae2d31e3988cf17ba6e2952ba4b30e5384fdde438c01e6cbac63721ba589c2939451c0cbb781eb13bf20481bbc28be33a87eedf3a1f40a5bbe734b03bf2f529bbf44885bb7aa42abc0db8c13b694f223bb278163b3fe6ae3b095643bc17e086bb60e0f13a1b2fc93ba62dbc3c5ce1563e7efb673e1a21073d67ec403c77db8a3bfffe2039df1408bacaafa0ba6e74933a69423a3a6e2cd7ba44d54aba9a2b263978d11dbb33fa2a3b381afcbb9def153cd26a263c0595febbadb3543aa9df5bbb2b88d3bbe16450bc9e67a13b0051ed3c9648f53c9382983b45ad7bbc091008bc1bc0b43bb7ac183c4955bb3ce4f6193e511a253eb1d14b3d5b614c3dd340d43cf14f2139010322ba8d32083a3954b2ba3c0299ba867a2f38cf84f5b92a5ee438d4675cbae8434b3b423730bb35d4e03bf173e23bf1c006bb61dd443b8a7321bafffea4ba879b74bb2a55813bcd4216bd117b19bd3efa283b0a704fbb8a5f19bb9438abb9f568ef3bd62f06bdd7489c3e6e249f3e4f8e02bdb4e6f63b4a86a93a618a10392db0edb9e54dde3966d75aba61ef8bb9f42dd8b9fb89e1b881466c387164c3b926d03f3bc7bb81ba9133623b8d8cb03b19b104bb152d943b07c065ba7fb493bb3bb8fbbbba1c313ba38ee1bcaebaeabc596b99ba0cbd06bc196bccbb4d86003b03c67e3b627d15bc9a298c3efb5a943e6ab03bbbed5d003cd345b53b90bee438dc5814b949948bb99a92a939349e173a3584fdb97ea08037161bcc38380b1cbafd4b2e3b2ea139bb4a921d3b4d077b3b7487a0bb3dc55c3b40b79fba29c0febbfe6b4bbc744879bba4c130ba5151a7bad8630bbc6eae84bc8a493bbcb3f4f03a55ba7a3b903cdd3ce9f95c3ec4a96e3e16d3373dce12983c39d6673cc3a83639aed9cab9a7a52db9099efaba5aa3b2bac39478ba99c07eb9c592d33750b77fbafbcf993b007106bb8f02343c8bdc303c56fec1b9b871923bb393bdb95d617bbadc6c0dbb81b45bb9be0e4ebdf4bb51bd52f453bb49fa05bbf0e717bbf95f32bb21b84e3cd0834bbd9f8ba83e52d3ab3e850b45bd3c94673c14ae7aba18c544394d7f12bafd26ea39430f4cba298348baa8c4a6b97e24fbb90ce04439f105053908073f3bf5aeabba7958a73bc02fd83b76908f39aa1d9a3b7bf5e93a70ac05bbad58babbf181953a598915bdcdaa21bd97f1bcbb6bad1dbc212621bc537f5dbbafed803bc219f2bc3bba993ec212a23e467eb0bc5eb16a3ca2e6143cac5bcd388c242cb91e298b376f11c5b9cb4ee5b97e17c5b9d16e8ab816c62f39568df038f53ecb3a17d9b2b9ff85753b4081be3b7cb7bdb95b72a03b6559203bd28ec2bb48dff1bbafa069bb0cd2abbc4ed7bfbcc3dd39bc2eff80bced0093bc58dd12bbd3458db8e5a78aba51e9843e0c578f3e1692833caa368d3ca0a2a43c3c7c013734001cb918c03939d3c85bbb55d675bb96c5b5b940d14db9a2a068b99d08c5ba8a56723b131243ba9277663c596d793cf5400e3a093e933b8d3986ba28e1c8392981813a3e41f03a1f0873bda90c7ebd9960d6ba6c608f39e33f95baaadcd0bbcfab8f3c8c927fbd0031ae3ec175b23e06b772bd76b79e3c449280bb7e0ba63992b547ba9c95253aca5484badbcdcbba059e39b96580afba7f86d139f1f9a2b981e8013bcf8595bab884de3be9ae093cb40e323badacbf3b25b72b3bee3e083aa45ac7ba633fd73a26982cbde9c946bd65de14bc5d4f41bc14782fbc0fbaefbbb484683be06549bdacc1a13ee1f3ab3ee51408bd6497ae3ca4c9383cb7fa4b385f7882b8bebad6375d2525b918764eba64f21dba55098bb99150763977bf31b9a7bbf5ba069ac2ba2309ec398c8cbe3be72159b83a58063cbc740e3cd6e76e3bd5da4e3b352b333b5d94a1bcb734dfbc374e5cbcef7eb9bce61617bde31ecfbc9bda69bc9bd9d3bc2d9c8b3e5e949a3e6ef1e13a06a1093d5735443df6422abaf2e97abaeec3713b7c6cd0bbc1a9c3bbd000403b24d4debaa49cfeb939997ebb05d37bba7468cc3aeab3443c609e523ca7374a3b45475a3a266782bbe141283c51b2aab9228e873c781182bd990889bdd2893d3c2c4c5ab87eb2fa3bd4e55bbc59f6883c694586bd22fbac3e3572b33e6b3c7dbdd84b903cbd2b15b