annotate liba52/resample_c.c @ 3722:1bd9efb54a62

*** empty log message ***
author eyck
date Mon, 24 Dec 2001 23:54:27 +0000
parents 33c3cff374a1
children 6312aa265429
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
1 // this code come from a52dec/libao/audio_out_oss.c
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
2
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
3 // FIXME FIXME FIXME
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
4
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
5 // a52_resample_init should find the requested converter (from type flags ->
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
6 // given number of channels) and set up some function pointers...
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
7
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
8 // a52_resample() should do the conversion.
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
9
3569
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
10 // MMX optimizations from Michael Niedermayer (michaelni@gmx.at) (under GPL)
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
11
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
12 /* optimization TODO / NOTES
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
13 movntq is slightly faster (0.5% with the current test.c benchmark)
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
14 (but thats just test.c so that needs to be testd in reallity)
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
15 and it would mean (C / MMX2 / MMX / 3DNOW) versions
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
16 */
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
17
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
18 #include <inttypes.h>
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
19 #include <stdio.h>
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
20 #include "a52.h"
3567
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
21 #include "../config.h"
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
22 #include "../cpudetect.h"
3567
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
23
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
24 int (* a52_resample) (float * _f, int16_t * s16)=NULL;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
25
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
26 #ifdef ARCH_X86
3574
8600f40003de mmx opt
michael
parents: 3569
diff changeset
27 static uint64_t __attribute__((aligned(8))) magicF2W= 0x43c0000043c00000LL;
8600f40003de mmx opt
michael
parents: 3569
diff changeset
28 static uint64_t __attribute__((aligned(8))) wm1010= 0xFFFF0000FFFF0000LL;
8600f40003de mmx opt
michael
parents: 3569
diff changeset
29 static uint64_t __attribute__((aligned(8))) wm0101= 0x0000FFFF0000FFFFLL;
8600f40003de mmx opt
michael
parents: 3569
diff changeset
30 static uint64_t __attribute__((aligned(8))) wm1100= 0xFFFFFFFF00000000LL;
3567
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
31 #endif
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
32
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
33 static inline int16_t convert (int32_t i)
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
34 {
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
35 if (i > 0x43c07fff)
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
36 return 32767;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
37 else if (i < 0x43bf8000)
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
38 return -32768;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
39 else
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
40 return i - 0x43c00000;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
41 }
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
42
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
43 static int chans=2;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
44 static int flags=0;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
45
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
46 int a52_resample_C(float * _f, int16_t * s16)
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
47 {
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
48 int i;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
49 int32_t * f = (int32_t *) _f;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
50
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
51 switch (flags) {
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
52 case A52_MONO:
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
53 for (i = 0; i < 256; i++) {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
54 s16[5*i] = s16[5*i+1] = s16[5*i+2] = s16[5*i+3] = 0;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
55 s16[5*i+4] = convert (f[i]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
56 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
57 break;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
58 case A52_CHANNEL:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
59 case A52_STEREO:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
60 case A52_DOLBY:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
61 for (i = 0; i < 256; i++) {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
62 s16[2*i] = convert (f[i]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
63 s16[2*i+1] = convert (f[i+256]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
64 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
65 break;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
66 case A52_3F:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
67 for (i = 0; i < 256; i++) {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
68 s16[5*i] = convert (f[i]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
69 s16[5*i+1] = convert (f[i+512]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
70 s16[5*i+2] = s16[5*i+3] = 0;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
71 s16[5*i+4] = convert (f[i+256]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
72 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
73 break;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
74 case A52_2F2R:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
75 for (i = 0; i < 256; i++) {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
76 s16[4*i] = convert (f[i]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
77 s16[4*i+1] = convert (f[i+256]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
78 s16[4*i+2] = convert (f[i+512]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
79 s16[4*i+3] = convert (f[i+768]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
80 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
81 break;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
82 case A52_3F2R:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
83 for (i = 0; i < 256; i++) {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
84 s16[5*i] = convert (f[i]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
85 s16[5*i+1] = convert (f[i+512]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
86 s16[5*i+2] = convert (f[i+768]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
87 s16[5*i+3] = convert (f[i+1024]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
88 s16[5*i+4] = convert (f[i+256]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
89 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
90 break;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
91 case A52_MONO | A52_LFE:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
92 for (i = 0; i < 256; i++) {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
93 s16[6*i] = s16[6*i+1] = s16[6*i+2] = s16[6*i+3] = 0;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
94 s16[6*i+4] = convert (f[i+256]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
95 s16[6*i+5] = convert (f[i]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
96 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
97 break;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
98 case A52_CHANNEL | A52_LFE:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
99 case A52_STEREO | A52_LFE:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
100 case A52_DOLBY | A52_LFE:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
101 for (i = 0; i < 256; i++) {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
102 s16[6*i] = convert (f[i+256]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
103 s16[6*i+1] = convert (f[i+512]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
104 s16[6*i+2] = s16[6*i+3] = s16[6*i+4] = 0;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
105 s16[6*i+5] = convert (f[i]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
106 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
107 break;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
108 case A52_3F | A52_LFE:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
109 for (i = 0; i < 256; i++) {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
110 s16[6*i] = convert (f[i+256]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
111 s16[6*i+1] = convert (f[i+768]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
112 s16[6*i+2] = s16[6*i+3] = 0;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
113 s16[6*i+4] = convert (f[i+512]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
114 s16[6*i+5] = convert (f[i]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
115 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
116 break;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
117 case A52_2F2R | A52_LFE:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
118 for (i = 0; i < 256; i++) {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
119 s16[6*i] = convert (f[i+256]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
120 s16[6*i+1] = convert (f[i+512]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
121 s16[6*i+2] = convert (f[i+768]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
122 s16[6*i+3] = convert (f[i+1024]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
123 s16[6*i+4] = 0;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
124 s16[6*i+5] = convert (f[i]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
125 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
126 break;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
127 case A52_3F2R | A52_LFE:
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
128 for (i = 0; i < 256; i++) {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
129 s16[6*i] = convert (f[i+256]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
130 s16[6*i+1] = convert (f[i+768]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
131 s16[6*i+2] = convert (f[i+1024]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
132 s16[6*i+3] = convert (f[i+1280]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
133 s16[6*i+4] = convert (f[i+512]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
134 s16[6*i+5] = convert (f[i]);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
135 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
136 break;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
137 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
138 return chans*256;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
139 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
140
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
141 #ifdef ARCH_X86
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
142 int a52_resample_MMX(float * _f, int16_t * s16)
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
143 {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
144 int i;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
145 int32_t * f = (int32_t *) _f;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
146
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
147 switch (flags) {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
148 case A52_MONO:
3574
8600f40003de mmx opt
michael
parents: 3569
diff changeset
149 asm volatile(
8600f40003de mmx opt
michael
parents: 3569
diff changeset
150 "movl $-512, %%esi \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
151 "movq magicF2W, %%mm7 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
152 "movq wm1100, %%mm3 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
153 "movq wm0101, %%mm4 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
154 "movq wm1010, %%mm5 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
155 "pxor %%mm6, %%mm6 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
156 "1: \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
157 "movq (%1, %%esi, 2), %%mm0 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
158 "movq 8(%1, %%esi, 2), %%mm1 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
159 "leal (%%esi, %%esi, 4), %%edi \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
160 "psubd %%mm7, %%mm0 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
161 "psubd %%mm7, %%mm1 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
162 "packssdw %%mm1, %%mm0 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
163 "movq %%mm0, %%mm1 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
164 "pand %%mm4, %%mm0 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
165 "pand %%mm5, %%mm1 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
166 "movq %%mm6, (%0, %%edi) \n\t" // 0 0 0 0
8600f40003de mmx opt
michael
parents: 3569
diff changeset
167 "movd %%mm0, 8(%0, %%edi) \n\t" // A 0
8600f40003de mmx opt
michael
parents: 3569
diff changeset
168 "pand %%mm3, %%mm0 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
169 "movd %%mm6, 12(%0, %%edi) \n\t" // 0 0
8600f40003de mmx opt
michael
parents: 3569
diff changeset
170 "movd %%mm1, 16(%0, %%edi) \n\t" // 0 B
8600f40003de mmx opt
michael
parents: 3569
diff changeset
171 "pand %%mm3, %%mm1 \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
172 "movd %%mm6, 20(%0, %%edi) \n\t" // 0 0
8600f40003de mmx opt
michael
parents: 3569
diff changeset
173 "movq %%mm0, 24(%0, %%edi) \n\t" // 0 0 C 0
8600f40003de mmx opt
michael
parents: 3569
diff changeset
174 "movq %%mm1, 32(%0, %%edi) \n\t" // 0 0 0 B
8600f40003de mmx opt
michael
parents: 3569
diff changeset
175 "addl $8, %%esi \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
176 " jnz 1b \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
177 "emms \n\t"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
178 :: "r" (s16+1280), "r" (f+256)
8600f40003de mmx opt
michael
parents: 3569
diff changeset
179 :"%esi", "%edi", "memory"
8600f40003de mmx opt
michael
parents: 3569
diff changeset
180 );
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
181 break;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
182 case A52_CHANNEL:
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
183 case A52_STEREO:
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
184 case A52_DOLBY:
3567
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
185 /* benchmark scores are 0.3% better with SSE but we would need to set bias=0 and premultiply it
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
186 #ifdef HAVE_SSE
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
187 asm volatile(
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
188 "movl $-1024, %%esi \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
189 "1: \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
190 "cvtps2pi (%1, %%esi), %%mm0 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
191 "cvtps2pi 1024(%1, %%esi), %%mm2\n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
192 "movq %%mm0, %%mm1 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
193 "punpcklwd %%mm2, %%mm0 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
194 "punpckhwd %%mm2, %%mm1 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
195 "movq %%mm0, (%0, %%esi) \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
196 "movq %%mm1, 8(%0, %%esi) \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
197 "addl $16, %%esi \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
198 " jnz 1b \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
199 "emms \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
200 :: "r" (s16+512), "r" (f+256)
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
201 :"%esi", "memory"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
202 );*/
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
203 asm volatile(
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
204 "movl $-1024, %%esi \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
205 "movq magicF2W, %%mm7 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
206 "1: \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
207 "movq (%1, %%esi), %%mm0 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
208 "movq 8(%1, %%esi), %%mm1 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
209 "movq 1024(%1, %%esi), %%mm2 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
210 "movq 1032(%1, %%esi), %%mm3 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
211 "psubd %%mm7, %%mm0 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
212 "psubd %%mm7, %%mm1 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
213 "psubd %%mm7, %%mm2 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
214 "psubd %%mm7, %%mm3 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
215 "packssdw %%mm1, %%mm0 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
216 "packssdw %%mm3, %%mm2 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
217 "movq %%mm0, %%mm1 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
218 "punpcklwd %%mm2, %%mm0 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
219 "punpckhwd %%mm2, %%mm1 \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
220 "movq %%mm0, (%0, %%esi) \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
221 "movq %%mm1, 8(%0, %%esi) \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
222 "addl $16, %%esi \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
223 " jnz 1b \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
224 "emms \n\t"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
225 :: "r" (s16+512), "r" (f+256)
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
226 :"%esi", "memory"
9e1e88b3ca18 mmx opt
michael
parents: 3412
diff changeset
227 );
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
228 break;
3654
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
229 case A52_3F:
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
230 asm volatile(
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
231 "movl $-1024, %%esi \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
232 "movq magicF2W, %%mm7 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
233 "pxor %%mm6, %%mm6 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
234 "movq %%mm7, %%mm5 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
235 "punpckldq %%mm6, %%mm5 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
236 "1: \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
237 "movd (%1, %%esi), %%mm0 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
238 "punpckldq 2048(%1, %%esi), %%mm0\n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
239 "movd 1024(%1, %%esi), %%mm1 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
240 "punpckldq 4(%1, %%esi), %%mm1 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
241 "movd 2052(%1, %%esi), %%mm2 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
242 "movq %%mm7, %%mm3 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
243 "punpckldq 1028(%1, %%esi), %%mm3\n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
244 "movd 8(%1, %%esi), %%mm4 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
245 "punpckldq 2056(%1, %%esi), %%mm4\n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
246 "leal (%%esi, %%esi, 4), %%edi \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
247 "sarl $1, %%edi \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
248 "psubd %%mm7, %%mm0 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
249 "psubd %%mm7, %%mm1 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
250 "psubd %%mm5, %%mm2 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
251 "psubd %%mm7, %%mm3 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
252 "psubd %%mm7, %%mm4 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
253 "packssdw %%mm6, %%mm0 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
254 "packssdw %%mm2, %%mm1 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
255 "packssdw %%mm4, %%mm3 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
256 "movq %%mm0, (%0, %%edi) \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
257 "movq %%mm1, 8(%0, %%edi) \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
258 "movq %%mm3, 16(%0, %%edi) \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
259
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
260 "movd 1032(%1, %%esi), %%mm1 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
261 "punpckldq 12(%1, %%esi), %%mm1\n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
262 "movd 2060(%1, %%esi), %%mm2 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
263 "movq %%mm7, %%mm3 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
264 "punpckldq 1036(%1, %%esi), %%mm3\n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
265 "pxor %%mm0, %%mm0 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
266 "psubd %%mm7, %%mm1 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
267 "psubd %%mm5, %%mm2 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
268 "psubd %%mm7, %%mm3 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
269 "packssdw %%mm1, %%mm0 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
270 "packssdw %%mm3, %%mm2 \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
271 "movq %%mm0, 24(%0, %%edi) \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
272 "movq %%mm2, 32(%0, %%edi) \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
273
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
274 "addl $16, %%esi \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
275 " jnz 1b \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
276 "emms \n\t"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
277 :: "r" (s16+1280), "r" (f+256)
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
278 :"%esi", "%edi", "memory"
33c3cff374a1 sse optimize of 3F
michael
parents: 3653
diff changeset
279 );
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
280 break;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
281 case A52_2F2R:
3569
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
282 asm volatile(
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
283 "movl $-1024, %%esi \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
284 "movq magicF2W, %%mm7 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
285 "1: \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
286 "movq (%1, %%esi), %%mm0 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
287 "movq 8(%1, %%esi), %%mm1 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
288 "movq 1024(%1, %%esi), %%mm2 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
289 "movq 1032(%1, %%esi), %%mm3 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
290 "psubd %%mm7, %%mm0 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
291 "psubd %%mm7, %%mm1 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
292 "psubd %%mm7, %%mm2 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
293 "psubd %%mm7, %%mm3 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
294 "packssdw %%mm1, %%mm0 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
295 "packssdw %%mm3, %%mm2 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
296 "movq 2048(%1, %%esi), %%mm3 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
297 "movq 2056(%1, %%esi), %%mm4 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
298 "movq 3072(%1, %%esi), %%mm5 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
299 "movq 3080(%1, %%esi), %%mm6 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
300 "psubd %%mm7, %%mm3 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
301 "psubd %%mm7, %%mm4 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
302 "psubd %%mm7, %%mm5 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
303 "psubd %%mm7, %%mm6 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
304 "packssdw %%mm4, %%mm3 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
305 "packssdw %%mm6, %%mm5 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
306 "movq %%mm0, %%mm1 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
307 "movq %%mm3, %%mm4 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
308 "punpcklwd %%mm2, %%mm0 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
309 "punpckhwd %%mm2, %%mm1 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
310 "punpcklwd %%mm5, %%mm3 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
311 "punpckhwd %%mm5, %%mm4 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
312 "movq %%mm0, %%mm2 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
313 "movq %%mm1, %%mm5 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
314 "punpckldq %%mm3, %%mm0 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
315 "punpckhdq %%mm3, %%mm2 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
316 "punpckldq %%mm4, %%mm1 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
317 "punpckhdq %%mm4, %%mm5 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
318 "movq %%mm0, (%0, %%esi,2) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
319 "movq %%mm2, 8(%0, %%esi,2) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
320 "movq %%mm1, 16(%0, %%esi,2) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
321 "movq %%mm5, 24(%0, %%esi,2) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
322 "addl $16, %%esi \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
323 " jnz 1b \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
324 "emms \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
325 :: "r" (s16+1024), "r" (f+256)
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
326 :"%esi", "memory"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
327 );
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
328 break;
3653
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
329 case A52_3F2R:
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
330 asm volatile(
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
331 "movl $-1024, %%esi \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
332 "movq magicF2W, %%mm7 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
333 "1: \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
334 "movd (%1, %%esi), %%mm0 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
335 "punpckldq 2048(%1, %%esi), %%mm0\n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
336 "movd 3072(%1, %%esi), %%mm1 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
337 "punpckldq 4096(%1, %%esi), %%mm1\n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
338 "movd 1024(%1, %%esi), %%mm2 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
339 "punpckldq 4(%1, %%esi), %%mm2 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
340 "movd 2052(%1, %%esi), %%mm3 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
341 "punpckldq 3076(%1, %%esi), %%mm3\n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
342 "movd 4100(%1, %%esi), %%mm4 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
343 "punpckldq 1028(%1, %%esi), %%mm4\n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
344 "movd 8(%1, %%esi), %%mm5 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
345 "punpckldq 2056(%1, %%esi), %%mm5\n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
346 "leal (%%esi, %%esi, 4), %%edi \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
347 "sarl $1, %%edi \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
348 "psubd %%mm7, %%mm0 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
349 "psubd %%mm7, %%mm1 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
350 "psubd %%mm7, %%mm2 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
351 "psubd %%mm7, %%mm3 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
352 "psubd %%mm7, %%mm4 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
353 "psubd %%mm7, %%mm5 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
354 "packssdw %%mm1, %%mm0 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
355 "packssdw %%mm3, %%mm2 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
356 "packssdw %%mm5, %%mm4 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
357 "movq %%mm0, (%0, %%edi) \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
358 "movq %%mm2, 8(%0, %%edi) \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
359 "movq %%mm4, 16(%0, %%edi) \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
360
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
361 "movd 3080(%1, %%esi), %%mm0 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
362 "punpckldq 4104(%1, %%esi), %%mm0\n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
363 "movd 1032(%1, %%esi), %%mm1 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
364 "punpckldq 12(%1, %%esi), %%mm1\n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
365 "movd 2060(%1, %%esi), %%mm2 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
366 "punpckldq 3084(%1, %%esi), %%mm2\n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
367 "movd 4108(%1, %%esi), %%mm3 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
368 "punpckldq 1036(%1, %%esi), %%mm3\n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
369 "psubd %%mm7, %%mm0 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
370 "psubd %%mm7, %%mm1 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
371 "psubd %%mm7, %%mm2 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
372 "psubd %%mm7, %%mm3 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
373 "packssdw %%mm1, %%mm0 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
374 "packssdw %%mm3, %%mm2 \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
375 "movq %%mm0, 24(%0, %%edi) \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
376 "movq %%mm2, 32(%0, %%edi) \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
377
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
378 "addl $16, %%esi \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
379 " jnz 1b \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
380 "emms \n\t"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
381 :: "r" (s16+1280), "r" (f+256)
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
382 :"%esi", "%edi", "memory"
b11b15df02ed 3F2R sse optimized
michael
parents: 3626
diff changeset
383 );
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
384 break;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
385 case A52_MONO | A52_LFE:
3569
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
386 asm volatile(
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
387 "movl $-1024, %%esi \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
388 "movq magicF2W, %%mm7 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
389 "pxor %%mm6, %%mm6 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
390 "1: \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
391 "movq 1024(%1, %%esi), %%mm0 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
392 "movq 1032(%1, %%esi), %%mm1 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
393 "movq (%1, %%esi), %%mm2 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
394 "movq 8(%1, %%esi), %%mm3 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
395 "psubd %%mm7, %%mm0 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
396 "psubd %%mm7, %%mm1 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
397 "psubd %%mm7, %%mm2 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
398 "psubd %%mm7, %%mm3 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
399 "packssdw %%mm1, %%mm0 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
400 "packssdw %%mm3, %%mm2 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
401 "movq %%mm0, %%mm1 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
402 "punpcklwd %%mm2, %%mm0 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
403 "punpckhwd %%mm2, %%mm1 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
404 "leal (%%esi, %%esi, 2), %%edi \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
405 "movq %%mm6, (%0, %%edi) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
406 "movd %%mm0, 8(%0, %%edi) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
407 "punpckhdq %%mm0, %%mm0 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
408 "movq %%mm6, 12(%0, %%edi) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
409 "movd %%mm0, 20(%0, %%edi) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
410 "movq %%mm6, 24(%0, %%edi) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
411 "movd %%mm1, 32(%0, %%edi) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
412 "punpckhdq %%mm1, %%mm1 \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
413 "movq %%mm6, 36(%0, %%edi) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
414 "movd %%mm1, 44(%0, %%edi) \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
415 "addl $16, %%esi \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
416 " jnz 1b \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
417 "emms \n\t"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
418 :: "r" (s16+1536), "r" (f+256)
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
419 :"%esi", "%edi", "memory"
d14494d84c29 MMX opt
michael
parents: 3567
diff changeset
420 );
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
421 break;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
422 case A52_CHANNEL | A52_LFE:
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
423 case A52_STEREO | A52_LFE:
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
424 case A52_DOLBY | A52_LFE:
3576
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
425 asm volatile(
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
426 "movl $-1024, %%esi \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
427 "movq magicF2W, %%mm7 \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
428 "pxor %%mm6, %%mm6 \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
429 "1: \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
430 "movq 1024(%1, %%esi), %%mm0 \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
431 "movq 2048(%1, %%esi), %%mm1 \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
432 "movq (%1, %%esi), %%mm5 \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
433 "psubd %%mm7, %%mm0 \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
434 "psubd %%mm7, %%mm1 \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
435 "psubd %%mm7, %%mm5 \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
436 "leal (%%esi, %%esi, 2), %%edi \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
437
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
438 "pxor %%mm4, %%mm4 \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
439 "packssdw %%mm5, %%mm0 \n\t" // FfAa
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
440 "packssdw %%mm4, %%mm1 \n\t" // 00Bb
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
441 "punpckhwd %%mm0, %%mm4 \n\t" // F0f0
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
442 "punpcklwd %%mm1, %%mm0 \n\t" // BAba
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
443 "movq %%mm0, %%mm1 \n\t" // BAba
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
444 "punpckldq %%mm4, %%mm3 \n\t" // f0XX
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
445 "punpckldq %%mm6, %%mm0 \n\t" // 00ba
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
446 "punpckhdq %%mm1, %%mm3 \n\t" // BAf0
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
447
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
448 "movq %%mm0, (%0, %%edi) \n\t" // 00ba
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
449 "punpckhdq %%mm4, %%mm0 \n\t" // F000
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
450 "movq %%mm3, 8(%0, %%edi) \n\t" // BAf0
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
451 "movq %%mm0, 16(%0, %%edi) \n\t" // F000
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
452 "addl $8, %%esi \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
453 " jnz 1b \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
454 "emms \n\t"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
455 :: "r" (s16+1536), "r" (f+256)
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
456 :"%esi", "%edi", "memory"
c282fd9e8534 mmx opt
michael
parents: 3575
diff changeset
457 );
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
458 break;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
459 case A52_3F | A52_LFE:
3578
79759c05911e mmx opt
michael
parents: 3577
diff changeset
460 asm volatile(
79759c05911e mmx opt
michael
parents: 3577
diff changeset
461 "movl $-1024, %%esi \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
462 "movq magicF2W, %%mm7 \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
463 "pxor %%mm6, %%mm6 \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
464 "1: \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
465 "movq 1024(%1, %%esi), %%mm0 \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
466 "movq 3072(%1, %%esi), %%mm1 \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
467 "movq 2048(%1, %%esi), %%mm4 \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
468 "movq (%1, %%esi), %%mm5 \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
469 "psubd %%mm7, %%mm0 \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
470 "psubd %%mm7, %%mm1 \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
471 "psubd %%mm7, %%mm4 \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
472 "psubd %%mm7, %%mm5 \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
473 "leal (%%esi, %%esi, 2), %%edi \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
474
79759c05911e mmx opt
michael
parents: 3577
diff changeset
475 "packssdw %%mm4, %%mm0 \n\t" // EeAa
79759c05911e mmx opt
michael
parents: 3577
diff changeset
476 "packssdw %%mm5, %%mm1 \n\t" // FfBb
79759c05911e mmx opt
michael
parents: 3577
diff changeset
477 "movq %%mm0, %%mm2 \n\t" // EeAa
79759c05911e mmx opt
michael
parents: 3577
diff changeset
478 "punpcklwd %%mm1, %%mm0 \n\t" // BAba
79759c05911e mmx opt
michael
parents: 3577
diff changeset
479 "punpckhwd %%mm1, %%mm2 \n\t" // FEfe
79759c05911e mmx opt
michael
parents: 3577
diff changeset
480 "movq %%mm0, %%mm1 \n\t" // BAba
79759c05911e mmx opt
michael
parents: 3577
diff changeset
481 "punpckldq %%mm6, %%mm0 \n\t" // 00ba
79759c05911e mmx opt
michael
parents: 3577
diff changeset
482 "punpckhdq %%mm1, %%mm1 \n\t" // BABA
79759c05911e mmx opt
michael
parents: 3577
diff changeset
483
79759c05911e mmx opt
michael
parents: 3577
diff changeset
484 "movq %%mm0, (%0, %%edi) \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
485 "punpckhdq %%mm2, %%mm0 \n\t" // FE00
79759c05911e mmx opt
michael
parents: 3577
diff changeset
486 "punpckldq %%mm1, %%mm2 \n\t" // BAfe
79759c05911e mmx opt
michael
parents: 3577
diff changeset
487 "movq %%mm2, 8(%0, %%edi) \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
488 "movq %%mm0, 16(%0, %%edi) \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
489 "addl $8, %%esi \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
490 " jnz 1b \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
491 "emms \n\t"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
492 :: "r" (s16+1536), "r" (f+256)
79759c05911e mmx opt
michael
parents: 3577
diff changeset
493 :"%esi", "%edi", "memory"
79759c05911e mmx opt
michael
parents: 3577
diff changeset
494 );
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
495 break;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
496 case A52_2F2R | A52_LFE:
3577
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
497 asm volatile(
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
498 "movl $-1024, %%esi \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
499 "movq magicF2W, %%mm7 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
500 // "pxor %%mm6, %%mm6 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
501 "1: \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
502 "movq 1024(%1, %%esi), %%mm0 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
503 "movq 2048(%1, %%esi), %%mm1 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
504 "movq 3072(%1, %%esi), %%mm2 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
505 "movq 4096(%1, %%esi), %%mm3 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
506 "movq (%1, %%esi), %%mm5 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
507 "psubd %%mm7, %%mm0 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
508 "psubd %%mm7, %%mm1 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
509 "psubd %%mm7, %%mm2 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
510 "psubd %%mm7, %%mm3 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
511 "psubd %%mm7, %%mm5 \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
512 "leal (%%esi, %%esi, 2), %%edi \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
513
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
514 "packssdw %%mm2, %%mm0 \n\t" // CcAa
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
515 "packssdw %%mm3, %%mm1 \n\t" // DdBb
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
516 "packssdw %%mm5, %%mm5 \n\t" // FfFf
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
517 "movq %%mm0, %%mm2 \n\t" // CcAa
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
518 "punpcklwd %%mm1, %%mm0 \n\t" // BAba
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
519 "punpckhwd %%mm1, %%mm2 \n\t" // DCdc
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
520 "pxor %%mm4, %%mm4 \n\t" // 0000
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
521 "punpcklwd %%mm5, %%mm4 \n\t" // F0f0
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
522 "movq %%mm0, %%mm1 \n\t" // BAba
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
523 "movq %%mm4, %%mm3 \n\t" // F0f0
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
524 "punpckldq %%mm2, %%mm0 \n\t" // dcba
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
525 "punpckhdq %%mm1, %%mm1 \n\t" // BABA
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
526 "punpckldq %%mm1, %%mm4 \n\t" // BAf0
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
527 "punpckhdq %%mm3, %%mm2 \n\t" // F0DC
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
528
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
529 "movq %%mm0, (%0, %%edi) \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
530 "movq %%mm4, 8(%0, %%edi) \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
531 "movq %%mm2, 16(%0, %%edi) \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
532 "addl $8, %%esi \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
533 " jnz 1b \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
534 "emms \n\t"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
535 :: "r" (s16+1536), "r" (f+256)
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
536 :"%esi", "%edi", "memory"
6bf4dbfb941c mmx opt
michael
parents: 3576
diff changeset
537 );
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
538 break;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
539 case A52_3F2R | A52_LFE:
3575
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
540 asm volatile(
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
541 "movl $-1024, %%esi \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
542 "movq magicF2W, %%mm7 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
543 // "pxor %%mm6, %%mm6 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
544 "1: \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
545 "movq 1024(%1, %%esi), %%mm0 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
546 "movq 3072(%1, %%esi), %%mm1 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
547 "movq 4096(%1, %%esi), %%mm2 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
548 "movq 5120(%1, %%esi), %%mm3 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
549 "movq 2048(%1, %%esi), %%mm4 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
550 "movq (%1, %%esi), %%mm5 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
551 "psubd %%mm7, %%mm0 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
552 "psubd %%mm7, %%mm1 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
553 "psubd %%mm7, %%mm2 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
554 "psubd %%mm7, %%mm3 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
555 "psubd %%mm7, %%mm4 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
556 "psubd %%mm7, %%mm5 \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
557 "leal (%%esi, %%esi, 2), %%edi \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
558
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
559 "packssdw %%mm2, %%mm0 \n\t" // CcAa
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
560 "packssdw %%mm3, %%mm1 \n\t" // DdBb
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
561 "packssdw %%mm4, %%mm4 \n\t" // EeEe
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
562 "packssdw %%mm5, %%mm5 \n\t" // FfFf
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
563 "movq %%mm0, %%mm2 \n\t" // CcAa
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
564 "punpcklwd %%mm1, %%mm0 \n\t" // BAba
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
565 "punpckhwd %%mm1, %%mm2 \n\t" // DCdc
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
566 "punpcklwd %%mm5, %%mm4 \n\t" // FEfe
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
567 "movq %%mm0, %%mm1 \n\t" // BAba
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
568 "movq %%mm4, %%mm3 \n\t" // FEfe
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
569 "punpckldq %%mm2, %%mm0 \n\t" // dcba
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
570 "punpckhdq %%mm1, %%mm1 \n\t" // BABA
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
571 "punpckldq %%mm1, %%mm4 \n\t" // BAfe
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
572 "punpckhdq %%mm3, %%mm2 \n\t" // FEDC
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
573
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
574 "movq %%mm0, (%0, %%edi) \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
575 "movq %%mm4, 8(%0, %%edi) \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
576 "movq %%mm2, 16(%0, %%edi) \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
577 "addl $8, %%esi \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
578 " jnz 1b \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
579 "emms \n\t"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
580 :: "r" (s16+1536), "r" (f+256)
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
581 :"%esi", "%edi", "memory"
01a2466e035e mmx opt
michael
parents: 3574
diff changeset
582 );
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
583 break;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
584 }
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
585 return chans*256;
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
586 }
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
587 #endif //arch_x86
3412
21d65a4ae3c9 resample.c added - float->int conversion and channel ordering
arpi
parents:
diff changeset
588
3626
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
589 void a52_resample_init(int _flags,int _chans){
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
590 chans=_chans;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
591 flags=_flags;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
592
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
593 if(a52_resample==NULL) // only once please ;)
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
594 {
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
595 if(gCpuCaps.hasMMX) fprintf(stderr, "Using MMX optimized resampler\n");
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
596 else fprintf(stderr, "No accelerated resampler found\n");
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
597 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
598
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
599 #ifdef ARCH_X86
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
600 if(gCpuCaps.hasMMX) a52_resample= a52_resample_MMX;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
601 #else
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
602 if(0);
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
603 #endif
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
604 else a52_resample= a52_resample_C;
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
605 }
e22ff7ebdc05 runtime cpu detection for the resample stuff
michael
parents: 3578
diff changeset
606