annotate liba52/downmix.c @ 2325:1180a04d64c5 libavcodec

Miro VideoXL (VIXL) decoder, courtesy of Konstantin Shishkov
author melanson
date Wed, 27 Oct 2004 04:30:48 +0000
parents e101d1cffec6
children 0b546eab515d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
1 /*
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
2 * downmix.c
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
3 * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
5 *
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
6 * This file is part of a52dec, a free ATSC A-52 stream decoder.
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
7 * See http://liba52.sourceforge.net/ for updates.
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
8 *
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
9 * a52dec is free software; you can redistribute it and/or modify
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
12 * (at your option) any later version.
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
13 *
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
14 * a52dec is distributed in the hope that it will be useful,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
17 * GNU General Public License for more details.
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
18 *
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
22 */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
23 #include "a52.h"
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
24 #include "a52_internal.h"
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
25
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
26 #define CONVERT(acmod,output) (((output) << 3) + (acmod))
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
27
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
28 int a52_downmix_init (int input, int flags, level_t * level,
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
29 level_t clev, level_t slev)
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
30 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
31 static uint8_t table[11][8] = {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
32 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
33 A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO},
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
34 {A52_MONO, A52_MONO, A52_MONO, A52_MONO,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
35 A52_MONO, A52_MONO, A52_MONO, A52_MONO},
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
36 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
37 A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO},
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
38 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
39 A52_STEREO, A52_3F, A52_STEREO, A52_3F},
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
40 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
41 A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R},
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
42 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
43 A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R},
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
44 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
45 A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R},
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
46 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
47 A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R},
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
48 {A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
49 A52_MONO, A52_MONO, A52_MONO, A52_MONO},
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
50 {A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
51 A52_MONO, A52_MONO, A52_MONO, A52_MONO},
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
52 {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY,
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
53 A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY}
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
54 };
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
55 int output;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
56
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
57 output = flags & A52_CHANNEL_MASK;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
58 if (output > A52_DOLBY)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
59 return -1;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
60
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
61 output = table[output][input & 7];
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
62
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
63 if (output == A52_STEREO &&
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
64 (input == A52_DOLBY || (input == A52_3F && clev == LEVEL (LEVEL_3DB))))
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
65 output = A52_DOLBY;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
66
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
67 if (flags & A52_ADJUST_LEVEL) {
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
68 level_t adjust;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
69
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
70 switch (CONVERT (input & 7, output)) {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
71
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
72 case CONVERT (A52_3F, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
73 adjust = DIV (LEVEL_3DB, LEVEL (1) + clev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
74 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
75
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
76 case CONVERT (A52_STEREO, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
77 case CONVERT (A52_2F2R, A52_2F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
78 case CONVERT (A52_3F2R, A52_3F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
79 level_3db:
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
80 adjust = LEVEL (LEVEL_3DB);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
81 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
82
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
83 case CONVERT (A52_3F2R, A52_2F1R):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
84 if (clev < LEVEL (LEVEL_PLUS3DB - 1))
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
85 goto level_3db;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
86 /* break thru */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
87 case CONVERT (A52_3F, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
88 case CONVERT (A52_3F1R, A52_2F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
89 case CONVERT (A52_3F1R, A52_2F2R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
90 case CONVERT (A52_3F2R, A52_2F2R):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
91 adjust = DIV (1, LEVEL (1) + clev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
92 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
93
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
94 case CONVERT (A52_2F1R, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
95 adjust = DIV (LEVEL_PLUS3DB, LEVEL (2) + slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
96 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
97
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
98 case CONVERT (A52_2F1R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
99 case CONVERT (A52_3F1R, A52_3F):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
100 adjust = DIV (1, LEVEL (1) + MUL_C (slev, LEVEL_3DB));
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
101 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
102
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
103 case CONVERT (A52_3F1R, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
104 adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + MUL_C (slev, 0.5));
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
105 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
106
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
107 case CONVERT (A52_3F1R, A52_STEREO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
108 adjust = DIV (1, LEVEL (1) + clev + MUL_C (slev, LEVEL_3DB));
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
109 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
110
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
111 case CONVERT (A52_2F2R, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
112 adjust = DIV (LEVEL_3DB, LEVEL (1) + slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
113 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
114
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
115 case CONVERT (A52_2F2R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
116 case CONVERT (A52_3F2R, A52_3F):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
117 adjust = DIV (1, LEVEL (1) + slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
118 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
119
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
120 case CONVERT (A52_3F2R, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
121 adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
122 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
123
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
124 case CONVERT (A52_3F2R, A52_STEREO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
125 adjust = DIV (1, LEVEL (1) + clev + slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
126 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
127
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
128 case CONVERT (A52_MONO, A52_DOLBY):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
129 adjust = LEVEL (LEVEL_PLUS3DB);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
130 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
131
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
132 case CONVERT (A52_3F, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
133 case CONVERT (A52_2F1R, A52_DOLBY):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
134 adjust = LEVEL (1 / (1 + LEVEL_3DB));
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
135 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
136
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
137 case CONVERT (A52_3F1R, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
138 case CONVERT (A52_2F2R, A52_DOLBY):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
139 adjust = LEVEL (1 / (1 + 2 * LEVEL_3DB));
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
140 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
141
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
142 case CONVERT (A52_3F2R, A52_DOLBY):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
143 adjust = LEVEL (1 / (1 + 3 * LEVEL_3DB));
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
144 break;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
145
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
146 default:
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
147 return output;
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
148 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
149
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
150 *level = MUL_L (*level, adjust);
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
151 }
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
152
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
153 return output;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
154 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
155
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
156 int a52_downmix_coeff (level_t * coeff, int acmod, int output, level_t level,
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
157 level_t clev, level_t slev)
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
158 {
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
159 level_t level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
160
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
161 level_3db = MUL_C (level, LEVEL_3DB);
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
162
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
163 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
164
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
165 case CONVERT (A52_CHANNEL, A52_CHANNEL):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
166 case CONVERT (A52_MONO, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
167 case CONVERT (A52_STEREO, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
168 case CONVERT (A52_3F, A52_3F):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
169 case CONVERT (A52_2F1R, A52_2F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
170 case CONVERT (A52_3F1R, A52_3F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
171 case CONVERT (A52_2F2R, A52_2F2R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
172 case CONVERT (A52_3F2R, A52_3F2R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
173 case CONVERT (A52_STEREO, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
174 coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
175 return 0;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
176
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
177 case CONVERT (A52_CHANNEL, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
178 coeff[0] = coeff[1] = MUL_C (level, LEVEL_6DB);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
179 return 3;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
180
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
181 case CONVERT (A52_STEREO, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
182 coeff[0] = coeff[1] = level_3db;
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
183 return 3;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
184
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
185 case CONVERT (A52_3F, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
186 coeff[0] = coeff[2] = level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
187 coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
188 return 7;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
189
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
190 case CONVERT (A52_2F1R, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
191 coeff[0] = coeff[1] = level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
192 coeff[2] = MUL_L (level_3db, slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
193 return 7;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
194
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
195 case CONVERT (A52_2F2R, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
196 coeff[0] = coeff[1] = level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
197 coeff[2] = coeff[3] = MUL_L (level_3db, slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
198 return 15;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
199
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
200 case CONVERT (A52_3F1R, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
201 coeff[0] = coeff[2] = level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
202 coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB);
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
203 coeff[3] = MUL_L (level_3db, slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
204 return 15;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
205
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
206 case CONVERT (A52_3F2R, A52_MONO):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
207 coeff[0] = coeff[2] = level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
208 coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB);
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
209 coeff[3] = coeff[4] = MUL_L (level_3db, slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
210 return 31;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
211
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
212 case CONVERT (A52_MONO, A52_DOLBY):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
213 coeff[0] = level_3db;
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
214 return 0;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
215
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
216 case CONVERT (A52_3F, A52_DOLBY):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
217 coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
218 coeff[1] = level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
219 return 7;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
220
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
221 case CONVERT (A52_3F, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
222 case CONVERT (A52_3F1R, A52_2F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
223 case CONVERT (A52_3F2R, A52_2F2R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
224 coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
225 coeff[1] = MUL_L (level, clev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
226 return 7;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
227
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
228 case CONVERT (A52_2F1R, A52_DOLBY):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
229 coeff[0] = coeff[1] = level;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
230 coeff[2] = level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
231 return 7;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
232
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
233 case CONVERT (A52_2F1R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
234 coeff[0] = coeff[1] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
235 coeff[2] = MUL_L (level_3db, slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
236 return 7;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
237
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
238 case CONVERT (A52_3F1R, A52_DOLBY):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
239 coeff[0] = coeff[2] = level;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
240 coeff[1] = coeff[3] = level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
241 return 15;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
242
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
243 case CONVERT (A52_3F1R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
244 coeff[0] = coeff[2] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
245 coeff[1] = MUL_L (level, clev);
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
246 coeff[3] = MUL_L (level_3db, slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
247 return 15;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
248
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
249 case CONVERT (A52_2F2R, A52_DOLBY):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
250 coeff[0] = coeff[1] = level;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
251 coeff[2] = coeff[3] = level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
252 return 15;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
253
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
254 case CONVERT (A52_2F2R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
255 coeff[0] = coeff[1] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
256 coeff[2] = coeff[3] = MUL_L (level, slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
257 return 15;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
258
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
259 case CONVERT (A52_3F2R, A52_DOLBY):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
260 coeff[0] = coeff[2] = level;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
261 coeff[1] = coeff[3] = coeff[4] = level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
262 return 31;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
263
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
264 case CONVERT (A52_3F2R, A52_2F1R):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
265 coeff[0] = coeff[2] = level;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
266 coeff[1] = MUL_L (level, clev);
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
267 coeff[3] = coeff[4] = level_3db;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
268 return 31;
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
269
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
270 case CONVERT (A52_3F2R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
271 coeff[0] = coeff[2] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
272 coeff[1] = MUL_L (level, clev);
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
273 coeff[3] = coeff[4] = MUL_L (level, slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
274 return 31;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
275
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
276 case CONVERT (A52_3F1R, A52_3F):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
277 coeff[0] = coeff[1] = coeff[2] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
278 coeff[3] = MUL_L (level_3db, slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
279 return 13;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
280
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
281 case CONVERT (A52_3F2R, A52_3F):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
282 coeff[0] = coeff[1] = coeff[2] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
283 coeff[3] = coeff[4] = MUL_L (level, slev);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
284 return 29;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
285
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
286 case CONVERT (A52_2F2R, A52_2F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
287 coeff[0] = coeff[1] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
288 coeff[2] = coeff[3] = level_3db;
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
289 return 12;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
290
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
291 case CONVERT (A52_3F2R, A52_3F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
292 coeff[0] = coeff[1] = coeff[2] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
293 coeff[3] = coeff[4] = level_3db;
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
294 return 24;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
295
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
296 case CONVERT (A52_2F1R, A52_2F2R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
297 coeff[0] = coeff[1] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
298 coeff[2] = level_3db;
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
299 return 0;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
300
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
301 case CONVERT (A52_3F1R, A52_2F2R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
302 coeff[0] = coeff[2] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
303 coeff[1] = MUL_L (level, clev);
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
304 coeff[3] = level_3db;
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
305 return 7;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
306
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
307 case CONVERT (A52_3F1R, A52_3F2R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
308 coeff[0] = coeff[1] = coeff[2] = level;
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
309 coeff[3] = level_3db;
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
310 return 0;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
311
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
312 case CONVERT (A52_CHANNEL, A52_CHANNEL1):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
313 coeff[0] = level;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
314 coeff[1] = 0;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
315 return 0;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
316
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
317 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
318 coeff[0] = 0;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
319 coeff[1] = level;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
320 return 0;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
321 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
322
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
323 return -1; /* NOTREACHED */
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
324 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
325
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
326 static void mix2to1 (sample_t * dest, sample_t * src, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
327 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
328 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
329
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
330 for (i = 0; i < 256; i++)
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
331 dest[i] += BIAS (src[i]);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
332 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
333
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
334 static void mix3to1 (sample_t * samples, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
335 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
336 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
337
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
338 for (i = 0; i < 256; i++)
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
339 samples[i] += BIAS (samples[i + 256] + samples[i + 512]);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
340 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
341
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
342 static void mix4to1 (sample_t * samples, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
343 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
344 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
345
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
346 for (i = 0; i < 256; i++)
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
347 samples[i] += BIAS (samples[i + 256] + samples[i + 512] +
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
348 samples[i + 768]);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
349 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
350
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
351 static void mix5to1 (sample_t * samples, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
352 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
353 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
354
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
355 for (i = 0; i < 256; i++)
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
356 samples[i] += BIAS (samples[i + 256] + samples[i + 512] +
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
357 samples[i + 768] + samples[i + 1024]);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
358 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
359
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
360 static void mix3to2 (sample_t * samples, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
361 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
362 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
363 sample_t common;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
364
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
365 for (i = 0; i < 256; i++) {
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
366 common = BIAS (samples[i + 256]);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
367 samples[i] += common;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
368 samples[i + 256] = samples[i + 512] + common;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
369 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
370 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
371
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
372 static void mix21to2 (sample_t * left, sample_t * right, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
373 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
374 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
375 sample_t common;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
376
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
377 for (i = 0; i < 256; i++) {
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
378 common = BIAS (right[i + 256]);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
379 left[i] += common;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
380 right[i] += common;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
381 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
382 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
383
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
384 static void mix21toS (sample_t * samples, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
385 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
386 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
387 sample_t surround;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
388
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
389 for (i = 0; i < 256; i++) {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
390 surround = samples[i + 512];
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
391 samples[i] += BIAS (-surround);
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
392 samples[i + 256] += BIAS (surround);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
393 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
394 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
395
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
396 static void mix31to2 (sample_t * samples, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
397 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
398 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
399 sample_t common;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
400
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
401 for (i = 0; i < 256; i++) {
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
402 common = BIAS (samples[i + 256] + samples[i + 768]);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
403 samples[i] += common;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
404 samples[i + 256] = samples[i + 512] + common;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
405 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
406 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
407
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
408 static void mix31toS (sample_t * samples, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
409 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
410 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
411 sample_t common, surround;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
412
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
413 for (i = 0; i < 256; i++) {
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
414 common = BIAS (samples[i + 256]);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
415 surround = samples[i + 768];
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
416 samples[i] += common - surround;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
417 samples[i + 256] = samples[i + 512] + common + surround;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
418 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
419 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
420
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
421 static void mix22toS (sample_t * samples, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
422 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
423 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
424 sample_t surround;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
425
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
426 for (i = 0; i < 256; i++) {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
427 surround = samples[i + 512] + samples[i + 768];
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
428 samples[i] += BIAS (-surround);
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
429 samples[i + 256] += BIAS (surround);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
430 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
431 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
432
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
433 static void mix32to2 (sample_t * samples, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
434 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
435 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
436 sample_t common;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
437
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
438 for (i = 0; i < 256; i++) {
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
439 common = BIAS (samples[i + 256]);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
440 samples[i] += common + samples[i + 768];
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
441 samples[i + 256] = common + samples[i + 512] + samples[i + 1024];
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
442 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
443 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
444
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
445 static void mix32toS (sample_t * samples, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
446 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
447 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
448 sample_t common, surround;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
449
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
450 for (i = 0; i < 256; i++) {
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
451 common = BIAS (samples[i + 256]);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
452 surround = samples[i + 768] + samples[i + 1024];
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
453 samples[i] += common - surround;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
454 samples[i + 256] = samples[i + 512] + common + surround;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
455 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
456 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
457
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
458 static void move2to1 (sample_t * src, sample_t * dest, sample_t bias)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
459 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
460 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
461
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
462 for (i = 0; i < 256; i++)
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
463 dest[i] = BIAS (src[i] + src[i + 256]);
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
464 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
465
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
466 static void zero (sample_t * samples)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
467 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
468 int i;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
469
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
470 for (i = 0; i < 256; i++)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
471 samples[i] = 0;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
472 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
473
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
474 void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias,
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
475 level_t clev, level_t slev)
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
476 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
477 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
478
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
479 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
480 memcpy (samples, samples + 256, 256 * sizeof (sample_t));
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
481 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
482
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
483 case CONVERT (A52_CHANNEL, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
484 case CONVERT (A52_STEREO, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
485 mix_2to1:
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
486 mix2to1 (samples, samples + 256, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
487 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
488
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
489 case CONVERT (A52_2F1R, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
490 if (slev == 0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
491 goto mix_2to1;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
492 case CONVERT (A52_3F, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
493 mix_3to1:
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
494 mix3to1 (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
495 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
496
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
497 case CONVERT (A52_3F1R, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
498 if (slev == 0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
499 goto mix_3to1;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
500 case CONVERT (A52_2F2R, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
501 if (slev == 0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
502 goto mix_2to1;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
503 mix4to1 (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
504 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
505
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
506 case CONVERT (A52_3F2R, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
507 if (slev == 0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
508 goto mix_3to1;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
509 mix5to1 (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
510 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
511
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
512 case CONVERT (A52_MONO, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
513 memcpy (samples + 256, samples, 256 * sizeof (sample_t));
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
514 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
515
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
516 case CONVERT (A52_3F, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
517 case CONVERT (A52_3F, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
518 mix_3to2:
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
519 mix3to2 (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
520 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
521
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
522 case CONVERT (A52_2F1R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
523 if (slev == 0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
524 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
525 mix21to2 (samples, samples + 256, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
526 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
527
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
528 case CONVERT (A52_2F1R, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
529 mix21toS (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
530 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
531
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
532 case CONVERT (A52_3F1R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
533 if (slev == 0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
534 goto mix_3to2;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
535 mix31to2 (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
536 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
537
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
538 case CONVERT (A52_3F1R, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
539 mix31toS (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
540 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
541
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
542 case CONVERT (A52_2F2R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
543 if (slev == 0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
544 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
545 mix2to1 (samples, samples + 512, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
546 mix2to1 (samples + 256, samples + 768, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
547 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
548
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
549 case CONVERT (A52_2F2R, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
550 mix22toS (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
551 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
552
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
553 case CONVERT (A52_3F2R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
554 if (slev == 0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
555 goto mix_3to2;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
556 mix32to2 (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
557 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
558
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
559 case CONVERT (A52_3F2R, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
560 mix32toS (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
561 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
562
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
563 case CONVERT (A52_3F1R, A52_3F):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
564 if (slev == 0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
565 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
566 mix21to2 (samples, samples + 512, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
567 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
568
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
569 case CONVERT (A52_3F2R, A52_3F):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
570 if (slev == 0)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
571 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
572 mix2to1 (samples, samples + 768, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
573 mix2to1 (samples + 512, samples + 1024, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
574 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
575
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
576 case CONVERT (A52_3F1R, A52_2F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
577 mix3to2 (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
578 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
579 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
580
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
581 case CONVERT (A52_2F2R, A52_2F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
582 mix2to1 (samples + 512, samples + 768, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
583 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
584
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
585 case CONVERT (A52_3F2R, A52_2F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
586 mix3to2 (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
587 move2to1 (samples + 768, samples + 512, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
588 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
589
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
590 case CONVERT (A52_3F2R, A52_3F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
591 mix2to1 (samples + 768, samples + 1024, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
592 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
593
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
594 case CONVERT (A52_2F1R, A52_2F2R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
595 memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
596 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
597
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
598 case CONVERT (A52_3F1R, A52_2F2R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
599 mix3to2 (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
600 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
601 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
602
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
603 case CONVERT (A52_3F2R, A52_2F2R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
604 mix3to2 (samples, bias);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
605 memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
606 memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t));
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
607 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
608
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
609 case CONVERT (A52_3F1R, A52_3F2R):
1072
68d0a38bd802 * sync with main liba52 sources
kabi
parents: 428
diff changeset
610 memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
332
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
611 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
612 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
613 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
614
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
615 void a52_upmix (sample_t * samples, int acmod, int output)
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
616 {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
617 switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
618
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
619 case CONVERT (A52_CHANNEL, A52_CHANNEL2):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
620 memcpy (samples + 256, samples, 256 * sizeof (sample_t));
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
621 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
622
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
623 case CONVERT (A52_3F2R, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
624 zero (samples + 1024);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
625 case CONVERT (A52_3F1R, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
626 case CONVERT (A52_2F2R, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
627 zero (samples + 768);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
628 case CONVERT (A52_3F, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
629 case CONVERT (A52_2F1R, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
630 zero (samples + 512);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
631 case CONVERT (A52_CHANNEL, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
632 case CONVERT (A52_STEREO, A52_MONO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
633 zero (samples + 256);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
634 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
635
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
636 case CONVERT (A52_3F2R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
637 case CONVERT (A52_3F2R, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
638 zero (samples + 1024);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
639 case CONVERT (A52_3F1R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
640 case CONVERT (A52_3F1R, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
641 zero (samples + 768);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
642 case CONVERT (A52_3F, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
643 case CONVERT (A52_3F, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
644 mix_3to2:
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
645 memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t));
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
646 zero (samples + 256);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
647 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
648
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
649 case CONVERT (A52_2F2R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
650 case CONVERT (A52_2F2R, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
651 zero (samples + 768);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
652 case CONVERT (A52_2F1R, A52_STEREO):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
653 case CONVERT (A52_2F1R, A52_DOLBY):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
654 zero (samples + 512);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
655 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
656
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
657 case CONVERT (A52_3F2R, A52_3F):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
658 zero (samples + 1024);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
659 case CONVERT (A52_3F1R, A52_3F):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
660 case CONVERT (A52_2F2R, A52_2F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
661 zero (samples + 768);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
662 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
663
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
664 case CONVERT (A52_3F2R, A52_3F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
665 zero (samples + 1024);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
666 break;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
667
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
668 case CONVERT (A52_3F2R, A52_2F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
669 zero (samples + 1024);
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
670 case CONVERT (A52_3F1R, A52_2F1R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
671 mix_31to21:
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
672 memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
673 goto mix_3to2;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
674
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
675 case CONVERT (A52_3F2R, A52_2F2R):
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
676 memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
677 goto mix_31to21;
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
678 }
207cc56d18f8 * add support for liba52
kabi
parents:
diff changeset
679 }