diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2025-04-07 01:33:07 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2025-04-07 01:33:07 +0200 |
commit | 1b72dceae8427a7e43bef44c7dbb47f53c0cb865 (patch) | |
tree | 0ccb209a12dcd733367a43b7d1899463234704c6 /graphics.c | |
parent | 068e4f94310953bf3d2ead074997b55d4c3c0091 (diff) | |
download | reduced_system_layer-1b72dceae8427a7e43bef44c7dbb47f53c0cb865.zip |
Rewrite antialiasing downscale code
Diffstat (limited to 'graphics.c')
-rwxr-xr-x | graphics.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -961,6 +961,18 @@ vec4_f32 vec4_f32_lerp(vec4_f32 a, vec4_f32 b, f32 t) { // ================================================================ +static f64 gamma_(f64 x) { + if (x >= 0.0031308) + return 1.055 * pow(x, 1.0 / 2.4) - 0.055; + return 12.92 * x; +} + +static f64 gamma_re_(f64 x) { + if (x >= 0.04045) + return pow((x + 0.055) / 1.055, 2.4); + return x / 12.92; +} + vec3_f32 rgb_gamma_add(vec3_f32 rgb) { return (vec3_f32) { .x = (f32) gamma_(rgb.x), |