Update mpv config:

This commit is contained in:
aria 2025-05-26 00:03:04 +10:00
parent 64e685695e
commit d1e0b97d62
Signed by: aria
SSH key fingerprint: SHA256:WqtcVnDMrv1lnUlNah5k31iywFUI/DV+5yHzCTO4Vds
36 changed files with 5555 additions and 10 deletions

View file

@ -0,0 +1,28 @@
// https://www.itu.int/rec/R-REC-BT.1886
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC transfer function (bt.1886)
float bt1886_eotf_inv(float L, float gamma, float Lw, float Lb) {
float a = pow(pow(Lw, 1.0 / gamma) - pow(Lb, 1.0 / gamma), gamma);
float b = pow(Lb, 1.0 / gamma) / (pow(Lw, 1.0 / gamma) - pow(Lb, 1.0 / gamma));
float V = pow(max(L / a, 0.0), 1.0 / gamma) - b;
return V;
}
vec3 bt1886_eotf_inv(vec3 color, float gamma, float Lw, float Lb) {
return vec3(
bt1886_eotf_inv(color.r, gamma, Lw, Lb),
bt1886_eotf_inv(color.g, gamma, Lw, Lb),
bt1886_eotf_inv(color.b, gamma, Lw, Lb)
);
}
vec4 hook() {
vec4 color = HOOKED_tex(HOOKED_pos);
color.rgb = bt1886_eotf_inv(color.rgb, 2.4, 1.0, 0.001);
return color;
}

View file

@ -0,0 +1,28 @@
// https://www.itu.int/rec/R-REC-BT.1886
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC transfer function (bt.1886, inverse)
float bt1886_eotf(float V, float gamma, float Lw, float Lb) {
float a = pow(pow(Lw, 1.0 / gamma) - pow(Lb, 1.0 / gamma), gamma);
float b = pow(Lb, 1.0 / gamma) / (pow(Lw, 1.0 / gamma) - pow(Lb, 1.0 / gamma));
float L = a * pow(max(V + b, 0.0), gamma);
return L;
}
vec3 bt1886_eotf(vec3 color, float gamma, float Lw, float Lb) {
return vec3(
bt1886_eotf(color.r, gamma, Lw, Lb),
bt1886_eotf(color.g, gamma, Lw, Lb),
bt1886_eotf(color.b, gamma, Lw, Lb)
);
}
vec4 hook() {
vec4 color = HOOKED_tex(HOOKED_pos);
color.rgb = bt1886_eotf(color.rgb, 2.4, 1.0, 0.001);
return color;
}

View file

@ -0,0 +1,30 @@
// https://www.itu.int/rec/R-REC-BT.601
// https://www.itu.int/rec/R-REC-BT.709
// https://www.itu.int/rec/R-REC-BT.2020
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC transfer function (bt.709)
const float beta = 0.018053968510807;
const float alpha = 1.0 + 5.5 * beta;
float bt709_oetf(float L) {
return L < beta ? 4.5 * L : alpha * pow(L, 0.45) - (alpha - 1.0);
}
vec3 bt709_oetf(vec3 color) {
return vec3(
bt709_oetf(color.r),
bt709_oetf(color.g),
bt709_oetf(color.b)
);
}
vec4 hook() {
vec4 color = HOOKED_tex(HOOKED_pos);
color.rgb = bt709_oetf(color.rgb);
return color;
}

View file

@ -0,0 +1,30 @@
// https://www.itu.int/rec/R-REC-BT.601
// https://www.itu.int/rec/R-REC-BT.709
// https://www.itu.int/rec/R-REC-BT.2020
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC transfer function (bt.709, inverse)
const float beta = 0.018053968510807;
const float alpha = 1.0 + 5.5 * beta;
float bt709_oetf_inv(float V) {
return V < 4.5 * beta ? V / 4.5 : pow((V + (alpha - 1.0)) / alpha, 1.0 / 0.45);
}
vec3 bt709_oetf_inv(vec3 color) {
return vec3(
bt709_oetf_inv(color.r),
bt709_oetf_inv(color.g),
bt709_oetf_inv(color.b)
);
}
vec4 hook() {
vec4 color = HOOKED_tex(HOOKED_pos);
color.rgb = bt709_oetf_inv(color.rgb);
return color;
}

View file

