annotate liba52/downmix.c @ 5638:86663f1b9b00

new osd code, use osd objs to follow changes and do minimal updates
author arpi
date Mon, 15 Apr 2002 19:17:12 +0000
parents ef2abfbbd1df
children d0a34309e424
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
1 /*
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
2 * downmix.c
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
3 * Copyright (C) 2000-2001 Michel Lespinasse <walken@zoy.org>
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
5 *
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
6 * This file is part of a52dec, a free ATSC A-52 stream decoder.
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
7 * See http://liba52.sourceforge.net/ for updates.
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
8 *
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
9 * a52dec is free software; you can redistribute it and/or modify
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
12 * (at your option) any later version.
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
13 *
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
14 * a52dec is distributed in the hope that it will be useful,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
17 * GNU General Public License for more details.
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
18 *
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3625
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
22 *
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
23 * SSE optimizations from Michael Niedermayer (michaelni@gmx.at)
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
24 */
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
25
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
26 #include "config.h"
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
27
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
28 #include <string.h>
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
29 #include <inttypes.h>
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
30
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
31 #include "a52.h"
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
32 #include "a52_internal.h"
3910
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
33 #include "mm_accel.h"
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
34
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
35 #define CONVERT(acmod,output) (((output) << 3) + (acmod))
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
36
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
37
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
38 void (*downmix)(sample_t * samples, int acmod, int output, sample_t bias,
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
39 sample_t clev, sample_t slev)= NULL;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
40 void (*upmix)(sample_t * samples, int acmod, int output)= NULL;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
41
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
42 static void downmix_SSE (sample_t * samples, int acmod, int output, sample_t bias,
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
43 sample_t clev, sample_t slev);
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
44 static void downmix_3dnow (sample_t * samples, int acmod, int output, sample_t bias,
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
45 sample_t clev, sample_t slev);
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
46 static void downmix_C (sample_t * samples, int acmod, int output, sample_t bias,
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
47 sample_t clev, sample_t slev);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
48 static void upmix_MMX (sample_t * samples, int acmod, int output);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
49 static void upmix_C (sample_t * samples, int acmod, int output);
3910
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
50
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
51 void downmix_accel_init(uint32_t mm_accel)
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
52 {
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
53 upmix= upmix_C;
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
54 downmix= downmix_C;
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
55 #ifdef ARCH_X86
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
56 if(mm_accel & MM_ACCEL_X86_MMX) upmix= upmix_MMX;
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
57 if(mm_accel & MM_ACCEL_X86_SSE) downmix= downmix_SSE;
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
58 if(mm_accel & MM_ACCEL_X86_3DNOW) downmix= downmix_3dnow;
3910
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
59 #endif
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
60 }
db1d556fcf58 runtime cpudetect the liba52 way part 2 (downmix.c)
michael
parents: 3904
diff changeset
61
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
62 int downmix_init (int input, int flags, sample_t * level,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
63 sample_t clev, sample_t slev)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
64 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
65 static uint8_t table[11][8] = {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
66 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
67 A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
68 {A52_MONO, A52_MONO, A52_MONO, A52_MONO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
69 A52_MONO, A52_MONO, A52_MONO, A52_MONO},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
70 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
71 A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
72 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
73 A52_STEREO, A52_3F, A52_STEREO, A52_3F},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
74 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
75 A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
76 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
77 A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
78 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
79 A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
80 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
81 A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
82 {A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
83 A52_MONO, A52_MONO, A52_MONO, A52_MONO},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
84 {A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
85 A52_MONO, A52_MONO, A52_MONO, A52_MONO},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
86 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
87 A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY}
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
88 };
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
89 int output;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
90
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
91 output = flags & A52_CHANNEL_MASK;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
92 if (output > A52_DOLBY)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
93 return -1;
3738
5c1da9bc17a3 memset(?, 0, 256*sizeof(float)) in MMX
michael
parents: 3679
diff changeset
94
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
95 output = table[output][input & 7];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
96
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
97 if ((output == A52_STEREO) &&
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
98 ((input == A52_DOLBY) || ((input == A52_3F) && (clev == LEVEL_3DB))))
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
99 output = A52_DOLBY;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
100
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
101 if (flags & A52_ADJUST_LEVEL)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
102 switch (CONVERT (input & 7, output)) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
103
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
104 case CONVERT (A52_3F, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
105 *level *= LEVEL_3DB / (1 + clev);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
106 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
107
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
108 case CONVERT (A52_STEREO, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
109 case CONVERT (A52_2F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
110 case CONVERT (A52_3F2R, A52_3F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
111 level_3db:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
112 *level *= LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
113 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
114
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
115 case CONVERT (A52_3F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
116 if (clev < LEVEL_PLUS3DB - 1)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
117 goto level_3db;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
118 /* break thru */
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
119 case CONVERT (A52_3F, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
120 case CONVERT (A52_3F1R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
121 case CONVERT (A52_3F1R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
122 case CONVERT (A52_3F2R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
123 *level /= 1 + clev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
124 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
125
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
126 case CONVERT (A52_2F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
127 *level *= LEVEL_PLUS3DB / (2 + slev);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
128 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
129
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
130 case CONVERT (A52_2F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
131 case CONVERT (A52_3F1R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
132 *level /= 1 + slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
133 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
134
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
135 case CONVERT (A52_3F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
136 *level *= LEVEL_3DB / (1 + clev + 0.5 * slev);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
137 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
138
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
139 case CONVERT (A52_3F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
140 *level /= 1 + clev + slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
141 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
142
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
143 case CONVERT (A52_2F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
144 *level *= LEVEL_3DB / (1 + slev);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
145 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
146
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
147 case CONVERT (A52_2F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
148 case CONVERT (A52_3F2R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
149 *level /= 1 + slev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
150 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
151
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
152 case CONVERT (A52_3F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
153 *level *= LEVEL_3DB / (1 + clev + slev);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
154 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
155
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
156 case CONVERT (A52_3F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
157 *level /= 1 + clev + slev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
158 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
159
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
160 case CONVERT (A52_MONO, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
161 *level *= LEVEL_PLUS3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
162 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
163
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
164 case CONVERT (A52_3F, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
165 case CONVERT (A52_2F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
166 *level *= 1 / (1 + LEVEL_3DB);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
167 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
168
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
169 case CONVERT (A52_3F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
170 case CONVERT (A52_2F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
171 *level *= 1 / (1 + 2 * LEVEL_3DB);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
172 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
173
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
174 case CONVERT (A52_3F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
175 *level *= 1 / (1 + 3 * LEVEL_3DB);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
176 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
177 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
178
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
179 return output;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
180 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
181
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
182 int downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
183 sample_t clev, sample_t slev)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
184 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
185 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
186
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
187 case CONVERT (A52_CHANNEL, A52_CHANNEL):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
188 case CONVERT (A52_MONO, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
189 case CONVERT (A52_STEREO, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
190 case CONVERT (A52_3F, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
191 case CONVERT (A52_2F1R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
192 case CONVERT (A52_3F1R, A52_3F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
193 case CONVERT (A52_2F2R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
194 case CONVERT (A52_3F2R, A52_3F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
195 case CONVERT (A52_STEREO, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
196 coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
197 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
198
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
199 case CONVERT (A52_CHANNEL, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
200 coeff[0] = coeff[1] = level * LEVEL_6DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
201 return 3;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
202
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
203 case CONVERT (A52_STEREO, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
204 coeff[0] = coeff[1] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
205 return 3;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
206
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
207 case CONVERT (A52_3F, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
208 coeff[0] = coeff[2] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
209 coeff[1] = level * clev * LEVEL_PLUS3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
210 return 7;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
211
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
212 case CONVERT (A52_2F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
213 coeff[0] = coeff[1] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
214 coeff[2] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
215 return 7;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
216
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
217 case CONVERT (A52_2F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
218 coeff[0] = coeff[1] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
219 coeff[2] = coeff[3] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
220 return 15;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
221
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
222 case CONVERT (A52_3F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
223 coeff[0] = coeff[2] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
224 coeff[1] = level * clev * LEVEL_PLUS3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
225 coeff[3] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
226 return 15;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
227
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
228 case CONVERT (A52_3F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
229 coeff[0] = coeff[2] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
230 coeff[1] = level * clev * LEVEL_PLUS3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
231 coeff[3] = coeff[4] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
232 return 31;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
233
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
234 case CONVERT (A52_MONO, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
235 coeff[0] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
236 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
237
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
238 case CONVERT (A52_3F, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
239 clev = LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
240 case CONVERT (A52_3F, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
241 case CONVERT (A52_3F1R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
242 case CONVERT (A52_3F2R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
243 coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
244 coeff[1] = level * clev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
245 return 7;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
246
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
247 case CONVERT (A52_2F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
248 slev = 1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
249 case CONVERT (A52_2F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
250 coeff[0] = coeff[1] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
251 coeff[2] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
252 return 7;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
253
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
254 case CONVERT (A52_3F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
255 clev = LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
256 slev = 1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
257 case CONVERT (A52_3F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
258 coeff[0] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
259 coeff[1] = level * clev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
260 coeff[3] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
261 return 15;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
262
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
263 case CONVERT (A52_2F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
264 slev = LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
265 case CONVERT (A52_2F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
266 coeff[0] = coeff[1] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
267 coeff[2] = coeff[3] = level * slev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
268 return 15;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
269
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
270 case CONVERT (A52_3F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
271 clev = LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
272 case CONVERT (A52_3F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
273 slev = LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
274 case CONVERT (A52_3F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
275 coeff[0] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
276 coeff[1] = level * clev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
277 coeff[3] = coeff[4] = level * slev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
278 return 31;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
279
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
280 case CONVERT (A52_3F1R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
281 coeff[0] = coeff[1] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
282 coeff[3] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
283 return 13;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
284
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
285 case CONVERT (A52_3F2R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
286 coeff[0] = coeff[1] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
287 coeff[3] = coeff[4] = level * slev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
288 return 29;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
289
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
290 case CONVERT (A52_2F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
291 coeff[0] = coeff[1] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
292 coeff[2] = coeff[3] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
293 return 12;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
294
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
295 case CONVERT (A52_3F2R, A52_3F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
296 coeff[0] = coeff[1] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
297 coeff[3] = coeff[4] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
298 return 24;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
299
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
300 case CONVERT (A52_2F1R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
301 coeff[0] = coeff[1] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
302 coeff[2] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
303 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
304
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
305 case CONVERT (A52_3F1R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
306 coeff[0] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
307 coeff[1] = level * clev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
308 coeff[3] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
309 return 7;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
310
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
311 case CONVERT (A52_3F1R, A52_3F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
312 coeff[0] = coeff[1] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
313 coeff[3] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
314 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
315
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
316 case CONVERT (A52_CHANNEL, A52_CHANNEL1):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
317 coeff[0] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
318 coeff[1] = 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
319 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
320
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
321 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
322 coeff[0] = 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
323 coeff[1] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
324 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
325 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
326
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
327 return -1; /* NOTREACHED */
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
328 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
329
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
330 static void mix2to1 (sample_t * dest, sample_t * src, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
331 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
332 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
333
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
334 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
335 dest[i] += src[i] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
336 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
337
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
338 static void mix3to1 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
339 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
340 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
341
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
342 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
343 samples[i] += samples[i + 256] + samples[i + 512] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
344 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
345
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
346 static void mix4to1 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
347 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
348 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
349
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
350 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
351 samples[i] += (samples[i + 256] + samples[i + 512] +
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
352 samples[i + 768] + bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
353 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
354
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
355 static void mix5to1 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
356 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
357 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
358
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
359 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
360 samples[i] += (samples[i + 256] + samples[i + 512] +
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
361 samples[i + 768] + samples[i + 1024] + bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
362 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
363
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
364 static void mix3to2 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
365 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
366 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
367 sample_t common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
368
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
369 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
370 common = samples[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
371 samples[i] += common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
372 samples[i + 256] = samples[i + 512] + common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
373 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
374 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
375
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
376 static void mix21to2 (sample_t * left, sample_t * right, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
377 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
378 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
379 sample_t common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
380
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
381 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
382 common = right[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
383 left[i] += common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
384 right[i] += common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
385 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
386 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
387
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
388 static void mix21toS (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
389 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
390 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
391 sample_t surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
392
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
393 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
394 surround = samples[i + 512];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
395 samples[i] += bias - surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
396 samples[i + 256] += bias + surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
397 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
398 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
399
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
400 static void mix31to2 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
401 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
402 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
403 sample_t common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
404
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
405 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
406 common = samples[i + 256] + samples[i + 768] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
407 samples[i] += common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
408 samples[i + 256] = samples[i + 512] + common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
409 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
410 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
411
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
412 static void mix31toS (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
413 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
414 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
415 sample_t common, surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
416
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
417 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
418 common = samples[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
419 surround = samples[i + 768];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
420 samples[i] += common - surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
421 samples[i + 256] = samples[i + 512] + common + surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
422 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
423 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
424
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
425 static void mix22toS (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
426 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
427 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
428 sample_t surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
429
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
430 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
431 surround = samples[i + 512] + samples[i + 768];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
432 samples[i] += bias - surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
433 samples[i + 256] += bias + surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
434 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
435 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
436
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
437 static void mix32to2 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
438 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
439 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
440 sample_t common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
441
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
442 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
443 common = samples[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
444 samples[i] += common + samples[i + 768];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
445 samples[i + 256] = common + samples[i + 512] + samples[i + 1024];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
446 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
447 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
448
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
449 static void mix32toS (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
450 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
451 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
452 sample_t common, surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
453
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
454 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
455 common = samples[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
456 surround = samples[i + 768] + samples[i + 1024];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
457 samples[i] += common - surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
458 samples[i + 256] = samples[i + 512] + common + surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
459 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
460 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
461
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
462 static void move2to1 (sample_t * src, sample_t * dest, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
463 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
464 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
465
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
466 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
467 dest[i] = src[i] + src[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
468 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
469
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
470 static void zero (sample_t * samples)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
471 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
472 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
473 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
474 samples[i] = 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
475 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
476
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
477 static void downmix_C (sample_t * samples, int acmod, int output, sample_t bias,
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
478 sample_t clev, sample_t slev)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
479 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
480 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
481
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
482 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
483 memcpy (samples, samples + 256, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
484 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
485
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
486 case CONVERT (A52_CHANNEL, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
487 case CONVERT (A52_STEREO, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
488 mix_2to1:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
489 mix2to1 (samples, samples + 256, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
490 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
491
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
492 case CONVERT (A52_2F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
493 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
494 goto mix_2to1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
495 case CONVERT (A52_3F, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
496 mix_3to1:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
497 mix3to1 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
498 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
499
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
500 case CONVERT (A52_3F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
501 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
502 goto mix_3to1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
503 case CONVERT (A52_2F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
504 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
505 goto mix_2to1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
506 mix4to1 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
507 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
508
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
509 case CONVERT (A52_3F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
510 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
511 goto mix_3to1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
512 mix5to1 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
513 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
514
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
515 case CONVERT (A52_MONO, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
516 memcpy (samples + 256, samples, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
517 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
518
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
519 case CONVERT (A52_3F, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
520 case CONVERT (A52_3F, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
521 mix_3to2:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
522 mix3to2 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
523 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
524
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
525 case CONVERT (A52_2F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
526 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
527 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
528 mix21to2 (samples, samples + 256, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
529 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
530
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
531 case CONVERT (A52_2F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
532 mix21toS (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
533 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
534
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
535 case CONVERT (A52_3F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
536 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
537 goto mix_3to2;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
538 mix31to2 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
539 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
540
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
541 case CONVERT (A52_3F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
542 mix31toS (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
543 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
544
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
545 case CONVERT (A52_2F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
546 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
547 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
548 mix2to1 (samples, samples + 512, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
549 mix2to1 (samples + 256, samples + 768, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
550 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
551
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
552 case CONVERT (A52_2F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
553 mix22toS (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
554 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
555
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
556 case CONVERT (A52_3F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
557 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
558 goto mix_3to2;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
559 mix32to2 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
560 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
561
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
562 case CONVERT (A52_3F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
563 mix32toS (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
564 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
565
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
566 case CONVERT (A52_3F1R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
567 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
568 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
569 mix21to2 (samples, samples + 512, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
570 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
571
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
572 case CONVERT (A52_3F2R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
573 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
574 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
575 mix2to1 (samples, samples + 768, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
576 mix2to1 (samples + 512, samples + 1024, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
577 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
578
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
579 case CONVERT (A52_3F1R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
580 mix3to2 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
581 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
582 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
583
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
584 case CONVERT (A52_2F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
585 mix2to1 (samples + 512, samples + 768, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
586 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
587
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
588 case CONVERT (A52_3F2R, A52_2F1R):
3678
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
589 mix3to2 (samples, bias); //FIXME possible bug? (output doesnt seem to be used)
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
590 move2to1 (samples + 768, samples + 512, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
591 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
592
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
593 case CONVERT (A52_3F2R, A52_3F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
594 mix2to1 (samples + 768, samples + 1024, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
595 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
596
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
597 case CONVERT (A52_2F1R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
598 memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
599 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
600
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
601 case CONVERT (A52_3F1R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
602 mix3to2 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
603 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
604 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
605
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
606 case CONVERT (A52_3F2R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
607 mix3to2 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
608 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
609 memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
610 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
611
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
612 case CONVERT (A52_3F1R, A52_3F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
613 memcpy (samples + 1027, samples + 768, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
614 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
615 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
616 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
617
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
618 static void upmix_C (sample_t * samples, int acmod, int output)
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
619 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
620 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
621
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
622 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
623 memcpy (samples + 256, samples, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
624 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
625
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
626 case CONVERT (A52_3F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
627 zero (samples + 1024);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
628 case CONVERT (A52_3F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
629 case CONVERT (A52_2F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
630 zero (samples + 768);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
631 case CONVERT (A52_3F, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
632 case CONVERT (A52_2F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
633 zero (samples + 512);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
634 case CONVERT (A52_CHANNEL, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
635 case CONVERT (A52_STEREO, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
636 zero (samples + 256);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
637 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
638
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
639 case CONVERT (A52_3F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
640 case CONVERT (A52_3F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
641 zero (samples + 1024);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
642 case CONVERT (A52_3F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
643 case CONVERT (A52_3F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
644 zero (samples + 768);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
645 case CONVERT (A52_3F, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
646 case CONVERT (A52_3F, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
647 mix_3to2:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
648 memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
649 zero (samples + 256);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
650 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
651
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
652 case CONVERT (A52_2F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
653 case CONVERT (A52_2F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
654 zero (samples + 768);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
655 case CONVERT (A52_2F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
656 case CONVERT (A52_2F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
657 zero (samples + 512);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
658 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
659
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
660 case CONVERT (A52_3F2R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
661 zero (samples + 1024);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
662 case CONVERT (A52_3F1R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
663 case CONVERT (A52_2F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
664 zero (samples + 768);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
665 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
666
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
667 case CONVERT (A52_3F2R, A52_3F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
668 zero (samples + 1024);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
669 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
670
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
671 case CONVERT (A52_3F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
672 zero (samples + 1024);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
673 case CONVERT (A52_3F1R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
674 mix_31to21:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
675 memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
676 goto mix_3to2;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
677
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
678 case CONVERT (A52_3F2R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
679 memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
680 goto mix_31to21;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
681 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
682 }
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
683
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
684 #ifdef ARCH_X86
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
685 static void mix2to1_SSE (sample_t * dest, sample_t * src, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
686 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
687 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
688 "movlps %2, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
689 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
690 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
691 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
692 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
693 "movaps (%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
694 "movaps 16(%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
695 "addps (%1, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
696 "addps 16(%1, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
697 "addps %%xmm7, %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
698 "addps %%xmm7, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
699 "movaps %%xmm0, (%1, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
700 "movaps %%xmm1, 16(%1, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
701 "addl $32, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
702 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
703 :: "r" (src+256), "r" (dest+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
704 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
705 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
706 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
707
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
708 static void mix3to1_SSE (sample_t * samples, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
709 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
710 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
711 "movlps %1, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
712 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
713 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
714 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
715 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
716 "movaps (%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
717 "movaps 1024(%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
718 "addps 2048(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
719 "addps %%xmm7, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
720 "addps %%xmm1, %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
721 "movaps %%xmm0, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
722 "addl $16, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
723 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
724 :: "r" (samples+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
725 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
726 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
727 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
728
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
729 static void mix4to1_SSE (sample_t * samples, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
730 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
731 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
732 "movlps %1, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
733 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
734 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
735 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
736 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
737 "movaps (%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
738 "movaps 1024(%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
739 "addps 2048(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
740 "addps 3072(%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
741 "addps %%xmm7, %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
742 "addps %%xmm1, %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
743 "movaps %%xmm0, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
744 "addl $16, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
745 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
746 :: "r" (samples+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
747 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
748 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
749 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
750
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
751 static void mix5to1_SSE (sample_t * samples, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
752 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
753 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
754 "movlps %1, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
755 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
756 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
757 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
758 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
759 "movaps (%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
760 "movaps 1024(%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
761 "addps 2048(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
762 "addps 3072(%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
763 "addps %%xmm7, %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
764 "addps 4096(%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
765 "addps %%xmm1, %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
766 "movaps %%xmm0, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
767 "addl $16, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
768 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
769 :: "r" (samples+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
770 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
771 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
772 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
773
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
774 static void mix3to2_SSE (sample_t * samples, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
775 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
776 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
777 "movlps %1, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
778 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
779 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
780 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
781 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
782 "movaps 1024(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
783 "addps %%xmm7, %%xmm0 \n\t" //common
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
784 "movaps (%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
785 "movaps 2048(%0, %%esi), %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
786 "addps %%xmm0, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
787 "addps %%xmm0, %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
788 "movaps %%xmm1, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
789 "movaps %%xmm2, 1024(%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
790 "addl $16, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
791 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
792 :: "r" (samples+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
793 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
794 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
795 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
796
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
797 static void mix21to2_SSE (sample_t * left, sample_t * right, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
798 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
799 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
800 "movlps %2, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
801 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
802 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
803 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
804 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
805 "movaps 1024(%1, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
806 "addps %%xmm7, %%xmm0 \n\t" //common
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
807 "movaps (%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
808 "movaps (%1, %%esi), %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
809 "addps %%xmm0, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
810 "addps %%xmm0, %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
811 "movaps %%xmm1, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
812 "movaps %%xmm2, (%1, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
813 "addl $16, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
814 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
815 :: "r" (left+256), "r" (right+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
816 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
817 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
818 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
819
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
820 static void mix21toS_SSE (sample_t * samples, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
821 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
822 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
823 "movlps %1, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
824 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
825 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
826 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
827 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
828 "movaps 2048(%0, %%esi), %%xmm0 \n\t" // surround
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
829 "movaps (%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
830 "movaps 1024(%0, %%esi), %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
831 "addps %%xmm7, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
832 "addps %%xmm7, %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
833 "subps %%xmm0, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
834 "addps %%xmm0, %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
835 "movaps %%xmm1, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
836 "movaps %%xmm2, 1024(%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
837 "addl $16, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
838 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
839 :: "r" (samples+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
840 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
841 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
842 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
843
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
844 static void mix31to2_SSE (sample_t * samples, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
845 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
846 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
847 "movlps %1, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
848 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
849 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
850 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
851 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
852 "movaps 1024(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
853 "addps 3072(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
854 "addps %%xmm7, %%xmm0 \n\t" // common
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
855 "movaps (%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
856 "movaps 2048(%0, %%esi), %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
857 "addps %%xmm0, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
858 "addps %%xmm0, %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
859 "movaps %%xmm1, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
860 "movaps %%xmm2, 1024(%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
861 "addl $16, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
862 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
863 :: "r" (samples+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
864 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
865 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
866 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
867
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
868 static void mix31toS_SSE (sample_t * samples, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
869 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
870 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
871 "movlps %1, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
872 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
873 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
874 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
875 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
876 "movaps 1024(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
877 "movaps 3072(%0, %%esi), %%xmm3 \n\t" // surround
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
878 "addps %%xmm7, %%xmm0 \n\t" // common
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
879 "movaps (%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
880 "movaps 2048(%0, %%esi), %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
881 "addps %%xmm0, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
882 "addps %%xmm0, %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
883 "subps %%xmm3, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
884 "addps %%xmm3, %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
885 "movaps %%xmm1, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
886 "movaps %%xmm2, 1024(%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
887 "addl $16, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
888 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
889 :: "r" (samples+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
890 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
891 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
892 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
893
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
894 static void mix22toS_SSE (sample_t * samples, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
895 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
896 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
897 "movlps %1, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
898 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
899 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
900 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
901 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
902 "movaps 2048(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
903 "addps 3072(%0, %%esi), %%xmm0 \n\t" // surround
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
904 "movaps (%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
905 "movaps 1024(%0, %%esi), %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
906 "addps %%xmm7, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
907 "addps %%xmm7, %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
908 "subps %%xmm0, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
909 "addps %%xmm0, %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
910 "movaps %%xmm1, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
911 "movaps %%xmm2, 1024(%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
912 "addl $16, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
913 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
914 :: "r" (samples+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
915 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
916 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
917 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
918
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
919 static void mix32to2_SSE (sample_t * samples, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
920 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
921 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
922 "movlps %1, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
923 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
924 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
925 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
926 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
927 "movaps 1024(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
928 "addps %%xmm7, %%xmm0 \n\t" // common
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
929 "movaps %%xmm0, %%xmm1 \n\t" // common
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
930 "addps (%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
931 "addps 2048(%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
932 "addps 3072(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
933 "addps 4096(%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
934 "movaps %%xmm0, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
935 "movaps %%xmm1, 1024(%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
936 "addl $16, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
937 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
938 :: "r" (samples+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
939 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
940 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
941 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
942
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
943 static void mix32toS_SSE (sample_t * samples, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
944 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
945 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
946 "movlps %1, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
947 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
948 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
949 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
950 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
951 "movaps 1024(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
952 "movaps 3072(%0, %%esi), %%xmm2 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
953 "addps %%xmm7, %%xmm0 \n\t" // common
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
954 "addps 4096(%0, %%esi), %%xmm2 \n\t" // surround
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
955 "movaps (%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
956 "movaps 2048(%0, %%esi), %%xmm3 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
957 "subps %%xmm2, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
958 "addps %%xmm2, %%xmm3 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
959 "addps %%xmm0, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
960 "addps %%xmm0, %%xmm3 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
961 "movaps %%xmm1, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
962 "movaps %%xmm3, 1024(%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
963 "addl $16, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
964 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
965 :: "r" (samples+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
966 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
967 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
968 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
969
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
970 static void move2to1_SSE (sample_t * src, sample_t * dest, sample_t bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
971 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
972 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
973 "movlps %2, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
974 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
975 "movl $-1024, %%esi \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
976 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
977 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
978 "movaps (%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
979 "movaps 16(%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
980 "addps 1024(%0, %%esi), %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
981 "addps 1040(%0, %%esi), %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
982 "addps %%xmm7, %%xmm0 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
983 "addps %%xmm7, %%xmm1 \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
984 "movaps %%xmm0, (%1, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
985 "movaps %%xmm1, 16(%1, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
986 "addl $32, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
987 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
988 :: "r" (src+256), "r" (dest+256), "m" (bias)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
989 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
990 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
991 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
992
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
993 static void zero_MMX(sample_t * samples)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
994 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
995 asm volatile(
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
996 "movl $-1024, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
997 "pxor %%mm0, %%mm0 \n\t"
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
998 ".balign 16\n\t"
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
999 "1: \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1000 "movq %%mm0, (%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1001 "movq %%mm0, 8(%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1002 "movq %%mm0, 16(%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1003 "movq %%mm0, 24(%0, %%esi) \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1004 "addl $32, %%esi \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1005 " jnz 1b \n\t"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1006 "emms"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1007 :: "r" (samples+256)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1008 : "%esi"
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1009 );
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1010 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1011
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1012 /*
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1013 I hope dest and src will be at least 8 byte aligned and size
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1014 will devide on 8 without remain
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1015 Note: untested and unused.
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1016 */
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1017 static void copy_MMX(void *dest,const void *src,unsigned size)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1018 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1019 unsigned i;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1020 size /= 64;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1021 for(i=0;i<size;i++)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1022 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1023 __asm __volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1024 "movq %0, %%mm0\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1025 "movq 8%0, %%mm1\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1026 "movq 16%0, %%mm2\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1027 "movq 24%0, %%mm3\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1028 "movq 32%0, %%mm4\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1029 "movq 40%0, %%mm5\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1030 "movq 48%0, %%mm6\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1031 "movq 56%0, %%mm7\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1032 "movq %%mm0, %1\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1033 "movq %%mm1, 8%1\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1034 "movq %%mm2, 16%1\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1035 "movq %%mm3, 24%1\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1036 "movq %%mm4, 32%1\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1037 "movq %%mm5, 40%1\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1038 "movq %%mm6, 48%1\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1039 "movq %%mm7, 56%1\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1040 :
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1041 :"m"(src),"m"(dest));
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1042 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1043 }
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1044
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1045 static void downmix_SSE (sample_t * samples, int acmod, int output, sample_t bias,
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1046 sample_t clev, sample_t slev)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1047 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1048 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1049
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1050 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1051 memcpy (samples, samples + 256, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1052 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1053
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1054 case CONVERT (A52_CHANNEL, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1055 case CONVERT (A52_STEREO, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1056 mix_2to1_SSE:
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1057 mix2to1_SSE (samples, samples + 256, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1058 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1059
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1060 case CONVERT (A52_2F1R, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1061 if (slev == 0)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1062 goto mix_2to1_SSE;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1063 case CONVERT (A52_3F, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1064 mix_3to1_SSE:
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1065 mix3to1_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1066 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1067
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1068 case CONVERT (A52_3F1R, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1069 if (slev == 0)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1070 goto mix_3to1_SSE;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1071 case CONVERT (A52_2F2R, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1072 if (slev == 0)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1073 goto mix_2to1_SSE;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1074 mix4to1_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1075 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1076
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1077 case CONVERT (A52_3F2R, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1078 if (slev == 0)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1079 goto mix_3to1_SSE;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1080 mix5to1_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1081 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1082
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1083 case CONVERT (A52_MONO, A52_DOLBY):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1084 memcpy (samples + 256, samples, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1085 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1086
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1087 case CONVERT (A52_3F, A52_STEREO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1088 case CONVERT (A52_3F, A52_DOLBY):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1089 mix_3to2_SSE:
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1090 mix3to2_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1091 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1092
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1093 case CONVERT (A52_2F1R, A52_STEREO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1094 if (slev == 0)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1095 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1096 mix21to2_SSE (samples, samples + 256, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1097 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1098
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1099 case CONVERT (A52_2F1R, A52_DOLBY):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1100 mix21toS_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1101 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1102
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1103 case CONVERT (A52_3F1R, A52_STEREO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1104 if (slev == 0)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1105 goto mix_3to2_SSE;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1106 mix31to2_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1107 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1108
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1109 case CONVERT (A52_3F1R, A52_DOLBY):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1110 mix31toS_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1111 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1112
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1113 case CONVERT (A52_2F2R, A52_STEREO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1114 if (slev == 0)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1115 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1116 mix2to1_SSE (samples, samples + 512, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1117 mix2to1_SSE (samples + 256, samples + 768, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1118 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1119
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1120 case CONVERT (A52_2F2R, A52_DOLBY):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1121 mix22toS_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1122 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1123
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1124 case CONVERT (A52_3F2R, A52_STEREO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1125 if (slev == 0)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1126 goto mix_3to2_SSE;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1127 mix32to2_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1128 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1129
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1130 case CONVERT (A52_3F2R, A52_DOLBY):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1131 mix32toS_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1132 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1133
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1134 case CONVERT (A52_3F1R, A52_3F):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1135 if (slev == 0)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1136 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1137 mix21to2_SSE (samples, samples + 512, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1138 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1139
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1140 case CONVERT (A52_3F2R, A52_3F):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1141 if (slev == 0)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1142 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1143 mix2to1_SSE (samples, samples + 768, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1144 mix2to1_SSE (samples + 512, samples + 1024, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1145 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1146
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1147 case CONVERT (A52_3F1R, A52_2F1R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1148 mix3to2_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1149 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1150 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1151
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1152 case CONVERT (A52_2F2R, A52_2F1R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1153 mix2to1_SSE (samples + 512, samples + 768, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1154 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1155
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1156 case CONVERT (A52_3F2R, A52_2F1R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1157 mix3to2_SSE (samples, bias); //FIXME possible bug? (output doesnt seem to be used)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1158 move2to1_SSE (samples + 768, samples + 512, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1159 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1160
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1161 case CONVERT (A52_3F2R, A52_3F1R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1162 mix2to1_SSE (samples + 768, samples + 1024, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1163 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1164
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1165 case CONVERT (A52_2F1R, A52_2F2R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1166 memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1167 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1168
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1169 case CONVERT (A52_3F1R, A52_2F2R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1170 mix3to2_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1171 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1172 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1173
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1174 case CONVERT (A52_3F2R, A52_2F2R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1175 mix3to2_SSE (samples, bias);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1176 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1177 memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1178 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1179
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1180 case CONVERT (A52_3F1R, A52_3F2R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1181 memcpy (samples + 1027, samples + 768, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1182 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1183 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1184 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1185
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1186 static void upmix_MMX (sample_t * samples, int acmod, int output)
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1187 {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1188 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1189
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1190 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1191 memcpy (samples + 256, samples, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1192 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1193
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1194 case CONVERT (A52_3F2R, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1195 zero_MMX (samples + 1024);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1196 case CONVERT (A52_3F1R, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1197 case CONVERT (A52_2F2R, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1198 zero_MMX (samples + 768);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1199 case CONVERT (A52_3F, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1200 case CONVERT (A52_2F1R, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1201 zero_MMX (samples + 512);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1202 case CONVERT (A52_CHANNEL, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1203 case CONVERT (A52_STEREO, A52_MONO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1204 zero_MMX (samples + 256);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1205 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1206
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1207 case CONVERT (A52_3F2R, A52_STEREO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1208 case CONVERT (A52_3F2R, A52_DOLBY):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1209 zero_MMX (samples + 1024);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1210 case CONVERT (A52_3F1R, A52_STEREO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1211 case CONVERT (A52_3F1R, A52_DOLBY):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1212 zero_MMX (samples + 768);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1213 case CONVERT (A52_3F, A52_STEREO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1214 case CONVERT (A52_3F, A52_DOLBY):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1215 mix_3to2_MMX:
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1216 memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1217 zero_MMX (samples + 256);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1218 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1219
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1220 case CONVERT (A52_2F2R, A52_STEREO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1221 case CONVERT (A52_2F2R, A52_DOLBY):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1222 zero_MMX (samples + 768);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1223 case CONVERT (A52_2F1R, A52_STEREO):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1224 case CONVERT (A52_2F1R, A52_DOLBY):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1225 zero_MMX (samples + 512);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1226 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1227
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1228 case CONVERT (A52_3F2R, A52_3F):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1229 zero_MMX (samples + 1024);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1230 case CONVERT (A52_3F1R, A52_3F):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1231 case CONVERT (A52_2F2R, A52_2F1R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1232 zero_MMX (samples + 768);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1233 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1234
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1235 case CONVERT (A52_3F2R, A52_3F1R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1236 zero_MMX (samples + 1024);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1237 break;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1238
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1239 case CONVERT (A52_3F2R, A52_2F1R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1240 zero_MMX (samples + 1024);
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1241 case CONVERT (A52_3F1R, A52_2F1R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1242 mix_31to21_MMX:
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1243 memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1244 goto mix_3to2_MMX;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1245
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1246 case CONVERT (A52_3F2R, A52_2F2R):
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1247 memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1248 goto mix_31to21_MMX;
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1249 }
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1250 }
4233
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1251
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1252 static void mix2to1_3dnow (sample_t * dest, sample_t * src, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1253 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1254 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1255 "movd %2, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1256 "punpckldq %2, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1257 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1258 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1259 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1260 "movq (%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1261 "movq 8(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1262 "movq 16(%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1263 "movq 24(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1264 "pfadd (%1, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1265 "pfadd 8(%1, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1266 "pfadd 16(%1, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1267 "pfadd 24(%1, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1268 "pfadd %%mm7, %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1269 "pfadd %%mm7, %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1270 "pfadd %%mm7, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1271 "pfadd %%mm7, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1272 "movq %%mm0, (%1, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1273 "movq %%mm1, 8(%1, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1274 "movq %%mm2, 16(%1, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1275 "movq %%mm3, 24(%1, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1276 "addl $32, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1277 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1278 :: "r" (src+256), "r" (dest+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1279 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1280 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1281 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1282
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1283 static void mix3to1_3dnow (sample_t * samples, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1284 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1285 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1286 "movd %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1287 "punpckldq %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1288 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1289 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1290 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1291 "movq (%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1292 "movq 8(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1293 "movq 1024(%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1294 "movq 1032(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1295 "pfadd 2048(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1296 "pfadd 2056(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1297 "pfadd %%mm7, %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1298 "pfadd %%mm7, %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1299 "pfadd %%mm2, %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1300 "pfadd %%mm3, %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1301 "movq %%mm0, (%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1302 "movq %%mm1, 8(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1303 "addl $16, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1304 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1305 :: "r" (samples+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1306 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1307 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1308 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1309
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1310 static void mix4to1_3dnow (sample_t * samples, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1311 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1312 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1313 "movd %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1314 "punpckldq %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1315 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1316 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1317 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1318 "movq (%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1319 "movq 8(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1320 "movq 1024(%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1321 "movq 1032(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1322 "pfadd 2048(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1323 "pfadd 2056(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1324 "pfadd 3072(%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1325 "pfadd 3080(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1326 "pfadd %%mm7, %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1327 "pfadd %%mm7, %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1328 "pfadd %%mm2, %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1329 "pfadd %%mm3, %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1330 "movq %%mm0, (%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1331 "movq %%mm1, 8(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1332 "addl $16, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1333 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1334 :: "r" (samples+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1335 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1336 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1337 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1338
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1339 static void mix5to1_3dnow (sample_t * samples, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1340 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1341 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1342 "movd %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1343 "punpckldq %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1344 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1345 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1346 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1347 "movq (%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1348 "movq 8(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1349 "movq 1024(%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1350 "movq 1032(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1351 "pfadd 2048(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1352 "pfadd 2056(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1353 "pfadd 3072(%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1354 "pfadd 3080(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1355 "pfadd %%mm7, %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1356 "pfadd %%mm7, %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1357 "pfadd 4096(%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1358 "pfadd 4104(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1359 "pfadd %%mm2, %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1360 "pfadd %%mm3, %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1361 "movq %%mm0, (%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1362 "movq %%mm1, 8(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1363 "addl $16, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1364 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1365 :: "r" (samples+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1366 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1367 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1368 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1369
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1370 static void mix3to2_3dnow (sample_t * samples, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1371 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1372 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1373 "movd %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1374 "punpckldq %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1375 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1376 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1377 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1378 "movq 1024(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1379 "movq 1032(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1380 "pfadd %%mm7, %%mm0 \n\t" //common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1381 "pfadd %%mm7, %%mm1 \n\t" //common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1382 "movq (%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1383 "movq 8(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1384 "movq 2048(%0, %%esi), %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1385 "movq 2056(%0, %%esi), %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1386 "pfadd %%mm0, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1387 "pfadd %%mm0, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1388 "pfadd %%mm0, %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1389 "pfadd %%mm0, %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1390 "movq %%mm2, (%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1391 "movq %%mm3, 8(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1392 "movq %%mm4, 1024(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1393 "movq %%mm5, 1032(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1394 "addl $16, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1395 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1396 :: "r" (samples+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1397 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1398 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1399 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1400
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1401 static void mix21to2_3dnow (sample_t * left, sample_t * right, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1402 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1403 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1404 "movd %2, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1405 "punpckldq %2, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1406 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1407 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1408 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1409 "movq 1024(%1, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1410 "movq 1032(%1, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1411 "pfadd %%mm7, %%mm0 \n\t" //common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1412 "pfadd %%mm7, %%mm1 \n\t" //common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1413 "movq (%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1414 "movq 8(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1415 "movq (%1, %%esi), %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1416 "movq 8(%1, %%esi), %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1417 "pfadd %%mm0, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1418 "pfadd %%mm1, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1419 "pfadd %%mm0, %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1420 "pfadd %%mm1, %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1421 "movq %%mm2, (%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1422 "movq %%mm3, 8(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1423 "movq %%mm4, (%1, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1424 "movq %%mm5, 8(%1, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1425 "addl $16, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1426 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1427 :: "r" (left+256), "r" (right+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1428 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1429 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1430 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1431
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1432 static void mix21toS_3dnow (sample_t * samples, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1433 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1434 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1435 "movd %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1436 "punpckldq %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1437 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1438 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1439 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1440 "movq 2048(%0, %%esi), %%mm0 \n\t" // surround
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1441 "movq 2056(%0, %%esi), %%mm1 \n\t" // surround
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1442 "movq (%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1443 "movq 8(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1444 "movq 1024(%0, %%esi), %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1445 "movq 1032(%0, %%esi), %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1446 "pfadd %%mm7, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1447 "pfadd %%mm7, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1448 "pfadd %%mm7, %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1449 "pfadd %%mm7, %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1450 "pfsub %%mm0, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1451 "pfsub %%mm1, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1452 "pfadd %%mm0, %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1453 "pfadd %%mm1, %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1454 "movq %%mm2, (%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1455 "movq %%mm3, 8(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1456 "movq %%mm4, 1024(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1457 "movq %%mm5, 1032(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1458 "addl $16, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1459 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1460 :: "r" (samples+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1461 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1462 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1463 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1464
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1465 static void mix31to2_3dnow (sample_t * samples, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1466 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1467 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1468 "movd %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1469 "punpckldq %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1470 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1471 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1472 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1473 "movq 1024(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1474 "movq 1032(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1475 "pfadd 3072(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1476 "pfadd 3080(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1477 "pfadd %%mm7, %%mm0 \n\t" // common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1478 "pfadd %%mm7, %%mm1 \n\t" // common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1479 "movq (%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1480 "movq 8(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1481 "movq 2048(%0, %%esi), %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1482 "movq 2056(%0, %%esi), %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1483 "pfadd %%mm0, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1484 "pfadd %%mm1, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1485 "pfadd %%mm0, %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1486 "pfadd %%mm1, %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1487 "movq %%mm2, (%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1488 "movq %%mm3, 8(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1489 "movq %%mm4, 1024(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1490 "movq %%mm5, 1032(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1491 "addl $16, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1492 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1493 :: "r" (samples+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1494 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1495 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1496 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1497
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1498 static void mix31toS_3dnow (sample_t * samples, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1499 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1500 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1501 "movd %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1502 "punpckldq %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1503 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1504 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1505 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1506 "movq 1024(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1507 "movq 1032(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1508 "pfadd %%mm7, %%mm0 \n\t" // common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1509 "pfadd %%mm7, %%mm1 \n\t" // common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1510 "movq (%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1511 "movq 8(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1512 "movq 2048(%0, %%esi), %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1513 "movq 2056(%0, %%esi), %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1514 "pfadd %%mm0, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1515 "pfadd %%mm1, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1516 "pfadd %%mm0, %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1517 "pfadd %%mm1, %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1518 "movq 3072(%0, %%esi), %%mm0 \n\t" // surround
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1519 "movq 3080(%0, %%esi), %%mm1 \n\t" // surround
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1520 "pfsub %%mm0, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1521 "pfsub %%mm1, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1522 "pfadd %%mm0, %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1523 "pfadd %%mm1, %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1524 "movq %%mm2, (%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1525 "movq %%mm3, 8(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1526 "movq %%mm4, 1024(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1527 "movq %%mm5, 1032(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1528 "addl $16, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1529 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1530 :: "r" (samples+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1531 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1532 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1533 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1534
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1535 static void mix22toS_3dnow (sample_t * samples, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1536 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1537 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1538 "movd %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1539 "punpckldq %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1540 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1541 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1542 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1543 "movq 2048(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1544 "movq 2056(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1545 "pfadd 3072(%0, %%esi), %%mm0 \n\t" // surround
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1546 "pfadd 3080(%0, %%esi), %%mm1 \n\t" // surround
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1547 "movq (%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1548 "movq 8(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1549 "movq 1024(%0, %%esi), %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1550 "movq 1032(%0, %%esi), %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1551 "pfadd %%mm7, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1552 "pfadd %%mm7, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1553 "pfadd %%mm7, %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1554 "pfadd %%mm7, %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1555 "pfsub %%mm0, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1556 "pfsub %%mm1, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1557 "pfadd %%mm0, %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1558 "pfadd %%mm1, %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1559 "movq %%mm2, (%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1560 "movq %%mm3, 8(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1561 "movq %%mm4, 1024(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1562 "movq %%mm5, 1032(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1563 "addl $16, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1564 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1565 :: "r" (samples+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1566 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1567 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1568 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1569
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1570 static void mix32to2_3dnow (sample_t * samples, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1571 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1572 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1573 "movd %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1574 "punpckldq %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1575 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1576 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1577 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1578 "movq 1024(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1579 "movq 1032(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1580 "pfadd %%mm7, %%mm0 \n\t" // common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1581 "pfadd %%mm7, %%mm1 \n\t" // common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1582 "movq %%mm0, %%mm2 \n\t" // common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1583 "movq %%mm1, %%mm3 \n\t" // common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1584 "pfadd (%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1585 "pfadd 8(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1586 "pfadd 2048(%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1587 "pfadd 2056(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1588 "pfadd 3072(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1589 "pfadd 3080(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1590 "pfadd 4096(%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1591 "pfadd 4104(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1592 "movq %%mm0, (%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1593 "movq %%mm1, 8(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1594 "movq %%mm2, 1024(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1595 "movq %%mm3, 1032(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1596 "addl $16, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1597 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1598 :: "r" (samples+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1599 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1600 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1601 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1602
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1603 /* todo: should be optimized better */
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1604 static void mix32toS_3dnow (sample_t * samples, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1605 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1606 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1607 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1608 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1609 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1610 "movd %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1611 "punpckldq %1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1612 "movq 1024(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1613 "movq 1032(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1614 "movq 3072(%0, %%esi), %%mm4 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1615 "movq 3080(%0, %%esi), %%mm5 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1616 "pfadd %%mm7, %%mm0 \n\t" // common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1617 "pfadd %%mm7, %%mm1 \n\t" // common
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1618 "pfadd 4096(%0, %%esi), %%mm4 \n\t" // surround
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1619 "pfadd 4104(%0, %%esi), %%mm5 \n\t" // surround
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1620 "movq (%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1621 "movq 8(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1622 "movq 2048(%0, %%esi), %%mm6 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1623 "movq 2056(%0, %%esi), %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1624 "pfsub %%mm4, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1625 "pfsub %%mm5, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1626 "pfadd %%mm4, %%mm6 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1627 "pfadd %%mm5, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1628 "pfadd %%mm0, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1629 "pfadd %%mm1, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1630 "pfadd %%mm0, %%mm6 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1631 "pfadd %%mm1, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1632 "movq %%mm2, (%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1633 "movq %%mm3, 8(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1634 "movq %%mm6, 1024(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1635 "movq %%mm7, 1032(%0, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1636 "addl $16, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1637 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1638 :: "r" (samples+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1639 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1640 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1641 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1642
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1643 static void move2to1_3dnow (sample_t * src, sample_t * dest, sample_t bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1644 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1645 asm volatile(
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1646 "movd %2, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1647 "punpckldq %2, %%mm7 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1648 "movl $-1024, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1649 ".balign 16\n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1650 "1: \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1651 "movq (%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1652 "movq 8(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1653 "movq 16(%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1654 "movq 24(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1655 "pfadd 1024(%0, %%esi), %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1656 "pfadd 1032(%0, %%esi), %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1657 "pfadd 1040(%0, %%esi), %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1658 "pfadd 1048(%0, %%esi), %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1659 "pfadd %%mm7, %%mm0 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1660 "pfadd %%mm7, %%mm1 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1661 "pfadd %%mm7, %%mm2 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1662 "pfadd %%mm7, %%mm3 \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1663 "movq %%mm0, (%1, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1664 "movq %%mm1, 8(%1, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1665 "movq %%mm2, 16(%1, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1666 "movq %%mm3, 24(%1, %%esi) \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1667 "addl $32, %%esi \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1668 " jnz 1b \n\t"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1669 :: "r" (src+256), "r" (dest+256), "m" (bias)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1670 : "%esi"
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1671 );
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1672 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1673
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1674 static void downmix_3dnow (sample_t * samples, int acmod, int output, sample_t bias,
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1675 sample_t clev, sample_t slev)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1676 {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1677 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1678
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1679 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1680 memcpy (samples, samples + 256, 256 * sizeof (sample_t));
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1681 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1682
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1683 case CONVERT (A52_CHANNEL, A52_MONO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1684 case CONVERT (A52_STEREO, A52_MONO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1685 mix_2to1_3dnow:
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1686 mix2to1_3dnow (samples, samples + 256, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1687 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1688
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1689 case CONVERT (A52_2F1R, A52_MONO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1690 if (slev == 0)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1691 goto mix_2to1_3dnow;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1692 case CONVERT (A52_3F, A52_MONO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1693 mix_3to1_3dnow:
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1694 mix3to1_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1695 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1696
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1697 case CONVERT (A52_3F1R, A52_MONO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1698 if (slev == 0)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1699 goto mix_3to1_3dnow;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1700 case CONVERT (A52_2F2R, A52_MONO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1701 if (slev == 0)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1702 goto mix_2to1_3dnow;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1703 mix4to1_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1704 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1705
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1706 case CONVERT (A52_3F2R, A52_MONO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1707 if (slev == 0)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1708 goto mix_3to1_3dnow;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1709 mix5to1_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1710 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1711
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1712 case CONVERT (A52_MONO, A52_DOLBY):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1713 memcpy (samples + 256, samples, 256 * sizeof (sample_t));
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1714 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1715
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1716 case CONVERT (A52_3F, A52_STEREO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1717 case CONVERT (A52_3F, A52_DOLBY):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1718 mix_3to2_3dnow:
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1719 mix3to2_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1720 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1721
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1722 case CONVERT (A52_2F1R, A52_STEREO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1723 if (slev == 0)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1724 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1725 mix21to2_3dnow (samples, samples + 256, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1726 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1727
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1728 case CONVERT (A52_2F1R, A52_DOLBY):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1729 mix21toS_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1730 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1731
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1732 case CONVERT (A52_3F1R, A52_STEREO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1733 if (slev == 0)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1734 goto mix_3to2_3dnow;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1735 mix31to2_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1736 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1737
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1738 case CONVERT (A52_3F1R, A52_DOLBY):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1739 mix31toS_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1740 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1741
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1742 case CONVERT (A52_2F2R, A52_STEREO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1743 if (slev == 0)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1744 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1745 mix2to1_3dnow (samples, samples + 512, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1746 mix2to1_3dnow (samples + 256, samples + 768, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1747 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1748
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1749 case CONVERT (A52_2F2R, A52_DOLBY):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1750 mix22toS_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1751 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1752
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1753 case CONVERT (A52_3F2R, A52_STEREO):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1754 if (slev == 0)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1755 goto mix_3to2_3dnow;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1756 mix32to2_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1757 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1758
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1759 case CONVERT (A52_3F2R, A52_DOLBY):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1760 mix32toS_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1761 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1762
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1763 case CONVERT (A52_3F1R, A52_3F):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1764 if (slev == 0)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1765 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1766 mix21to2_3dnow (samples, samples + 512, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1767 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1768
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1769 case CONVERT (A52_3F2R, A52_3F):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1770 if (slev == 0)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1771 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1772 mix2to1_3dnow (samples, samples + 768, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1773 mix2to1_3dnow (samples + 512, samples + 1024, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1774 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1775
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1776 case CONVERT (A52_3F1R, A52_2F1R):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1777 mix3to2_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1778 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1779 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1780
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1781 case CONVERT (A52_2F2R, A52_2F1R):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1782 mix2to1_3dnow (samples + 512, samples + 768, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1783 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1784
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1785 case CONVERT (A52_3F2R, A52_2F1R):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1786 mix3to2_3dnow (samples, bias); //FIXME possible bug? (output doesnt seem to be used)
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1787 move2to1_3dnow (samples + 768, samples + 512, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1788 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1789
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1790 case CONVERT (A52_3F2R, A52_3F1R):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1791 mix2to1_3dnow (samples + 768, samples + 1024, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1792 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1793
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1794 case CONVERT (A52_2F1R, A52_2F2R):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1795 memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1796 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1797
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1798 case CONVERT (A52_3F1R, A52_2F2R):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1799 mix3to2_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1800 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1801 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1802
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1803 case CONVERT (A52_3F2R, A52_2F2R):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1804 mix3to2_3dnow (samples, bias);
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1805 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1806 memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t));
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1807 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1808
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1809 case CONVERT (A52_3F1R, A52_3F2R):
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1810 memcpy (samples + 1027, samples + 768, 256 * sizeof (sample_t));
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1811 break;
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1812 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1813 __asm __volatile("femms":::"memory");
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1814 }
ef2abfbbd1df 3dnow optimization. Not all functions are tested!!!
nick
parents: 3910
diff changeset
1815
3904
848d848521b9 runtime cpudetect
michael
parents: 3741
diff changeset
1816 #endif //ARCH_X86