changeset 3679:f74f4524de6a

mix3to1 in SSE
author michael
date Sun, 23 Dec 2001 17:52:27 +0000
parents 265680bbdcfd
children 2cc5737ec923
files liba52/downmix.c
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liba52/downmix.c	Sun Dec 23 17:32:34 2001 +0000
+++ b/liba52/downmix.c	Sun Dec 23 17:52:27 2001 +0000
@@ -334,15 +334,34 @@
 {
     int i;
 
+#ifdef HAVE_SSE
+	asm volatile(
+	"movlps %1, %%xmm7		\n\t"
+	"shufps $0x00, %%xmm7, %%xmm7	\n\t"
+	"movl $-1024, %%esi		\n\t"
+	"1:				\n\t"
+	"movaps (%0, %%esi), %%xmm0	\n\t" 
+	"movaps 1024(%0, %%esi), %%xmm1	\n\t" 
+	"addps 2048(%0, %%esi), %%xmm0	\n\t" 
+	"addps %%xmm7, %%xmm1		\n\t"
+	"addps %%xmm1, %%xmm0		\n\t"
+	"movaps %%xmm0, (%0, %%esi)	\n\t"
+	"addl $16, %%esi		\n\t"
+	" jnz 1b			\n\t"
+	:: "r" (samples+256), "m" (bias)
+	: "%esi"
+	);
+#else
     for (i = 0; i < 256; i++)
 	samples[i] += samples[i + 256] + samples[i + 512] + bias;
+#endif
 }
 
 static void mix4to1 (sample_t * samples, sample_t bias)
 {
     int i;
 
-#ifdef HAVE_SSE // FIXME untested
+#ifdef HAVE_SSE
 	asm volatile(
 	"movlps %1, %%xmm7		\n\t"
 	"shufps $0x00, %%xmm7, %%xmm7	\n\t"