annotate liba52/downmix.c @ 16915:6b1d1e4adaea

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