swr: unroll audioconvert core C function
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 27 Apr 2012 02:53:56 +0000 (04:53 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 27 Apr 2012 03:05:20 +0000 (05:05 +0200)
36k->32k decicycles

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libswresample/audioconvert.c

index ba47188..7598bba 100644 (file)
@@ -47,9 +47,16 @@ struct AudioConvert {
 #define CONV_FUNC(ofmt, otype, ifmt, expr)\
 static void CONV_FUNC_NAME(ofmt, ifmt)(uint8_t *po, const uint8_t *pi, int is, int os, uint8_t *end)\
 {\
-    do{\
+    uint8_t *end2 = end - 3*os;\
+    while(po < end2){\
         *(otype*)po = expr; pi += is; po += os;\
-    }while(po < end);\
+        *(otype*)po = expr; pi += is; po += os;\
+        *(otype*)po = expr; pi += is; po += os;\
+        *(otype*)po = expr; pi += is; po += os;\
+    }\
+    while(po < end){\
+        *(otype*)po = expr; pi += is; po += os;\
+    }\
 }
 
 //FIXME put things below under ifdefs so we do not waste space for cases no codec will need