[Vorbis-dev] [PATCH] smallft.c

Michael W. Bombardieri mb at ii.net
Wed Dec 12 19:58:15 PST 2012


Hi,

I'm re-posting this; the first post
was filtered because I wasn't a member
of the mailing list...

I have a small diff for Vorbis
which replaces some loops with memcpy.
This allows us to take advantage of
memcpy's optimisations when copying
the floating point data.

Does this look OK?

- Michael


Index: smallft.c
===================================================================
--- smallft.c	(revision 18737)
+++ smallft.c	(working copy)
@@ -388,7 +388,7 @@
   }
 
 L119:
-  for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
+  memcpy(c2, ch2, idl1 * sizeof(float));
 
   t1=0;
   t2=ipp2*idl1;
@@ -628,7 +628,7 @@
 
   if(na==1)return;
 
-  for(i=0;i<n;i++)c[i]=ch[i];
+  memcpy(c, ch, n * sizeof(float));
 }
 
 static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){
@@ -1097,7 +1097,7 @@
 L132:
   if(ido==1)return;
 
-  for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
+  memcpy(c2, ch2, idl1 * sizeof(float));
 
   t1=0;
   for(j=1;j<ip;j++){
@@ -1226,7 +1226,7 @@
 
   if(na==0)return;
 
-  for(i=0;i<n;i++)c[i]=ch[i];
+  memcpy(c, ch, n * sizeof(float)); 
 }
 
 void drft_forward(drft_lookup *l,float *data){


More information about the Vorbis-dev mailing list