Update mpv config:
This commit is contained in:
parent
64e685695e
commit
d1e0b97d62
36 changed files with 5555 additions and 10 deletions
11
mpv/shaders/hdr-toys/utils/clip_black.glsl
Normal file
11
mpv/shaders/hdr-toys/utils/clip_black.glsl
Normal file
|
@ -0,0 +1,11 @@
|
|||
//!HOOK OUTPUT
|
||||
//!BIND HOOKED
|
||||
//!DESC clip code value (black)
|
||||
|
||||
vec4 hook() {
|
||||
vec4 color = HOOKED_tex(HOOKED_pos);
|
||||
|
||||
color.rgb = max(color.rgb, 0.0);
|
||||
|
||||
return color;
|
||||
}
|
11
mpv/shaders/hdr-toys/utils/clip_both.glsl
Normal file
11
mpv/shaders/hdr-toys/utils/clip_both.glsl
Normal file
|
@ -0,0 +1,11 @@
|
|||
//!HOOK OUTPUT
|
||||
//!BIND HOOKED
|
||||
//!DESC clip code value (black, white)
|
||||
|
||||
vec4 hook() {
|
||||
vec4 color = HOOKED_tex(HOOKED_pos);
|
||||
|
||||
color.rgb = clamp(color.rgb, 0.0, 1.0);
|
||||
|
||||
return color;
|
||||
}
|
11
mpv/shaders/hdr-toys/utils/clip_white.glsl
Normal file
11
mpv/shaders/hdr-toys/utils/clip_white.glsl
Normal file
|
@ -0,0 +1,11 @@
|
|||
//!HOOK OUTPUT
|
||||
//!BIND HOOKED
|
||||
//!DESC clip code value (white)
|
||||
|
||||
vec4 hook() {
|
||||
vec4 color = HOOKED_tex(HOOKED_pos);
|
||||
|
||||
color.rgb = min(color.rgb, 1.0);
|
||||
|
||||
return color;
|
||||
}
|
83
mpv/shaders/hdr-toys/utils/edge_detection.glsl
Normal file
83
mpv/shaders/hdr-toys/utils/edge_detection.glsl
Normal file
|
@ -0,0 +1,83 @@
|
|||
// https://anirban-karchaudhuri.medium.com/edge-detection-methods-comparison-9e4b75a9bf87
|
||||
|
||||
//!HOOK OUTPUT
|
||||
//!BIND HOOKED
|
||||
//!DESC edge detection
|
||||
|
||||
#define tex HOOKED_texOff
|
||||
|
||||
|
||||
const mat3 prewitt_x = mat3(
|
||||
1.0, 0.0, -1.0,
|
||||
1.0, 0.0, -1.0,
|
||||
1.0, 0.0, -1.0
|
||||
);
|
||||
|
||||
const mat3 prewitt_y = mat3(
|
||||
1.0, 1.0, 1.0,
|
||||
0.0, 0.0, 0.0,
|
||||
-1.0, -1.0, -1.0
|
||||
);
|
||||
|
||||
const mat3 sobel_x = mat3(
|
||||
1.0, 0.0, -1.0,
|
||||
2.0, 0.0, -2.0,
|
||||
1.0, 0.0, -1.0
|
||||
);
|
||||
|
||||
const mat3 sobel_y = mat3(
|
||||
1.0, 2.0, 1.0,
|
||||
0.0, 0.0, 0.0,
|
||||
-1.0, -2.0, -1.0
|
||||
);
|
||||
|
||||
const mat3 laplacian_p = mat3(
|
||||
0.0, 1.0, 0.0,
|
||||
1.0, -4.0, 1.0,
|
||||
0.0, 1.0, 0.0
|
||||
);
|
||||
|
||||
const mat3 laplacian_n = mat3(
|
||||
0.0, -1.0, 0.0,
|
||||
-1.0, 4.0, -1.0,
|
||||
0.0, -1.0, 0.0
|
||||
);
|
||||
|
||||
const float base = 0.0;
|
||||
const uvec2 k_size = uvec2(3, 3);
|
||||
const vec2 k_size_h = vec2(k_size / 2);
|
||||
|
||||
vec3 conv(mat3 k) {
|
||||
vec3 x = vec3(base);
|
||||
for (uint i = 0; i < k_size.x; i++)
|
||||
for (uint j = 0; j < k_size.y; j++)
|
||||
x += tex(vec2(j, i) - k_size_h).rgb * k[i][j];
|
||||
return x;
|
||||
}
|
||||
|
||||
vec3 prewitt() {
|
||||
vec3 x = conv(prewitt_x);
|
||||
vec3 y = conv(prewitt_y);
|
||||
vec3 g = abs(sqrt(x * x + y * y));
|
||||
return g;
|
||||
}
|
||||
|
||||
vec3 sobel() {
|
||||
vec3 x = conv(sobel_x);
|
||||
vec3 y = conv(sobel_y);
|
||||
vec3 g = abs(sqrt(x * x + y * y));
|
||||
return g;
|
||||
}
|
||||
|
||||
vec3 laplacian() {
|
||||
vec3 x = conv(laplacian_p);
|
||||
return x;
|
||||
}
|
||||
|
||||
vec4 hook() {
|
||||
vec4 color = vec4(vec3(0.0), 1.0);
|
||||
|
||||
color.rgb = laplacian();
|
||||
|
||||
return color;
|
||||
}
|
28
mpv/shaders/hdr-toys/utils/exposure.glsl
Normal file
28
mpv/shaders/hdr-toys/utils/exposure.glsl
Normal file
|
@ -0,0 +1,28 @@
|
|||
// https://en.wikipedia.org/wiki/Exposure_value
|
||||
|
||||
//!PARAM exposure_value
|
||||
//!TYPE float
|
||||
//!MINIMUM -64
|
||||
//!MAXIMUM 64
|
||||
0.0
|
||||
|
||||
//!HOOK OUTPUT
|
||||
//!BIND HOOKED
|
||||
//!WHEN exposure_value
|
||||
//!DESC exposure
|
||||
|
||||
float exposure(float x, float ev) {
|
||||
return x * exp2(ev);
|
||||
}
|
||||
|
||||
vec3 exposure(vec3 x, float ev) {
|
||||
return x * exp2(ev);
|
||||
}
|
||||
|
||||
vec4 hook() {
|
||||
vec4 color = HOOKED_tex(HOOKED_pos);
|
||||
|
||||
color.rgb = exposure(color.rgb, exposure_value);
|
||||
|
||||
return color;
|
||||
}
|
21
mpv/shaders/hdr-toys/utils/invert.glsl
Normal file
21
mpv/shaders/hdr-toys/utils/invert.glsl
Normal file
|
@ -0,0 +1,21 @@
|
|||
// invert the signal
|
||||
|
||||
//!HOOK OUTPUT
|
||||
//!BIND HOOKED
|
||||
//!DESC signal invert
|
||||
|
||||
float invert(float x, float w) {
|
||||
return -x + w;
|
||||
}
|
||||
|
||||
vec3 invert(vec3 x, float w) {
|
||||
return -x + w;
|
||||
}
|
||||
|
||||
vec4 hook() {
|
||||
vec4 color = HOOKED_tex(HOOKED_pos);
|
||||
|
||||
color.rgb = invert(color.rgb, 1.0);
|
||||
|
||||
return color;
|
||||
}
|
38
mpv/shaders/hdr-toys/utils/range.glsl
Normal file
38
mpv/shaders/hdr-toys/utils/range.glsl
Normal file
|
@ -0,0 +1,38 @@
|
|||
// from "full" to "limited" signal range
|
||||
|
||||
//!PARAM black
|
||||
//!TYPE float
|
||||
0.0625
|
||||
|
||||
//!PARAM white
|
||||
//!TYPE float
|
||||
0.91796875
|
||||
|
||||
//!PARAM depth
|
||||
//!TYPE float
|
||||
10.0
|
||||
|
||||
//!HOOK OUTPUT
|
||||
//!BIND HOOKED
|
||||
//!DESC signal range scaling
|
||||
|
||||
float range(float x, float w, float b) {
|
||||
return x * (w - b) + b;
|
||||
}
|
||||
|
||||
vec3 range(vec3 x, float w, float b) {
|
||||
return x * (w - b) + b;
|
||||
}
|
||||
|
||||
vec4 hook() {
|
||||
vec4 color = HOOKED_tex(HOOKED_pos);
|
||||
|
||||
float l = exp2(depth);
|
||||
float d = l - 1.0;
|
||||
float b = l * black / d;
|
||||
float w = l * white / d;
|
||||
|
||||
color.rgb = range(color.rgb, w, b);
|
||||
|
||||
return color;
|
||||
}
|
38
mpv/shaders/hdr-toys/utils/range_inv.glsl
Normal file
38
mpv/shaders/hdr-toys/utils/range_inv.glsl
Normal file
|
@ -0,0 +1,38 @@
|
|||
// from "limited" to "full" signal range
|
||||
|
||||
//!PARAM black
|
||||
//!TYPE float
|
||||
0.0625
|
||||
|
||||
//!PARAM white
|
||||
//!TYPE float
|
||||
0.91796875
|
||||
|
||||
//!PARAM depth
|
||||
//!TYPE float
|
||||
10.0
|
||||
|
||||
//!HOOK OUTPUT
|
||||
//!BIND HOOKED
|
||||
//!DESC signal range scaling (inverse)
|
||||
|
||||
float range_inv(float x, float w, float b) {
|
||||
return (x - b) / (w - b);
|
||||
}
|
||||
|
||||
vec3 range_inv(vec3 x, float w, float b) {
|
||||
return (x - b) / (w - b);
|
||||
}
|
||||
|
||||
vec4 hook() {
|
||||
vec4 color = HOOKED_tex(HOOKED_pos);
|
||||
|
||||
float l = exp2(depth);
|
||||
float d = l - 1.0;
|
||||
float b = l * black / d;
|
||||
float w = l * white / d;
|
||||
|
||||
color.rgb = range_inv(color.rgb, w, b);
|
||||
|
||||
return color;
|
||||
}
|
83
mpv/shaders/hdr-toys/utils/transform.glsl
Normal file
83
mpv/shaders/hdr-toys/utils/transform.glsl
Normal file
|
@ -0,0 +1,83 @@
|
|||
// https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
||||
|
||||
//!PARAM scale_x
|
||||
//!TYPE float
|
||||
1.0
|
||||
|
||||
//!PARAM scale_y
|
||||
//!TYPE float
|
||||
1.0
|
||||
|
||||
//!PARAM translate_x
|
||||
//!TYPE float
|
||||
0.0
|
||||
|
||||
//!PARAM translate_y
|
||||
//!TYPE float
|
||||
0.0
|
||||
|
||||
//!PARAM skew_x
|
||||
//!TYPE float
|
||||
0.0
|
||||
|
||||
//!PARAM skew_y
|
||||
//!TYPE float
|
||||
0.0
|
||||
|
||||
//!PARAM rotate
|
||||
//!TYPE float
|
||||
0.0
|
||||
|
||||
//!PARAM background
|
||||
//!TYPE ENUM int
|
||||
black
|
||||
border
|
||||
repeat
|
||||
mirror
|
||||
|
||||
//!HOOK OUTPUT
|
||||
//!BIND HOOKED
|
||||
//!DESC transform
|
||||
//!WHEN scale_x 1 - scale_y 1 - + translate_x + translate_y + skew_x + skew_y + rotate +
|
||||
|
||||
vec4 hook() {
|
||||
vec2 pos = HOOKED_pos;
|
||||
vec2 size = HOOKED_size;
|
||||
vec2 align = vec2(0.5, 0.5); // center
|
||||
|
||||
pos -= align;
|
||||
|
||||
if (scale_x != 1.0 || scale_y != 1.0)
|
||||
pos /= vec2(scale_x, scale_y);
|
||||
|
||||
if (translate_x != 0.0 || translate_y != 0.0)
|
||||
pos -= vec2(translate_x, translate_y) * vec2(scale_x, scale_y);
|
||||
|
||||
if (skew_x != 0.0 || skew_y != 0.0)
|
||||
pos = mat2(1.0, -tan(radians(skew_y)), -tan(radians(skew_x)), 1.0) * pos;
|
||||
|
||||
if (rotate != 0.0) {
|
||||
pos *= size;
|
||||
float c = length(pos);
|
||||
float h = atan(pos.y, pos.x) - radians(rotate);
|
||||
float a = cos(h) * c;
|
||||
float b = sin(h) * c;
|
||||
pos = vec2(a, b);
|
||||
pos = floor(pos);
|
||||
pos /= size;
|
||||
}
|
||||
|
||||
pos += align;
|
||||
|
||||
if (background == black)
|
||||
if (pos != clamp(pos, 0.0, 1.0))
|
||||
return vec4(vec3(0.0), 1.0);
|
||||
else if (background == border)
|
||||
pos = clamp(pos, 0.0, 1.0);
|
||||
else if (background == repeat)
|
||||
pos = mod(pos, 1.0);
|
||||
else if (background == mirror)
|
||||
pos = abs(1.0 - abs(mod(pos, 2.0) - 1.0));
|
||||
|
||||
return HOOKED_tex(pos);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue