From 5a4554a9a3075a3486f9e660c72d61da10a5d8ca Mon Sep 17 00:00:00 2001 From: Matiq Date: Thu, 20 Aug 2026 09:26:38 +0300 Subject: [PATCH] P4-prep: eval_lut_bin uses float logf/expf (matches decomp FUN_180563440 logf/expf, not double std::log/exp) --- dsp/levelpath.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dsp/levelpath.cpp b/dsp/levelpath.cpp index 95d9fac..bca6187 100644 --- a/dsp/levelpath.cpp +++ b/dsp/levelpath.cpp @@ -61,22 +61,19 @@ static float eval_lut_bin(float x, const BandConfig* band) { float result; if (band->flag == 0) { // Linear path (0x563595): t = x^(1/γ) if γ!=1 && x>0; val = A + (B-A)*t + // decomp: fVar16 = expf(logf(x)/gamma) (FLOAT log/exp) float t = x; if (gamma != ONE && x > ZERO) { - double d = static_cast(fabsf(x)); - d = std::log(d) / static_cast(gamma); - t = static_cast(std::exp(d)); + t = expf(logf(x) / gamma); } result = band->A + (band->B - band->A) * t; } else { // Power-law path (0x5635cd): t = 2x-1; if γ!=1 && t!=0: t = sign(t)·|t|^(1/γ) - // val = A + (B-A)·0.5·(1+t) + // val = A + (B-A)·0.5·(1+t); decomp: sign·expf(logf(|t|)/gamma) float t = TWO * x - ONE; if (gamma != ONE && t != ZERO) { float sign = (t < ZERO) ? NEG1 : ONE; - double d = static_cast(fabsf(t)); - d = std::log(d) / static_cast(gamma); - t = static_cast(std::exp(d)) * sign; + t = expf(logf(fabsf(t)) / gamma) * sign; } result = band->A + (band->B - band->A) * HALF * (ONE + t); }