• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iserver/alsa-lib-1.0.26/src/pcm/

Lines Matching defs:*

2  *  Plugin sample operators with fast switch
3 * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
6 * This library is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef SX_INLINES
23 #define SX_INLINES
24 static inline u_int32_t sx24(u_int32_t x)
26 if(x&0x00800000)
27 return x|0xFF000000;
28 return x&0x00FFFFFF;
30 static inline u_int32_t sx24s(u_int32_t x)
32 if(x&0x00008000)
33 return x|0x000000FF;
34 return x&0xFFFFFF00;
36 #endif
38 #define as_u8(ptr) (*(u_int8_t*)(ptr))
39 #define as_u16(ptr) (*(u_int16_t*)(ptr))
40 #define as_u32(ptr) (*(u_int32_t*)(ptr))
41 #define as_u64(ptr) (*(u_int64_t*)(ptr))
42 #define as_s8(ptr) (*(int8_t*)(ptr))
43 #define as_s16(ptr) (*(int16_t*)(ptr))
44 #define as_s32(ptr) (*(int32_t*)(ptr))
45 #define as_s64(ptr) (*(int64_t*)(ptr))
46 #define as_float(ptr) (*(float_t*)(ptr))
47 #define as_double(ptr) (*(double_t*)(ptr))
49 #define as_u8c(ptr) (*(const u_int8_t*)(ptr))
50 #define as_u16c(ptr) (*(const u_int16_t*)(ptr))
51 #define as_u32c(ptr) (*(const u_int32_t*)(ptr))
52 #define as_u64c(ptr) (*(const u_int64_t*)(ptr))
53 #define as_s8c(ptr) (*(const int8_t*)(ptr))
54 #define as_s16c(ptr) (*(const int16_t*)(ptr))
55 #define as_s32c(ptr) (*(const int32_t*)(ptr))
56 #define as_s64c(ptr) (*(const int64_t*)(ptr))
57 #define as_floatc(ptr) (*(const float_t*)(ptr))
58 #define as_doublec(ptr) (*(const double_t*)(ptr))
60 #define _get_triple_le(ptr) (*(u_int8_t*)(ptr) | (u_int32_t)*((u_int8_t*)(ptr) + 1) << 8 | (u_int32_t)*((u_int8_t*)(ptr) + 2) << 16)
61 #define _get_triple_be(ptr) ((u_int32_t)*(u_int8_t*)(ptr) << 16 | (u_int32_t)*((u_int8_t*)(ptr) + 1) << 8 | *((u_int8_t*)(ptr) + 2))
62 #define _put_triple_le(ptr,val) do { \
63 u_int8_t *_tmp = (u_int8_t *)(ptr); \
64 u_int32_t _val = (val); \
65 _tmp[0] = _val; \
66 _tmp[1] = _val >> 8; \
67 _tmp[2] = _val >> 16; \
68 } while(0)
69 #define _put_triple_be(ptr,val) do { \
70 u_int8_t *_tmp = (u_int8_t *)(ptr); \
71 u_int32_t _val = (val); \
72 _tmp[0] = _val >> 16; \
73 _tmp[1] = _val >> 8; \
74 _tmp[2] = _val; \
75 } while(0)
77 #ifdef SNDRV_LITTLE_ENDIAN
78 #define _get_triple(ptr) _get_triple_le(ptr)
79 #define _get_triple_s(ptr) _get_triple_be(ptr)
80 #define _put_triple(ptr,val) _put_triple_le(ptr,val)
81 #define _put_triple_s(ptr,val) _put_triple_be(ptr,val)
82 #else
83 #define _get_triple(ptr) _get_triple_be(ptr)
84 #define _get_triple_s(ptr) _get_triple_le(ptr)
85 #define _put_triple(ptr,val) _put_triple_be(ptr,val)
86 #define _put_triple_s(ptr,val) _put_triple_le(ptr,val)
87 #endif
89 #ifdef COPY_LABELS
90 static void *copy_labels[5] = {
91 &&copy_8,
92 &&copy_16,
93 &&copy_24
94 &&copy_32,
95 &&copy_64
97 #endif
99 #ifdef COPY_END
100 while(0) {
101 copy_8: as_s8(dst) = as_s8c(src); goto COPY_END;
102 copy_16: as_s16(dst) = as_s16c(src); goto COPY_END;
103 copy_24: memcpy(dst,src,3); goto COPY_END;
104 copy_32: as_s32(dst) = as_s32c(src); goto COPY_END;
105 copy_64: as_s64(dst) = as_s64c(src); goto COPY_END;
107 #endif
109 #ifdef CONV_LABELS
110 /* src_wid src_endswap sign_toggle dst_wid dst_endswap */
111 static void *const conv_labels[4 * 2 * 2 * 4 * 2] = {
112 &&conv_xxx1_xxx1, /* 8h -> 8h */
113 &&conv_xxx1_xxx1, /* 8h -> 8s */
114 &&conv_xxx1_xx10, /* 8h -> 16h */
115 &&conv_xxx1_xx01, /* 8h -> 16s */
116 &&conv_xxx1_x100, /* 8h -> 24h */
117 &&conv_xxx1_001x, /* 8h -> 24s */
118 &&conv_xxx1_1000, /* 8h -> 32h */
119 &&conv_xxx1_0001, /* 8h -> 32s */
120 &&conv_xxx1_xxx9, /* 8h ^> 8h */
121 &&conv_xxx1_xxx9, /* 8h ^> 8s */
122 &&conv_xxx1_xx90, /* 8h ^> 16h */
123 &&conv_xxx1_xx09, /* 8h ^> 16s */
124 &&conv_xxx1_x900, /* 8h ^> 24h */
125 &&conv_xxx1_009x, /* 8h ^> 24s */
126 &&conv_xxx1_9000, /* 8h ^> 32h */
127 &&conv_xxx1_0009, /* 8h ^> 32s */
128 &&conv_xxx1_xxx1, /* 8s -> 8h */
129 &&conv_xxx1_xxx1, /* 8s -> 8s */
130 &&conv_xxx1_xx10, /* 8s -> 16h */
131 &&conv_xxx1_xx01, /* 8s -> 16s */
132 &&conv_xxx1_x100, /* 8s -> 24h */
133 &&conv_xxx1_001x, /* 8s -> 24s */
134 &&conv_xxx1_1000, /* 8s -> 32h */
135 &&conv_xxx1_0001, /* 8s -> 32s */
136 &&conv_xxx1_xxx9, /* 8s ^> 8h */
137 &&conv_xxx1_xxx9, /* 8s ^> 8s */
138 &&conv_xxx1_xx90, /* 8s ^> 16h */
139 &&conv_xxx1_xx09, /* 8s ^> 16s */
140 &&conv_xxx1_x900, /* 8s ^> 24h */
141 &&conv_xxx1_009x, /* 8s ^> 24s */
142 &&conv_xxx1_9000, /* 8s ^> 32h */
143 &&conv_xxx1_0009, /* 8s ^> 32s */
144 &&conv_xx12_xxx1, /* 16h -> 8h */
145 &&conv_xx12_xxx1, /* 16h -> 8s */
146 &&conv_xx12_xx12, /* 16h -> 16h */
147 &&conv_xx12_xx21, /* 16h -> 16s */
148 &&conv_xx12_x120, /* 16h -> 24h */
149 &&conv_xx12_021x, /* 16h -> 24s */
150 &&conv_xx12_1200, /* 16h -> 32h */
151 &&conv_xx12_0021, /* 16h -> 32s */
152 &&conv_xx12_xxx9, /* 16h ^> 8h */
153 &&conv_xx12_xxx9, /* 16h ^> 8s */
154 &&conv_xx12_xx92, /* 16h ^> 16h */
155 &&conv_xx12_xx29, /* 16h ^> 16s */
156 &&conv_xx12_x920, /* 16h ^> 24h */
157 &&conv_xx12_029x, /* 16h ^> 24s */
158 &&conv_xx12_9200, /* 16h ^> 32h */
159 &&conv_xx12_0029, /* 16h ^> 32s */
160 &&conv_xx12_xxx2, /* 16s -> 8h */
161 &&conv_xx12_xxx2, /* 16s -> 8s */
162 &&conv_xx12_xx21, /* 16s -> 16h */
163 &&conv_xx12_xx12, /* 16s -> 16s */
164 &&conv_xx12_x210, /* 16s -> 24h */
165 &&conv_xx12_012x, /* 16s -> 24s */
166 &&conv_xx12_2100, /* 16s -> 32h */
167 &&conv_xx12_0012, /* 16s -> 32s */
168 &&conv_xx12_xxxA, /* 16s ^> 8h */
169 &&conv_xx12_xxxA, /* 16s ^> 8s */
170 &&conv_xx12_xxA1, /* 16s ^> 16h */
171 &&conv_xx12_xx1A, /* 16s ^> 16s */
172 &&conv_xx12_xA10, /* 16s ^> 24h */
173 &&conv_xx12_01Ax, /* 16s ^> 24s */
174 &&conv_xx12_A100, /* 16s ^> 32h */
175 &&conv_xx12_001A, /* 16s ^> 32s */
176 &&conv_x123_xxx1, /* 24h -> 8h */
177 &&conv_x123_xxx1, /* 24h -> 8s */
178 &&conv_x123_xx12, /* 24h -> 16h */
179 &&conv_x123_xx21, /* 24h -> 16s */
180 &&conv_x123_x123, /* 24h -> 24h */
181 &&conv_x123_321x, /* 24h -> 24s */
182 &&conv_x123_1230, /* 24h -> 32h */
183 &&conv_x123_0321, /* 24h -> 32s */
184 &&conv_x123_xxx9, /* 24h ^> 8h */
185 &&conv_x123_xxx9, /* 24h ^> 8s */
186 &&conv_x123_xx92, /* 24h ^> 16h */
187 &&conv_x123_xx29, /* 24h ^> 16s */
188 &&conv_x123_x923, /* 24h ^> 24h */
189 &&conv_x123_329x, /* 24h ^> 24s */
190 &&conv_x123_9230, /* 24h ^> 32h */
191 &&conv_x123_0329, /* 24h ^> 32s */
192 &&conv_123x_xxx3, /* 24s -> 8h */
193 &&conv_123x_xxx3, /* 24s -> 8s */
194 &&conv_123x_xx32, /* 24s -> 16h */
195 &&conv_123x_xx23, /* 24s -> 16s */
196 &&conv_123x_x321, /* 24s -> 24h */
197 &&conv_123x_123x, /* 24s -> 24s */
198 &&conv_123x_3210, /* 24s -> 32h */
199 &&conv_123x_0123, /* 24s -> 32s */
200 &&conv_123x_xxxB, /* 24s ^> 8h */
201 &&conv_123x_xxxB, /* 24s ^> 8s */
202 &&conv_123x_xxB2, /* 24s ^> 16h */
203 &&conv_123x_xx2B, /* 24s ^> 16s */
204 &&conv_123x_xB21, /* 24s ^> 24h */
205 &&conv_123x_12Bx, /* 24s ^> 24s */
206 &&conv_123x_B210, /* 24s ^> 32h */
207 &&conv_123x_012B, /* 24s ^> 32s */
208 &&conv_1234_xxx1, /* 32h -> 8h */
209 &&conv_1234_xxx1, /* 32h -> 8s */
210 &&conv_1234_xx12, /* 32h -> 16h */
211 &&conv_1234_xx21, /* 32h -> 16s */
212 &&conv_1234_x123, /* 32h -> 24h */
213 &&conv_1234_321x, /* 32h -> 24s */
214 &&conv_1234_1234, /* 32h -> 32h */
215 &&conv_1234_4321, /* 32h -> 32s */
216 &&conv_1234_xxx9, /* 32h ^> 8h */
217 &&conv_1234_xxx9, /* 32h ^> 8s */
218 &&conv_1234_xx92, /* 32h ^> 16h */
219 &&conv_1234_xx29, /* 32h ^> 16s */
220 &&conv_1234_x923, /* 32h ^> 24h */
221 &&conv_1234_329x, /* 32h ^> 24s */
222 &&conv_1234_9234, /* 32h ^> 32h */
223 &&conv_1234_4329, /* 32h ^> 32s */
224 &&conv_1234_xxx4, /* 32s -> 8h */
225 &&conv_1234_xxx4, /* 32s -> 8s */
226 &&conv_1234_xx43, /* 32s -> 16h */
227 &&conv_1234_xx34, /* 32s -> 16s */
228 &&conv_1234_x432, /* 32s -> 24h */
229 &&conv_1234_234x, /* 32s -> 24s */
230 &&conv_1234_4321, /* 32s -> 32h */
231 &&conv_1234_1234, /* 32s -> 32s */
232 &&conv_1234_xxxC, /* 32s ^> 8h */
233 &&conv_1234_xxxC, /* 32s ^> 8s */
234 &&conv_1234_xxC3, /* 32s ^> 16h */
235 &&conv_1234_xx3C, /* 32s ^> 16s */
236 &&conv_1234_xC32, /* 32s ^> 24h */
237 &&conv_1234_23Cx, /* 32s ^> 24s */
238 &&conv_1234_C321, /* 32s ^> 32h */
239 &&conv_1234_123C, /* 32s ^> 32s */
241 #endif
243 #ifdef CONV_END
244 while(0) {
245 conv_xxx1_xxx1: as_u8(dst) = as_u8c(src); goto CONV_END;
246 conv_xxx1_xx10: as_u16(dst) = (u_int16_t)as_u8c(src) << 8; goto CONV_END;
247 conv_xxx1_xx01: as_u16(dst) = (u_int16_t)as_u8c(src); goto CONV_END;
248 conv_xxx1_x100: as_u32(dst) = sx24((u_int32_t)as_u8c(src) << 16); goto CONV_END;
249 conv_xxx1_001x: as_u32(dst) = sx24s((u_int32_t)as_u8c(src) << 8); goto CONV_END;
250 conv_xxx1_1000: as_u32(dst) = (u_int32_t)as_u8c(src) << 24; goto CONV_END;
251 conv_xxx1_0001: as_u32(dst) = (u_int32_t)as_u8c(src); goto CONV_END;
252 conv_xxx1_xxx9: as_u8(dst) = as_u8c(src) ^ 0x80; goto CONV_END;
253 conv_xxx1_xx90: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto CONV_END;
254 conv_xxx1_xx09: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80); goto CONV_END;
255 conv_xxx1_x900: as_u32(dst) = sx24((u_int32_t)(as_u8c(src) ^ 0x80) << 16); goto CONV_END;
256 conv_xxx1_009x: as_u32(dst) = sx24s((u_int32_t)(as_u8c(src) ^ 0x80) << 8); goto CONV_END;
257 conv_xxx1_9000: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto CONV_END;
258 conv_xxx1_0009: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80); goto CONV_END;
259 conv_xx12_xxx1: as_u8(dst) = as_u16c(src) >> 8; goto CONV_END;
260 conv_xx12_xx12: as_u16(dst) = as_u16c(src); goto CONV_END;
261 conv_xx12_xx21: as_u16(dst) = bswap_16(as_u16c(src)); goto CONV_END;
262 conv_xx12_x120: as_u32(dst) = sx24((u_int32_t)as_u16c(src) << 8); goto CONV_END;
263 conv_xx12_021x: as_u32(dst) = sx24s((u_int32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END;
264 conv_xx12_1200: as_u32(dst) = (u_int32_t)as_u16c(src) << 16; goto CONV_END;
265 conv_xx12_0021: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)); goto CONV_END;
266 conv_xx12_xxx9: as_u8(dst) = (as_u16c(src) >> 8) ^ 0x80; goto CONV_END;
267 conv_xx12_xx92: as_u16(dst) = as_u16c(src) ^ 0x8000; goto CONV_END;
268 conv_xx12_xx29: as_u16(dst) = bswap_16(as_u16c(src)) ^ 0x80; goto CONV_END;
269 conv_xx12_x920: as_u32(dst) = sx24((u_int32_t)(as_u16c(src) ^ 0x8000) << 8); goto CONV_END;
270 conv_xx12_029x: as_u32(dst) = sx24s((u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80) << 8); goto CONV_END;
271 conv_xx12_9200: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto CONV_END;
272 conv_xx12_0029: as_u32(dst) = (u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80); goto CONV_END;
273 conv_xx12_xxx2: as_u8(dst) = as_u16c(src) & 0xff; goto CONV_END;
274 conv_xx12_x210: as_u32(dst) = sx24((u_int32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END;
275 conv_xx12_012x: as_u32(dst) = sx24s((u_int32_t)as_u16c(src) << 8); goto CONV_END;
276 conv_xx12_2100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto CONV_END;
277 conv_xx12_0012: as_u32(dst) = (u_int32_t)as_u16c(src); goto CONV_END;
278 conv_xx12_xxxA: as_u8(dst) = (as_u16c(src) ^ 0x80) & 0xff; goto CONV_END;
279 conv_xx12_xxA1: as_u16(dst) = bswap_16(as_u16c(src) ^ 0x80); goto CONV_END;
280 conv_xx12_xx1A: as_u16(dst) = as_u16c(src) ^ 0x80; goto CONV_END;
281 conv_xx12_xA10: as_u32(dst) = sx24((u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 8); goto CONV_END;
282 conv_xx12_01Ax: as_u32(dst) = sx24s((u_int32_t)(as_u16c(src) ^ 0x80) << 8); goto CONV_END;
283 conv_xx12_A100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto CONV_END;
284 conv_xx12_001A: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x80); goto CONV_END;
285 conv_x123_xxx1: as_u8(dst) = as_u32c(src) >> 16; goto CONV_END;
286 conv_x123_xx12: as_u16(dst) = as_u32c(src) >> 8; goto CONV_END;
287 conv_x123_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
288 conv_x123_x123: as_u32(dst) = sx24(as_u32c(src)); goto CONV_END;
289 conv_x123_321x: as_u32(dst) = sx24s(bswap_32(as_u32c(src))); goto CONV_END;
290 conv_x123_1230: as_u32(dst) = as_u32c(src) << 8; goto CONV_END;
291 conv_x123_0321: as_u32(dst) = bswap_32(as_u32c(src)) >> 8; goto CONV_END;
292 conv_x123_xxx9: as_u8(dst) = (as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
293 conv_x123_xx92: as_u16(dst) = (as_u32c(src) >> 8) ^ 0x8000; goto CONV_END;
294 conv_x123_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
295 conv_x123_x923: as_u32(dst) = sx24(as_u32c(src) ^ 0x800000); goto CONV_END;
296 conv_x123_329x: as_u32(dst) = sx24s(bswap_32(as_u32c(src)) ^ 0x8000); goto CONV_END;
297 conv_x123_9230: as_u32(dst) = (as_u32c(src) ^ 0x800000) << 8; goto CONV_END;
298 conv_x123_0329: as_u32(dst) = (bswap_32(as_u32c(src)) >> 8) ^ 0x80; goto CONV_END;
299 conv_123x_xxx3: as_u8(dst) = (as_u32c(src) >> 8) & 0xff; goto CONV_END;
300 conv_123x_xx32: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
301 conv_123x_xx23: as_u16(dst) = (as_u32c(src) >> 8) & 0xffff; goto CONV_END;
302 conv_123x_x321: as_u32(dst) = sx24(bswap_32(as_u32c(src))); goto CONV_END;
303 conv_123x_123x: as_u32(dst) = sx24s(as_u32c(src)); goto CONV_END;
304 conv_123x_3210: as_u32(dst) = bswap_32(as_u32c(src)) << 8; goto CONV_END;
305 conv_123x_0123: as_u32(dst) = as_u32c(src) >> 8; goto CONV_END;
306 conv_123x_xxxB: as_u8(dst) = ((as_u32c(src) >> 8) & 0xff) ^ 0x80; goto CONV_END;
307 conv_123x_xxB2: as_u16(dst) = bswap_16((as_u32c(src) >> 8) ^ 0x80); goto CONV_END;
308 conv_123x_xx2B: as_u16(dst) = ((as_u32c(src) >> 8) & 0xffff) ^ 0x80; goto CONV_END;
309 conv_123x_xB21: as_u32(dst) = sx24(bswap_32(as_u32c(src)) ^ 0x800000); goto CONV_END;
310 conv_123x_12Bx: as_u32(dst) = sx24s(as_u32c(src) ^ 0x8000); goto CONV_END;
311 conv_123x_B210: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x8000) << 8; goto CONV_END;
312 conv_123x_012B: as_u32(dst) = (as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
313 conv_1234_xxx1: as_u8(dst) = as_u32c(src) >> 24; goto CONV_END;
314 conv_1234_xx12: as_u16(dst) = as_u32c(src) >> 16; goto CONV_END;
315 conv_1234_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 16); goto CONV_END;
316 conv_1234_x123: as_u32(dst) = sx24(as_u32c(src) >> 8); goto CONV_END;
317 conv_1234_321x: as_u32(dst) = sx24s(bswap_32(as_u32c(src)) << 8); goto CONV_END;
318 conv_1234_1234: as_u32(dst) = as_u32c(src); goto CONV_END;
319 conv_1234_4321: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
320 conv_1234_xxx9: as_u8(dst) = (as_u32c(src) >> 24) ^ 0x80; goto CONV_END;
321 conv_1234_xx92: as_u16(dst) = (as_u32c(src) >> 16) ^ 0x8000; goto CONV_END;
322 conv_1234_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
323 conv_1234_x923: as_u32(dst) = sx24((as_u32c(src) >> 8) ^ 0x800000); goto CONV_END;
324 conv_1234_329x: as_u32(dst) = sx24s((bswap_32(as_u32c(src)) ^ 0x80) << 8); goto CONV_END;
325 conv_1234_9234: as_u32(dst) = as_u32c(src) ^ 0x80000000; goto CONV_END;
326 conv_1234_4329: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x80; goto CONV_END;
327 conv_1234_xxx4: as_u8(dst) = as_u32c(src) & 0xff; goto CONV_END;
328 conv_1234_xx43: as_u16(dst) = bswap_16(as_u32c(src)); goto CONV_END;
329 conv_1234_xx34: as_u16(dst) = as_u32c(src) & 0xffff; goto CONV_END;
330 conv_1234_x432: as_u32(dst) = sx24(bswap_32(as_u32c(src)) >> 8); goto CONV_END;
331 conv_1234_234x: as_u32(dst) = sx24s(as_u32c(src) << 8); goto CONV_END;
332 conv_1234_xxxC: as_u8(dst) = (as_u32c(src) & 0xff) ^ 0x80; goto CONV_END;
333 conv_1234_xxC3: as_u16(dst) = bswap_16(as_u32c(src) ^ 0x80); goto CONV_END;
334 conv_1234_xx3C: as_u16(dst) = (as_u32c(src) & 0xffff) ^ 0x80; goto CONV_END;
335 conv_1234_xC32: as_u32(dst) = sx24((bswap_32(as_u32c(src)) >> 8) ^ 0x800000); goto CONV_END;
336 conv_1234_23Cx: as_u32(dst) = sx24s((as_u32c(src) ^ 0x80) << 8); goto CONV_END;
337 conv_1234_C321: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x80); goto CONV_END;
338 conv_1234_123C: as_u32(dst) = as_u32c(src) ^ 0x80; goto CONV_END;
340 #endif
342 #ifdef GET16_LABELS
343 /* src_wid src_endswap sign_toggle */
344 static void *const get16_labels[4 * 2 * 2 + 4 * 3] = {
345 &&get16_1_10, /* 8h -> 16h */
346 &&get16_1_90, /* 8h ^> 16h */
347 &&get16_1_10, /* 8s -> 16h */
348 &&get16_1_90, /* 8s ^> 16h */
349 &&get16_12_12, /* 16h -> 16h */
350 &&get16_12_92, /* 16h ^> 16h */
351 &&get16_12_21, /* 16s -> 16h */
352 &&get16_12_A1, /* 16s ^> 16h */
353 &&get16_0123_12, /* 24h -> 16h */
354 &&get16_0123_92, /* 24h ^> 16h */
355 &&get16_1230_32, /* 24s -> 16h */
356 &&get16_1230_B2, /* 24s ^> 16h */
357 &&get16_1234_12, /* 32h -> 16h */
358 &&get16_1234_92, /* 32h ^> 16h */
359 &&get16_1234_43, /* 32s -> 16h */
360 &&get16_1234_C3, /* 32s ^> 16h */
361 /* 3bytes format */
362 &&get16_123_12, /* 24h -> 16h */
363 &&get16_123_92, /* 24h ^> 16h */
364 &&get16_123_32, /* 24s -> 16h */
365 &&get16_123_B2, /* 24s ^> 16h */
366 &&get16_123_12_20, /* 20h -> 16h */
367 &&get16_123_92_20, /* 20h ^> 16h */
368 &&get16_123_32_20, /* 20s -> 16h */
369 &&get16_123_B2_20, /* 20s ^> 16h */
370 &&get16_123_12_18, /* 18h -> 16h */
371 &&get16_123_92_18, /* 18h ^> 16h */
372 &&get16_123_32_18, /* 18s -> 16h */
373 &&get16_123_B2_18, /* 18s ^> 16h */
375 #endif
377 #ifdef GET16_END
378 while(0) {
379 get16_1_10: sample = (u_int16_t)as_u8c(src) << 8; goto GET16_END;
380 get16_1_90: sample = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto GET16_END;
381 get16_12_12: sample = as_u16c(src); goto GET16_END;
382 get16_12_92: sample = as_u16c(src) ^ 0x8000; goto GET16_END;
383 get16_12_21: sample = bswap_16(as_u16c(src)); goto GET16_END;
384 get16_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GET16_END;
385 get16_0123_12: sample = as_u32c(src) >> 8; goto GET16_END;
386 get16_0123_92: sample = (as_u32c(src) >> 8) ^ 0x8000; goto GET16_END;
387 get16_1230_32: sample = bswap_16(as_u32c(src) >> 8); goto GET16_END;
388 get16_1230_B2: sample = bswap_16((as_u32c(src) >> 8) ^ 0x80); goto GET16_END;
389 get16_1234_12: sample = as_u32c(src) >> 16; goto GET16_END;
390 get16_1234_92: sample = (as_u32c(src) >> 16) ^ 0x8000; goto GET16_END;
391 get16_1234_43: sample = bswap_16(as_u32c(src)); goto GET16_END;
392 get16_1234_C3: sample = bswap_16(as_u32c(src) ^ 0x80); goto GET16_END;
393 get16_123_12: sample = _get_triple(src) >> 8; goto GET16_END;
394 get16_123_92: sample = (_get_triple(src) >> 8) ^ 0x8000; goto GET16_END;
395 get16_123_32: sample = _get_triple_s(src) >> 8; goto GET16_END;
396 get16_123_B2: sample = (_get_triple_s(src) >> 8) ^ 0x8000; goto GET16_END;
397 get16_123_12_20: sample = _get_triple(src) >> 4; goto GET16_END;
398 get16_123_92_20: sample = (_get_triple(src) >> 4) ^ 0x8000; goto GET16_END;
399 get16_123_32_20: sample = _get_triple_s(src) >> 4; goto GET16_END;
400 get16_123_B2_20: sample = (_get_triple_s(src) >> 4) ^ 0x8000; goto GET16_END;
401 get16_123_12_18: sample = _get_triple(src) >> 2; goto GET16_END;
402 get16_123_92_18: sample = (_get_triple(src) >> 2) ^ 0x8000; goto GET16_END;
403 get16_123_32_18: sample = _get_triple_s(src) >> 2; goto GET16_END;
404 get16_123_B2_18: sample = (_get_triple_s(src) >> 2) ^ 0x8000; goto GET16_END;
406 #endif
408 #ifdef PUT16_LABELS
409 /* dst_wid dst_endswap sign_toggle */
410 static void *const put16_labels[4 * 2 * 2 + 4 * 3] = {
411 &&put16_12_1, /* 16h -> 8h */
412 &&put16_12_9, /* 16h ^> 8h */
413 &&put16_12_1, /* 16h -> 8s */
414 &&put16_12_9, /* 16h ^> 8s */
415 &&put16_12_12, /* 16h -> 16h */
416 &&put16_12_92, /* 16h ^> 16h */
417 &&put16_12_21, /* 16h -> 16s */
418 &&put16_12_29, /* 16h ^> 16s */
419 &&put16_12_0120, /* 16h -> 24h */
420 &&put16_12_0920, /* 16h ^> 24h */
421 &&put16_12_0210, /* 16h -> 24s */
422 &&put16_12_0290, /* 16h ^> 24s */
423 &&put16_12_1200, /* 16h -> 32h */
424 &&put16_12_9200, /* 16h ^> 32h */
425 &&put16_12_0021, /* 16h -> 32s */
426 &&put16_12_0029, /* 16h ^> 32s */
427 /* 3bytes format */
428 &&put16_12_120, /* 16h -> 24h */
429 &&put16_12_920, /* 16h ^> 24h */
430 &&put16_12_021, /* 16h -> 24s */
431 &&put16_12_029, /* 16h ^> 24s */
432 &&put16_12_120_20, /* 16h -> 20h */
433 &&put16_12_920_20, /* 16h ^> 20h */
434 &&put16_12_021_20, /* 16h -> 20s */
435 &&put16_12_029_20, /* 16h ^> 20s */
436 &&put16_12_120_18, /* 16h -> 18h */
437 &&put16_12_920_18, /* 16h ^> 18h */
438 &&put16_12_021_18, /* 16h -> 18s */
439 &&put16_12_029_18, /* 16h ^> 18s */
441 #endif
443 #ifdef PUT16_END
444 while (0) {
445 put16_12_1: as_u8(dst) = sample >> 8; goto PUT16_END;
446 put16_12_9: as_u8(dst) = (sample >> 8) ^ 0x80; goto PUT16_END;
447 put16_12_12: as_u16(dst) = sample; goto PUT16_END;
448 put16_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT16_END;
449 put16_12_21: as_u16(dst) = bswap_16(sample); goto PUT16_END;
450 put16_12_29: as_u16(dst) = bswap_16(sample) ^ 0x80; goto PUT16_END;
451 put16_12_0120: as_u32(dst) = sx24((u_int32_t)sample << 8); goto PUT16_END;
452 put16_12_0920: as_u32(dst) = sx24((u_int32_t)(sample ^ 0x8000) << 8); goto PUT16_END;
453 put16_12_0210: as_u32(dst) = sx24s((u_int32_t)bswap_16(sample) << 8); goto PUT16_END;
454 put16_12_0290: as_u32(dst) = sx24s((u_int32_t)(bswap_16(sample) ^ 0x80) << 8); goto PUT16_END;
455 put16_12_1200: as_u32(dst) = (u_int32_t)sample << 16; goto PUT16_END;
456 put16_12_9200: as_u32(dst) = (u_int32_t)(sample ^ 0x8000) << 16; goto PUT16_END;
457 put16_12_0021: as_u32(dst) = (u_int32_t)bswap_16(sample); goto PUT16_END;
458 put16_12_0029: as_u32(dst) = (u_int32_t)bswap_16(sample) ^ 0x80; goto PUT16_END;
459 put16_12_120: _put_triple(dst, (u_int32_t)sample << 8); goto PUT16_END;
460 put16_12_920: _put_triple(dst, (u_int32_t)(sample ^ 0x8000) << 8); goto PUT16_END;
461 put16_12_021: _put_triple_s(dst, (u_int32_t)sample << 8); goto PUT16_END;
462 put16_12_029: _put_triple_s(dst, (u_int32_t)(sample ^ 0x8000) << 8); goto PUT16_END;
463 put16_12_120_20: _put_triple(dst, (u_int32_t)sample << 4); goto PUT16_END;
464 put16_12_920_20: _put_triple(dst, (u_int32_t)(sample ^ 0x8000) << 4); goto PUT16_END;
465 put16_12_021_20: _put_triple_s(dst, (u_int32_t)sample << 4); goto PUT16_END;
466 put16_12_029_20: _put_triple_s(dst, (u_int32_t)(sample ^ 0x8000) << 4); goto PUT16_END;
467 put16_12_120_18: _put_triple(dst, (u_int32_t)sample << 2); goto PUT16_END;
468 put16_12_920_18: _put_triple(dst, (u_int32_t)(sample ^ 0x8000) << 2); goto PUT16_END;
469 put16_12_021_18: _put_triple_s(dst, (u_int32_t)sample << 2); goto PUT16_END;
470 put16_12_029_18: _put_triple_s(dst, (u_int32_t)(sample ^ 0x8000) << 2); goto PUT16_END;
472 #endif
474 #ifdef CONV24_LABELS
475 #define GET32_LABELS
476 #define PUT32_LABELS
477 #endif
479 #ifdef GET32_LABELS
480 /* src_wid src_endswap sign_toggle */
481 static void *const get32_labels[4 * 2 * 2 + 4 * 3] = {
482 &&get32_1_1000, /* 8h -> 32h */
483 &&get32_1_9000, /* 8h ^> 32h */
484 &&get32_1_1000, /* 8s -> 32h */
485 &&get32_1_9000, /* 8s ^> 32h */
486 &&get32_12_1200, /* 16h -> 32h */
487 &&get32_12_9200, /* 16h ^> 32h */
488 &&get32_12_2100, /* 16s -> 32h */
489 &&get32_12_A100, /* 16s ^> 32h */
490 &&get32_0123_1230, /* 24h -> 32h */
491 &&get32_0123_9230, /* 24h ^> 32h */
492 &&get32_1230_3210, /* 24s -> 32h */
493 &&get32_1230_B210, /* 24s ^> 32h */
494 &&get32_1234_1234, /* 32h -> 32h */
495 &&get32_1234_9234, /* 32h ^> 32h */
496 &&get32_1234_4321, /* 32s -> 32h */
497 &&get32_1234_C321, /* 32s ^> 32h */
498 /* 3bytes format */
499 &&get32_123_1230, /* 24h -> 32h */
500 &&get32_123_9230, /* 24h ^> 32h */
501 &&get32_123_3210, /* 24s -> 32h */
502 &&get32_123_B210, /* 24s ^> 32h */
503 &&get32_123_1230_20, /* 20h -> 32h */
504 &&get32_123_9230_20, /* 20h ^> 32h */
505 &&get32_123_3210_20, /* 20s -> 32h */
506 &&get32_123_B210_20, /* 20s ^> 32h */
507 &&get32_123_1230_18, /* 18h -> 32h */
508 &&get32_123_9230_18, /* 18h ^> 32h */
509 &&get32_123_3210_18, /* 18s -> 32h */
510 &&get32_123_B210_18, /* 18s ^> 32h */
512 #endif
514 #ifdef CONV24_END
515 #define GET32_END __conv24_get
516 #endif
518 #ifdef GET32_END
519 while (0) {
520 get32_1_1000: sample = (u_int32_t)as_u8c(src) << 24; goto GET32_END;
521 get32_1_9000: sample = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto GET32_END;
522 get32_12_1200: sample = (u_int32_t)as_u16c(src) << 16; goto GET32_END;
523 get32_12_9200: sample = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto GET32_END;
524 get32_12_2100: sample = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto GET32_END;
525 get32_12_A100: sample = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto GET32_END;
526 get32_0123_1230: sample = as_u32c(src) << 8; goto GET32_END;
527 get32_0123_9230: sample = (as_u32c(src) << 8) ^ 0x80000000; goto GET32_END;
528 get32_1230_3210: sample = bswap_32(as_u32c(src) >> 8); goto GET32_END;
529 get32_1230_B210: sample = bswap_32((as_u32c(src) >> 8) ^ 0x80); goto GET32_END;
530 get32_1234_1234: sample = as_u32c(src); goto GET32_END;
531 get32_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GET32_END;
532 get32_1234_4321: sample = bswap_32(as_u32c(src)); goto GET32_END;
533 get32_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GET32_END;
534 get32_123_1230: sample = _get_triple(src) << 8; goto GET32_END;
535 get32_123_9230: sample = (_get_triple(src) << 8) ^ 0x80000000; goto GET32_END;
536 get32_123_3210: sample = _get_triple_s(src) << 8; goto GET32_END;
537 get32_123_B210: sample = (_get_triple_s(src) << 8) ^ 0x80000000; goto GET32_END;
538 get32_123_1230_20: sample = _get_triple(src) << 12; goto GET32_END;
539 get32_123_9230_20: sample = (_get_triple(src) << 12) ^ 0x80000000; goto GET32_END;
540 get32_123_3210_20: sample = _get_triple_s(src) << 12; goto GET32_END;
541 get32_123_B210_20: sample = (_get_triple_s(src) << 12) ^ 0x80000000; goto GET32_END;
542 get32_123_1230_18: sample = _get_triple(src) << 14; goto GET32_END;
543 get32_123_9230_18: sample = (_get_triple(src) << 14) ^ 0x80000000; goto GET32_END;
544 get32_123_3210_18: sample = _get_triple_s(src) << 14; goto GET32_END;
545 get32_123_B210_18: sample = (_get_triple_s(src) << 14) ^ 0x80000000; goto GET32_END;
547 #endif
549 #ifdef CONV24_END
550 __conv24_get: goto *put;
551 #define PUT32_END CONV24_END
552 #endif
554 #ifdef PUT32_LABELS
555 /* dst_wid dst_endswap sign_toggle */
556 static void *const put32_labels[4 * 2 * 2 + 4 * 3] = {
557 &&put32_1234_1, /* 32h -> 8h */
558 &&put32_1234_9, /* 32h ^> 8h */
559 &&put32_1234_1, /* 32h -> 8s */
560 &&put32_1234_9, /* 32h ^> 8s */
561 &&put32_1234_12, /* 32h -> 16h */
562 &&put32_1234_92, /* 32h ^> 16h */
563 &&put32_1234_21, /* 32h -> 16s */
564 &&put32_1234_29, /* 32h ^> 16s */
565 &&put32_1234_0123, /* 32h -> 24h */
566 &&put32_1234_0923, /* 32h ^> 24h */
567 &&put32_1234_3210, /* 32h -> 24s */
568 &&put32_1234_3290, /* 32h ^> 24s */
569 &&put32_1234_1234, /* 32h -> 32h */
570 &&put32_1234_9234, /* 32h ^> 32h */
571 &&put32_1234_4321, /* 32h -> 32s */
572 &&put32_1234_4329, /* 32h ^> 32s */
573 /* 3bytes format */
574 &&put32_1234_123, /* 32h -> 24h */
575 &&put32_1234_923, /* 32h ^> 24h */
576 &&put32_1234_321, /* 32h -> 24s */
577 &&put32_1234_329, /* 32h ^> 24s */
578 &&put32_1234_123_20, /* 32h -> 24h */
579 &&put32_1234_923_20, /* 32h ^> 24h */
580 &&put32_1234_321_20, /* 32h -> 24s */
581 &&put32_1234_329_20, /* 32h ^> 24s */
582 &&put32_1234_123_18, /* 32h -> 24h */
583 &&put32_1234_923_18, /* 32h ^> 24h */
584 &&put32_1234_321_18, /* 32h -> 24s */
585 &&put32_1234_329_18, /* 32h ^> 24s */
587 #endif
589 #ifdef CONV24_LABELS
590 #undef GET32_LABELS
591 #undef PUT32_LABELS
592 #endif
594 #ifdef PUT32_END
595 while (0) {
596 put32_1234_1: as_u8(dst) = sample >> 24; goto PUT32_END;
597 put32_1234_9: as_u8(dst) = (sample >> 24) ^ 0x80; goto PUT32_END;
598 put32_1234_12: as_u16(dst) = sample >> 16; goto PUT32_END;
599 put32_1234_92: as_u16(dst) = (sample >> 16) ^ 0x8000; goto PUT32_END;
600 put32_1234_21: as_u16(dst) = bswap_16(sample >> 16); goto PUT32_END;
601 put32_1234_29: as_u16(dst) = bswap_16(sample >> 16) ^ 0x80; goto PUT32_END;
602 put32_1234_0123: as_u32(dst) = sx24(sample >> 8); goto PUT32_END;
603 put32_1234_0923: as_u32(dst) = sx24((sample >> 8) ^ 0x800000); goto PUT32_END;
604 put32_1234_3210: as_u32(dst) = sx24s(bswap_32(sample) << 8); goto PUT32_END;
605 put32_1234_3290: as_u32(dst) = sx24s((bswap_32(sample) ^ 0x80) << 8); goto PUT32_END;
606 put32_1234_1234: as_u32(dst) = sample; goto PUT32_END;
607 put32_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT32_END;
608 put32_1234_4321: as_u32(dst) = bswap_32(sample); goto PUT32_END;
609 put32_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT32_END;
610 put32_1234_123: _put_triple(dst, sample >> 8); goto PUT32_END;
611 put32_1234_923: _put_triple(dst, (sample ^ 0x80000000) >> 8); goto PUT32_END;
612 put32_1234_321: _put_triple_s(dst, sample >> 8); goto PUT32_END;
613 put32_1234_329: _put_triple_s(dst, (sample ^ 0x80000000) >> 8); goto PUT32_END;
614 put32_1234_123_20: _put_triple(dst, sample >> 12); goto PUT32_END;
615 put32_1234_923_20: _put_triple(dst, (sample ^ 0x80000000) >> 12); goto PUT32_END;
616 put32_1234_321_20: _put_triple_s(dst, sample >> 12); goto PUT32_END;
617 put32_1234_329_20: _put_triple_s(dst, (sample ^ 0x80000000) >> 12); goto PUT32_END;
618 put32_1234_123_18: _put_triple(dst, sample >> 14); goto PUT32_END;
619 put32_1234_923_18: _put_triple(dst, (sample ^ 0x80000000) >> 14); goto PUT32_END;
620 put32_1234_321_18: _put_triple_s(dst, sample >> 14); goto PUT32_END;
621 put32_1234_329_18: _put_triple_s(dst, (sample ^ 0x80000000) >> 14); goto PUT32_END;
623 #endif
625 #ifdef CONV24_END
626 #undef GET32_END
627 #undef PUT32_END
628 #endif
630 #ifdef GETU_LABELS
631 /* width endswap sign_toggle */
632 static void *const getu_labels[4 * 2 * 2] = {
633 &&getu_1_1, /* 8h -> 8h */
634 &&getu_1_9, /* 8h ^> 8h */
635 &&getu_1_1, /* 8s -> 8h */
636 &&getu_1_9, /* 8s ^> 8h */
637 &&getu_12_12, /* 16h -> 16h */
638 &&getu_12_92, /* 16h ^> 16h */
639 &&getu_12_21, /* 16s -> 16h */
640 &&getu_12_A1, /* 16s ^> 16h */
641 &&getu_0123_0123, /* 24h -> 24h */
642 &&getu_0123_0923, /* 24h ^> 24h */
643 &&getu_1230_0321, /* 24s -> 24h */
644 &&getu_1230_0B21, /* 24s ^> 24h */
645 &&getu_1234_1234, /* 32h -> 32h */
646 &&getu_1234_9234, /* 32h ^> 32h */
647 &&getu_1234_4321, /* 32s -> 32h */
648 &&getu_1234_C321, /* 32s ^> 32h */
650 #endif
652 #ifdef GETU_END
653 while (0) {
654 getu_1_1: sample = as_u8c(src); goto GETU_END;
655 getu_1_9: sample = as_u8c(src) ^ 0x80; goto GETU_END;
656 getu_12_12: sample = as_u16c(src); goto GETU_END;
657 getu_12_92: sample = as_u16c(src) ^ 0x8000; goto GETU_END;
658 getu_12_21: sample = bswap_16(as_u16c(src)); goto GETU_END;
659 getu_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GETU_END;
660 getu_0123_0123: sample = sx24(as_u32c(src)); goto GETU_END;
661 getu_0123_0923: sample = sx24(as_u32c(src) ^ 0x800000); goto GETU_END;
662 getu_1230_0321: sample = sx24(bswap_32(as_u32c(src))); goto GETU_END;
663 getu_1230_0B21: sample = sx24(bswap_32(as_u32c(src) ^ 0x8000)); goto GETU_END;
664 getu_1234_1234: sample = as_u32c(src); goto GETU_END;
665 getu_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GETU_END;
666 getu_1234_4321: sample = bswap_32(as_u32c(src)); goto GETU_END;
667 getu_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GETU_END;
669 #endif
671 #ifdef GETS_LABELS
672 /* width endswap sign_toggle */
673 static void *const gets_labels[4 * 2 * 2] = {
674 &&gets_1_1, /* 8h -> 8h */
675 &&gets_1_9, /* 8h ^> 8h */
676 &&gets_1_1, /* 8s -> 8h */
677 &&gets_1_9, /* 8s ^> 8h */
678 &&gets_12_12, /* 16h -> 16h */
679 &&gets_12_92, /* 16h ^> 16h */
680 &&gets_12_21, /* 16s -> 16h */
681 &&gets_12_A1, /* 16s ^> 16h */
682 &&gets_0123_0123, /* 24h -> 24h */
683 &&gets_0123_0923, /* 24h ^> 24h */
684 &&gets_1230_0321, /* 24s -> 24h */
685 &&gets_1230_0B21, /* 24s ^> 24h */
686 &&gets_1234_1234, /* 32h -> 32h */
687 &&gets_1234_9234, /* 32h ^> 32h */
688 &&gets_1234_4321, /* 32s -> 32h */
689 &&gets_1234_C321, /* 32s ^> 32h */
691 #endif
693 #ifdef GETS_END
694 while (0) {
695 gets_1_1: sample = as_s8c(src); goto GETS_END;
696 gets_1_9: sample = (int8_t)(as_s8c(src) ^ 0x80); goto GETS_END;
697 gets_12_12: sample = as_s16c(src); goto GETS_END;
698 gets_12_92: sample = (int16_t)(as_s16c(src) ^ 0x8000); goto GETS_END;
699 gets_12_21: sample = (int16_t)bswap_16(as_s16c(src)); goto GETS_END;
700 gets_12_A1: sample = (int16_t)bswap_16(as_s16c(src) ^ 0x80); goto GETS_END;
701 gets_0123_0123: sample = sx24((int32_t)(as_s32c(src) << 8) >> 8); goto GETS_END;
702 gets_0123_0923: sample = sx24((int32_t)((as_s32c(src) ^ 0x800000) << 8) >> 8); goto GETS_END;
703 gets_1230_0321: sample = sx24((int32_t)(bswap_32(as_s32c(src)) << 8) >> 8); goto GETS_END;
704 gets_1230_0B21: sample = sx24((int32_t)(bswap_32(as_s32c(src) ^ 0x8000) << 8) >> 8); goto GETS_END;
705 gets_1234_1234: sample = as_s32c(src); goto GETS_END;
706 gets_1234_9234: sample = (int32_t)(as_s32c(src) ^ 0x80000000); goto GETS_END;
707 gets_1234_4321: sample = (int32_t)bswap_32(as_s32c(src)); goto GETS_END;
708 gets_1234_C321: sample = (int32_t)bswap_32(as_s32c(src) ^ 0x80); goto GETS_END;
710 #endif
712 #ifdef PUT_LABELS
713 /* width endswap sign_toggle */
714 static void *const put_labels[4 * 2 * 2] = {
715 &&put_1_1, /* 8h -> 8h */
716 &&put_1_9, /* 8h ^> 8h */
717 &&put_1_1, /* 8h -> 8s */
718 &&put_1_9, /* 8h ^> 8s */
719 &&put_12_12, /* 16h -> 16h */
720 &&put_12_92, /* 16h ^> 16h */
721 &&put_12_21, /* 16h -> 16s */
722 &&put_12_29, /* 16h ^> 16s */
723 &&put_0123_0123, /* 24h -> 24h */
724 &&put_0123_0923, /* 24h ^> 24h */
725 &&put_0123_3210, /* 24h -> 24s */
726 &&put_0123_3290, /* 24h ^> 24s */
727 &&put_1234_1234, /* 32h -> 32h */
728 &&put_1234_9234, /* 32h ^> 32h */
729 &&put_1234_4321, /* 32h -> 32s */
730 &&put_1234_4329, /* 32h ^> 32s */
732 #endif
734 #ifdef PUT_END
735 put_1_1: as_s8(dst) = sample; goto PUT_END;
736 put_1_9: as_u8(dst) = sample ^ 0x80; goto PUT_END;
737 put_12_12: as_s16(dst) = sample; goto PUT_END;
738 put_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT_END;
739 put_12_21: as_s16(dst) = bswap_16(sample); goto PUT_END;
740 put_12_29: as_u16(dst) = bswap_16(sample) ^ 0x80; goto PUT_END;
741 /* this always writes the unused byte in 24-bit formats as 0x00 */
742 put_0123_0123: as_s32(dst) = sx24(sample & 0x00ffffff); goto PUT_END;
743 put_0123_0923: as_u32(dst) = sx24((sample & 0x00ffffff) ^ 0x800000); goto PUT_END;
744 put_0123_3210: as_s32(dst) = sx24s(bswap_32(sample) & 0xffffff00); goto PUT_END;
745 put_0123_3290: as_u32(dst) = sx24s((bswap_32(sample) & 0xffffff00) ^ 0x8000); goto PUT_END;
746 put_1234_1234: as_s32(dst) = sample; goto PUT_END;
747 put_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT_END;
748 put_1234_4321: as_s32(dst) = bswap_32(sample); goto PUT_END;
749 put_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT_END;
750 #endif
752 #ifdef PUT32F_LABELS
753 /* type (0 = float, 1 = float64), endswap */
754 static void *const put32float_labels[2 * 2] = {
755 &&put32f_1234_1234F, /* 32h -> (float)h */
756 &&put32f_1234_4321F, /* 32h -> (float)s */
757 &&put32f_1234_1234D, /* 32h -> (float64)h */
758 &&put32f_1234_4321D, /* 32h -> (float64)s */
760 #endif
762 #ifdef PUT32F_END
763 put32f_1234_1234F: as_float(dst) = (float_t)((int32_t)sample) / (float_t)0x80000000UL; goto PUT32F_END;
764 put32f_1234_4321F: tmp_float.f = (float_t)((int32_t)sample) / (float_t)0x80000000UL;
765 as_u32(dst) = bswap_32(tmp_float.i); goto PUT32F_END;
766 put32f_1234_1234D: as_double(dst) = (double_t)((int32_t)sample) / (double_t)0x80000000UL; goto PUT32F_END;
767 put32f_1234_4321D: tmp_double.d = (double_t)((int32_t)sample) / (double_t)0x80000000UL;
768 as_u64(dst) = bswap_64(tmp_double.l); goto PUT32F_END;
769 #endif
771 #ifdef GET32F_LABELS
772 /* type (0 = float, 1 = float64), endswap */
773 static void *const get32float_labels[2 * 2] = {
774 &&get32f_1234F_1234, /* (float)h -> 32h */
775 &&get32f_4321F_1234, /* (float)s -> 32h */
776 &&get32f_1234D_1234, /* (float64)h -> 32h */
777 &&get32f_4321D_1234, /* (float64)s -> 32h */
779 #endif
781 #ifdef GET32F_END
782 get32f_1234F_1234: tmp_float.f = as_floatc(src);
783 if (tmp_float.f >= 1.0)
784 sample = 0x7fffffff;
785 else if (tmp_float.f <= -1.0)
786 sample = 0x80000000;
787 else
788 sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
789 goto GET32F_END;
790 get32f_4321F_1234: tmp_float.i = bswap_32(as_u32c(src));
791 if (tmp_float.f >= 1.0)
792 sample = 0x7fffffff;
793 else if (tmp_float.f <= -1.0)
794 sample = 0x80000000;
795 else
796 sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
797 goto GET32F_END;
798 get32f_1234D_1234: tmp_double.d = as_doublec(src);
799 if (tmp_double.d >= 1.0)
800 sample = 0x7fffffff;
801 else if (tmp_double.d <= -1.0)
802 sample = 0x80000000;
803 else
804 sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
805 goto GET32F_END;
806 get32f_4321D_1234: tmp_double.l = bswap_64(as_u64c(src));
807 if (tmp_double.d >= 1.0)
808 sample = 0x7fffffff;
809 else if (tmp_double.d <= -1.0)
810 sample = 0x80000000;
811 else
812 sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
813 goto GET32F_END;
814 #endif
816 #ifdef NORMS_LABELS
817 static inline void _norms(const void *src, void *dst,
818 int src_wid,
819 int dst_sign, int dst_wid, int dst_end)
821 int32_t s;
822 switch (src_wid) {
823 case 8:
824 s = *(int32_t*)src;
825 if (s >= 0x7f)
826 goto _max;
827 else if (s <= -0x80)
828 goto _min;
829 break;
830 case 16:
831 s = *(int32_t*)src;
832 if (s >= 0x7fff)
833 goto _max;
834 else if (s <= -0x8000)
835 goto _min;
836 break;
837 case 24:
838 s = *(int32_t*)src;
839 if (s >= 0x7fffff)
840 goto _max;
841 else if (s <= -0x800000)
842 goto _min;
843 break;
844 case 32:
846 int64_t s64;
847 s64 = *(int64_t*)src;
848 if (s64 >= 0x7fffffff)
849 goto _max;
850 else if (s64 <= -0x80000000)
851 goto _min;
852 s = s64;
853 break;
855 default:
856 assert(0);
857 return;
859 if (src_wid < dst_wid) {
860 unsigned int bits = dst_wid - src_wid;
861 s *= 1 << bits;
862 } else if (src_wid > dst_wid) {
863 unsigned int bits = src_wid - dst_wid;
864 s = (s + (1 << (bits - 1))) / (1 << bits);
866 if (!dst_sign)
867 s += (1U << (dst_wid - 1));
868 switch (dst_wid) {
869 case 8:
870 *(u_int8_t*)dst = s;
871 break;
872 case 16:
873 if (dst_end)
874 s = bswap_16(s);
875 *(u_int16_t*)dst = s;
876 break;
877 case 24:
878 case 32:
879 if (dst_end)
880 s = bswap_32(s);
881 *(u_int32_t*)dst = s;
882 break;
884 return;
886 _min:
887 switch (dst_wid) {
888 case 8:
889 if (dst_sign)
890 *(u_int8_t*)dst = 0x80;
891 else
892 *(u_int8_t*)dst = 0;
893 break;
894 case 16:
895 if (dst_sign)
896 *(u_int16_t*)dst = dst_end ? 0x0080 : 0x8000;
897 else
898 *(u_int16_t*)dst = 0;
899 break;
900 case 24:
901 if (dst_sign)
902 *(u_int32_t*)dst = dst_end ? 0x00008000 : 0x00800000;
903 else
904 *(u_int32_t*)dst = 0;
905 break;
906 case 32:
907 if (dst_sign)
908 *(u_int32_t*)dst = dst_end ? 0x00000080 : 0x80000000;
909 else
910 *(u_int32_t*)dst = 0;
911 break;
912 default:
913 assert(0);
914 break;
916 return;
918 _max:
919 switch (dst_wid) {
920 case 8:
921 if (dst_sign)
922 *(u_int8_t*)dst = 0x7f;
923 else
924 *(u_int8_t*)dst = 0xff;
925 break;
926 case 16:
927 if (dst_sign)
928 *(u_int16_t*)dst = dst_end ? 0xff7f : 0x7fff;
929 else
930 *(u_int16_t*)dst = 0;
931 break;
932 case 24:
933 if (dst_sign)
934 *(u_int32_t*)dst = dst_end ? 0xffff7f00 : 0x007fffff;
935 else
936 *(u_int32_t*)dst = 0;
937 break;
938 case 32:
939 if (dst_sign)
940 *(u_int32_t*)dst = dst_end ? 0xffffff7f : 0x7fffffff;
941 else
942 *(u_int32_t*)dst = 0;
943 break;
944 default:
945 assert(0);
946 break;
948 return;
951 /* src_wid dst_sign dst_wid dst_end */
952 static void *const norms_labels[4 * 2 * 4 * 2] = {
953 &&norms_8_u8, /* s8 -> u8 */
954 &&norms_8_u8, /* s8 -> u8 */
955 &&norms_8_u16h, /* s8 -> u16h */
956 &&norms_8_u16s, /* s8 -> u16s */
957 &&norms_8_u24h, /* s8 -> u24h */
958 &&norms_8_u24s, /* s8 -> u24s */
959 &&norms_8_u32h, /* s8 -> u32h */
960 &&norms_8_u32s, /* s8 -> u32s */
961 &&norms_8_s8, /* s8 -> s8 */
962 &&norms_8_s8, /* s8 -> s8 */
963 &&norms_8_s16h, /* s8 -> s16h */
964 &&norms_8_s16s, /* s8 -> s16s */
965 &&norms_8_s24h, /* s8 -> s24h */
966 &&norms_8_s24s, /* s8 -> s24s */
967 &&norms_8_s32h, /* s8 -> s32h */
968 &&norms_8_s32s, /* s8 -> s32s */
969 &&norms_16_u8, /* s16 -> u8 */
970 &&norms_16_u8, /* s16 -> u8 */
971 &&norms_16_u16h, /* s16 -> u16h */
972 &&norms_16_u16s, /* s16 -> u16s */
973 &&norms_16_u24h, /* s16 -> u24h */
974 &&norms_16_u24s, /* s16 -> u24s */
975 &&norms_16_u32h, /* s16 -> u32h */
976 &&norms_16_u32s, /* s16 -> u32s */
977 &&norms_16_s8, /* s16 -> s8 h*/
978 &&norms_16_s8, /* s16 -> s8 */
979 &&norms_16_s16h, /* s16 -> s16h */
980 &&norms_16_s16s, /* s16 -> s16s */
981 &&norms_16_s24h, /* s16 -> s24h */
982 &&norms_16_s24s, /* s16 -> s24s */
983 &&norms_16_s32h, /* s16 -> s32h */
984 &&norms_16_s32s, /* s16 -> s32s */
985 &&norms_24_u8, /* s24 -> u8 */
986 &&norms_24_u8, /* s24 -> u8 */
987 &&norms_24_u16h, /* s24 -> u16h */
988 &&norms_24_u16s, /* s24 -> u16s */
989 &&norms_24_u24h, /* s24 -> u24h */
990 &&norms_24_u24s, /* s24 -> u24s */
991 &&norms_24_u32h, /* s24 -> u32h */
992 &&norms_24_u32s, /* s24 -> u32s */
993 &&norms_24_s8, /* s24 -> s8 */
994 &&norms_24_s8, /* s24 -> s8 */
995 &&norms_24_s16h, /* s24 -> s16h */
996 &&norms_24_s16s, /* s24 -> s16s */
997 &&norms_24_s24h, /* s24 -> s24h */
998 &&norms_24_s24s, /* s24 -> s24s */
999 &&norms_24_s32h, /* s24 -> s32h */
1000 &&norms_24_s32s, /* s24 -> s32s */
1001 &&norms_32_u8, /* s32 -> u8 */
1002 &&norms_32_u8, /* s32 -> u8 */
1003 &&norms_32_u16h, /* s32 -> u16h */
1004 &&norms_32_u16s, /* s32 -> u16s */
1005 &&norms_32_u24h, /* s32 -> u24h */
1006 &&norms_32_u24s, /* s32 -> u24s */
1007 &&norms_32_u32h, /* s32 -> u32h */
1008 &&norms_32_u32s, /* s32 -> u32s */
1009 &&norms_32_s8, /* s32 -> s8 */
1010 &&norms_32_s8, /* s32 -> s8 */
1011 &&norms_32_s16h, /* s32 -> s16h */
1012 &&norms_32_s16s, /* s32 -> s16s */
1013 &&norms_32_s24h, /* s32 -> s24h */
1014 &&norms_32_s24s, /* s32 -> s24s */
1015 &&norms_32_s32h, /* s32 -> s32h */
1016 &&norms_32_s32s, /* s32 -> s32s */
1018 #endif
1020 #ifdef NORMS_END
1021 norms_8_u8: _norms(src, dst, 8, 0, 8, 0); goto NORMS_END;
1022 norms_8_u16h: _norms(src, dst, 8, 0, 16, 0); goto NORMS_END;
1023 norms_8_u16s: _norms(src, dst, 8, 0, 16, 1); goto NORMS_END;
1024 norms_8_u24h: _norms(src, dst, 8, 0, 24, 0); goto NORMS_END;
1025 norms_8_u24s: _norms(src, dst, 8, 0, 24, 1); goto NORMS_END;
1026 norms_8_u32h: _norms(src, dst, 8, 0, 32, 0); goto NORMS_END;
1027 norms_8_u32s: _norms(src, dst, 8, 0, 32, 1); goto NORMS_END;
1028 norms_8_s8: _norms(src, dst, 8, 1, 8, 0); goto NORMS_END;
1029 norms_8_s16h: _norms(src, dst, 8, 1, 16, 0); goto NORMS_END;
1030 norms_8_s16s: _norms(src, dst, 8, 1, 16, 1); goto NORMS_END;
1031 norms_8_s24h: _norms(src, dst, 8, 1, 24, 0); goto NORMS_END;
1032 norms_8_s24s: _norms(src, dst, 8, 1, 24, 1); goto NORMS_END;
1033 norms_8_s32h: _norms(src, dst, 8, 1, 32, 0); goto NORMS_END;
1034 norms_8_s32s: _norms(src, dst, 8, 1, 32, 1); goto NORMS_END;
1035 norms_16_u8: _norms(src, dst, 16, 0, 8, 0); goto NORMS_END;
1036 norms_16_u16h: _norms(src, dst, 16, 0, 16, 0); goto NORMS_END;
1037 norms_16_u16s: _norms(src, dst, 16, 0, 16, 1); goto NORMS_END;
1038 norms_16_u24h: _norms(src, dst, 16, 0, 24, 0); goto NORMS_END;
1039 norms_16_u24s: _norms(src, dst, 16, 0, 24, 1); goto NORMS_END;
1040 norms_16_u32h: _norms(src, dst, 16, 0, 32, 0); goto NORMS_END;
1041 norms_16_u32s: _norms(src, dst, 16, 0, 32, 1); goto NORMS_END;
1042 norms_16_s8: _norms(src, dst, 16, 1, 8, 0); goto NORMS_END;
1043 norms_16_s16h: _norms(src, dst, 16, 1, 16, 0); goto NORMS_END;
1044 norms_16_s16s: _norms(src, dst, 16, 1, 16, 1); goto NORMS_END;
1045 norms_16_s24h: _norms(src, dst, 16, 1, 24, 0); goto NORMS_END;
1046 norms_16_s24s: _norms(src, dst, 16, 1, 24, 1); goto NORMS_END;
1047 norms_16_s32h: _norms(src, dst, 16, 1, 32, 0); goto NORMS_END;
1048 norms_16_s32s: _norms(src, dst, 16, 1, 32, 1); goto NORMS_END;
1049 norms_24_u8: _norms(src, dst, 24, 0, 8, 0); goto NORMS_END;
1050 norms_24_u16h: _norms(src, dst, 24, 0, 16, 0); goto NORMS_END;
1051 norms_24_u16s: _norms(src, dst, 24, 0, 16, 1); goto NORMS_END;
1052 norms_24_u24h: _norms(src, dst, 24, 0, 24, 0); goto NORMS_END;
1053 norms_24_u24s: _norms(src, dst, 24, 0, 24, 1); goto NORMS_END;
1054 norms_24_u32h: _norms(src, dst, 24, 0, 32, 0); goto NORMS_END;
1055 norms_24_u32s: _norms(src, dst, 24, 0, 32, 1); goto NORMS_END;
1056 norms_24_s8: _norms(src, dst, 24, 1, 8, 0); goto NORMS_END;
1057 norms_24_s16h: _norms(src, dst, 24, 1, 16, 0); goto NORMS_END;
1058 norms_24_s16s: _norms(src, dst, 24, 1, 16, 1); goto NORMS_END;
1059 norms_24_s24h: _norms(src, dst, 24, 1, 24, 0); goto NORMS_END;
1060 norms_24_s24s: _norms(src, dst, 24, 1, 24, 1); goto NORMS_END;
1061 norms_24_s32h: _norms(src, dst, 24, 1, 32, 0); goto NORMS_END;
1062 norms_24_s32s: _norms(src, dst, 24, 1, 32, 1); goto NORMS_END;
1063 norms_32_u8: _norms(src, dst, 32, 0, 8, 0); goto NORMS_END;
1064 norms_32_u16h: _norms(src, dst, 32, 0, 16, 0); goto NORMS_END;
1065 norms_32_u16s: _norms(src, dst, 32, 0, 16, 1); goto NORMS_END;
1066 norms_32_u24h: _norms(src, dst, 32, 0, 24, 0); goto NORMS_END;
1067 norms_32_u24s: _norms(src, dst, 32, 0, 24, 1); goto NORMS_END;
1068 norms_32_u32h: _norms(src, dst, 32, 0, 32, 0); goto NORMS_END;
1069 norms_32_u32s: _norms(src, dst, 32, 0, 32, 1); goto NORMS_END;
1070 norms_32_s8: _norms(src, dst, 32, 1, 8, 0); goto NORMS_END;
1071 norms_32_s16h: _norms(src, dst, 32, 1, 16, 0); goto NORMS_END;
1072 norms_32_s16s: _norms(src, dst, 32, 1, 16, 1); goto NORMS_END;
1073 norms_32_s24h: _norms(src, dst, 32, 1, 24, 0); goto NORMS_END;
1074 norms_32_s24s: _norms(src, dst, 32, 1, 24, 1); goto NORMS_END;
1075 norms_32_s32h: _norms(src, dst, 32, 1, 32, 0); goto NORMS_END;
1076 norms_32_s32s: _norms(src, dst, 32, 1, 32, 1); goto NORMS_END;
1077 #endif
1080 #undef as_u8
1081 #undef as_u16
1082 #undef as_u32
1083 #undef as_s8
1084 #undef as_s16
1085 #undef as_s32
1086 #undef as_float
1087 #undef as_double
1089 #undef as_u8c
1090 #undef as_u16c
1091 #undef as_u32c
1092 #undef as_s8c
1093 #undef as_s16c
1094 #undef as_s32c
1095 #undef as_floatc
1096 #undef as_doublec
1098 #undef _get_triple
1099 #undef _get_triple_s
1100 #undef _get_triple_le
1101 #undef _get_triple_be
1102 #undef _put_triple
1103 #undef _put_triple_s
1104 #undef _put_triple_le
1105 #undef _put_triple_be