OSDN Git Service

Finished lfloat plugin.
[android-x86/external-alsa-lib.git] / src / pcm / plugin_ops.h
1 /*
2  *  Plugin sample operators with fast switch
3  *  Copyright (c) 2000 by Jaroslav Kysela <perex@suse.cz>
4  *
5  *
6  *   This library is free software; you can redistribute it and/or modify
7  *   it under the terms of the GNU Library General Public License as
8  *   published by the Free Software Foundation; either version 2 of
9  *   the License, or (at your option) any later version.
10  *
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 Library General Public License for more details.
15  *
16  *   You should have received a copy of the GNU Library General Public
17  *   License along with this library; if not, write to the Free Software
18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  */
21
22 #define as_u8(ptr) (*(u_int8_t*)(ptr))
23 #define as_u16(ptr) (*(u_int16_t*)(ptr))
24 #define as_u32(ptr) (*(u_int32_t*)(ptr))
25 #define as_u64(ptr) (*(u_int64_t*)(ptr))
26 #define as_s8(ptr) (*(int8_t*)(ptr))
27 #define as_s16(ptr) (*(int16_t*)(ptr))
28 #define as_s32(ptr) (*(int32_t*)(ptr))
29 #define as_s64(ptr) (*(int64_t*)(ptr))
30 #define as_float(ptr) (*(float_t*)(ptr))
31 #define as_double(ptr) (*(double_t*)(ptr))
32
33 #define as_u8c(ptr) (*(const u_int8_t*)(ptr))
34 #define as_u16c(ptr) (*(const u_int16_t*)(ptr))
35 #define as_u32c(ptr) (*(const u_int32_t*)(ptr))
36 #define as_u64c(ptr) (*(const u_int64_t*)(ptr))
37 #define as_s8c(ptr) (*(const int8_t*)(ptr))
38 #define as_s16c(ptr) (*(const int16_t*)(ptr))
39 #define as_s32c(ptr) (*(const int32_t*)(ptr))
40 #define as_s64c(ptr) (*(const int64_t*)(ptr))
41 #define as_floatc(ptr) (*(const float_t*)(ptr))
42 #define as_doublec(ptr) (*(const double_t*)(ptr))
43
44 #ifdef COPY_LABELS
45 static void *copy_labels[4] = {
46         &&copy_8,
47         &&copy_16,
48         &&copy_32,
49         &&copy_64
50 };
51 #endif
52
53 #ifdef COPY_END
54 while(0) {
55 copy_8: as_s8(dst) = as_s8c(src); goto COPY_END;
56 copy_16: as_s16(dst) = as_s16c(src); goto COPY_END;
57 copy_32: as_s32(dst) = as_s32c(src); goto COPY_END;
58 copy_64: as_s64(dst) = as_s64c(src); goto COPY_END;
59 }
60 #endif
61
62 #ifdef CONV_LABELS
63 /* src_wid src_endswap sign_toggle dst_wid dst_endswap */
64 static void *conv_labels[4 * 2 * 2 * 4 * 2] = {
65         &&conv_xxx1_xxx1,        /*  8h ->  8h */
66         &&conv_xxx1_xxx1,        /*  8h ->  8s */
67         &&conv_xxx1_xx10,        /*  8h -> 16h */
68         &&conv_xxx1_xx01,        /*  8h -> 16s */
69         &&conv_xxx1_x100,        /*  8h -> 24h */
70         &&conv_xxx1_001x,        /*  8h -> 24s */
71         &&conv_xxx1_1000,        /*  8h -> 32h */
72         &&conv_xxx1_0001,        /*  8h -> 32s */
73         &&conv_xxx1_xxx9,        /*  8h ^>  8h */
74         &&conv_xxx1_xxx9,        /*  8h ^>  8s */
75         &&conv_xxx1_xx90,        /*  8h ^> 16h */
76         &&conv_xxx1_xx09,        /*  8h ^> 16s */
77         &&conv_xxx1_x900,        /*  8h ^> 24h */
78         &&conv_xxx1_009x,        /*  8h ^> 24s */
79         &&conv_xxx1_9000,        /*  8h ^> 32h */
80         &&conv_xxx1_0009,        /*  8h ^> 32s */
81         &&conv_xxx1_xxx1,        /*  8s ->  8h */
82         &&conv_xxx1_xxx1,        /*  8s ->  8s */
83         &&conv_xxx1_xx10,        /*  8s -> 16h */
84         &&conv_xxx1_xx01,        /*  8s -> 16s */
85         &&conv_xxx1_x100,        /*  8s -> 24h */
86         &&conv_xxx1_001x,        /*  8s -> 24s */
87         &&conv_xxx1_1000,        /*  8s -> 32h */
88         &&conv_xxx1_0001,        /*  8s -> 32s */
89         &&conv_xxx1_xxx9,        /*  8s ^>  8h */
90         &&conv_xxx1_xxx9,        /*  8s ^>  8s */
91         &&conv_xxx1_xx90,        /*  8s ^> 16h */
92         &&conv_xxx1_xx09,        /*  8s ^> 16s */
93         &&conv_xxx1_x900,        /*  8s ^> 24h */
94         &&conv_xxx1_009x,        /*  8s ^> 24s */
95         &&conv_xxx1_9000,        /*  8s ^> 32h */
96         &&conv_xxx1_0009,        /*  8s ^> 32s */
97         &&conv_xx12_xxx1,        /* 16h ->  8h */
98         &&conv_xx12_xxx1,        /* 16h ->  8s */
99         &&conv_xx12_xx12,        /* 16h -> 16h */
100         &&conv_xx12_xx21,        /* 16h -> 16s */
101         &&conv_xx12_x120,        /* 16h -> 24h */
102         &&conv_xx12_021x,        /* 16h -> 24s */
103         &&conv_xx12_1200,        /* 16h -> 32h */
104         &&conv_xx12_0021,        /* 16h -> 32s */
105         &&conv_xx12_xxx9,        /* 16h ^>  8h */
106         &&conv_xx12_xxx9,        /* 16h ^>  8s */
107         &&conv_xx12_xx92,        /* 16h ^> 16h */
108         &&conv_xx12_xx29,        /* 16h ^> 16s */
109         &&conv_xx12_x920,        /* 16h ^> 24h */
110         &&conv_xx12_029x,        /* 16h ^> 24s */
111         &&conv_xx12_9200,        /* 16h ^> 32h */
112         &&conv_xx12_0029,        /* 16h ^> 32s */
113         &&conv_xx12_xxx2,        /* 16s ->  8h */
114         &&conv_xx12_xxx2,        /* 16s ->  8s */
115         &&conv_xx12_xx21,        /* 16s -> 16h */
116         &&conv_xx12_xx12,        /* 16s -> 16s */
117         &&conv_xx12_x210,        /* 16s -> 24h */
118         &&conv_xx12_012x,        /* 16s -> 24s */
119         &&conv_xx12_2100,        /* 16s -> 32h */
120         &&conv_xx12_0012,        /* 16s -> 32s */
121         &&conv_xx12_xxxA,        /* 16s ^>  8h */
122         &&conv_xx12_xxxA,        /* 16s ^>  8s */
123         &&conv_xx12_xxA1,        /* 16s ^> 16h */
124         &&conv_xx12_xx1A,        /* 16s ^> 16s */
125         &&conv_xx12_xA10,        /* 16s ^> 24h */
126         &&conv_xx12_01Ax,        /* 16s ^> 24s */
127         &&conv_xx12_A100,        /* 16s ^> 32h */
128         &&conv_xx12_001A,        /* 16s ^> 32s */
129         &&conv_x123_xxx1,        /* 24h ->  8h */
130         &&conv_x123_xxx1,        /* 24h ->  8s */
131         &&conv_x123_xx12,        /* 24h -> 16h */
132         &&conv_x123_xx21,        /* 24h -> 16s */
133         &&conv_x123_x123,        /* 24h -> 24h */
134         &&conv_x123_321x,        /* 24h -> 24s */
135         &&conv_x123_1230,        /* 24h -> 32h */
136         &&conv_x123_0321,        /* 24h -> 32s */
137         &&conv_x123_xxx9,        /* 24h ^>  8h */
138         &&conv_x123_xxx9,        /* 24h ^>  8s */
139         &&conv_x123_xx92,        /* 24h ^> 16h */
140         &&conv_x123_xx29,        /* 24h ^> 16s */
141         &&conv_x123_x923,        /* 24h ^> 24h */
142         &&conv_x123_329x,        /* 24h ^> 24s */
143         &&conv_x123_9230,        /* 24h ^> 32h */
144         &&conv_x123_0329,        /* 24h ^> 32s */
145         &&conv_123x_xxx3,        /* 24s ->  8h */
146         &&conv_123x_xxx3,        /* 24s ->  8s */
147         &&conv_123x_xx32,        /* 24s -> 16h */
148         &&conv_123x_xx23,        /* 24s -> 16s */
149         &&conv_123x_x321,        /* 24s -> 24h */
150         &&conv_123x_123x,        /* 24s -> 24s */
151         &&conv_123x_3210,        /* 24s -> 32h */
152         &&conv_123x_0123,        /* 24s -> 32s */
153         &&conv_123x_xxxB,        /* 24s ^>  8h */
154         &&conv_123x_xxxB,        /* 24s ^>  8s */
155         &&conv_123x_xxB2,        /* 24s ^> 16h */
156         &&conv_123x_xx2B,        /* 24s ^> 16s */
157         &&conv_123x_xB21,        /* 24s ^> 24h */
158         &&conv_123x_12Bx,        /* 24s ^> 24s */
159         &&conv_123x_B210,        /* 24s ^> 32h */
160         &&conv_123x_012B,        /* 24s ^> 32s */
161         &&conv_1234_xxx1,        /* 32h ->  8h */
162         &&conv_1234_xxx1,        /* 32h ->  8s */
163         &&conv_1234_xx12,        /* 32h -> 16h */
164         &&conv_1234_xx21,        /* 32h -> 16s */
165         &&conv_1234_x123,        /* 32h -> 24h */
166         &&conv_1234_321x,        /* 32h -> 24s */
167         &&conv_1234_1234,        /* 32h -> 32h */
168         &&conv_1234_4321,        /* 32h -> 32s */
169         &&conv_1234_xxx9,        /* 32h ^>  8h */
170         &&conv_1234_xxx9,        /* 32h ^>  8s */
171         &&conv_1234_xx92,        /* 32h ^> 16h */
172         &&conv_1234_xx29,        /* 32h ^> 16s */
173         &&conv_1234_x923,        /* 32h ^> 24h */
174         &&conv_1234_329x,        /* 32h ^> 24s */
175         &&conv_1234_9234,        /* 32h ^> 32h */
176         &&conv_1234_4329,        /* 32h ^> 32s */
177         &&conv_1234_xxx4,        /* 32s ->  8h */
178         &&conv_1234_xxx4,        /* 32s ->  8s */
179         &&conv_1234_xx43,        /* 32s -> 16h */
180         &&conv_1234_xx34,        /* 32s -> 16s */
181         &&conv_1234_x432,        /* 32s -> 24h */
182         &&conv_1234_234x,        /* 32s -> 24s */
183         &&conv_1234_4321,        /* 32s -> 32h */
184         &&conv_1234_1234,        /* 32s -> 32s */
185         &&conv_1234_xxxC,        /* 32s ^>  8h */
186         &&conv_1234_xxxC,        /* 32s ^>  8s */
187         &&conv_1234_xxC3,        /* 32s ^> 16h */
188         &&conv_1234_xx3C,        /* 32s ^> 16s */
189         &&conv_1234_xC32,        /* 32s ^> 24h */
190         &&conv_1234_23Cx,        /* 32s ^> 24s */
191         &&conv_1234_C321,        /* 32s ^> 32h */
192         &&conv_1234_123C,        /* 32s ^> 32s */
193 };
194 #endif
195
196 #ifdef CONV_END
197 while(0) {
198 conv_xxx1_xxx1: as_u8(dst) = as_u8c(src); goto CONV_END;
199 conv_xxx1_xx10: as_u16(dst) = (u_int16_t)as_u8c(src) << 8; goto CONV_END;
200 conv_xxx1_xx01: as_u16(dst) = (u_int16_t)as_u8c(src); goto CONV_END;
201 conv_xxx1_x100: as_u32(dst) = (u_int32_t)as_u8c(src) << 16; goto CONV_END;
202 conv_xxx1_001x: as_u32(dst) = (u_int32_t)as_u8c(src) << 8; goto CONV_END;
203 conv_xxx1_1000: as_u32(dst) = (u_int32_t)as_u8c(src) << 24; goto CONV_END;
204 conv_xxx1_0001: as_u32(dst) = (u_int32_t)as_u8c(src); goto CONV_END;
205 conv_xxx1_xxx9: as_u8(dst) = as_u8c(src) ^ 0x80; goto CONV_END;
206 conv_xxx1_xx90: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto CONV_END;
207 conv_xxx1_xx09: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80); goto CONV_END;
208 conv_xxx1_x900: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 16; goto CONV_END;
209 conv_xxx1_009x: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 8; goto CONV_END;
210 conv_xxx1_9000: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto CONV_END;
211 conv_xxx1_0009: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80); goto CONV_END;
212 conv_xx12_xxx1: as_u8(dst) = as_u16c(src) >> 8; goto CONV_END;
213 conv_xx12_xx12: as_u16(dst) = as_u16c(src); goto CONV_END;
214 conv_xx12_xx21: as_u16(dst) = bswap_16(as_u16c(src)); goto CONV_END;
215 conv_xx12_x120: as_u32(dst) = (u_int32_t)as_u16c(src) << 8; goto CONV_END;
216 conv_xx12_021x: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 8; goto CONV_END;
217 conv_xx12_1200: as_u32(dst) = (u_int32_t)as_u16c(src) << 16; goto CONV_END;
218 conv_xx12_0021: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)); goto CONV_END;
219 conv_xx12_xxx9: as_u8(dst) = (as_u16c(src) >> 8) ^ 0x80; goto CONV_END;
220 conv_xx12_xx92: as_u16(dst) = as_u16c(src) ^ 0x8000; goto CONV_END;
221 conv_xx12_xx29: as_u16(dst) = bswap_16(as_u16c(src)) ^ 0x80; goto CONV_END;
222 conv_xx12_x920: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x8000) << 8; goto CONV_END;
223 conv_xx12_029x: as_u32(dst) = (u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80) << 8; goto CONV_END;
224 conv_xx12_9200: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto CONV_END;
225 conv_xx12_0029: as_u32(dst) = (u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80); goto CONV_END;
226 conv_xx12_xxx2: as_u8(dst) = as_u16c(src) & 0xff; goto CONV_END;
227 conv_xx12_x210: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 8; goto CONV_END;
228 conv_xx12_012x: as_u32(dst) = (u_int32_t)as_u16c(src) << 8; goto CONV_END;
229 conv_xx12_2100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto CONV_END;
230 conv_xx12_0012: as_u32(dst) = (u_int32_t)as_u16c(src); goto CONV_END; 
231 conv_xx12_xxxA: as_u8(dst) = (as_u16c(src) ^ 0x80) & 0xff; goto CONV_END;
232 conv_xx12_xxA1: as_u16(dst) = bswap_16(as_u16c(src) ^ 0x80); goto CONV_END;
233 conv_xx12_xx1A: as_u16(dst) = as_u16c(src) ^ 0x80; goto CONV_END;
234 conv_xx12_xA10: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 8; goto CONV_END;
235 conv_xx12_01Ax: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x80) << 8; goto CONV_END;
236 conv_xx12_A100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto CONV_END;
237 conv_xx12_001A: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x80); goto CONV_END;
238 conv_x123_xxx1: as_u8(dst) = as_u32c(src) >> 16; goto CONV_END;
239 conv_x123_xx12: as_u16(dst) = as_u32c(src) >> 8; goto CONV_END;
240 conv_x123_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
241 conv_x123_x123: as_u32(dst) = as_u32c(src); goto CONV_END;
242 conv_x123_321x: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
243 conv_x123_1230: as_u32(dst) = as_u32c(src) << 8; goto CONV_END;
244 conv_x123_0321: as_u32(dst) = bswap_32(as_u32c(src)) >> 8; goto CONV_END;
245 conv_x123_xxx9: as_u8(dst) = (as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
246 conv_x123_xx92: as_u16(dst) = (as_u32c(src) >> 8) ^ 0x8000; goto CONV_END;
247 conv_x123_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
248 conv_x123_x923: as_u32(dst) = as_u32c(src) ^ 0x800000; goto CONV_END;
249 conv_x123_329x: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x8000; goto CONV_END;
250 conv_x123_9230: as_u32(dst) = (as_u32c(src) ^ 0x800000) << 8; goto CONV_END;
251 conv_x123_0329: as_u32(dst) = (bswap_32(as_u32c(src)) >> 8) ^ 0x80; goto CONV_END;
252 conv_123x_xxx3: as_u8(dst) = (as_u32c(src) >> 8) & 0xff; goto CONV_END;
253 conv_123x_xx32: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
254 conv_123x_xx23: as_u16(dst) = (as_u32c(src) >> 8) & 0xffff; goto CONV_END;
255 conv_123x_x321: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
256 conv_123x_123x: as_u32(dst) = as_u32c(src); goto CONV_END;
257 conv_123x_3210: as_u32(dst) = bswap_32(as_u32c(src)) << 8; goto CONV_END;
258 conv_123x_0123: as_u32(dst) = as_u32c(src) >> 8; goto CONV_END;
259 conv_123x_xxxB: as_u8(dst) = ((as_u32c(src) >> 8) & 0xff) ^ 0x80; goto CONV_END;
260 conv_123x_xxB2: as_u16(dst) = bswap_16((as_u32c(src) >> 8) ^ 0x80); goto CONV_END;
261 conv_123x_xx2B: as_u16(dst) = ((as_u32c(src) >> 8) & 0xffff) ^ 0x80; goto CONV_END;
262 conv_123x_xB21: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x800000; goto CONV_END;
263 conv_123x_12Bx: as_u32(dst) = as_u32c(src) ^ 0x8000; goto CONV_END;
264 conv_123x_B210: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x8000) << 8; goto CONV_END;
265 conv_123x_012B: as_u32(dst) = (as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
266 conv_1234_xxx1: as_u8(dst) = as_u32c(src) >> 24; goto CONV_END;
267 conv_1234_xx12: as_u16(dst) = as_u32c(src) >> 16; goto CONV_END;
268 conv_1234_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 16); goto CONV_END;
269 conv_1234_x123: as_u32(dst) = as_u32c(src) >> 8; goto CONV_END;
270 conv_1234_321x: as_u32(dst) = bswap_32(as_u32c(src)) << 8; goto CONV_END;
271 conv_1234_1234: as_u32(dst) = as_u32c(src); goto CONV_END;
272 conv_1234_4321: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
273 conv_1234_xxx9: as_u8(dst) = (as_u32c(src) >> 24) ^ 0x80; goto CONV_END;
274 conv_1234_xx92: as_u16(dst) = (as_u32c(src) >> 16) ^ 0x8000; goto CONV_END;
275 conv_1234_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
276 conv_1234_x923: as_u32(dst) = (as_u32c(src) >> 8) ^ 0x800000; goto CONV_END;
277 conv_1234_329x: as_u32(dst) = (bswap_32(as_u32c(src)) ^ 0x80) << 8; goto CONV_END;
278 conv_1234_9234: as_u32(dst) = as_u32c(src) ^ 0x80000000; goto CONV_END;
279 conv_1234_4329: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x80; goto CONV_END;
280 conv_1234_xxx4: as_u8(dst) = as_u32c(src) & 0xff; goto CONV_END;
281 conv_1234_xx43: as_u16(dst) = bswap_16(as_u32c(src)); goto CONV_END;
282 conv_1234_xx34: as_u16(dst) = as_u32c(src) & 0xffff; goto CONV_END;
283 conv_1234_x432: as_u32(dst) = bswap_32(as_u32c(src)) >> 8; goto CONV_END;
284 conv_1234_234x: as_u32(dst) = as_u32c(src) << 8; goto CONV_END;
285 conv_1234_xxxC: as_u8(dst) = (as_u32c(src) & 0xff) ^ 0x80; goto CONV_END;
286 conv_1234_xxC3: as_u16(dst) = bswap_16(as_u32c(src) ^ 0x80); goto CONV_END;
287 conv_1234_xx3C: as_u16(dst) = (as_u32c(src) & 0xffff) ^ 0x80; goto CONV_END;
288 conv_1234_xC32: as_u32(dst) = (bswap_32(as_u32c(src)) >> 8) ^ 0x800000; goto CONV_END;
289 conv_1234_23Cx: as_u32(dst) = (as_u32c(src) ^ 0x80) << 8; goto CONV_END;
290 conv_1234_C321: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x80); goto CONV_END;
291 conv_1234_123C: as_u32(dst) = as_u32c(src) ^ 0x80; goto CONV_END;
292 }
293 #endif
294
295 #ifdef GET16_LABELS
296 /* src_wid src_endswap sign_toggle */
297 static void *get16_labels[4 * 2 * 2] = {
298         &&get16_1_10,    /*  8h -> 16h */
299         &&get16_1_90,    /*  8h ^> 16h */
300         &&get16_1_10,    /*  8s -> 16h */
301         &&get16_1_90,    /*  8s ^> 16h */
302         &&get16_12_12,   /* 16h -> 16h */
303         &&get16_12_92,   /* 16h ^> 16h */
304         &&get16_12_21,   /* 16s -> 16h */
305         &&get16_12_A1,   /* 16s ^> 16h */
306         &&get16_0123_12, /* 24h -> 16h */
307         &&get16_0123_92, /* 24h ^> 16h */
308         &&get16_1230_32, /* 24s -> 16h */
309         &&get16_1230_B2, /* 24s ^> 16h */
310         &&get16_1234_12, /* 32h -> 16h */
311         &&get16_1234_92, /* 32h ^> 16h */
312         &&get16_1234_43, /* 32s -> 16h */
313         &&get16_1234_C3, /* 32s ^> 16h */
314 };
315 #endif
316
317 #ifdef GET16_END
318 while(0) {
319 get16_1_10: sample = (u_int16_t)as_u8c(src) << 8; goto GET16_END;
320 get16_1_90: sample = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto GET16_END;
321 get16_12_12: sample = as_u16c(src); goto GET16_END;
322 get16_12_92: sample = as_u16c(src) ^ 0x8000; goto GET16_END;
323 get16_12_21: sample = bswap_16(as_u16c(src)); goto GET16_END;
324 get16_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GET16_END;
325 get16_0123_12: sample = as_u32c(src) >> 8; goto GET16_END;
326 get16_0123_92: sample = (as_u32c(src) >> 8) ^ 0x8000; goto GET16_END;
327 get16_1230_32: sample = bswap_16(as_u32c(src) >> 8); goto GET16_END;
328 get16_1230_B2: sample = bswap_16((as_u32c(src) >> 8) ^ 0x8000); goto GET16_END;
329 get16_1234_12: sample = as_u32c(src) >> 16; goto GET16_END;
330 get16_1234_92: sample = (as_u32c(src) >> 16) ^ 0x8000; goto GET16_END;
331 get16_1234_43: sample = bswap_16(as_u32c(src)); goto GET16_END;
332 get16_1234_C3: sample = bswap_16(as_u32c(src) ^ 0x80); goto GET16_END;
333 }
334 #endif
335
336 #ifdef PUT16_LABELS
337 /* dst_wid dst_endswap sign_toggle */
338 static void *put16_labels[4 * 2 * 2 * 4 * 2] = {
339         &&put16_12_1,            /* 16h ->  8h */
340         &&put16_12_9,            /* 16h ^>  8h */
341         &&put16_12_1,            /* 16h ->  8s */
342         &&put16_12_9,            /* 16h ^>  8s */
343         &&put16_12_12,           /* 16h -> 16h */
344         &&put16_12_92,           /* 16h ^> 16h */
345         &&put16_12_21,           /* 16h -> 16s */
346         &&put16_12_29,           /* 16h ^> 16s */
347         &&put16_12_0120,         /* 16h -> 24h */
348         &&put16_12_0920,         /* 16h ^> 24h */
349         &&put16_12_0210,         /* 16h -> 24s */
350         &&put16_12_0290,         /* 16h ^> 24s */
351         &&put16_12_1200,         /* 16h -> 32h */
352         &&put16_12_9200,         /* 16h ^> 32h */
353         &&put16_12_0021,         /* 16h -> 32s */
354         &&put16_12_0029,         /* 16h ^> 32s */
355 };
356 #endif
357
358 #ifdef PUT16_END
359 while (0) {
360 put16_12_1: as_u8(dst) = sample >> 8; goto PUT16_END;
361 put16_12_9: as_u8(dst) = (sample >> 8) ^ 0x80; goto PUT16_END;
362 put16_12_12: as_u16(dst) = sample; goto PUT16_END;
363 put16_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT16_END;
364 put16_12_21: as_u16(dst) = bswap_16(sample); goto PUT16_END;
365 put16_12_29: as_u16(dst) = bswap_16(sample) ^ 0x80; goto PUT16_END;
366 put16_12_0120: as_u32(dst) = (u_int32_t)sample << 8; goto PUT16_END;
367 put16_12_0920: as_u32(dst) = (u_int32_t)(sample ^ 0x8000) << 8; goto PUT16_END;
368 put16_12_0210: as_u32(dst) = (u_int32_t)bswap_16(sample) << 8; goto PUT16_END;
369 put16_12_0290: as_u32(dst) = (u_int32_t)(bswap_16(sample) ^ 0x80) << 8; goto PUT16_END;
370 put16_12_1200: as_u32(dst) = (u_int32_t)sample << 16; goto PUT16_END;
371 put16_12_9200: as_u32(dst) = (u_int32_t)(sample ^ 0x8000) << 16; goto PUT16_END;
372 put16_12_0021: as_u32(dst) = (u_int32_t)bswap_16(sample); goto PUT16_END;
373 put16_12_0029: as_u32(dst) = (u_int32_t)bswap_16(sample) ^ 0x80; goto PUT16_END;
374 }
375 #endif
376
377 #ifdef GET32_LABELS
378 /* src_wid src_endswap sign_toggle */
379 static void *get32_labels[4 * 2 * 2] = {
380         &&get32_1_1000,          /*  8h -> 32h */
381         &&get32_1_9000,          /*  8h ^> 32h */
382         &&get32_1_1000,          /*  8s -> 32h */
383         &&get32_1_9000,          /*  8s ^> 32h */
384         &&get32_12_1200,         /* 16h -> 32h */
385         &&get32_12_9200,         /* 16h ^> 32h */
386         &&get32_12_2100,         /* 16s -> 32h */
387         &&get32_12_A100,         /* 16s ^> 32h */
388         &&get32_0123_1230,       /* 24h -> 32h */
389         &&get32_0123_9230,       /* 24h ^> 32h */
390         &&get32_1230_3210,       /* 24s -> 32h */
391         &&get32_1230_B210,       /* 24s ^> 32h */
392         &&get32_1234_1234,       /* 32h -> 32h */
393         &&get32_1234_9234,       /* 32h ^> 32h */
394         &&get32_1234_4321,       /* 32s -> 32h */
395         &&get32_1234_C321,       /* 32s ^> 32h */
396 };
397 #endif
398
399 #ifdef GET32_END
400 while (0) {
401 get32_1_1000: sample = (u_int32_t)as_u8c(src) << 24; goto GET32_END;
402 get32_1_9000: sample = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto GET32_END;
403 get32_12_1200: sample = (u_int32_t)as_u16c(src) << 16; goto GET32_END;
404 get32_12_9200: sample = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto GET32_END;
405 get32_12_2100: sample = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto GET32_END;
406 get32_12_A100: sample = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto GET32_END;
407 get32_0123_1230: sample = as_u32c(src) << 8; goto GET32_END;
408 get32_0123_9230: sample = (as_u32c(src) << 8) ^ 0x80000000; goto GET32_END;
409 get32_1230_3210: sample = bswap_32(as_u32c(src) >> 8); goto GET32_END;
410 get32_1230_B210: sample = bswap_32((as_u32c(src) >> 8) ^ 0x80); goto GET32_END;
411 get32_1234_1234: sample = as_u32c(src); goto GET32_END;
412 get32_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GET32_END;
413 get32_1234_4321: sample = bswap_32(as_u32c(src)); goto GET32_END;
414 get32_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GET32_END;
415 }
416 #endif
417
418 #ifdef PUT32_LABELS
419 /* dst_wid dst_endswap sign_toggle */
420 static void *put32_labels[4 * 2 * 2] = {
421         &&put32_1234_1,          /* 32h ->  8h */
422         &&put32_1234_9,          /* 32h ^>  8h */
423         &&put32_1234_1,          /* 32h ->  8s */
424         &&put32_1234_9,          /* 32h ^>  8s */
425         &&put32_1234_12,         /* 32h -> 16h */
426         &&put32_1234_92,         /* 32h ^> 16h */
427         &&put32_1234_21,         /* 32h -> 16s */
428         &&put32_1234_29,         /* 32h ^> 16s */
429         &&put32_1234_0123,       /* 32h -> 24h */
430         &&put32_1234_0923,       /* 32h ^> 24h */
431         &&put32_1234_3210,       /* 32h -> 24s */
432         &&put32_1234_3290,       /* 32h ^> 24s */
433         &&put32_1234_1234,       /* 32h -> 32h */
434         &&put32_1234_9234,       /* 32h ^> 32h */
435         &&put32_1234_4321,       /* 32h -> 32s */
436         &&put32_1234_4329,       /* 32h ^> 32s */
437 };
438 #endif
439
440 #ifdef PUT32_END
441 while (0) {
442 put32_1234_1: as_u8(dst) = sample >> 24; goto PUT32_END;
443 put32_1234_9: as_u8(dst) = (sample >> 24) ^ 0x80; goto PUT32_END;
444 put32_1234_12: as_u16(dst) = sample >> 16; goto PUT32_END;
445 put32_1234_92: as_u16(dst) = (sample >> 16) ^ 0x8000; goto PUT32_END;
446 put32_1234_21: as_u16(dst) = bswap_16(sample >> 16); goto PUT32_END;
447 put32_1234_29: as_u16(dst) = bswap_16(sample >> 16) ^ 0x80; goto PUT32_END;
448 put32_1234_0123: as_u32(dst) = sample >> 8; goto PUT32_END;
449 put32_1234_0923: as_u32(dst) = (sample >> 8) ^ 0x800000; goto PUT32_END;
450 put32_1234_3210: as_u32(dst) = bswap_32(sample) << 8; goto PUT32_END;
451 put32_1234_3290: as_u32(dst) = (bswap_32(sample) ^ 0x80) << 8; goto PUT32_END;
452 put32_1234_1234: as_u32(dst) = sample; goto PUT32_END;
453 put32_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT32_END;
454 put32_1234_4321: as_u32(dst) = bswap_32(sample); goto PUT32_END;
455 put32_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT32_END;
456 }
457 #endif
458
459 #ifdef GETU_LABELS
460 /* width endswap sign_toggle */
461 static void *getu_labels[4 * 2 * 2] = {
462         &&getu_1_1,             /*  8h ->  8h */
463         &&getu_1_9,             /*  8h ^>  8h */
464         &&getu_1_1,             /*  8s ->  8h */
465         &&getu_1_9,             /*  8s ^>  8h */
466         &&getu_12_12,           /* 16h -> 16h */
467         &&getu_12_92,           /* 16h ^> 16h */
468         &&getu_12_21,           /* 16s -> 16h */
469         &&getu_12_A1,           /* 16s ^> 16h */
470         &&getu_0123_0123,       /* 24h -> 24h */
471         &&getu_0123_0923,       /* 24h ^> 24h */
472         &&getu_1230_0321,       /* 24s -> 24h */
473         &&getu_1230_0B21,       /* 24s ^> 24h */
474         &&getu_1234_1234,       /* 32h -> 32h */
475         &&getu_1234_9234,       /* 32h ^> 32h */
476         &&getu_1234_4321,       /* 32s -> 32h */
477         &&getu_1234_C321,       /* 32s ^> 32h */
478 };
479 #endif
480
481 #ifdef GETU_END
482 while (0) {
483 getu_1_1: sample = as_u8c(src); goto GETU_END;
484 getu_1_9: sample = as_u8c(src) ^ 0x80; goto GETU_END;
485 getu_12_12: sample = as_u16c(src); goto GETU_END;
486 getu_12_92: sample = as_u16c(src) ^ 0x8000; goto GETU_END;
487 getu_12_21: sample = bswap_16(as_u16c(src)); goto GETU_END;
488 getu_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GETU_END;
489 getu_0123_0123: sample = as_u32c(src); goto GETU_END;
490 getu_0123_0923: sample = (as_u32c(src) ^ 0x800000); goto GETU_END;
491 getu_1230_0321: sample = bswap_32(as_u32c(src)); goto GETU_END;
492 getu_1230_0B21: sample = bswap_32(as_u32c(src) ^ 0x8000); goto GETU_END;
493 getu_1234_1234: sample = as_u32c(src); goto GETU_END;
494 getu_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GETU_END;
495 getu_1234_4321: sample = bswap_32(as_u32c(src)); goto GETU_END;
496 getu_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GETU_END;
497 }
498 #endif
499
500 #ifdef GETS_LABELS
501 /* width endswap sign_toggle */
502 static void *gets_labels[4 * 2 * 2] = {
503         &&gets_1_1,             /*  8h ->  8h */
504         &&gets_1_9,             /*  8h ^>  8h */
505         &&gets_1_1,             /*  8s ->  8h */
506         &&gets_1_9,             /*  8s ^>  8h */
507         &&gets_12_12,           /* 16h -> 16h */
508         &&gets_12_92,           /* 16h ^> 16h */
509         &&gets_12_21,           /* 16s -> 16h */
510         &&gets_12_A1,           /* 16s ^> 16h */
511         &&gets_0123_0123,       /* 24h -> 24h */
512         &&gets_0123_0923,       /* 24h ^> 24h */
513         &&gets_1230_0321,       /* 24s -> 24h */
514         &&gets_1230_0B21,       /* 24s ^> 24h */
515         &&gets_1234_1234,       /* 32h -> 32h */
516         &&gets_1234_9234,       /* 32h ^> 32h */
517         &&gets_1234_4321,       /* 32s -> 32h */
518         &&gets_1234_C321,       /* 32s ^> 32h */
519 };
520 #endif
521
522 #ifdef GETS_END
523 while (0) {
524 gets_1_1: sample = as_s8c(src); goto GETS_END;
525 gets_1_9: sample = as_s8c(src) ^ 0x80; goto GETS_END;
526 gets_12_12: sample = as_s16c(src); goto GETS_END;
527 gets_12_92: sample = as_s16c(src) ^ 0x8000; goto GETS_END;
528 gets_12_21: sample = bswap_16(as_s16c(src)); goto GETS_END;
529 gets_12_A1: sample = (int16_t)bswap_16(as_s16c(src) ^ 0x80); goto GETS_END;
530 gets_0123_0123: sample = as_s32c(src); goto GETS_END;
531 gets_0123_0923: sample = (as_s32c(src) ^ 0x800000); goto GETS_END;
532 gets_1230_0321: sample = (int32_t)bswap_32(as_s32c(src)); goto GETS_END;
533 gets_1230_0B21: sample = (int32_t)bswap_32(as_s32c(src) ^ 0x8000); goto GETS_END;
534 gets_1234_1234: sample = as_s32c(src); goto GETS_END;
535 gets_1234_9234: sample = as_s32c(src) ^ 0x80000000; goto GETS_END;
536 gets_1234_4321: sample = (int32_t)bswap_32(as_s32c(src)); goto GETS_END;
537 gets_1234_C321: sample = (int32_t)bswap_32(as_s32c(src) ^ 0x80); goto GETS_END;
538 }
539 #endif
540
541 #ifdef PUT_LABELS
542 /* width endswap sign_toggle */
543 static void *put_labels[4 * 2 * 2] = {
544         &&put_1_1,              /*  8h ->  8h */
545         &&put_1_9,              /*  8h ^>  8h */
546         &&put_1_1,              /*  8h ->  8s */
547         &&put_1_9,              /*  8h ^>  8s */
548         &&put_12_12,            /* 16h -> 16h */
549         &&put_12_92,            /* 16h ^> 16h */
550         &&put_12_21,            /* 16h -> 16s */
551         &&put_12_A1,            /* 16h ^> 16s */
552         &&put_0123_0123,        /* 24h -> 24h */
553         &&put_0123_0923,        /* 24h ^> 24h */
554         &&put_0123_3210,        /* 24h -> 24s */
555         &&put_0123_3290,        /* 24h ^> 24s */
556         &&put_1234_1234,        /* 32h -> 32h */
557         &&put_1234_9234,        /* 32h ^> 32h */
558         &&put_1234_4321,        /* 32h -> 32s */
559         &&put_1234_4329,        /* 32h ^> 32s */
560 };
561 #endif
562
563 #ifdef PUT_END
564 put_1_1: as_s8(dst) = sample; goto PUT_END;
565 put_1_9: as_u8(dst) = sample ^ 0x80; goto PUT_END;
566 put_12_12: as_s16(dst) = sample; goto PUT_END;
567 put_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT_END;
568 put_12_21: as_s16(dst) = bswap_16(sample); goto PUT_END;
569 put_12_A1: as_u16(dst) = bswap_16(sample ^ 0x80); goto PUT_END;
570 put_0123_0123: as_s24(dst) = sample; goto PUT_END;
571 put_0123_0923: as_u24(dst) = sample ^ 0x800000; goto PUT_END;
572 put_0123_3210: as_s24(dst) = bswap_32(sample); goto PUT_END;
573 put_0123_3290: as_u24(dst) = bswap_32(sample) ^ 0x8000; goto PUT_END;
574 put_1234_1234: as_s32(dst) = sample; goto PUT_END;
575 put_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT_END;
576 put_1234_4321: as_s32(dst) = bswap_32(sample); goto PUT_END;
577 put_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT_END;
578 #endif
579
580 #ifdef PUT32F_LABELS
581 /* type (0 = float, 1 = float64), endswap */
582 static void *put32float_labels[2 * 2] = {
583         &&put32f_1234_1234F,    /* 32h -> (float)h */
584         &&put32f_1234_4321F,    /* 32h -> (float)s */
585         &&put32f_1234_1234D,    /* 32h -> (float64)h */
586         &&put32f_1234_4321D,    /* 32h -> (float64)s */
587 };
588 #endif
589
590 #ifdef PUT32F_END
591 put32f_1234_1234F: as_float(dst) = (float_t)((int32_t)sample) / (float_t)0x80000000UL; goto PUT32F_END;
592 put32f_1234_4321F: tmp_float = (float_t)((int32_t)sample) / (float_t)0x80000000UL;
593                    as_u32(dst) = bswap_32(as_u32c(&tmp_float)); goto PUT32F_END;
594 put32f_1234_1234D: as_double(dst) = (double_t)((int32_t)sample) / (double_t)0x80000000UL; goto PUT32F_END;
595 put32f_1234_4321D: tmp_double = (double_t)((int32_t)sample) / (double_t)0x80000000UL;
596                    as_u64(dst) = bswap_64(as_u64c(&tmp_double)); goto PUT32F_END;
597 #endif
598
599 #ifdef GET32F_LABELS
600 /* type (0 = float, 1 = float64), endswap */
601 static void *get32float_labels[2 * 2] = {
602         &&get32f_1234F_1234,    /* (float)h -> 32h */
603         &&get32f_4321F_1234,    /* (float)s -> 32h */
604         &&get32f_1234D_1234,    /* (float64)h -> 32h */
605         &&get32f_4321D_1234,    /* (float64)s -> 32h */
606 };
607 #endif
608
609 #ifdef GET32F_END
610 get32f_1234F_1234: tmp_float = as_floatc(src);
611                    if (tmp_float >= 1.0)
612                         sample = 0x7fffffff;
613                    else if (tmp_float <= -1.0)
614                         sample = 0x80000000;
615                    else
616                         sample = (int32_t)(tmp_float * (float_t)0x80000000UL);
617                    goto GET32F_END;
618 get32f_4321F_1234: sample = bswap_32(as_u32c(src));
619                    tmp_float = as_floatc(&sample);
620                    if (tmp_float >= 1.0)
621                         sample = 0x7fffffff;
622                    else if (tmp_float <= -1.0)
623                         sample = 0x80000000;
624                    else
625                         sample = (int32_t)(tmp_float * (float_t)0x80000000UL);
626                    goto GET32F_END;
627 get32f_1234D_1234: tmp_double = as_doublec(src);
628                    if (tmp_double >= 1.0)
629                         sample = 0x7fffffff;
630                    else if (tmp_double <= -1.0)
631                         sample = 0x80000000;
632                    else
633                         sample = (int32_t)(tmp_double * (double_t)0x80000000UL);
634                    goto GET32F_END;
635 get32f_4321D_1234: sample64 = bswap_64(as_u64c(src));
636                    tmp_double = as_doublec(&sample);
637                    if (tmp_double >= 1.0)
638                         sample = 0x7fffffff;
639                    else if (tmp_double <= -1.0)
640                         sample = 0x80000000;
641                    else
642                         sample = (int32_t)(tmp_double * (double_t)0x80000000UL);
643                    goto GET32F_END;
644 #endif
645
646 #ifdef NORMS_LABELS
647 static inline void _norms(const void *src, void *dst,
648                           int src_wid,
649                           int dst_sign, int dst_wid, int dst_end)
650 {
651         int32_t s;
652         switch (src_wid) {
653         case 8:
654                 s = *(int8_t*)src;
655                 if (s >= 0x7f)
656                         goto _min;
657                 else if (s <= -0x80)
658                         goto _max;
659                 break;
660         case 16:
661                 s = *(int16_t*)src;
662                 if (s >= 0x7fff)
663                         goto _min;
664                 else if (s <= -0x8000)
665                         goto _max;
666                 break;
667         case 24:
668                 s = *(int32_t*)src;
669                 if (s >= 0x7fffff)
670                         goto _min;
671                 else if (s <= -0x800000)
672                         goto _max;
673                 break;
674         case 32:
675         {
676                 int64_t s64;
677                 s64 = *(int64_t*)src;
678                 if (s64 >= 0x7fffffff)
679                         goto _min;
680                 else if (s64 <= -0x80000000)
681                         goto _max;
682                 s = s64;
683                 break;
684         }
685         default:
686                 assert(0);
687                 return;
688         }
689         if (src_wid < dst_wid) {
690                 unsigned int bits = dst_wid - src_wid;
691                 s *= 1 << bits;
692         } else if (src_wid > dst_wid) {
693                 unsigned int bits = src_wid - dst_wid;
694                 s = (s + (1 << (bits - 1)))/ (1 << bits);
695         }
696         if (!dst_sign)
697                 s += (1U << (dst_wid - 1));
698         switch (dst_wid) {
699         case 8:
700                 *(u_int8_t*)dst = s;
701                 break;
702         case 16:
703                 if (dst_end)
704                         s = bswap_16(s);
705                 *(u_int16_t*)dst = s;
706                 break;
707         case 24:
708         case 32:
709                 if (dst_end)
710                         s = bswap_32(s);
711                 *(u_int32_t*)dst = s;
712                 break;
713         }
714         return;
715
716  _min:
717         switch (dst_wid) {
718         case 8:
719                 if (dst_sign)
720                         *(u_int8_t*)dst = 0x80;
721                 else
722                         *(u_int8_t*)dst = 0;
723                 break;
724         case 16:
725                 if (dst_sign)
726                         *(u_int16_t*)dst = dst_end ? 0x0080 : 0x8000;
727                 else
728                         *(u_int16_t*)dst = 0;
729                 break;
730         case 24:
731                 if (dst_sign)
732                         *(u_int32_t*)dst = dst_end ? 0x00008000 : 0x00800000;
733                 else
734                         *(u_int32_t*)dst = 0;
735                 break;
736         case 32:
737                 if (dst_sign)
738                         *(u_int32_t*)dst = dst_end ? 0x00000080 : 0x80000000;
739                 else
740                         *(u_int32_t*)dst = 0;
741                 break;
742         default:
743                 assert(0);
744                 break;
745         }
746         return;
747
748  _max:
749         switch (dst_wid) {
750         case 8:
751                 if (dst_sign)
752                         *(u_int8_t*)dst = 0x7f;
753                 else
754                         *(u_int8_t*)dst = 0xff;
755                 break;
756         case 16:
757                 if (dst_sign)
758                         *(u_int16_t*)dst = dst_end ? 0xff7f : 0x7fff;
759                 else
760                         *(u_int16_t*)dst = 0;
761                 break;
762         case 24:
763                 if (dst_sign)
764                         *(u_int32_t*)dst = dst_end ? 0xffff7f00 : 0x007fffff;
765                 else
766                         *(u_int32_t*)dst = 0;
767                 break;
768         case 32:
769                 if (dst_sign)
770                         *(u_int32_t*)dst = dst_end ? 0xffffff7f : 0x7fffffff;
771                 else
772                         *(u_int32_t*)dst = 0;
773                 break;
774         default:
775                 assert(0);
776                 break;
777         }
778         return;
779 }
780
781 /* src_wid dst_sign dst_wid dst_end */
782 static void *norms_labels[4 * 2 * 4 * 2] = {
783         &&norms_8_u8,           /*  s8 -> u8 */
784         &&norms_8_u8,           /*  s8 -> u8 */
785         &&norms_8_u16h,         /*  s8 -> u16h */
786         &&norms_8_u16s,         /*  s8 -> u16s */
787         &&norms_8_u24h,         /*  s8 -> u24h */
788         &&norms_8_u24s,         /*  s8 -> u24s */
789         &&norms_8_u32h,         /*  s8 -> u32h */
790         &&norms_8_u32s,         /*  s8 -> u32s */
791         &&norms_8_s8,           /*  s8 -> s8 */
792         &&norms_8_s8,           /*  s8 -> s8 */
793         &&norms_8_s16h,         /*  s8 -> s16h */
794         &&norms_8_s16s,         /*  s8 -> s16s */
795         &&norms_8_s24h,         /*  s8 -> s24h */
796         &&norms_8_s24s,         /*  s8 -> s24s */
797         &&norms_8_s32h,         /*  s8 -> s32h */
798         &&norms_8_s32s,         /*  s8 -> s32s */
799         &&norms_16_u8,          /* s16 -> u8 */
800         &&norms_16_u8,          /* s16 -> u8 */
801         &&norms_16_u16h,        /* s16 -> u16h */
802         &&norms_16_u16s,        /* s16 -> u16s */
803         &&norms_16_u24h,        /* s16 -> u24h */
804         &&norms_16_u24s,        /* s16 -> u24s */
805         &&norms_16_u32h,        /* s16 -> u32h */
806         &&norms_16_u32s,        /* s16 -> u32s */
807         &&norms_16_s8,          /* s16 -> s8 h*/
808         &&norms_16_s8,          /* s16 -> s8 */
809         &&norms_16_s16h,        /* s16 -> s16h */
810         &&norms_16_s16s,        /* s16 -> s16s */
811         &&norms_16_s24h,        /* s16 -> s24h */
812         &&norms_16_s24s,        /* s16 -> s24s */
813         &&norms_16_s32h,        /* s16 -> s32h */
814         &&norms_16_s32s,        /* s16 -> s32s */
815         &&norms_24_u8,          /* s24 -> u8 */
816         &&norms_24_u8,          /* s24 -> u8 */
817         &&norms_24_u16h,        /* s24 -> u16h */
818         &&norms_24_u16s,        /* s24 -> u16s */
819         &&norms_24_u24h,        /* s24 -> u24h */
820         &&norms_24_u24s,        /* s24 -> u24s */
821         &&norms_24_u32h,        /* s24 -> u32h */
822         &&norms_24_u32s,        /* s24 -> u32s */
823         &&norms_24_s8,          /* s24 -> s8 */
824         &&norms_24_s8,          /* s24 -> s8 */
825         &&norms_24_s16h,        /* s24 -> s16h */
826         &&norms_24_s16s,        /* s24 -> s16s */
827         &&norms_24_s24h,        /* s24 -> s24h */
828         &&norms_24_s24s,        /* s24 -> s24s */
829         &&norms_24_s32h,        /* s24 -> s32h */
830         &&norms_24_s32s,        /* s24 -> s32s */
831         &&norms_32_u8,          /* s32 -> u8 */
832         &&norms_32_u8,          /* s32 -> u8 */
833         &&norms_32_u16h,        /* s32 -> u16h */
834         &&norms_32_u16s,        /* s32 -> u16s */
835         &&norms_32_u24h,        /* s32 -> u24h */
836         &&norms_32_u24s,        /* s32 -> u24s */
837         &&norms_32_u32h,        /* s32 -> u32h */
838         &&norms_32_u32s,        /* s32 -> u32s */
839         &&norms_32_s8,          /* s32 -> s8 */
840         &&norms_32_s8,          /* s32 -> s8 */
841         &&norms_32_s16h,        /* s32 -> s16h */
842         &&norms_32_s16s,        /* s32 -> s16s */
843         &&norms_32_s24h,        /* s32 -> s24h */
844         &&norms_32_s24s,        /* s32 -> s24s */
845         &&norms_32_s32h,        /* s32 -> s32h */
846         &&norms_32_s32s,        /* s32 -> s32s */
847 };
848 #endif
849
850 #ifdef NORMS_END
851 norms_8_u8:     _norms(src, dst,  8, 0,  8, 0); goto NORMS_END;
852 norms_8_u16h:   _norms(src, dst,  8, 0,  16, 0); goto NORMS_END;
853 norms_8_u16s:   _norms(src, dst,  8, 0,  16, 1); goto NORMS_END;
854 norms_8_u24h:   _norms(src, dst,  8, 0,  24, 0); goto NORMS_END;
855 norms_8_u24s:   _norms(src, dst,  8, 0,  24, 1); goto NORMS_END;
856 norms_8_u32h:   _norms(src, dst,  8, 0,  32, 0); goto NORMS_END;
857 norms_8_u32s:   _norms(src, dst,  8, 0,  32, 1); goto NORMS_END;
858 norms_8_s8:     _norms(src, dst,  8, 1,  8, 0); goto NORMS_END;
859 norms_8_s16h:   _norms(src, dst,  8, 1,  16, 0); goto NORMS_END;
860 norms_8_s16s:   _norms(src, dst,  8, 1,  16, 1); goto NORMS_END;
861 norms_8_s24h:   _norms(src, dst,  8, 1,  24, 0); goto NORMS_END;
862 norms_8_s24s:   _norms(src, dst,  8, 1,  24, 1); goto NORMS_END;
863 norms_8_s32h:   _norms(src, dst,  8, 1,  32, 0); goto NORMS_END;
864 norms_8_s32s:   _norms(src, dst,  8, 1,  32, 1); goto NORMS_END;
865 norms_16_u8:    _norms(src, dst, 16, 0,  8, 0); goto NORMS_END;
866 norms_16_u16h:  _norms(src, dst, 16, 0,  16, 0); goto NORMS_END;
867 norms_16_u16s:  _norms(src, dst, 16, 0,  16, 1); goto NORMS_END;
868 norms_16_u24h:  _norms(src, dst, 16, 0,  24, 0); goto NORMS_END;
869 norms_16_u24s:  _norms(src, dst, 16, 0,  24, 1); goto NORMS_END;
870 norms_16_u32h:  _norms(src, dst, 16, 0,  32, 0); goto NORMS_END;
871 norms_16_u32s:  _norms(src, dst, 16, 0,  32, 1); goto NORMS_END;
872 norms_16_s8:    _norms(src, dst, 16, 1,  8, 0); goto NORMS_END;
873 norms_16_s16h:  _norms(src, dst, 16, 1,  16, 0); goto NORMS_END;
874 norms_16_s16s:  _norms(src, dst, 16, 1,  16, 1); goto NORMS_END;
875 norms_16_s24h:  _norms(src, dst, 16, 1,  24, 0); goto NORMS_END;
876 norms_16_s24s:  _norms(src, dst, 16, 1,  24, 1); goto NORMS_END;
877 norms_16_s32h:  _norms(src, dst, 16, 1,  32, 0); goto NORMS_END;
878 norms_16_s32s:  _norms(src, dst, 16, 1,  32, 1); goto NORMS_END;
879 norms_24_u8:    _norms(src, dst, 24, 0,  8, 0); goto NORMS_END;
880 norms_24_u16h:  _norms(src, dst, 24, 0,  16, 0); goto NORMS_END;
881 norms_24_u16s:  _norms(src, dst, 24, 0,  16, 1); goto NORMS_END;
882 norms_24_u24h:  _norms(src, dst, 24, 0,  24, 0); goto NORMS_END;
883 norms_24_u24s:  _norms(src, dst, 24, 0,  24, 1); goto NORMS_END;
884 norms_24_u32h:  _norms(src, dst, 24, 0,  32, 0); goto NORMS_END;
885 norms_24_u32s:  _norms(src, dst, 24, 0,  32, 1); goto NORMS_END;
886 norms_24_s8:    _norms(src, dst, 24, 1,  8, 0); goto NORMS_END;
887 norms_24_s16h:  _norms(src, dst, 24, 1,  16, 0); goto NORMS_END;
888 norms_24_s16s:  _norms(src, dst, 24, 1,  16, 1); goto NORMS_END;
889 norms_24_s24h:  _norms(src, dst, 24, 1,  24, 0); goto NORMS_END;
890 norms_24_s24s:  _norms(src, dst, 24, 1,  24, 1); goto NORMS_END;
891 norms_24_s32h:  _norms(src, dst, 24, 1,  32, 0); goto NORMS_END;
892 norms_24_s32s:  _norms(src, dst, 24, 1,  32, 1); goto NORMS_END;
893 norms_32_u8:    _norms(src, dst, 32, 0,  8, 0); goto NORMS_END;
894 norms_32_u16h:  _norms(src, dst, 32, 0,  16, 0); goto NORMS_END;
895 norms_32_u16s:  _norms(src, dst, 32, 0,  16, 1); goto NORMS_END;
896 norms_32_u24h:  _norms(src, dst, 32, 0,  24, 0); goto NORMS_END;
897 norms_32_u24s:  _norms(src, dst, 32, 0,  24, 1); goto NORMS_END;
898 norms_32_u32h:  _norms(src, dst, 32, 0,  32, 0); goto NORMS_END;
899 norms_32_u32s:  _norms(src, dst, 32, 0,  32, 1); goto NORMS_END;
900 norms_32_s8:    _norms(src, dst, 32, 1,  8, 0); goto NORMS_END;
901 norms_32_s16h:  _norms(src, dst, 32, 1,  16, 0); goto NORMS_END;
902 norms_32_s16s:  _norms(src, dst, 32, 1,  16, 1); goto NORMS_END;
903 norms_32_s24h:  _norms(src, dst, 32, 1,  24, 0); goto NORMS_END;
904 norms_32_s24s:  _norms(src, dst, 32, 1,  24, 1); goto NORMS_END;
905 norms_32_s32h:  _norms(src, dst, 32, 1,  32, 0); goto NORMS_END;
906 norms_32_s32s:  _norms(src, dst, 32, 1,  32, 1); goto NORMS_END;
907 #endif
908
909
910 #undef as_u8
911 #undef as_u16
912 #undef as_u32
913 #undef as_s8
914 #undef as_s16
915 #undef as_s32
916 #undef as_float
917 #undef as_double
918
919 #undef as_u8c
920 #undef as_u16c
921 #undef as_u32c
922 #undef as_s8c
923 #undef as_s16c
924 #undef as_s32c
925 #undef as_floatc
926 #undef as_doublec