summaryrefslogtreecommitdiff
path: root/src/pulsecore/remap_mmx.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-08-29 12:22:42 +0200
committerLennart Poettering <lennart@poettering.net>2009-08-31 21:50:56 +0200
commitdc221f204b89fca85c0125e55f3afea4a807ffa7 (patch)
treec265009f484b32562a7e7729d33ffe6e06e657f3 /src/pulsecore/remap_mmx.c
parentdee2aa3f0564caed698e600963b592d50cda068c (diff)
remap: fix counters for mmx and sse remap
Take the size of the sample into account when calculating the amount of samples we process in parallel.
Diffstat (limited to 'src/pulsecore/remap_mmx.c')
-rw-r--r--src/pulsecore/remap_mmx.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/pulsecore/remap_mmx.c b/src/pulsecore/remap_mmx.c
index b5fe82ee7..79e4f1fc2 100644
--- a/src/pulsecore/remap_mmx.c
+++ b/src/pulsecore/remap_mmx.c
@@ -65,16 +65,24 @@
" add $32, %1 \n\t" \
" add $64, %0 \n\t"
-#define HANDLE_SINGLE(s) \
+#define HANDLE_SINGLE_dq() \
" movd (%1), %%mm0 \n\t" \
- " punpckl"#s" %%mm0, %%mm0 \n\t" \
+ " punpckldq %%mm0, %%mm0 \n\t" \
" movq %%mm0, (%0) \n\t" \
" add $4, %1 \n\t" \
" add $8, %0 \n\t"
-#define MONO_TO_STEREO(s) \
- " mov %3, %2 \n\t" \
- " sar $3, %2 \n\t" \
+#define HANDLE_SINGLE_wd() \
+ " movw (%1), %w3 \n\t" \
+ " movd %3, %%mm0 \n\t" \
+ " punpcklwd %%mm0, %%mm0 \n\t" \
+ " movd %%mm0, (%0) \n\t" \
+ " add $2, %1 \n\t" \
+ " add $4, %0 \n\t"
+
+#define MONO_TO_STEREO(s,shift,mask) \
+ " mov %4, %2 \n\t" \
+ " sar $"#shift", %2 \n\t" \
" cmp $0, %2 \n\t" \
" je 2f \n\t" \
"1: \n\t" \
@@ -84,11 +92,11 @@
" dec %2 \n\t" \
" jne 1b \n\t" \
"2: \n\t" \
- " mov %3, %2 \n\t" \
- " and $7, %2 \n\t" \
+ " mov %4, %2 \n\t" \
+ " and $"#mask", %2 \n\t" \
" je 4f \n\t" \
"3: \n\t" \
- HANDLE_SINGLE(s) \
+ HANDLE_SINGLE_##s() \
" dec %2 \n\t" \
" jne 3b \n\t" \
"4: \n\t" \
@@ -96,14 +104,14 @@
#if defined (__i386__) || defined (__amd64__)
static void remap_mono_to_stereo_mmx (pa_remap_t *m, void *dst, const void *src, unsigned n) {
- pa_reg_x86 temp;
+ pa_reg_x86 temp, temp2;
switch (*m->format) {
case PA_SAMPLE_FLOAT32NE:
{
__asm__ __volatile__ (
- MONO_TO_STEREO(dq) /* do doubles to quads */
- : "+r" (dst), "+r" (src), "=&r" (temp)
+ MONO_TO_STEREO(dq,3,7) /* do doubles to quads */
+ : "+r" (dst), "+r" (src), "=&r" (temp), "=&r" (temp2)
: "r" ((pa_reg_x86)n)
: "cc"
);
@@ -112,8 +120,8 @@ static void remap_mono_to_stereo_mmx (pa_remap_t *m, void *dst, const void *src,
case PA_SAMPLE_S16NE:
{
__asm__ __volatile__ (
- MONO_TO_STEREO(wd) /* do words to doubles */
- : "+r" (dst), "+r" (src), "=&r" (temp)
+ MONO_TO_STEREO(wd,4,15) /* do words to doubles */
+ : "+r" (dst), "+r" (src), "=&r" (temp), "=&r" (temp2)
: "r" ((pa_reg_x86)n)
: "cc"
);