Commit c039ebbb authored by Pascal Obry's avatar Pascal Obry Committed by Tobias Ellinghaus

grain: add back variable names used as documentation.

(cherry picked from commit 77967870)
parent 677214e1
......@@ -364,13 +364,15 @@ static double _simplex_2d_noise(double x, double y, uint32_t octaves, double per
static float paper_resp(float exposure, float mb, float gp)
{
const float delta = GRAIN_LUT_DELTA_MAX * expf((mb / 100.0f) * logf(GRAIN_LUT_DELTA_MIN));
return (1.0f + 2.0f * delta) / (1.0f + expf( (4.0f * gp * (0.5f - exposure)) / (1.0f + 2.0f * delta) )) - delta;
const float density = (1.0f + 2.0f * delta) / (1.0f + expf( (4.0f * gp * (0.5f - exposure)) / (1.0f + 2.0f * delta) )) - delta;
return density;
}
static float paper_resp_inverse(float density, float mb, float gp)
{
const float delta = GRAIN_LUT_DELTA_MAX * expf((mb / 100.0f) * logf(GRAIN_LUT_DELTA_MIN));
return -logf((1.0f + 2.0f * delta) / (density + delta) - 1.0f) * (1.0f + 2.0f * delta) / (4.0f * gp) + 0.5f;
const float exposure = -logf((1.0f + 2.0f * delta) / (density + delta) - 1.0f) * (1.0f + 2.0f * delta) / (4.0f * gp) + 0.5f;
return exposure;
}
static void evaluate_grain_lut(float *grain_lut, const float mb)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment