annotate liba52/downmix.c @ 3724:a2325883c46c

vplayer format - no longer crashes on slightly broken subs.
author eyck
date Tue, 25 Dec 2001 01:32:04 +0000
parents f74f4524de6a
children 5c1da9bc17a3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
1 /*
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
2 * downmix.c
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
3 * Copyright (C) 2000-2001 Michel Lespinasse <walken@zoy.org>
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
5 *
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
6 * This file is part of a52dec, a free ATSC A-52 stream decoder.
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
7 * See http://liba52.sourceforge.net/ for updates.
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
8 *
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
9 * a52dec is free software; you can redistribute it and/or modify
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
12 * (at your option) any later version.
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
13 *
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
14 * a52dec is distributed in the hope that it will be useful,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
17 * GNU General Public License for more details.
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
18 *
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3625
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
22 *
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
23 * SSE optimizations from Michael Niedermayer (michaelni@gmx.at)
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
24 */
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
25
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
26 #include "config.h"
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
27
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
28 #include <string.h>
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
29 #include <inttypes.h>
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
30
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
31 #include "a52.h"
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
32 #include "a52_internal.h"
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
33
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
34 #define CONVERT(acmod,output) (((output) << 3) + (acmod))
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
35
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
36 int downmix_init (int input, int flags, sample_t * level,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
37 sample_t clev, sample_t slev)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
38 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
39 static uint8_t table[11][8] = {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
40 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
41 A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
42 {A52_MONO, A52_MONO, A52_MONO, A52_MONO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
43 A52_MONO, A52_MONO, A52_MONO, A52_MONO},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
44 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
45 A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
46 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
47 A52_STEREO, A52_3F, A52_STEREO, A52_3F},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
48 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
49 A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
50 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
51 A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
52 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
53 A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
54 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
55 A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
56 {A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
57 A52_MONO, A52_MONO, A52_MONO, A52_MONO},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
58 {A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
59 A52_MONO, A52_MONO, A52_MONO, A52_MONO},
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
60 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
61 A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY}
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
62 };
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
63 int output;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
64
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
65 output = flags & A52_CHANNEL_MASK;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
66 if (output > A52_DOLBY)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
67 return -1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
68
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
69 output = table[output][input & 7];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
70
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
71 if ((output == A52_STEREO) &&
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
72 ((input == A52_DOLBY) || ((input == A52_3F) && (clev == LEVEL_3DB))))
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
73 output = A52_DOLBY;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
74
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
75 if (flags & A52_ADJUST_LEVEL)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
76 switch (CONVERT (input & 7, output)) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
77
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
78 case CONVERT (A52_3F, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
79 *level *= LEVEL_3DB / (1 + clev);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
80 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
81
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
82 case CONVERT (A52_STEREO, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
83 case CONVERT (A52_2F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
84 case CONVERT (A52_3F2R, A52_3F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
85 level_3db:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
86 *level *= LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
87 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
88
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
89 case CONVERT (A52_3F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
90 if (clev < LEVEL_PLUS3DB - 1)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
91 goto level_3db;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
92 /* break thru */
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
93 case CONVERT (A52_3F, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
94 case CONVERT (A52_3F1R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
95 case CONVERT (A52_3F1R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
96 case CONVERT (A52_3F2R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
97 *level /= 1 + clev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
98 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
99
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
100 case CONVERT (A52_2F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
101 *level *= LEVEL_PLUS3DB / (2 + slev);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
102 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
103
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
104 case CONVERT (A52_2F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
105 case CONVERT (A52_3F1R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
106 *level /= 1 + slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
107 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
108
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
109 case CONVERT (A52_3F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
110 *level *= LEVEL_3DB / (1 + clev + 0.5 * slev);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
111 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
112
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
113 case CONVERT (A52_3F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
114 *level /= 1 + clev + slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
115 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
116
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
117 case CONVERT (A52_2F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
118 *level *= LEVEL_3DB / (1 + slev);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
119 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
120
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
121 case CONVERT (A52_2F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
122 case CONVERT (A52_3F2R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
123 *level /= 1 + slev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
124 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
125
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
126 case CONVERT (A52_3F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
127 *level *= LEVEL_3DB / (1 + clev + slev);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
128 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
129
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
130 case CONVERT (A52_3F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
131 *level /= 1 + clev + 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_MONO, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
135 *level *= LEVEL_PLUS3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
136 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
137
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
138 case CONVERT (A52_3F, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
139 case CONVERT (A52_2F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
140 *level *= 1 / (1 + LEVEL_3DB);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
141 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
142
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
143 case CONVERT (A52_3F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
144 case CONVERT (A52_2F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
145 *level *= 1 / (1 + 2 * LEVEL_3DB);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
146 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
147
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
148 case CONVERT (A52_3F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
149 *level *= 1 / (1 + 3 * LEVEL_3DB);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
150 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
151 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
152
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
153 return output;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
154 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
155
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
156 int downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
157 sample_t clev, sample_t slev)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
158 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
159 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
160
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
161 case CONVERT (A52_CHANNEL, A52_CHANNEL):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
162 case CONVERT (A52_MONO, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
163 case CONVERT (A52_STEREO, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
164 case CONVERT (A52_3F, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
165 case CONVERT (A52_2F1R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
166 case CONVERT (A52_3F1R, A52_3F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
167 case CONVERT (A52_2F2R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
168 case CONVERT (A52_3F2R, A52_3F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
169 case CONVERT (A52_STEREO, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
170 coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
171 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
172
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
173 case CONVERT (A52_CHANNEL, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
174 coeff[0] = coeff[1] = level * LEVEL_6DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
175 return 3;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
176
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
177 case CONVERT (A52_STEREO, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
178 coeff[0] = coeff[1] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
179 return 3;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
180
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
181 case CONVERT (A52_3F, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
182 coeff[0] = coeff[2] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
183 coeff[1] = level * clev * LEVEL_PLUS3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
184 return 7;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
185
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
186 case CONVERT (A52_2F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
187 coeff[0] = coeff[1] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
188 coeff[2] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
189 return 7;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
190
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
191 case CONVERT (A52_2F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
192 coeff[0] = coeff[1] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
193 coeff[2] = coeff[3] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
194 return 15;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
195
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
196 case CONVERT (A52_3F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
197 coeff[0] = coeff[2] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
198 coeff[1] = level * clev * LEVEL_PLUS3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
199 coeff[3] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
200 return 15;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
201
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
202 case CONVERT (A52_3F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
203 coeff[0] = coeff[2] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
204 coeff[1] = level * clev * LEVEL_PLUS3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
205 coeff[3] = coeff[4] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
206 return 31;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
207
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
208 case CONVERT (A52_MONO, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
209 coeff[0] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
210 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
211
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
212 case CONVERT (A52_3F, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
213 clev = LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
214 case CONVERT (A52_3F, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
215 case CONVERT (A52_3F1R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
216 case CONVERT (A52_3F2R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
217 coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
218 coeff[1] = level * clev;
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_2F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
222 slev = 1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
223 case CONVERT (A52_2F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
224 coeff[0] = coeff[1] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
225 coeff[2] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
226 return 7;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
227
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
228 case CONVERT (A52_3F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
229 clev = LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
230 slev = 1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
231 case CONVERT (A52_3F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
232 coeff[0] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
233 coeff[1] = level * clev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
234 coeff[3] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
235 return 15;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
236
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
237 case CONVERT (A52_2F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
238 slev = LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
239 case CONVERT (A52_2F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
240 coeff[0] = coeff[1] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
241 coeff[2] = coeff[3] = level * slev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
242 return 15;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
243
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
244 case CONVERT (A52_3F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
245 clev = LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
246 case CONVERT (A52_3F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
247 slev = LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
248 case CONVERT (A52_3F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
249 coeff[0] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
250 coeff[1] = level * clev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
251 coeff[3] = coeff[4] = level * slev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
252 return 31;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
253
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
254 case CONVERT (A52_3F1R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
255 coeff[0] = coeff[1] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
256 coeff[3] = level * slev * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
257 return 13;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
258
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
259 case CONVERT (A52_3F2R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
260 coeff[0] = coeff[1] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
261 coeff[3] = coeff[4] = level * slev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
262 return 29;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
263
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
264 case CONVERT (A52_2F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
265 coeff[0] = coeff[1] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
266 coeff[2] = coeff[3] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
267 return 12;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
268
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
269 case CONVERT (A52_3F2R, A52_3F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
270 coeff[0] = coeff[1] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
271 coeff[3] = coeff[4] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
272 return 24;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
273
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
274 case CONVERT (A52_2F1R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
275 coeff[0] = coeff[1] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
276 coeff[2] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
277 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
278
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
279 case CONVERT (A52_3F1R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
280 coeff[0] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
281 coeff[1] = level * clev;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
282 coeff[3] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
283 return 7;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
284
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
285 case CONVERT (A52_3F1R, A52_3F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
286 coeff[0] = coeff[1] = coeff[2] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
287 coeff[3] = level * LEVEL_3DB;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
288 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
289
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
290 case CONVERT (A52_CHANNEL, A52_CHANNEL1):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
291 coeff[0] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
292 coeff[1] = 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
293 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
294
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
295 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
296 coeff[0] = 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
297 coeff[1] = level;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
298 return 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
299 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
300
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
301 return -1; /* NOTREACHED */
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
302 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
303
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
304 static void mix2to1 (sample_t * dest, sample_t * src, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
305 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
306 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
307
3675
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
308 #ifdef HAVE_SSE
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
309 asm volatile(
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
310 "movlps %2, %%xmm7 \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
311 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
312 "movl $-1024, %%esi \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
313 "1: \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
314 "movaps (%0, %%esi), %%xmm0 \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
315 "movaps 16(%0, %%esi), %%xmm1 \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
316 "addps (%1, %%esi), %%xmm0 \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
317 "addps 16(%1, %%esi), %%xmm1 \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
318 "addps %%xmm7, %%xmm0 \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
319 "addps %%xmm7, %%xmm1 \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
320 "movaps %%xmm0, (%1, %%esi) \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
321 "movaps %%xmm1, 16(%1, %%esi) \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
322 "addl $32, %%esi \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
323 " jnz 1b \n\t"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
324 :: "r" (src+256), "r" (dest+256), "m" (bias)
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
325 : "%esi"
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
326 );
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
327 #else
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
328 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
329 dest[i] += src[i] + bias;
3675
a6f4cce5001a mix2to1 in SSE
michael
parents: 3625
diff changeset
330 #endif
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
331 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
332
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
333 static void mix3to1 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
334 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
335 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
336
3679
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
337 #ifdef HAVE_SSE
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
338 asm volatile(
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
339 "movlps %1, %%xmm7 \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
340 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
341 "movl $-1024, %%esi \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
342 "1: \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
343 "movaps (%0, %%esi), %%xmm0 \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
344 "movaps 1024(%0, %%esi), %%xmm1 \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
345 "addps 2048(%0, %%esi), %%xmm0 \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
346 "addps %%xmm7, %%xmm1 \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
347 "addps %%xmm1, %%xmm0 \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
348 "movaps %%xmm0, (%0, %%esi) \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
349 "addl $16, %%esi \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
350 " jnz 1b \n\t"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
351 :: "r" (samples+256), "m" (bias)
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
352 : "%esi"
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
353 );
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
354 #else
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
355 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
356 samples[i] += samples[i + 256] + samples[i + 512] + bias;
3679
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
357 #endif
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
358 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
359
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
360 static void mix4to1 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
361 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
362 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
363
3679
f74f4524de6a mix3to1 in SSE
michael
parents: 3678
diff changeset
364 #ifdef HAVE_SSE
3677
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
365 asm volatile(
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
366 "movlps %1, %%xmm7 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
367 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
368 "movl $-1024, %%esi \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
369 "1: \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
370 "movaps (%0, %%esi), %%xmm0 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
371 "movaps 1024(%0, %%esi), %%xmm1 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
372 "addps 2048(%0, %%esi), %%xmm0 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
373 "addps 3072(%0, %%esi), %%xmm1 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
374 "addps %%xmm7, %%xmm0 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
375 "addps %%xmm1, %%xmm0 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
376 "movaps %%xmm0, (%0, %%esi) \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
377 "addl $16, %%esi \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
378 " jnz 1b \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
379 :: "r" (samples+256), "m" (bias)
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
380 : "%esi"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
381 );
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
382 #else
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
383 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
384 samples[i] += (samples[i + 256] + samples[i + 512] +
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
385 samples[i + 768] + bias);
3677
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
386 #endif
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
387 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
388
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
389 static void mix5to1 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
390 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
391 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
392
3677
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
393 #ifdef HAVE_SSE
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
394 asm volatile(
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
395 "movlps %1, %%xmm7 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
396 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
397 "movl $-1024, %%esi \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
398 "1: \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
399 "movaps (%0, %%esi), %%xmm0 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
400 "movaps 1024(%0, %%esi), %%xmm1 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
401 "addps 2048(%0, %%esi), %%xmm0 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
402 "addps 3072(%0, %%esi), %%xmm1 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
403 "addps %%xmm7, %%xmm0 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
404 "addps 4096(%0, %%esi), %%xmm1 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
405 "addps %%xmm1, %%xmm0 \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
406 "movaps %%xmm0, (%0, %%esi) \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
407 "addl $16, %%esi \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
408 " jnz 1b \n\t"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
409 :: "r" (samples+256), "m" (bias)
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
410 : "%esi"
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
411 );
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
412 #else
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
413 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
414 samples[i] += (samples[i + 256] + samples[i + 512] +
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
415 samples[i + 768] + samples[i + 1024] + bias);
3677
2a36c3d11dbd mix5to1 & mix4to1 in SSE
michael
parents: 3675
diff changeset
416 #endif
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
417 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
418
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
419 static void mix3to2 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
420 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
421 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
422 sample_t common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
423
3678
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
424 #ifdef HAVE_SSE
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
425 asm volatile(
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
426 "movlps %1, %%xmm7 \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
427 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
428 "movl $-1024, %%esi \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
429 "1: \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
430 "movaps 1024(%0, %%esi), %%xmm0 \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
431 "addps %%xmm7, %%xmm0 \n\t" //common
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
432 "movaps (%0, %%esi), %%xmm1 \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
433 "movaps 2048(%0, %%esi), %%xmm2 \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
434 "addps %%xmm0, %%xmm1 \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
435 "addps %%xmm0, %%xmm2 \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
436 "movaps %%xmm1, (%0, %%esi) \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
437 "movaps %%xmm2, 1024(%0, %%esi) \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
438 "addl $16, %%esi \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
439 " jnz 1b \n\t"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
440 :: "r" (samples+256), "m" (bias)
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
441 : "%esi"
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
442 );
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
443 #else
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
444 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
445 common = samples[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
446 samples[i] += common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
447 samples[i + 256] = samples[i + 512] + common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
448 }
3678
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
449 #endif
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
450 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
451
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
452 static void mix21to2 (sample_t * left, sample_t * right, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
453 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
454 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
455 sample_t common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
456
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
457 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
458 common = right[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
459 left[i] += common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
460 right[i] += common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
461 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
462 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
463
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
464 static void mix21toS (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
465 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
466 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
467 sample_t surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
468
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
469 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
470 surround = samples[i + 512];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
471 samples[i] += bias - surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
472 samples[i + 256] += bias + surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
473 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
474 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
475
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
476 static void mix31to2 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
477 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
478 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
479 sample_t common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
480
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
481 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
482 common = samples[i + 256] + samples[i + 768] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
483 samples[i] += common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
484 samples[i + 256] = samples[i + 512] + common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
485 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
486 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
487
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
488 static void mix31toS (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
489 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
490 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
491 sample_t common, surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
492
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
493 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
494 common = samples[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
495 surround = samples[i + 768];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
496 samples[i] += common - surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
497 samples[i + 256] = samples[i + 512] + common + surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
498 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
499 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
500
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
501 static void mix22toS (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
502 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
503 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
504 sample_t surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
505
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
506 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
507 surround = samples[i + 512] + samples[i + 768];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
508 samples[i] += bias - surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
509 samples[i + 256] += bias + surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
510 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
511 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
512
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
513 static void mix32to2 (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
514 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
515 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
516 sample_t common;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
517
3624
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
518 #ifdef HAVE_SSE
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
519 asm volatile(
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
520 "movlps %1, %%xmm7 \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
521 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
522 "movl $-1024, %%esi \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
523 "1: \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
524 "movaps 1024(%0, %%esi), %%xmm0 \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
525 "addps %%xmm7, %%xmm0 \n\t" // common
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
526 "movaps %%xmm0, %%xmm1 \n\t" // common
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
527 "addps (%0, %%esi), %%xmm0 \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
528 "addps 2048(%0, %%esi), %%xmm1 \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
529 "addps 3072(%0, %%esi), %%xmm0 \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
530 "addps 4096(%0, %%esi), %%xmm1 \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
531 "movaps %%xmm0, (%0, %%esi) \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
532 "movaps %%xmm1, 1024(%0, %%esi) \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
533 "addl $16, %%esi \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
534 " jnz 1b \n\t"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
535 :: "r" (samples+256), "m" (bias)
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
536 : "%esi"
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
537 );
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
538 #else
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
539 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
540 common = samples[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
541 samples[i] += common + samples[i + 768];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
542 samples[i + 256] = common + samples[i + 512] + samples[i + 1024];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
543 }
3624
0e4ff1cac6a2 sse opt of mix32to2()
michael
parents: 3394
diff changeset
544 #endif
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
545 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
546
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
547 static void mix32toS (sample_t * samples, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
548 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
549 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
550 sample_t common, surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
551
3625
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
552 #ifdef HAVE_SSE
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
553 asm volatile(
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
554 "movlps %1, %%xmm7 \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
555 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
556 "movl $-1024, %%esi \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
557 "1: \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
558 "movaps 1024(%0, %%esi), %%xmm0 \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
559 "movaps 3072(%0, %%esi), %%xmm2 \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
560 "addps %%xmm7, %%xmm0 \n\t" // common
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
561 "addps 4096(%0, %%esi), %%xmm2 \n\t" // surround
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
562 "movaps (%0, %%esi), %%xmm1 \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
563 "movaps 2048(%0, %%esi), %%xmm3 \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
564 "subps %%xmm2, %%xmm1 \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
565 "addps %%xmm2, %%xmm3 \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
566 "addps %%xmm0, %%xmm1 \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
567 "addps %%xmm0, %%xmm3 \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
568 "movaps %%xmm1, (%0, %%esi) \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
569 "movaps %%xmm3, 1024(%0, %%esi) \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
570 "addl $16, %%esi \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
571 " jnz 1b \n\t"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
572 :: "r" (samples+256), "m" (bias)
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
573 : "%esi"
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
574 );
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
575 #else
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
576 for (i = 0; i < 256; i++) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
577 common = samples[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
578 surround = samples[i + 768] + samples[i + 1024];
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
579 samples[i] += common - surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
580 samples[i + 256] = samples[i + 512] + common + surround;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
581 }
3625
84ff13d4540c sse opt of mix32toS()
michael
parents: 3624
diff changeset
582 #endif
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
583 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
584
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
585 static void move2to1 (sample_t * src, sample_t * dest, sample_t bias)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
586 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
587 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
588
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
589 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
590 dest[i] = src[i] + src[i + 256] + bias;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
591 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
592
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
593 static void zero (sample_t * samples)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
594 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
595 int i;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
596
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
597 for (i = 0; i < 256; i++)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
598 samples[i] = 0;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
599 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
600
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
601 void downmix (sample_t * samples, int acmod, int output, sample_t bias,
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
602 sample_t clev, sample_t slev)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
603 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
604 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
605
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
606 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
607 memcpy (samples, samples + 256, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
608 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
609
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
610 case CONVERT (A52_CHANNEL, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
611 case CONVERT (A52_STEREO, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
612 mix_2to1:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
613 mix2to1 (samples, samples + 256, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
614 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
615
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
616 case CONVERT (A52_2F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
617 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
618 goto mix_2to1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
619 case CONVERT (A52_3F, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
620 mix_3to1:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
621 mix3to1 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
622 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
623
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
624 case CONVERT (A52_3F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
625 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
626 goto mix_3to1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
627 case CONVERT (A52_2F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
628 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
629 goto mix_2to1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
630 mix4to1 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
631 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
632
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
633 case CONVERT (A52_3F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
634 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
635 goto mix_3to1;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
636 mix5to1 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
637 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
638
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
639 case CONVERT (A52_MONO, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
640 memcpy (samples + 256, samples, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
641 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
642
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
643 case CONVERT (A52_3F, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
644 case CONVERT (A52_3F, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
645 mix_3to2:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
646 mix3to2 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
647 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
648
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
649 case CONVERT (A52_2F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
650 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
651 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
652 mix21to2 (samples, samples + 256, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
653 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
654
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
655 case CONVERT (A52_2F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
656 mix21toS (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
657 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
658
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
659 case CONVERT (A52_3F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
660 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
661 goto mix_3to2;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
662 mix31to2 (samples, bias);
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_3F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
666 mix31toS (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
667 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
668
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
669 case CONVERT (A52_2F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
670 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
671 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
672 mix2to1 (samples, samples + 512, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
673 mix2to1 (samples + 256, samples + 768, bias);
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_2F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
677 mix22toS (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
678 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
679
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
680 case CONVERT (A52_3F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
681 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
682 goto mix_3to2;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
683 mix32to2 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
684 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
685
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
686 case CONVERT (A52_3F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
687 mix32toS (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
688 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
689
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
690 case CONVERT (A52_3F1R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
691 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
692 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
693 mix21to2 (samples, samples + 512, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
694 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
695
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
696 case CONVERT (A52_3F2R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
697 if (slev == 0)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
698 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
699 mix2to1 (samples, samples + 768, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
700 mix2to1 (samples + 512, samples + 1024, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
701 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
702
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
703 case CONVERT (A52_3F1R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
704 mix3to2 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
705 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
706 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
707
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
708 case CONVERT (A52_2F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
709 mix2to1 (samples + 512, samples + 768, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
710 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
711
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
712 case CONVERT (A52_3F2R, A52_2F1R):
3678
265680bbdcfd mix3to2 in SSE
michael
parents: 3677
diff changeset
713 mix3to2 (samples, bias); //FIXME possible bug? (output doesnt seem to be used)
3394
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
714 move2to1 (samples + 768, samples + 512, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
715 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
716
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
717 case CONVERT (A52_3F2R, A52_3F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
718 mix2to1 (samples + 768, samples + 1024, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
719 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
720
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
721 case CONVERT (A52_2F1R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
722 memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
723 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
724
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
725 case CONVERT (A52_3F1R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
726 mix3to2 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
727 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
728 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
729
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
730 case CONVERT (A52_3F2R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
731 mix3to2 (samples, bias);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
732 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
733 memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
734 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
735
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
736 case CONVERT (A52_3F1R, A52_3F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
737 memcpy (samples + 1027, samples + 768, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
738 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
739 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
740 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
741
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
742 void upmix (sample_t * samples, int acmod, int output)
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
743 {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
744 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
745
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
746 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
747 memcpy (samples + 256, samples, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
748 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
749
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
750 case CONVERT (A52_3F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
751 zero (samples + 1024);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
752 case CONVERT (A52_3F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
753 case CONVERT (A52_2F2R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
754 zero (samples + 768);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
755 case CONVERT (A52_3F, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
756 case CONVERT (A52_2F1R, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
757 zero (samples + 512);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
758 case CONVERT (A52_CHANNEL, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
759 case CONVERT (A52_STEREO, A52_MONO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
760 zero (samples + 256);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
761 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
762
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
763 case CONVERT (A52_3F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
764 case CONVERT (A52_3F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
765 zero (samples + 1024);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
766 case CONVERT (A52_3F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
767 case CONVERT (A52_3F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
768 zero (samples + 768);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
769 case CONVERT (A52_3F, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
770 case CONVERT (A52_3F, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
771 mix_3to2:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
772 memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
773 zero (samples + 256);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
774 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
775
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
776 case CONVERT (A52_2F2R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
777 case CONVERT (A52_2F2R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
778 zero (samples + 768);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
779 case CONVERT (A52_2F1R, A52_STEREO):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
780 case CONVERT (A52_2F1R, A52_DOLBY):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
781 zero (samples + 512);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
782 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
783
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
784 case CONVERT (A52_3F2R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
785 zero (samples + 1024);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
786 case CONVERT (A52_3F1R, A52_3F):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
787 case CONVERT (A52_2F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
788 zero (samples + 768);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
789 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
790
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
791 case CONVERT (A52_3F2R, A52_3F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
792 zero (samples + 1024);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
793 break;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
794
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
795 case CONVERT (A52_3F2R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
796 zero (samples + 1024);
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
797 case CONVERT (A52_3F1R, A52_2F1R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
798 mix_31to21:
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
799 memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
800 goto mix_3to2;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
801
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
802 case CONVERT (A52_3F2R, A52_2F2R):
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
803 memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
804 goto mix_31to21;
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
805 }
35b18ed357c2 imported from liba52 CVS
arpi
parents:
diff changeset
806 }