aboutsummaryrefslogtreecommitdiffhomepage
path: root/liba52
diff options
context:
space:
mode:
authorGravatar michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-22 00:33:52 +0000
committerGravatar michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-22 00:33:52 +0000
commit5259ea04fccaa6757d3a48e5581a67efe94f6ef9 (patch)
tree9f8093326a0954d37f1fcf3ad4778a1c7bd6b076 /liba52
parent6f76545a7392ba8af3c91604650d6fd186fff65d (diff)
3F2R sse optimized
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3654 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'liba52')
-rw-r--r--liba52/resample.c65
-rw-r--r--liba52/resample_c.c65
-rw-r--r--liba52/resample_mmx.c65
3 files changed, 171 insertions, 24 deletions
diff --git a/liba52/resample.c b/liba52/resample.c
index ba3657be03..a5dd930eb0 100644
--- a/liba52/resample.c
+++ b/liba52/resample.c
@@ -282,14 +282,63 @@ int a52_resample_MMX(float * _f, int16_t * s16)
:"%esi", "memory"
);
break;
- case A52_3F2R: //FIXME optimitze
- for (i = 0; i < 256; i++) {
- s16[5*i] = convert (f[i]);
- s16[5*i+1] = convert (f[i+512]);
- s16[5*i+2] = convert (f[i+768]);
- s16[5*i+3] = convert (f[i+1024]);
- s16[5*i+4] = convert (f[i+256]);
- }
+ case A52_3F2R:
+ asm volatile(
+ "movl $-1024, %%esi \n\t"
+ "movq magicF2W, %%mm7 \n\t"
+ "1: \n\t"
+ "movd (%1, %%esi), %%mm0 \n\t"
+ "punpckldq 2048(%1, %%esi), %%mm0\n\t"
+ "movd 3072(%1, %%esi), %%mm1 \n\t"
+ "punpckldq 4096(%1, %%esi), %%mm1\n\t"
+ "movd 1024(%1, %%esi), %%mm2 \n\t"
+ "punpckldq 4(%1, %%esi), %%mm2 \n\t"
+ "movd 2052(%1, %%esi), %%mm3 \n\t"
+ "punpckldq 3076(%1, %%esi), %%mm3\n\t"
+ "movd 4100(%1, %%esi), %%mm4 \n\t"
+ "punpckldq 1028(%1, %%esi), %%mm4\n\t"
+ "movd 8(%1, %%esi), %%mm5 \n\t"
+ "punpckldq 2056(%1, %%esi), %%mm5\n\t"
+ "leal (%%esi, %%esi, 4), %%edi \n\t"
+ "sarl $1, %%edi \n\t"
+ "psubd %%mm7, %%mm0 \n\t"
+ "psubd %%mm7, %%mm1 \n\t"
+ "psubd %%mm7, %%mm2 \n\t"
+ "psubd %%mm7, %%mm3 \n\t"
+ "psubd %%mm7, %%mm4 \n\t"
+ "psubd %%mm7, %%mm5 \n\t"
+ "packssdw %%mm1, %%mm0 \n\t"
+ "packssdw %%mm3, %%mm2 \n\t"
+ "packssdw %%mm5, %%mm4 \n\t"
+ "movq %%mm0, (%0, %%edi) \n\t"
+ "movq %%mm2, 8(%0, %%edi) \n\t"
+ "movq %%mm4, 16(%0, %%edi) \n\t"
+
+ "movd 3080(%1, %%esi), %%mm0 \n\t"
+ "punpckldq 4104(%1, %%esi), %%mm0\n\t"
+ "movd 1032(%1, %%esi), %%mm1 \n\t"
+ "punpckldq 12(%1, %%esi), %%mm1\n\t"
+ "movd 2060(%1, %%esi), %%mm2 \n\t"
+ "punpckldq 3084(%1, %%esi), %%mm2\n\t"
+ "movd 4108(%1, %%esi), %%mm3 \n\t"
+ "punpckldq 1036(%1, %%esi), %%mm3\n\t"
+ "psubd %%mm7, %%mm0 \n\t"
+ "psubd %%mm7, %%mm1 \n\t"
+ "psubd %%mm7, %%mm2 \n\t"
+ "psubd %%mm7, %%mm3 \n\t"
+ "packssdw %%mm1, %%mm0 \n\t"
+ "packssdw %%mm3, %%mm2 \n\t"
+ "packssdw %%mm5, %%mm4 \n\t"
+ "movq %%mm0, 24(%0, %%edi) \n\t"
+ "movq %%mm2, 32(%0, %%edi) \n\t"
+ "movq %%mm4, 40(%0, %%edi) \n\t"
+
+ "addl $16, %%esi \n\t"
+ " jnz 1b \n\t"
+ "emms \n\t"
+ :: "r" (s16+1280), "r" (f+256)
+ :"%esi", "%edi", "memory"
+ );
break;
case A52_MONO | A52_LFE:
asm volatile(
diff --git a/liba52/resample_c.c b/liba52/resample_c.c
index ba3657be03..a5dd930eb0 100644
--- a/liba52/resample_c.c
+++ b/liba52/resample_c.c
@@ -282,14 +282,63 @@ int a52_resample_MMX(float * _f, int16_t * s16)
:"%esi", "memory"
);
break;
- case A52_3F2R: //FIXME optimitze
- for (i = 0; i < 256; i++) {
- s16[5*i] = convert (f[i]);
- s16[5*i+1] = convert (f[i+512]);
- s16[5*i+2] = convert (f[i+768]);
- s16[5*i+3] = convert (f[i+1024]);
- s16[5*i+4] = convert (f[i+256]);
- }
+ case A52_3F2R:
+ asm volatile(
+ "movl $-1024, %%esi \n\t"
+ "movq magicF2W, %%mm7 \n\t"
+ "1: \n\t"
+ "movd (%1, %%esi), %%mm0 \n\t"
+ "punpckldq 2048(%1, %%esi), %%mm0\n\t"
+ "movd 3072(%1, %%esi), %%mm1 \n\t"
+ "punpckldq 4096(%1, %%esi), %%mm1\n\t"
+ "movd 1024(%1, %%esi), %%mm2 \n\t"
+ "punpckldq 4(%1, %%esi), %%mm2 \n\t"
+ "movd 2052(%1, %%esi), %%mm3 \n\t"
+ "punpckldq 3076(%1, %%esi), %%mm3\n\t"
+ "movd 4100(%1, %%esi), %%mm4 \n\t"
+ "punpckldq 1028(%1, %%esi), %%mm4\n\t"
+ "movd 8(%1, %%esi), %%mm5 \n\t"
+ "punpckldq 2056(%1, %%esi), %%mm5\n\t"
+ "leal (%%esi, %%esi, 4), %%edi \n\t"
+ "sarl $1, %%edi \n\t"
+ "psubd %%mm7, %%mm0 \n\t"
+ "psubd %%mm7, %%mm1 \n\t"
+ "psubd %%mm7, %%mm2 \n\t"
+ "psubd %%mm7, %%mm3 \n\t"
+ "psubd %%mm7, %%mm4 \n\t"
+ "psubd %%mm7, %%mm5 \n\t"
+ "packssdw %%mm1, %%mm0 \n\t"
+ "packssdw %%mm3, %%mm2 \n\t"
+ "packssdw %%mm5, %%mm4 \n\t"
+ "movq %%mm0, (%0, %%edi) \n\t"
+ "movq %%mm2, 8(%0, %%edi) \n\t"
+ "movq %%mm4, 16(%0, %%edi) \n\t"
+
+ "movd 3080(%1, %%esi), %%mm0 \n\t"
+ "punpckldq 4104(%1, %%esi), %%mm0\n\t"
+ "movd 1032(%1, %%esi), %%mm1 \n\t"
+ "punpckldq 12(%1, %%esi), %%mm1\n\t"
+ "movd 2060(%1, %%esi), %%mm2 \n\t"
+ "punpckldq 3084(%1, %%esi), %%mm2\n\t"
+ "movd 4108(%1, %%esi), %%mm3 \n\t"
+ "punpckldq 1036(%1, %%esi), %%mm3\n\t"
+ "psubd %%mm7, %%mm0 \n\t"
+ "psubd %%mm7, %%mm1 \n\t"
+ "psubd %%mm7, %%mm2 \n\t"
+ "psubd %%mm7, %%mm3 \n\t"
+ "packssdw %%mm1, %%mm0 \n\t"
+ "packssdw %%mm3, %%mm2 \n\t"
+ "packssdw %%mm5, %%mm4 \n\t"
+ "movq %%mm0, 24(%0, %%edi) \n\t"
+ "movq %%mm2, 32(%0, %%edi) \n\t"
+ "movq %%mm4, 40(%0, %%edi) \n\t"
+
+ "addl $16, %%esi \n\t"
+ " jnz 1b \n\t"
+ "emms \n\t"
+ :: "r" (s16+1280), "r" (f+256)
+ :"%esi", "%edi", "memory"
+ );
break;
case A52_MONO | A52_LFE:
asm volatile(
diff --git a/liba52/resample_mmx.c b/liba52/resample_mmx.c
index ba3657be03..a5dd930eb0 100644
--- a/liba52/resample_mmx.c
+++ b/liba52/resample_mmx.c
@@ -282,14 +282,63 @@ int a52_resample_MMX(float * _f, int16_t * s16)
:"%esi", "memory"
);
break;
- case A52_3F2R: //FIXME optimitze
- for (i = 0; i < 256; i++) {
- s16[5*i] = convert (f[i]);
- s16[5*i+1] = convert (f[i+512]);
- s16[5*i+2] = convert (f[i+768]);
- s16[5*i+3] = convert (f[i+1024]);
- s16[5*i+4] = convert (f[i+256]);
- }
+ case A52_3F2R:
+ asm volatile(
+ "movl $-1024, %%esi \n\t"
+ "movq magicF2W, %%mm7 \n\t"
+ "1: \n\t"
+ "movd (%1, %%esi), %%mm0 \n\t"
+ "punpckldq 2048(%1, %%esi), %%mm0\n\t"
+ "movd 3072(%1, %%esi), %%mm1 \n\t"
+ "punpckldq 4096(%1, %%esi), %%mm1\n\t"
+ "movd 1024(%1, %%esi), %%mm2 \n\t"
+ "punpckldq 4(%1, %%esi), %%mm2 \n\t"
+ "movd 2052(%1, %%esi), %%mm3 \n\t"
+ "punpckldq 3076(%1, %%esi), %%mm3\n\t"
+ "movd 4100(%1, %%esi), %%mm4 \n\t"
+ "punpckldq 1028(%1, %%esi), %%mm4\n\t"
+ "movd 8(%1, %%esi), %%mm5 \n\t"
+ "punpckldq 2056(%1, %%esi), %%mm5\n\t"
+ "leal (%%esi, %%esi, 4), %%edi \n\t"
+ "sarl $1, %%edi \n\t"
+ "psubd %%mm7, %%mm0 \n\t"
+ "psubd %%mm7, %%mm1 \n\t"
+ "psubd %%mm7, %%mm2 \n\t"
+ "psubd %%mm7, %%mm3 \n\t"
+ "psubd %%mm7, %%mm4 \n\t"
+ "psubd %%mm7, %%mm5 \n\t"
+ "packssdw %%mm1, %%mm0 \n\t"
+ "packssdw %%mm3, %%mm2 \n\t"
+ "packssdw %%mm5, %%mm4 \n\t"
+ "movq %%mm0, (%0, %%edi) \n\t"
+ "movq %%mm2, 8(%0, %%edi) \n\t"
+ "movq %%mm4, 16(%0, %%edi) \n\t"
+
+ "movd 3080(%1, %%esi), %%mm0 \n\t"
+ "punpckldq 4104(%1, %%esi), %%mm0\n\t"
+ "movd 1032(%1, %%esi), %%mm1 \n\t"
+ "punpckldq 12(%1, %%esi), %%mm1\n\t"
+ "movd 2060(%1, %%esi), %%mm2 \n\t"
+ "punpckldq 3084(%1, %%esi), %%mm2\n\t"
+ "movd 4108(%1, %%esi), %%mm3 \n\t"
+ "punpckldq 1036(%1, %%esi), %%mm3\n\t"
+ "psubd %%mm7, %%mm0 \n\t"
+ "psubd %%mm7, %%mm1 \n\t"
+ "psubd %%mm7, %%mm2 \n\t"
+ "psubd %%mm7, %%mm3 \n\t"
+ "packssdw %%mm1, %%mm0 \n\t"
+ "packssdw %%mm3, %%mm2 \n\t"
+ "packssdw %%mm5, %%mm4 \n\t"
+ "movq %%mm0, 24(%0, %%edi) \n\t"
+ "movq %%mm2, 32(%0, %%edi) \n\t"
+ "movq %%mm4, 40(%0, %%edi) \n\t"
+
+ "addl $16, %%esi \n\t"
+ " jnz 1b \n\t"
+ "emms \n\t"
+ :: "r" (s16+1280), "r" (f+256)
+ :"%esi", "%edi", "memory"
+ );
break;
case A52_MONO | A52_LFE:
asm volatile(