mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00:00
LibGfx: Avoid float->double->float when converting from linear to gamma
Benchmark shows 5x speedup (from 644ms to 110ms).
This commit is contained in:
parent
c0eacf4cc1
commit
b34f194168
1 changed files with 1 additions and 1 deletions
|
@ -106,7 +106,7 @@ inline float linear_to_gamma(float x)
|
||||||
constexpr float a = 0.00279491;
|
constexpr float a = 0.00279491;
|
||||||
constexpr float b = 1.15907984;
|
constexpr float b = 1.15907984;
|
||||||
float c = (b / sqrt(1 + a)) - 1;
|
float c = (b / sqrt(1 + a)) - 1;
|
||||||
return ((b / __builtin_sqrt(x + a)) - c) * x;
|
return ((b / __builtin_sqrtf(x + a)) - c) * x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Linearize v1 and v2, lerp them by mix factor, then convert back.
|
// Linearize v1 and v2, lerp them by mix factor, then convert back.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue