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
Notes:
sideshowbarker
2024-07-18 20:49:11 +09:00
Author: https://github.com/olegv11 Commit: https://github.com/SerenityOS/serenity/commit/b34f1941681 Pull-request: https://github.com/SerenityOS/serenity/pull/6114
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 b = 1.15907984;
|
||||
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.
|
||||
|
|
Loading…
Add table
Reference in a new issue