Skip to content

Commit

Permalink
Automated Update
Browse files Browse the repository at this point in the history
  • Loading branch information
natural-harmonia-gropius authored and github-actions[bot] committed Nov 5, 2024
1 parent e48c55b commit ea8bf1a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions portable_config/shaders/CfL_Prediction.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,42 @@ vec4 hook() {
output_pix.xy = clamp(output_pix.xy, 0.0, 1.0);
return output_pix;
}

//!PARAM distance_coeff
//!TYPE float
//!MINIMUM 0.0
2.0

//!PARAM intensity_coeff
//!TYPE float
//!MINIMUM 0.0
128.0

//!HOOK CHROMA
//!BIND CHROMA
//!BIND LUMA
//!DESC Chroma From Luma Prediction (Smoothing Chroma)

float comp_w(vec2 spatial_distance, float intensity_distance) {
return max(100.0 * exp(-distance_coeff * pow(length(spatial_distance), 2.0) - intensity_coeff * pow(intensity_distance, 2.0)), 1e-32);
}

vec4 hook() {
vec4 output_pix = vec4(0.0, 0.0, 0.0, 1.0);
float luma_zero = LUMA_texOff(0).x;
float wt = 0.0;
vec2 ct = vec2(0.0);

for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
vec2 chroma_pixels = CHROMA_texOff(vec2(i, j)).xy;
float luma_pixels = LUMA_texOff(vec2(i, j)).x;
float w = comp_w(vec2(i, j), luma_zero - luma_pixels);
wt += w;
ct += w * chroma_pixels;
}
}

output_pix.xy = clamp(ct / wt, 0.0, 1.0);
return output_pix;
}

0 comments on commit ea8bf1a

Please sign in to comment.