annotate liba52/downmix.c @ 19257:fb837e2ab413

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