[vlc-commits] pow(x, 2) => x * x

Rafaël Carré git at videolan.org
Wed Apr 16 14:46:39 CEST 2014


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed Apr 16 14:12:52 2014 +0200| [4958368beac1a6c1a8ad78dfc46038000012f7f0] | committer: Rafaël Carré

pow(x, 2) => x * x

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

 modules/audio_filter/audiobargraph_a.c |    2 +-
 modules/audio_filter/normvol.c         |    3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/modules/audio_filter/audiobargraph_a.c b/modules/audio_filter/audiobargraph_a.c
index 77ef8a5..b34f6b5 100644
--- a/modules/audio_filter/audiobargraph_a.c
+++ b/modules/audio_filter/audiobargraph_a.c
@@ -167,7 +167,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
                 max = ch;
         }
     }
-    max = powf( max, 2 );
+    max *= max;
 
     if (p_sys->silence) {
         /* 2 - store the new value */
diff --git a/modules/audio_filter/normvol.c b/modules/audio_filter/normvol.c
index 68f8d62..6bcacdb 100644
--- a/modules/audio_filter/normvol.c
+++ b/modules/audio_filter/normvol.c
@@ -156,8 +156,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
         for( i_chan = 0; i_chan < i_channels; i_chan++ )
         {
             float f_sample = p_in[i_chan];
-            float f_square = pow( f_sample, 2 );
-            pf_sum[i_chan] += f_square;
+            pf_sum[i_chan] += f_sample * f_sample;
         }
         p_in += i_channels;
     }



More information about the vlc-commits mailing list