@ -0,0 +1,60 @@
// https://www.arib.or.jp/kikaku/kikaku_hoso/std-b67.html
// https://www.bbc.co.uk/rd/projects/high-dynamic-range
// https://www.itu.int/rec/R-REC-BT.2100
// https://www.itu.int/pub/R-REP-BT.2390
// extended gamma model for Lw is outside 400-2000 cd/m²:
// 1.2 * pow(1.111, log2(Lw / 1000.0)) * pow(0.98, log2(Lamb / 5.0))
//!PARAM reference_white
//!TYPE float
//!MINIMUM 0.0
//!MAXIMUM 1000.0
203.0
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC transfer function (hlg)
const vec3 y_coef = vec3(0.2627002120112671, 0.6779980715188708, 0.05930171646986196);
const float Lw = 1000.0;
const float Lb = 0.0;
const float Lamb = 5.0;
const float gamma = 1.2 + 0.42 * log(Lw / 1000.0) / log(10.0) - 0.076 * log(Lamb / 5.0) / log(10.0);
const float alpha = Lw;
const float beta = sqrt(3.0 * pow((Lb / Lw), 1.0 / gamma));
const float a = 0.17883277;
const float b = 1.0 - 4.0 * a;
const float c = 0.5 - a * log(4.0 * a);
float hlg_oetf(float x) {
return x <= 1.0 / 12.0 ? sqrt(3.0 * x) : a * log(12.0 * x - b) + c;
}
vec3 hlg_oetf(vec3 color) {
return vec3(
hlg_oetf(color.r),
hlg_oetf(color.g),
hlg_oetf(color.b)
);
}
vec3 hlg_ootf_inv(vec3 color) {
float Y = dot(color, y_coef);
return Y == 0.0 ? vec3(0.0) : pow(Y / alpha, (1.0 - gamma) / gamma) * (color / alpha);
}
vec3 hlg_eotf_inv(vec3 color) {
return (hlg_oetf(hlg_ootf_inv(color)) - beta) / (1.0 - beta);
}
vec4 hook() {
vec4 color = HOOKED_tex(HOOKED_pos);
color.rgb = hlg_eotf_inv(color.rgb * reference_white);
return color;
}

View file

@ -0,0 +1,56 @@
// https://www.arib.or.jp/kikaku/kikaku_hoso/std-b67.html
// https://www.bbc.co.uk/rd/projects/high-dynamic-range
// https://www.itu.int/rec/R-REC-BT.2100
//!PARAM reference_white
//!TYPE float
//!MINIMUM 0.0
//!MAXIMUM 1000.0
203.0
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC transfer function (hlg, inverse)
const vec3 y_coef = vec3(0.2627002120112671, 0.6779980715188708, 0.05930171646986196);
const float Lw = 1000.0;
const float Lb = 0.0;
const float Lamb = 5.0;
const float gamma = 1.2 + 0.42 * log(Lw / 1000.0) / log(10.0) - 0.076 * log(Lamb / 5.0) / log(10.0);
const float alpha = Lw;
const float beta = sqrt(3.0 * pow((Lb / Lw), 1.0 / gamma));
const float a = 0.17883277;
const float b = 1.0 - 4.0 * a;
const float c = 0.5 - a * log(4.0 * a);
float hlg_oetf_inv(float x) {
return x <= 1.0 / 2.0 ? pow(x, 2.0) / 3.0 : (exp((x - c) / a) + b) / 12.0;
}
vec3 hlg_oetf_inv(vec3 color) {
return vec3(
hlg_oetf_inv(color.r),
hlg_oetf_inv(color.g),
hlg_oetf_inv(color.b)
);
}
vec3 hlg_ootf(vec3 color) {
float Y = dot(color, y_coef);
return alpha * pow(Y, gamma - 1.0) * color;
}
vec3 hlg_eotf(vec3 color) {
return hlg_ootf(hlg_oetf_inv(max((1.0 - beta) * color + beta, 0.0)));
}
vec4 hook() {
vec4 color = HOOKED_tex(HOOKED_pos);
color.rgb = hlg_eotf(color.rgb) / reference_white;
return color;
}

View file

