annotate liba52/downmix.c @ 29484:be1d733d84e8

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