759 lines
116 KiB
Text
759 lines
116 KiB
Text
|
//
|
||
|
// 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, yuv, r4, compute)
|
||
|
//!HOOK NATIVE
|
||
|
//!BIND HOOKED
|
||
|
//!BIND ravu_lut4
|
||
|
//!SAVE ravu_int11
|
||
|
//!WHEN HOOKED.w OUTPUT.w / 0.707106 < HOOKED.h OUTPUT.h / 0.707106 < * LUMA.w 0 > *
|
||
|
//!COMPUTE 32 8
|
||
|
shared vec3 inp0[585];
|
||
|
shared float inp_luma0[585];
|
||
|
void hook() {
|
||
|
ivec2 group_base = ivec2(gl_WorkGroupID) * ivec2(gl_WorkGroupSize);
|
||
|
int local_pos = int(gl_LocalInvocationID.x) * 15 + int(gl_LocalInvocationID.y);
|
||
|
for (int id = int(gl_LocalInvocationIndex); id < 585; id += int(gl_WorkGroupSize.x * gl_WorkGroupSize.y)) {
|
||
|
int x = id / 15, y = id % 15;
|
||
|
inp0[id] = HOOKED_tex(HOOKED_pt * vec2(float(group_base.x+x)+(-2.5), float(group_base.y+y)+(-2.5))).xyz;
|
||
|
inp_luma0[id] = inp0[id].x;
|
||
|
}
|
||
|
groupMemoryBarrier();
|
||
|
barrier();
|
||
|
{
|
||
|
float luma57 = inp_luma0[local_pos + 106];
|
||
|
float luma58 = inp_luma0[local_pos + 107];
|
||
|
float luma59 = inp_luma0[local_pos + 108];
|
||
|
float luma60 = inp_luma0[local_pos + 109];
|
||
|
float luma61 = inp_luma0[local_pos + 110];
|
||
|
float luma62 = inp_luma0[local_pos + 111];
|
||
|
float luma8 = inp_luma0[local_pos + 15];
|
||
|
float luma9 = inp_luma0[local_pos + 16];
|
||
|
float luma10 = inp_luma0[local_pos + 17];
|
||
|
float luma11 = inp_luma0[local_pos + 18];
|
||
|
float luma12 = inp_luma0[local_pos + 19];
|
||
|
float luma1 = inp_luma0[local_pos + 1];
|
||
|
float luma13 = inp_luma0[local_pos + 20];
|
||
|
float luma14 = inp_luma0[local_pos + 21];
|
||
|
float luma15 = inp_luma0[local_pos + 22];
|
||
|
float luma2 = inp_luma0[local_pos + 2];
|
||
|
float luma16 = inp_luma0[local_pos + 30];
|
||
|
float luma17 = inp_luma0[local_pos + 31];
|
||
|
float luma18 = inp_luma0[local_pos + 32];
|
||
|
float luma19 = inp_luma0[local_pos + 33];
|
||
|
float luma20 = inp_luma0[local_pos + 34];
|
||
|
float luma21 = inp_luma0[local_pos + 35];
|
||
|
float luma22 = inp_luma0[local_pos + 36];
|
||
|
float luma23 = inp_luma0[local_pos + 37];
|
||
|
float luma3 = inp_luma0[local_pos + 3];
|
||
|
float luma24 = inp_luma0[local_pos + 45];
|
||
|
float luma25 = inp_luma0[local_pos + 46];
|
||
|
float luma26 = inp_luma0[local_pos + 47];
|
||
|
float luma27 = inp_luma0[local_pos + 48];
|
||
|
float luma28 = inp_luma0[local_pos + 49];
|
||
|
float luma4 = inp_luma0[local_pos + 4];
|
||
|
float luma29 = inp_luma0[local_pos + 50];
|
||
|
float luma30 = inp_luma0[local_pos + 51];
|
||
|
float luma31 = inp_luma0[local_pos + 52];
|
||
|
float luma5 = inp_luma0[local_pos + 5];
|
||
|
float luma32 = inp_luma0[local_pos + 60];
|
||
|
float luma33 = inp_luma0[local_pos + 61];
|
||
|
float luma34 = inp_luma0[local_pos + 62];
|
||
|
float luma35 = inp_luma0[local_pos + 63];
|
||
|
float luma36 = inp_luma0[local_pos + 64];
|
||
|
float luma37 = inp_luma0[local_pos + 65];
|
||
|
float luma38 = inp_luma0[local_pos + 66];
|
||
|
float luma39 = inp_luma0[local_pos + 67];
|
||
|
float luma6 = inp_luma0[local_pos + 6];
|
||
|
float luma40 = inp_luma0[local_pos + 75];
|
||
|
float luma41 = inp_luma0[local_pos + 76];
|
||
|
float luma42 = inp_luma0[local_pos + 77];
|
||
|
float luma43 = inp_luma0[local_pos + 78];
|
||
|
float luma44 = inp_luma0[local_pos + 79];
|
||
|
float luma45 = inp_luma0[local_pos + 80];
|
||
|
float luma46 = inp_luma0[local_pos + 81];
|
||
|
float luma47 = inp_luma0[local_pos + 82];
|
||
|
float luma48 = inp_luma0[local_pos + 90];
|
||
|
float luma49 = inp_luma0[local_pos + 91];
|
||
|
float luma50 = inp_luma0[local_pos + 92];
|
||
|
float luma51 = inp_luma0[local_pos + 93];
|
||
|
float luma52 = inp_luma0[local_pos + 94];
|
||
|
float luma53 = inp_luma0[local_pos + 95];
|
||
|
float luma54 = inp_luma0[local_pos + 96];
|
||
|
float luma55 = inp_luma0[local_pos + 97];
|
||
|
vec3 abd = vec3(0.0);
|
||
|
float gx, gy;
|
||
|
gx = (luma17-luma1)/2.0;
|
||
|
gy = (luma10-luma8)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
|
||
|
gx = (luma18-luma2)/2.0;
|
||
|
gy = (-luma12+8.0*luma11-8.0*luma9+luma8)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma19-luma3)/2.0;
|
||
|
gy = (-luma13+8.0*luma12-8.0*luma10+luma9)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma20-luma4)/2.0;
|
||
|
gy = (-luma14+8.0*luma13-8.0*luma11+luma10)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma21-luma5)/2.0;
|
||
|
gy = (-luma15+8.0*luma14-8.0*luma12+luma11)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma22-luma6)/2.0;
|
||
|
gy = (luma15-luma13)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
|
||
|
gx = (-luma33+8.0*luma25-8.0*luma9+luma1)/12.0;
|
||
|
gy = (luma18-luma16)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (-luma34+8.0*luma26-8.0*luma10+luma2)/12.0;
|
||
|
gy = (-luma20+8.0*luma19-8.0*luma17+luma16)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma35+8.0*luma27-8.0*luma11+luma3)/12.0;
|
||
|
gy = (-luma21+8.0*luma20-8.0*luma18+luma17)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma36+8.0*luma28-8.0*luma12+luma4)/12.0;
|
||
|
gy = (-luma22+8.0*luma21-8.0*luma19+luma18)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma37+8.0*luma29-8.0*luma13+luma5)/12.0;
|
||
|
gy = (-luma23+8.0*luma22-8.0*luma20+luma19)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma38+8.0*luma30-8.0*luma14+luma6)/12.0;
|
||
|
gy = (luma23-luma21)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (-luma41+8.0*luma33-8.0*luma17+luma9)/12.0;
|
||
|
gy = (luma26-luma24)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma42+8.0*luma34-8.0*luma18+luma10)/12.0;
|
||
|
gy = (-luma28+8.0*luma27-8.0*luma25+luma24)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma43+8.0*luma35-8.0*luma19+luma11)/12.0;
|
||
|
gy = (-luma29+8.0*luma28-8.0*luma26+luma25)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma44+8.0*luma36-8.0*luma20+luma12)/12.0;
|
||
|
gy = (-luma30+8.0*luma29-8.0*luma27+luma26)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma45+8.0*luma37-8.0*luma21+luma13)/12.0;
|
||
|
gy = (-luma31+8.0*luma30-8.0*luma28+luma27)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma46+8.0*luma38-8.0*luma22+luma14)/12.0;
|
||
|
gy = (luma31-luma29)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma49+8.0*luma41-8.0*luma25+luma17)/12.0;
|
||
|
gy = (luma34-luma32)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma50+8.0*luma42-8.0*luma26+luma18)/12.0;
|
||
|
gy = (-luma36+8.0*luma35-8.0*luma33+luma32)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma51+8.0*luma43-8.0*luma27+luma19)/12.0;
|
||
|
gy = (-luma37+8.0*luma36-8.0*luma34+luma33)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma52+8.0*luma44-8.0*luma28+luma20)/12.0;
|
||
|
gy = (-luma38+8.0*luma37-8.0*luma35+luma34)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma53+8.0*luma45-8.0*luma29+luma21)/12.0;
|
||
|
gy = (-luma39+8.0*luma38-8.0*luma36+luma35)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma54+8.0*luma46-8.0*luma30+luma22)/12.0;
|
||
|
gy = (luma39-luma37)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma57+8.0*luma49-8.0*luma33+luma25)/12.0;
|
||
|
gy = (luma42-luma40)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (-luma58+8.0*luma50-8.0*luma34+luma26)/12.0;
|
||
|
gy = (-luma44+8.0*luma43-8.0*luma41+luma40)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma59+8.0*luma51-8.0*luma35+luma27)/12.0;
|
||
|
gy = (-luma45+8.0*luma44-8.0*luma42+luma41)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma60+8.0*luma52-8.0*luma36+luma28)/12.0;
|
||
|
gy = (-luma46+8.0*luma45-8.0*luma43+luma42)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma61+8.0*luma53-8.0*luma37+luma29)/12.0;
|
||
|
gy = (-luma47+8.0*luma46-8.0*luma44+luma43)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma62+8.0*luma54-8.0*luma38+luma30)/12.0;
|
||
|
gy = (luma47-luma45)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma57-luma41)/2.0;
|
||
|
gy = (luma50-luma48)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
|
||
|
gx = (luma58-luma42)/2.0;
|
||
|
gy = (-luma52+8.0*luma51-8.0*luma49+luma48)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma59-luma43)/2.0;
|
||
|
gy = (-luma53+8.0*luma52-8.0*luma50+luma49)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma60-luma44)/2.0;
|
||
|
gy = (-luma54+8.0*luma53-8.0*luma51+luma50)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma61-luma45)/2.0;
|
||
|
gy = (-luma55+8.0*luma54-8.0*luma52+luma51)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma62-luma46)/2.0;
|
||
|
gy = (luma55-luma53)/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;
|
||
|
vec3 res = vec3(0.0);
|
||
|
vec4 w;
|
||
|
w = texture(ravu_lut4, vec2(0.0625, coord_y));
|
||
|
res += (inp0[local_pos + 0] + inp0[local_pos + 112]) * w[0];
|
||
|
res += (inp0[local_pos + 1] + inp0[local_pos + 111]) * w[1];
|
||
|
res += (inp0[local_pos + 2] + inp0[local_pos + 110]) * w[2];
|
||
|
res += (inp0[local_pos + 3] + inp0[local_pos + 109]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.1875, coord_y));
|
||
|
res += (inp0[local_pos + 4] + inp0[local_pos + 108]) * w[0];
|
||
|
res += (inp0[local_pos + 5] + inp0[local_pos + 107]) * w[1];
|
||
|
res += (inp0[local_pos + 6] + inp0[local_pos + 106]) * w[2];
|
||
|
res += (inp0[local_pos + 7] + inp0[local_pos + 105]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.3125, coord_y));
|
||
|
res += (inp0[local_pos + 15] + inp0[local_pos + 97]) * w[0];
|
||
|
res += (inp0[local_pos + 16] + inp0[local_pos + 96]) * w[1];
|
||
|
res += (inp0[local_pos + 17] + inp0[local_pos + 95]) * w[2];
|
||
|
res += (inp0[local_pos + 18] + inp0[local_pos + 94]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.4375, coord_y));
|
||
|
res += (inp0[local_pos + 19] + inp0[local_pos + 93]) * w[0];
|
||
|
res += (inp0[local_pos + 20] + inp0[local_pos + 92]) * w[1];
|
||
|
res += (inp0[local_pos + 21] + inp0[local_pos + 91]) * w[2];
|
||
|
res += (inp0[local_pos + 22] + inp0[local_pos + 90]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.5625, coord_y));
|
||
|
res += (inp0[local_pos + 30] + inp0[local_pos + 82]) * w[0];
|
||
|
res += (inp0[local_pos + 31] + inp0[local_pos + 81]) * w[1];
|
||
|
res += (inp0[local_pos + 32] + inp0[local_pos + 80]) * w[2];
|
||
|
res += (inp0[local_pos + 33] + inp0[local_pos + 79]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.6875, coord_y));
|
||
|
res += (inp0[local_pos + 34] + inp0[local_pos + 78]) * w[0];
|
||
|
res += (inp0[local_pos + 35] + inp0[local_pos + 77]) * w[1];
|
||
|
res += (inp0[local_pos + 36] + inp0[local_pos + 76]) * w[2];
|
||
|
res += (inp0[local_pos + 37] + inp0[local_pos + 75]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.8125, coord_y));
|
||
|
res += (inp0[local_pos + 45] + inp0[local_pos + 67]) * w[0];
|
||
|
res += (inp0[local_pos + 46] + inp0[local_pos + 66]) * w[1];
|
||
|
res += (inp0[local_pos + 47] + inp0[local_pos + 65]) * w[2];
|
||
|
res += (inp0[local_pos + 48] + inp0[local_pos + 64]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.9375, coord_y));
|
||
|
res += (inp0[local_pos + 49] + inp0[local_pos + 63]) * w[0];
|
||
|
res += (inp0[local_pos + 50] + inp0[local_pos + 62]) * w[1];
|
||
|
res += (inp0[local_pos + 51] + inp0[local_pos + 61]) * w[2];
|
||
|
res += (inp0[local_pos + 52] + inp0[local_pos + 60]) * w[3];
|
||
|
res = clamp(res, 0.0, 1.0);
|
||
|
imageStore(out_image, ivec2(gl_GlobalInvocationID), vec4(res, 1.0));
|
||
|
}
|
||
|
}
|
||
|
//!DESC RAVU (step2, yuv, r4, compute)
|
||
|
//!HOOK NATIVE
|
||
|
//!BIND HOOKED
|
||
|
//!BIND ravu_lut4
|
||
|
//!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 < * LUMA.w 0 > *
|
||
|
//!COMPUTE 64 16 32 8
|
||
|
shared vec3 inp0[585];
|
||
|
shared float inp_luma0[585];
|
||
|
shared vec3 inp1[585];
|
||
|
shared float inp_luma1[585];
|
||
|
void hook() {
|
||
|
ivec2 group_base = ivec2(gl_WorkGroupID) * ivec2(gl_WorkGroupSize);
|
||
|
int local_pos = int(gl_LocalInvocationID.x) * 15 + int(gl_LocalInvocationID.y);
|
||
|
for (int id = int(gl_LocalInvocationIndex); id < 585; id += int(gl_WorkGroupSize.x * gl_WorkGroupSize.y)) {
|
||
|
int x = id / 15, y = id % 15;
|
||
|
inp0[id] = ravu_int11_tex(ravu_int11_pt * vec2(float(group_base.x+x)+(-3.5), float(group_base.y+y)+(-3.5))).xyz;
|
||
|
inp_luma0[id] = inp0[id].x;
|
||
|
}
|
||
|
for (int id = int(gl_LocalInvocationIndex); id < 585; id += int(gl_WorkGroupSize.x * gl_WorkGroupSize.y)) {
|
||
|
int x = id / 15, y = id % 15;
|
||
|
inp1[id] = HOOKED_tex(HOOKED_pt * vec2(float(group_base.x+x)+(-2.5), float(group_base.y+y)+(-2.5))).xyz;
|
||
|
inp_luma1[id] = inp1[id].x;
|
||
|
}
|
||
|
groupMemoryBarrier();
|
||
|
barrier();
|
||
|
{
|
||
|
float luma16 = inp_luma0[local_pos + 18];
|
||
|
float luma9 = inp_luma0[local_pos + 19];
|
||
|
float luma2 = inp_luma0[local_pos + 20];
|
||
|
float luma32 = inp_luma0[local_pos + 32];
|
||
|
float luma25 = inp_luma0[local_pos + 33];
|
||
|
float luma18 = inp_luma0[local_pos + 34];
|
||
|
float luma11 = inp_luma0[local_pos + 35];
|
||
|
float luma4 = inp_luma0[local_pos + 36];
|
||
|
float luma48 = inp_luma0[local_pos + 46];
|
||
|
float luma41 = inp_luma0[local_pos + 47];
|
||
|
float luma34 = inp_luma0[local_pos + 48];
|
||
|
float luma27 = inp_luma0[local_pos + 49];
|
||
|
float luma20 = inp_luma0[local_pos + 50];
|
||
|
float luma13 = inp_luma0[local_pos + 51];
|
||
|
float luma6 = inp_luma0[local_pos + 52];
|
||
|
float luma57 = inp_luma0[local_pos + 61];
|
||
|
float luma50 = inp_luma0[local_pos + 62];
|
||
|
float luma43 = inp_luma0[local_pos + 63];
|
||
|
float luma36 = inp_luma0[local_pos + 64];
|
||
|
float luma29 = inp_luma0[local_pos + 65];
|
||
|
float luma22 = inp_luma0[local_pos + 66];
|
||
|
float luma15 = inp_luma0[local_pos + 67];
|
||
|
float luma59 = inp_luma0[local_pos + 77];
|
||
|
float luma52 = inp_luma0[local_pos + 78];
|
||
|
float luma45 = inp_luma0[local_pos + 79];
|
||
|
float luma38 = inp_luma0[local_pos + 80];
|
||
|
float luma31 = inp_luma0[local_pos + 81];
|
||
|
float luma61 = inp_luma0[local_pos + 93];
|
||
|
float luma54 = inp_luma0[local_pos + 94];
|
||
|
float luma47 = inp_luma0[local_pos + 95];
|
||
|
float luma24 = inp_luma1[local_pos + 17];
|
||
|
float luma17 = inp_luma1[local_pos + 18];
|
||
|
float luma10 = inp_luma1[local_pos + 19];
|
||
|
float luma3 = inp_luma1[local_pos + 20];
|
||
|
float luma40 = inp_luma1[local_pos + 31];
|
||
|
float luma33 = inp_luma1[local_pos + 32];
|
||
|
float luma26 = inp_luma1[local_pos + 33];
|
||
|
float luma19 = inp_luma1[local_pos + 34];
|
||
|
float luma12 = inp_luma1[local_pos + 35];
|
||
|
float luma5 = inp_luma1[local_pos + 36];
|
||
|
float luma8 = inp_luma1[local_pos + 3];
|
||
|
float luma49 = inp_luma1[local_pos + 46];
|
||
|
float luma42 = inp_luma1[local_pos + 47];
|
||
|
float luma35 = inp_luma1[local_pos + 48];
|
||
|
float luma28 = inp_luma1[local_pos + 49];
|
||
|
float luma1 = inp_luma1[local_pos + 4];
|
||
|
float luma21 = inp_luma1[local_pos + 50];
|
||
|
float luma14 = inp_luma1[local_pos + 51];
|
||
|
float luma58 = inp_luma1[local_pos + 61];
|
||
|
float luma51 = inp_luma1[local_pos + 62];
|
||
|
float luma44 = inp_luma1[local_pos + 63];
|
||
|
float luma37 = inp_luma1[local_pos + 64];
|
||
|
float luma30 = inp_luma1[local_pos + 65];
|
||
|
float luma23 = inp_luma1[local_pos + 66];
|
||
|
float luma60 = inp_luma1[local_pos + 77];
|
||
|
float luma53 = inp_luma1[local_pos + 78];
|
||
|
float luma46 = inp_luma1[local_pos + 79];
|
||
|
float luma39 = inp_luma1[local_pos + 80];
|
||
|
float luma62 = inp_luma1[local_pos + 93];
|
||
|
float luma55 = inp_luma1[local_pos + 94];
|
||
|
vec3 abd = vec3(0.0);
|
||
|
float gx, gy;
|
||
|
gx = (luma17-luma1)/2.0;
|
||
|
gy = (luma10-luma8)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
|
||
|
gx = (luma18-luma2)/2.0;
|
||
|
gy = (-luma12+8.0*luma11-8.0*luma9+luma8)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma19-luma3)/2.0;
|
||
|
gy = (-luma13+8.0*luma12-8.0*luma10+luma9)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma20-luma4)/2.0;
|
||
|
gy = (-luma14+8.0*luma13-8.0*luma11+luma10)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma21-luma5)/2.0;
|
||
|
gy = (-luma15+8.0*luma14-8.0*luma12+luma11)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma22-luma6)/2.0;
|
||
|
gy = (luma15-luma13)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
|
||
|
gx = (-luma33+8.0*luma25-8.0*luma9+luma1)/12.0;
|
||
|
gy = (luma18-luma16)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (-luma34+8.0*luma26-8.0*luma10+luma2)/12.0;
|
||
|
gy = (-luma20+8.0*luma19-8.0*luma17+luma16)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma35+8.0*luma27-8.0*luma11+luma3)/12.0;
|
||
|
gy = (-luma21+8.0*luma20-8.0*luma18+luma17)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma36+8.0*luma28-8.0*luma12+luma4)/12.0;
|
||
|
gy = (-luma22+8.0*luma21-8.0*luma19+luma18)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma37+8.0*luma29-8.0*luma13+luma5)/12.0;
|
||
|
gy = (-luma23+8.0*luma22-8.0*luma20+luma19)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma38+8.0*luma30-8.0*luma14+luma6)/12.0;
|
||
|
gy = (luma23-luma21)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (-luma41+8.0*luma33-8.0*luma17+luma9)/12.0;
|
||
|
gy = (luma26-luma24)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma42+8.0*luma34-8.0*luma18+luma10)/12.0;
|
||
|
gy = (-luma28+8.0*luma27-8.0*luma25+luma24)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma43+8.0*luma35-8.0*luma19+luma11)/12.0;
|
||
|
gy = (-luma29+8.0*luma28-8.0*luma26+luma25)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma44+8.0*luma36-8.0*luma20+luma12)/12.0;
|
||
|
gy = (-luma30+8.0*luma29-8.0*luma27+luma26)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma45+8.0*luma37-8.0*luma21+luma13)/12.0;
|
||
|
gy = (-luma31+8.0*luma30-8.0*luma28+luma27)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma46+8.0*luma38-8.0*luma22+luma14)/12.0;
|
||
|
gy = (luma31-luma29)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma49+8.0*luma41-8.0*luma25+luma17)/12.0;
|
||
|
gy = (luma34-luma32)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma50+8.0*luma42-8.0*luma26+luma18)/12.0;
|
||
|
gy = (-luma36+8.0*luma35-8.0*luma33+luma32)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma51+8.0*luma43-8.0*luma27+luma19)/12.0;
|
||
|
gy = (-luma37+8.0*luma36-8.0*luma34+luma33)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma52+8.0*luma44-8.0*luma28+luma20)/12.0;
|
||
|
gy = (-luma38+8.0*luma37-8.0*luma35+luma34)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma53+8.0*luma45-8.0*luma29+luma21)/12.0;
|
||
|
gy = (-luma39+8.0*luma38-8.0*luma36+luma35)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma54+8.0*luma46-8.0*luma30+luma22)/12.0;
|
||
|
gy = (luma39-luma37)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma57+8.0*luma49-8.0*luma33+luma25)/12.0;
|
||
|
gy = (luma42-luma40)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (-luma58+8.0*luma50-8.0*luma34+luma26)/12.0;
|
||
|
gy = (-luma44+8.0*luma43-8.0*luma41+luma40)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma59+8.0*luma51-8.0*luma35+luma27)/12.0;
|
||
|
gy = (-luma45+8.0*luma44-8.0*luma42+luma41)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma60+8.0*luma52-8.0*luma36+luma28)/12.0;
|
||
|
gy = (-luma46+8.0*luma45-8.0*luma43+luma42)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma61+8.0*luma53-8.0*luma37+luma29)/12.0;
|
||
|
gy = (-luma47+8.0*luma46-8.0*luma44+luma43)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma62+8.0*luma54-8.0*luma38+luma30)/12.0;
|
||
|
gy = (luma47-luma45)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma57-luma41)/2.0;
|
||
|
gy = (luma50-luma48)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
|
||
|
gx = (luma58-luma42)/2.0;
|
||
|
gy = (-luma52+8.0*luma51-8.0*luma49+luma48)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma59-luma43)/2.0;
|
||
|
gy = (-luma53+8.0*luma52-8.0*luma50+luma49)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma60-luma44)/2.0;
|
||
|
gy = (-luma54+8.0*luma53-8.0*luma51+luma50)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma61-luma45)/2.0;
|
||
|
gy = (-luma55+8.0*luma54-8.0*luma52+luma51)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma62-luma46)/2.0;
|
||
|
gy = (luma55-luma53)/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;
|
||
|
vec3 res = vec3(0.0);
|
||
|
vec4 w;
|
||
|
w = texture(ravu_lut4, vec2(0.0625, coord_y));
|
||
|
res += (inp0[local_pos + 4] + inp0[local_pos + 109]) * w[0];
|
||
|
res += (inp1[local_pos + 4] + inp1[local_pos + 93]) * w[1];
|
||
|
res += (inp0[local_pos + 20] + inp0[local_pos + 93]) * w[2];
|
||
|
res += (inp1[local_pos + 20] + inp1[local_pos + 77]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.1875, coord_y));
|
||
|
res += (inp0[local_pos + 36] + inp0[local_pos + 77]) * w[0];
|
||
|
res += (inp1[local_pos + 36] + inp1[local_pos + 61]) * w[1];
|
||
|
res += (inp0[local_pos + 52] + inp0[local_pos + 61]) * w[2];
|
||
|
res += (inp1[local_pos + 52] + inp1[local_pos + 45]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.3125, coord_y));
|
||
|
res += (inp1[local_pos + 3] + inp1[local_pos + 94]) * w[0];
|
||
|
res += (inp0[local_pos + 19] + inp0[local_pos + 94]) * w[1];
|
||
|
res += (inp1[local_pos + 19] + inp1[local_pos + 78]) * w[2];
|
||
|
res += (inp0[local_pos + 35] + inp0[local_pos + 78]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.4375, coord_y));
|
||
|
res += (inp1[local_pos + 35] + inp1[local_pos + 62]) * w[0];
|
||
|
res += (inp0[local_pos + 51] + inp0[local_pos + 62]) * w[1];
|
||
|
res += (inp1[local_pos + 51] + inp1[local_pos + 46]) * w[2];
|
||
|
res += (inp0[local_pos + 67] + inp0[local_pos + 46]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.5625, coord_y));
|
||
|
res += (inp0[local_pos + 18] + inp0[local_pos + 95]) * w[0];
|
||
|
res += (inp1[local_pos + 18] + inp1[local_pos + 79]) * w[1];
|
||
|
res += (inp0[local_pos + 34] + inp0[local_pos + 79]) * w[2];
|
||
|
res += (inp1[local_pos + 34] + inp1[local_pos + 63]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.6875, coord_y));
|
||
|
res += (inp0[local_pos + 50] + inp0[local_pos + 63]) * w[0];
|
||
|
res += (inp1[local_pos + 50] + inp1[local_pos + 47]) * w[1];
|
||
|
res += (inp0[local_pos + 66] + inp0[local_pos + 47]) * w[2];
|
||
|
res += (inp1[local_pos + 66] + inp1[local_pos + 31]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.8125, coord_y));
|
||
|
res += (inp1[local_pos + 17] + inp1[local_pos + 80]) * w[0];
|
||
|
res += (inp0[local_pos + 33] + inp0[local_pos + 80]) * w[1];
|
||
|
res += (inp1[local_pos + 33] + inp1[local_pos + 64]) * w[2];
|
||
|
res += (inp0[local_pos + 49] + inp0[local_pos + 64]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.9375, coord_y));
|
||
|
res += (inp1[local_pos + 49] + inp1[local_pos + 48]) * w[0];
|
||
|
res += (inp0[local_pos + 65] + inp0[local_pos + 48]) * w[1];
|
||
|
res += (inp1[local_pos + 65] + inp1[local_pos + 32]) * w[2];
|
||
|
res += (inp0[local_pos + 81] + inp0[local_pos + 32]) * w[3];
|
||
|
res = clamp(res, 0.0, 1.0);
|
||
|
imageStore(out_image, ivec2(gl_GlobalInvocationID) * 2 + ivec2(0, 1), vec4(res, 1.0));
|
||
|
}
|
||
|
{
|
||
|
float luma62 = inp_luma0[local_pos + 108];
|
||
|
float luma55 = inp_luma0[local_pos + 109];
|
||
|
float luma8 = inp_luma0[local_pos + 18];
|
||
|
float luma1 = inp_luma0[local_pos + 19];
|
||
|
float luma24 = inp_luma0[local_pos + 32];
|
||
|
float luma17 = inp_luma0[local_pos + 33];
|
||
|
float luma10 = inp_luma0[local_pos + 34];
|
||
|
float luma3 = inp_luma0[local_pos + 35];
|
||
|
float luma40 = inp_luma0[local_pos + 46];
|
||
|
float luma33 = inp_luma0[local_pos + 47];
|
||
|
float luma26 = inp_luma0[local_pos + 48];
|
||
|
float luma19 = inp_luma0[local_pos + 49];
|
||
|
float luma12 = inp_luma0[local_pos + 50];
|
||
|
float luma5 = inp_luma0[local_pos + 51];
|
||
|
float luma49 = inp_luma0[local_pos + 61];
|
||
|
float luma42 = inp_luma0[local_pos + 62];
|
||
|
float luma35 = inp_luma0[local_pos + 63];
|
||
|
float luma28 = inp_luma0[local_pos + 64];
|
||
|
float luma21 = inp_luma0[local_pos + 65];
|
||
|
float luma14 = inp_luma0[local_pos + 66];
|
||
|
float luma58 = inp_luma0[local_pos + 76];
|
||
|
float luma51 = inp_luma0[local_pos + 77];
|
||
|
float luma44 = inp_luma0[local_pos + 78];
|
||
|
float luma37 = inp_luma0[local_pos + 79];
|
||
|
float luma30 = inp_luma0[local_pos + 80];
|
||
|
float luma23 = inp_luma0[local_pos + 81];
|
||
|
float luma60 = inp_luma0[local_pos + 92];
|
||
|
float luma53 = inp_luma0[local_pos + 93];
|
||
|
float luma46 = inp_luma0[local_pos + 94];
|
||
|
float luma39 = inp_luma0[local_pos + 95];
|
||
|
float luma16 = inp_luma1[local_pos + 17];
|
||
|
float luma9 = inp_luma1[local_pos + 18];
|
||
|
float luma2 = inp_luma1[local_pos + 19];
|
||
|
float luma32 = inp_luma1[local_pos + 31];
|
||
|
float luma25 = inp_luma1[local_pos + 32];
|
||
|
float luma18 = inp_luma1[local_pos + 33];
|
||
|
float luma11 = inp_luma1[local_pos + 34];
|
||
|
float luma4 = inp_luma1[local_pos + 35];
|
||
|
float luma48 = inp_luma1[local_pos + 45];
|
||
|
float luma41 = inp_luma1[local_pos + 46];
|
||
|
float luma34 = inp_luma1[local_pos + 47];
|
||
|
float luma27 = inp_luma1[local_pos + 48];
|
||
|
float luma20 = inp_luma1[local_pos + 49];
|
||
|
float luma13 = inp_luma1[local_pos + 50];
|
||
|
float luma6 = inp_luma1[local_pos + 51];
|
||
|
float luma57 = inp_luma1[local_pos + 60];
|
||
|
float luma50 = inp_luma1[local_pos + 61];
|
||
|
float luma43 = inp_luma1[local_pos + 62];
|
||
|
float luma36 = inp_luma1[local_pos + 63];
|
||
|
float luma29 = inp_luma1[local_pos + 64];
|
||
|
float luma22 = inp_luma1[local_pos + 65];
|
||
|
float luma15 = inp_luma1[local_pos + 66];
|
||
|
float luma59 = inp_luma1[local_pos + 76];
|
||
|
float luma52 = inp_luma1[local_pos + 77];
|
||
|
float luma45 = inp_luma1[local_pos + 78];
|
||
|
float luma38 = inp_luma1[local_pos + 79];
|
||
|
float luma31 = inp_luma1[local_pos + 80];
|
||
|
float luma61 = inp_luma1[local_pos + 92];
|
||
|
float luma54 = inp_luma1[local_pos + 93];
|
||
|
float luma47 = inp_luma1[local_pos + 94];
|
||
|
vec3 abd = vec3(0.0);
|
||
|
float gx, gy;
|
||
|
gx = (luma17-luma1)/2.0;
|
||
|
gy = (luma10-luma8)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
|
||
|
gx = (luma18-luma2)/2.0;
|
||
|
gy = (-luma12+8.0*luma11-8.0*luma9+luma8)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma19-luma3)/2.0;
|
||
|
gy = (-luma13+8.0*luma12-8.0*luma10+luma9)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma20-luma4)/2.0;
|
||
|
gy = (-luma14+8.0*luma13-8.0*luma11+luma10)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma21-luma5)/2.0;
|
||
|
gy = (-luma15+8.0*luma14-8.0*luma12+luma11)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma22-luma6)/2.0;
|
||
|
gy = (luma15-luma13)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
|
||
|
gx = (-luma33+8.0*luma25-8.0*luma9+luma1)/12.0;
|
||
|
gy = (luma18-luma16)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (-luma34+8.0*luma26-8.0*luma10+luma2)/12.0;
|
||
|
gy = (-luma20+8.0*luma19-8.0*luma17+luma16)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma35+8.0*luma27-8.0*luma11+luma3)/12.0;
|
||
|
gy = (-luma21+8.0*luma20-8.0*luma18+luma17)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma36+8.0*luma28-8.0*luma12+luma4)/12.0;
|
||
|
gy = (-luma22+8.0*luma21-8.0*luma19+luma18)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma37+8.0*luma29-8.0*luma13+luma5)/12.0;
|
||
|
gy = (-luma23+8.0*luma22-8.0*luma20+luma19)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma38+8.0*luma30-8.0*luma14+luma6)/12.0;
|
||
|
gy = (luma23-luma21)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (-luma41+8.0*luma33-8.0*luma17+luma9)/12.0;
|
||
|
gy = (luma26-luma24)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma42+8.0*luma34-8.0*luma18+luma10)/12.0;
|
||
|
gy = (-luma28+8.0*luma27-8.0*luma25+luma24)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma43+8.0*luma35-8.0*luma19+luma11)/12.0;
|
||
|
gy = (-luma29+8.0*luma28-8.0*luma26+luma25)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma44+8.0*luma36-8.0*luma20+luma12)/12.0;
|
||
|
gy = (-luma30+8.0*luma29-8.0*luma27+luma26)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma45+8.0*luma37-8.0*luma21+luma13)/12.0;
|
||
|
gy = (-luma31+8.0*luma30-8.0*luma28+luma27)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma46+8.0*luma38-8.0*luma22+luma14)/12.0;
|
||
|
gy = (luma31-luma29)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma49+8.0*luma41-8.0*luma25+luma17)/12.0;
|
||
|
gy = (luma34-luma32)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma50+8.0*luma42-8.0*luma26+luma18)/12.0;
|
||
|
gy = (-luma36+8.0*luma35-8.0*luma33+luma32)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma51+8.0*luma43-8.0*luma27+luma19)/12.0;
|
||
|
gy = (-luma37+8.0*luma36-8.0*luma34+luma33)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma52+8.0*luma44-8.0*luma28+luma20)/12.0;
|
||
|
gy = (-luma38+8.0*luma37-8.0*luma35+luma34)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.04933151482066013;
|
||
|
gx = (-luma53+8.0*luma45-8.0*luma29+luma21)/12.0;
|
||
|
gy = (-luma39+8.0*luma38-8.0*luma36+luma35)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma54+8.0*luma46-8.0*luma30+luma22)/12.0;
|
||
|
gy = (luma39-luma37)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (-luma57+8.0*luma49-8.0*luma33+luma25)/12.0;
|
||
|
gy = (luma42-luma40)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (-luma58+8.0*luma50-8.0*luma34+luma26)/12.0;
|
||
|
gy = (-luma44+8.0*luma43-8.0*luma41+luma40)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma59+8.0*luma51-8.0*luma35+luma27)/12.0;
|
||
|
gy = (-luma45+8.0*luma44-8.0*luma42+luma41)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma60+8.0*luma52-8.0*luma36+luma28)/12.0;
|
||
|
gy = (-luma46+8.0*luma45-8.0*luma43+luma42)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.03841942237242872;
|
||
|
gx = (-luma61+8.0*luma53-8.0*luma37+luma29)/12.0;
|
||
|
gy = (-luma47+8.0*luma46-8.0*luma44+luma43)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.02992107622879854;
|
||
|
gx = (-luma62+8.0*luma54-8.0*luma38+luma30)/12.0;
|
||
|
gy = (luma47-luma45)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma57-luma41)/2.0;
|
||
|
gy = (luma50-luma48)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.011007348802298533;
|
||
|
gx = (luma58-luma42)/2.0;
|
||
|
gy = (-luma52+8.0*luma51-8.0*luma49+luma48)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma59-luma43)/2.0;
|
||
|
gy = (-luma53+8.0*luma52-8.0*luma50+luma49)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma60-luma44)/2.0;
|
||
|
gy = (-luma54+8.0*luma53-8.0*luma51+luma50)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.0233025575973275;
|
||
|
gx = (luma61-luma45)/2.0;
|
||
|
gy = (-luma55+8.0*luma54-8.0*luma52+luma51)/12.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.018148050104365175;
|
||
|
gx = (luma62-luma46)/2.0;
|
||
|
gy = (luma55-luma53)/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;
|
||
|
vec3 res = vec3(0.0);
|
||
|
vec4 w;
|
||
|
w = texture(ravu_lut4, vec2(0.0625, coord_y));
|
||
|
res += (inp1[local_pos + 3] + inp1[local_pos + 108]) * w[0];
|
||
|
res += (inp0[local_pos + 19] + inp0[local_pos + 108]) * w[1];
|
||
|
res += (inp1[local_pos + 19] + inp1[local_pos + 92]) * w[2];
|
||
|
res += (inp0[local_pos + 35] + inp0[local_pos + 92]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.1875, coord_y));
|
||
|
res += (inp1[local_pos + 35] + inp1[local_pos + 76]) * w[0];
|
||
|
res += (inp0[local_pos + 51] + inp0[local_pos + 76]) * w[1];
|
||
|
res += (inp1[local_pos + 51] + inp1[local_pos + 60]) * w[2];
|
||
|
res += (inp0[local_pos + 67] + inp0[local_pos + 60]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.3125, coord_y));
|
||
|
res += (inp0[local_pos + 18] + inp0[local_pos + 109]) * w[0];
|
||
|
res += (inp1[local_pos + 18] + inp1[local_pos + 93]) * w[1];
|
||
|
res += (inp0[local_pos + 34] + inp0[local_pos + 93]) * w[2];
|
||
|
res += (inp1[local_pos + 34] + inp1[local_pos + 77]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.4375, coord_y));
|
||
|
res += (inp0[local_pos + 50] + inp0[local_pos + 77]) * w[0];
|
||
|
res += (inp1[local_pos + 50] + inp1[local_pos + 61]) * w[1];
|
||
|
res += (inp0[local_pos + 66] + inp0[local_pos + 61]) * w[2];
|
||
|
res += (inp1[local_pos + 66] + inp1[local_pos + 45]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.5625, coord_y));
|
||
|
res += (inp1[local_pos + 17] + inp1[local_pos + 94]) * w[0];
|
||
|
res += (inp0[local_pos + 33] + inp0[local_pos + 94]) * w[1];
|
||
|
res += (inp1[local_pos + 33] + inp1[local_pos + 78]) * w[2];
|
||
|
res += (inp0[local_pos + 49] + inp0[local_pos + 78]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.6875, coord_y));
|
||
|
res += (inp1[local_pos + 49] + inp1[local_pos + 62]) * w[0];
|
||
|
res += (inp0[local_pos + 65] + inp0[local_pos + 62]) * w[1];
|
||
|
res += (inp1[local_pos + 65] + inp1[local_pos + 46]) * w[2];
|
||
|
res += (inp0[local_pos + 81] + inp0[local_pos + 46]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.8125, coord_y));
|
||
|
res += (inp0[local_pos + 32] + inp0[local_pos + 95]) * w[0];
|
||
|
res += (inp1[local_pos + 32] + inp1[local_pos + 79]) * w[1];
|
||
|
res += (inp0[local_pos + 48] + inp0[local_pos + 79]) * w[2];
|
||
|
res += (inp1[local_pos + 48] + inp1[local_pos + 63]) * w[3];
|
||
|
w = texture(ravu_lut4, vec2(0.9375, coord_y));
|
||
|
res += (inp0[local_pos + 64] + inp0[local_pos + 63]) * w[0];
|
||
|
res += (inp1[local_pos + 64] + inp1[local_pos + 47]) * w[1];
|
||
|
res += (inp0[local_pos + 80] + inp0[local_pos + 47]) * w[2];
|
||
|
res += (inp1[local_pos + 80] + inp1[local_pos + 31]) * w[3];
|
||
|
res = clamp(res, 0.0, 1.0);
|
||
|
imageStore(out_image, ivec2(gl_GlobalInvocationID) * 2 + ivec2(1, 0), vec4(res, 1.0));
|
||
|
}
|
||
|
vec3 res;
|
||
|
res = inp0[local_pos + 64];
|
||
|
imageStore(out_image, ivec2(gl_GlobalInvocationID) * 2 + ivec2(1, 1), vec4(res, 1.0));
|
||
|
res = inp1[local_pos + 48];
|
||
|
imageStore(out_image, ivec2(gl_GlobalInvocationID) * 2 + ivec2(0, 0), vec4(res, 1.0));
|
||
|
}
|
||
|
//!TEXTURE ravu_lut4
|
||
|
//!SIZE 8 648
|
||
|
//!FORMAT rgba16hf
|
||
|
//!FILTER NEAREST
|
||
|
010c8894c4929a12f81137937d946f0ce995e01e2c9cee164917429cef1ed1967f938f9e4221631f171e24211e9f1e92ec12b81b1c24b73214332925c31c3815330a9b900c9897194018d796218de809ea966c1ede9d3b1f681d88a00b1d7c955a9cb0a13620c9269b261e1d50a412a0aa1c0320f7239530d931c92bee2892231c030d057a0c541ab9196d8c128dac013905ed9b0e9cc1276b2663a46aa54691c997dfaa869c152d5e2d79a2fda8539aa8947ea618a5d42db32f5e2efd304724c906ae92f40a7d900c929f0cbd9249061c95281a3098421b041cc398661a8795938a5c9a9e1f29a55da5a21f459af284dd0fcf1ad6a251346c3482a27a1b5811f708be9091922a07270761930a914d096198891d089c1c17ff162a9d821d50992a9c55a10e1e1219b418771d1ba2379c8f17491ee125b732403339280722571c0809419005959c14d211b99657923109ef985819e19faf203321f59fa612df9a9c9e83a20b1d6b27aa27c41cdda341a0a61dc520db25d03029315f2a632aa2260a09109142109395c894be02ac8f2307e3925a1a8299071f141f3698271a0c912895a59b0b1cb2a8cca848197c9acb985a8d7b1f31a8e234f93414a8b71f4c1584086e8ff20ed7925f8cc18e0c87b1031b8eff190e94121b841d2698a11c2e939e9cde9f89190ca756a7cb9436a0639e0418f61baca06134a334de990320aa1d2607a3885d8c4d0dbd10ec8f01016106e0907219cd99ed18d81b049de61afe94f69f5ba2ca9b86913b955ba025a4daa18817d61bea26e8327533bf29c1243f23b509578e6d89d5979595c593f68ba701fe93ce1c3498a0218721108e941ced8ddb936b98de8a70aa8eaaa09a3098bf98939976225caa44355f3528aa3d23d593260a9490510f60924492368dd98f270a2808f8195d953b1dc11e7d0cd11c50172d98d39dac14aca80da9e89deda009a1ec9a071c91a7ce34113584a55623a7206b0661891601298e2a8f298e53847e0984075a16978dac1bf41dee8d041d0319149e8f9f4d9b5fa5ffa5cfa108a498a497986a84559427347b341d246a2425258100e088ce09de9aaf9bae8d6f8a458b2896931b19923423cb2372109a1c3294470e0c14821798abf0abb3967b0caa94879e7d24fdab7235943596abf624059c300d3e922d1123945e96cd897c958c0e188d0f18ac94f41e4d209019fd1d5e1942103b96ba1665a936aaa7a00aa27ca17e9f441b4baa0e35603541a87525c62130031484ad0129897492f090588cb30b8e89ae971596600ff41d658333207420771b771a99190da5faa6e2a2cca5b9a879a64fa39fa65d34d53410174d28222a5291d7938e1b839e1d9e001af796f58ff59bdf93631626229522521ad212139c4221568d3c2411ac48acec216983d61fdfa2482432ac68359c35eaab8224a9a00b0fd19623197898ba98f811ee984b0c8e8530952615fd1c29202c20a01a281b8118c394bc2211aa56ab5d9f0da3b8a005a0c70dc8ab0c35973545a87426ba206689980534075706439011902a0e6595d911cd9cf99bdd99ab1ca9960d21be24e51f3a246a22eea2bba632a57da79fab4ea9b1a803ab5534283502187b2bad2c0c0e7b983516899ce29c170c2699c781a58c44183b14d4239b24781cc31afa101618279b142032ac97ac4c91979b35904e9f7e25cbac8a35d83552ac3926849ccd85c09309150495879655933f9840964b16510a1d930c1b8721c11f1c1f771ee798980d1b2352a984ab7da421a378a27c9dad1f4ead0535d13551a86c28921ea2916b0fe70a0011f30c2e12b015849deb18c09e539d16a0111c279c1420b827bc8025282d262f143ea70ea712a81aadfda86fab82ae32344d35d9270d2d972ddd8ed194418c8099e998fa989e95dd93ce14181b6c171722eb23941e981c54182b97a79b261755ab49ac78a0499cca9a1a9b6525a5ac6c35dd3501ac2e26f199e991678e2d0e698bda8fb89ba396079ca7195c196c9a3519b521e820b620ae20cb9e570e8521cfa7b4abbea691a3eca2ab90062205aedc34ff3537a79d28411cc38d9f14df14d213ba159a0878199aa135153b9da7a2a09e791b3019a7170629729e0a298b28e51f50a84caa6ca62eadd3a514aca4b00234b7353f2a542e652c8299a315009ef19e5da1e99bce92c99512185f1d9e19f0274b28271d5a2031112d9cb39f732123add7ad3f19b5a0a494689f152861adaa350f36c7ac5e27759daa99119b5398ac9af79fc99f329a609c7d20811e8e1c7d21ba250925a3207f2270a17da0de0862a881ac01a866a4cea1cc1c0324c3aca634e535f69813252517d513bc1763162e1cdf0db4997199e4a34e9faf0eff9fdfa0201c9d23f7184729201d2a1eef29da2853a750ae59a948a940182daa33b26a3110365931a02eec20290df89411924d10230d3f903395f90dde96561f589a9505b711b59a551fed987792d19d4f22e11c140c3f21ce9f130fda8bd216e7216232bd336c26b11beb10f50cd48e959624176a12ba93c593740cc99897205598751c1a124ca02120049ab39b1ca14b210525f6240d187ca68c9ebf990119220ff42d9e32e62ff72a9b219c000c04bf93071c98931798b5913380c995492000a2b02172258ba4459dfe9c78949096381d1a2053268c250ca594a2e4a170a0eba7b02b952d36306832372a4e07a192da1058921e9099822f92c8047e950e1a8b98321b1c1ce998071bea95ae01099a1a203ea5b9a5e21f7f9a06846689881acfa33b348d345da2661b14142c0adc91ec92c50451092a921b94eb0a0d97711ead9a38120511079f981e309b7c9a89a01e211797cf96bd20f1a20798e694730895223d32fe339229a522751
|