[vlc-commits] audiobargraph_v: simplify iec_scale

Rafaël Carré git at videolan.org
Wed Apr 16 22:32:49 CEST 2014


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed Apr 16 16:02:51 2014 +0200| [6e507987b0c85557391ce0089d12adc7ca5ac7af] | committer: Rafaël Carré

audiobargraph_v: simplify iec_scale

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6e507987b0c85557391ce0089d12adc7ca5ac7af
---

 modules/video_filter/audiobargraph_v.c |   33 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/modules/video_filter/audiobargraph_v.c b/modules/video_filter/audiobargraph_v.c
index 2e5c977..a94c9c1 100644
--- a/modules/video_filter/audiobargraph_v.c
+++ b/modules/video_filter/audiobargraph_v.c
@@ -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;
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list