[Vorbis-dev] [RFC PATCH v1 2/3] lib/block.c: Use optimized routine for wave_operation

Viswanath Puttagunta viswanath.puttagunta at linaro.org
Wed Sep 10 12:15:08 PDT 2014


Signed-off-by: Viswanath Puttagunta <viswanath.puttagunta at linaro.org>
---
 lib/block.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/lib/block.c b/lib/block.c
index dfcd843..0c3f781 100644
--- a/lib/block.c
+++ b/lib/block.c
@@ -30,6 +30,7 @@
 #include "lpc.h"
 #include "registry.h"
 #include "misc.h"
+#include "simd.h"
 
 static int ilog2(unsigned int v){
   int ret=0;
@@ -774,15 +775,13 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
           const float *w=_vorbis_window_get(b->window[1]-hs);
           float *pcm=v->pcm[j]+prevCenter;
           float *p=vb->pcm[j];
-          for(i=0;i<n1;i++)
-            pcm[i]=pcm[i]*w[n1-i-1] + p[i]*w[i];
+	  wave_operation(&pcm[0], &w[0], &p[0], n1);
         }else{
           /* large/small */
           const float *w=_vorbis_window_get(b->window[0]-hs);
           float *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
           float *p=vb->pcm[j];
-          for(i=0;i<n0;i++)
-            pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
+	  wave_operation(&pcm[0], &w[0], &p[0], n0);
         }
       }else{
         if(v->W){
@@ -790,8 +789,8 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
           const float *w=_vorbis_window_get(b->window[0]-hs);
           float *pcm=v->pcm[j]+prevCenter;
           float *p=vb->pcm[j]+n1/2-n0/2;
-          for(i=0;i<n0;i++)
-            pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
+	  wave_operation(&pcm[0], &w[0], &p[0], n0);
+	  i = n0;
           for(;i<n1/2+n0/2;i++)
             pcm[i]=p[i];
         }else{
@@ -799,8 +798,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
           const float *w=_vorbis_window_get(b->window[0]-hs);
           float *pcm=v->pcm[j]+prevCenter;
           float *p=vb->pcm[j];
-          for(i=0;i<n0;i++)
-            pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
+	  wave_operation(&pcm[0], &w[0], &p[0], n0);
         }
       }
 
-- 
1.7.9.5



More information about the Vorbis-dev mailing list