@ -0,0 +1,43 @@
// https://ieeexplore.ieee.org/document/7291452
// https://www.itu.int/rec/R-REC-BT.2100
// https://www.itu.int/pub/R-REP-BT.2390
// pq ootf: 100.0 * bt1886_eotf(bt709_oetf(59.5208 * x), 2.4, 1.0, 0.0)
//!PARAM reference_white
//!TYPE float
//!MINIMUM 0.0
//!MAXIMUM 1000.0
203.0
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC transfer function (pq)
const float m1 = 2610.0 / 4096.0 / 4.0;
const float m2 = 2523.0 / 4096.0 * 128.0;
const float c1 = 3424.0 / 4096.0;
const float c2 = 2413.0 / 4096.0 * 32.0;
const float c3 = 2392.0 / 4096.0 * 32.0;
const float pw = 10000.0;
float pq_eotf_inv(float x) {
float t = pow(x / pw, m1);
return pow((c1 + c2 * t) / (1.0 + c3 * t), m2);
}
vec3 pq_eotf_inv(vec3 color) {
return vec3(
pq_eotf_inv(color.r),
pq_eotf_inv(color.g),
pq_eotf_inv(color.b)
);
}
vec4 hook() {
vec4 color = HOOKED_tex(HOOKED_pos);
color.rgb = pq_eotf_inv(color.rgb * reference_white);
return color;
}

View file

@ -0,0 +1,40 @@
// https://ieeexplore.ieee.org/document/7291452
// https://www.itu.int/rec/R-REC-BT.2100
//!PARAM reference_white
//!TYPE float
//!MINIMUM 0.0
//!MAXIMUM 1000.0
203.0
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC transfer function (pq, inverse)
const float m1 = 2610.0 / 4096.0 / 4.0;
const float m2 = 2523.0 / 4096.0 * 128.0;
const float c1 = 3424.0 / 4096.0;
const float c2 = 2413.0 / 4096.0 * 32.0;
const float c3 = 2392.0 / 4096.0 * 32.0;
const float pw = 10000.0;
float pq_eotf(float x) {
float t = pow(x, 1.0 / m2);
return pow(max(t - c1, 0.0) / (c2 - c3 * t), 1.0 / m1) * pw;
}
vec3 pq_eotf(vec3 color) {
return vec3(
pq_eotf(color.r),
pq_eotf(color.g),
pq_eotf(color.b)
);
}
vec4 hook() {
vec4 color = HOOKED_tex(HOOKED_pos);
color.rgb = pq_eotf(color.rgb) / reference_white;
return color;
}

View file

@ -0,0 +1,31 @@
// https://github.com/ampas/aces-core/blob/dev/lib/Lib.Academy.DisplayEncoding.ctl
// moncurve with gamma of 2.4 and offset of 0.055 matches the EOTF found in IEC 61966-2-1:1999 (sRGB)
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC transfer function (srgb)
const float gamma = 2.4;
const float offset = 0.055;
float monitor_curve_eotf_inv(float y) {
const float yb = pow(offset * gamma / ((gamma - 1.0) * (1.0 + offset)), gamma);
const float rs = pow((gamma - 1.0) / offset, gamma - 1.0) * pow((1.0 + offset) / gamma, gamma);
return y >= yb ? (1.0 + offset) * pow(y, 1.0 / gamma) - offset : y * rs;
}
vec3 monitor_curve_eotf_inv(vec3 color) {
return vec3(
monitor_curve_eotf_inv(color.r),
monitor_curve_eotf_inv(color.g),
monitor_curve_eotf_inv(color.b)
);
}
vec4 hook() {
vec4 color = HOOKED_tex(HOOKED_pos);
color.rgb = monitor_curve_eotf_inv(color.rgb);
return color;
}

View file

@ -0,0 +1,31 @@
// https://github.com/ampas/aces-core/blob/dev/lib/Lib.Academy.DisplayEncoding.ctl
// moncurve with gamma of 2.4 and offset of 0.055 matches the EOTF found in IEC 61966-2-1:1999 (sRGB)
//!HOOK OUTPUT
//!BIND HOOKED
//!DESC transfer function (srgb, inverse)
const float gamma = 2.4;
const float offset = 0.055;
float monitor_curve_eotf(float x) {
const float fs = ((gamma - 1.0) / offset) * pow(offset * gamma / ((gamma - 1.0) * (1.0 + offset)), gamma);
const float xb = offset / (gamma - 1.0);
return x >= xb ? pow((x + offset) / (1.0 + offset), gamma) : x * fs;
}
vec3 monitor_curve_eotf(vec3 color) {
return vec3(
monitor_curve_eotf(color.r),
monitor_curve_eotf(color.g),
monitor_curve_eotf(color.b)
);
}
vec4 hook() {
vec4 color = HOOKED_tex(HOOKED_pos);
color.rgb = monitor_curve_eotf(color.rgb);
return color;
}