Commit 6e507987 authored by Rafaël Carré's avatar Rafaël Carré

audiobargraph_v: simplify iec_scale

parent 680ef533
......@@ -160,24 +160,21 @@ static const char *const ppsz_filter_callbacks[] = {
*****************************************************************************/
static float iec_scale(float dB)
{
float fScale = 1.0f;
if (dB < -70.0f)
fScale = 0.0f;
else if (dB < -60.0f)
fScale = (dB + 70.0f) * 0.0025f;
else if (dB < -50.0f)
fScale = (dB + 60.0f) * 0.005f + 0.025f;
else if (dB < -40.0)
fScale = (dB + 50.0f) * 0.0075f + 0.075f;
else if (dB < -30.0f)
fScale = (dB + 40.0f) * 0.015f + 0.15f;
else if (dB < -20.0f)
fScale = (dB + 30.0f) * 0.02f + 0.3f;
else if (dB < -0.001f || dB > 0.001f) /* if (dB < 0.0f) */
fScale = (dB + 20.0f) * 0.025f + 0.5f;
return fScale;
if (dB < -70.0f)
return 0.0f;
if (dB < -60.0f)
return (dB + 70.0f) * 0.0025f;
if (dB < -50.0f)
return (dB + 60.0f) * 0.005f + 0.025f;
if (dB < -40.0)
return (dB + 50.0f) * 0.0075f + 0.075f;
if (dB < -30.0f)
return (dB + 40.0f) * 0.015f + 0.15f;
if (dB < -20.0f)
return (dB + 30.0f) * 0.02f + 0.3f;
if (dB < -0.001f || dB > 0.001f) /* if (dB < 0.0f) */
return (dB + 20.0f) * 0.025f + 0.5f;
return 1.0f;
}
/*****************************************************************************
......
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