OSDN Git Service

[DTXV] #26010 #PAN EL (WAV番号=ELの#PAN)を#PANELと誤認識しないよう修正。
[dtxmania/dtxmania.git] / @jpeglibソリューション / jpeg-8c / jdct.h
1 /*\r
2  * jdct.h\r
3  *\r
4  * Copyright (C) 1994-1996, Thomas G. Lane.\r
5  * This file is part of the Independent JPEG Group's software.\r
6  * For conditions of distribution and use, see the accompanying README file.\r
7  *\r
8  * This include file contains common declarations for the forward and\r
9  * inverse DCT modules.  These declarations are private to the DCT managers\r
10  * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms.\r
11  * The individual DCT algorithms are kept in separate files to ease \r
12  * machine-dependent tuning (e.g., assembly coding).\r
13  */\r
14 \r
15 \r
16 /*\r
17  * A forward DCT routine is given a pointer to an input sample array and\r
18  * a pointer to a work area of type DCTELEM[]; the DCT is to be performed\r
19  * in-place in that buffer.  Type DCTELEM is int for 8-bit samples, INT32\r
20  * for 12-bit samples.  (NOTE: Floating-point DCT implementations use an\r
21  * array of type FAST_FLOAT, instead.)\r
22  * The input data is to be fetched from the sample array starting at a\r
23  * specified column.  (Any row offset needed will be applied to the array\r
24  * pointer before it is passed to the FDCT code.)\r
25  * Note that the number of samples fetched by the FDCT routine is\r
26  * DCT_h_scaled_size * DCT_v_scaled_size.\r
27  * The DCT outputs are returned scaled up by a factor of 8; they therefore\r
28  * have a range of +-8K for 8-bit data, +-128K for 12-bit data.  This\r
29  * convention improves accuracy in integer implementations and saves some\r
30  * work in floating-point ones.\r
31  * Quantization of the output coefficients is done by jcdctmgr.c.\r
32  */\r
33 \r
34 #if BITS_IN_JSAMPLE == 8\r
35 typedef int DCTELEM;            /* 16 or 32 bits is fine */\r
36 #else\r
37 typedef INT32 DCTELEM;          /* must have 32 bits */\r
38 #endif\r
39 \r
40 typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data,\r
41                                                JSAMPARRAY sample_data,\r
42                                                JDIMENSION start_col));\r
43 typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data,\r
44                                              JSAMPARRAY sample_data,\r
45                                              JDIMENSION start_col));\r
46 \r
47 \r
48 /*\r
49  * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer\r
50  * to an output sample array.  The routine must dequantize the input data as\r
51  * well as perform the IDCT; for dequantization, it uses the multiplier table\r
52  * pointed to by compptr->dct_table.  The output data is to be placed into the\r
53  * sample array starting at a specified column.  (Any row offset needed will\r
54  * be applied to the array pointer before it is passed to the IDCT code.)\r
55  * Note that the number of samples emitted by the IDCT routine is\r
56  * DCT_h_scaled_size * DCT_v_scaled_size.\r
57  */\r
58 \r
59 /* typedef inverse_DCT_method_ptr is declared in jpegint.h */\r
60 \r
61 /*\r
62  * Each IDCT routine has its own ideas about the best dct_table element type.\r
63  */\r
64 \r
65 typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */\r
66 #if BITS_IN_JSAMPLE == 8\r
67 typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */\r
68 #define IFAST_SCALE_BITS  2     /* fractional bits in scale factors */\r
69 #else\r
70 typedef INT32 IFAST_MULT_TYPE;  /* need 32 bits for scaled quantizers */\r
71 #define IFAST_SCALE_BITS  13    /* fractional bits in scale factors */\r
72 #endif\r
73 typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */\r
74 \r
75 \r
76 /*\r
77  * Each IDCT routine is responsible for range-limiting its results and\r
78  * converting them to unsigned form (0..MAXJSAMPLE).  The raw outputs could\r
79  * be quite far out of range if the input data is corrupt, so a bulletproof\r
80  * range-limiting step is required.  We use a mask-and-table-lookup method\r
81  * to do the combined operations quickly.  See the comments with\r
82  * prepare_range_limit_table (in jdmaster.c) for more info.\r
83  */\r
84 \r
85 #define IDCT_range_limit(cinfo)  ((cinfo)->sample_range_limit + CENTERJSAMPLE)\r
86 \r
87 #define RANGE_MASK  (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */\r
88 \r
89 \r
90 /* Short forms of external names for systems with brain-damaged linkers. */\r
91 \r
92 #ifdef NEED_SHORT_EXTERNAL_NAMES\r
93 #define jpeg_fdct_islow         jFDislow\r
94 #define jpeg_fdct_ifast         jFDifast\r
95 #define jpeg_fdct_float         jFDfloat\r
96 #define jpeg_fdct_7x7           jFD7x7\r
97 #define jpeg_fdct_6x6           jFD6x6\r
98 #define jpeg_fdct_5x5           jFD5x5\r
99 #define jpeg_fdct_4x4           jFD4x4\r
100 #define jpeg_fdct_3x3           jFD3x3\r
101 #define jpeg_fdct_2x2           jFD2x2\r
102 #define jpeg_fdct_1x1           jFD1x1\r
103 #define jpeg_fdct_9x9           jFD9x9\r
104 #define jpeg_fdct_10x10         jFD10x10\r
105 #define jpeg_fdct_11x11         jFD11x11\r
106 #define jpeg_fdct_12x12         jFD12x12\r
107 #define jpeg_fdct_13x13         jFD13x13\r
108 #define jpeg_fdct_14x14         jFD14x14\r
109 #define jpeg_fdct_15x15         jFD15x15\r
110 #define jpeg_fdct_16x16         jFD16x16\r
111 #define jpeg_fdct_16x8          jFD16x8\r
112 #define jpeg_fdct_14x7          jFD14x7\r
113 #define jpeg_fdct_12x6          jFD12x6\r
114 #define jpeg_fdct_10x5          jFD10x5\r
115 #define jpeg_fdct_8x4           jFD8x4\r
116 #define jpeg_fdct_6x3           jFD6x3\r
117 #define jpeg_fdct_4x2           jFD4x2\r
118 #define jpeg_fdct_2x1           jFD2x1\r
119 #define jpeg_fdct_8x16          jFD8x16\r
120 #define jpeg_fdct_7x14          jFD7x14\r
121 #define jpeg_fdct_6x12          jFD6x12\r
122 #define jpeg_fdct_5x10          jFD5x10\r
123 #define jpeg_fdct_4x8           jFD4x8\r
124 #define jpeg_fdct_3x6           jFD3x6\r
125 #define jpeg_fdct_2x4           jFD2x4\r
126 #define jpeg_fdct_1x2           jFD1x2\r
127 #define jpeg_idct_islow         jRDislow\r
128 #define jpeg_idct_ifast         jRDifast\r
129 #define jpeg_idct_float         jRDfloat\r
130 #define jpeg_idct_7x7           jRD7x7\r
131 #define jpeg_idct_6x6           jRD6x6\r
132 #define jpeg_idct_5x5           jRD5x5\r
133 #define jpeg_idct_4x4           jRD4x4\r
134 #define jpeg_idct_3x3           jRD3x3\r
135 #define jpeg_idct_2x2           jRD2x2\r
136 #define jpeg_idct_1x1           jRD1x1\r
137 #define jpeg_idct_9x9           jRD9x9\r
138 #define jpeg_idct_10x10         jRD10x10\r
139 #define jpeg_idct_11x11         jRD11x11\r
140 #define jpeg_idct_12x12         jRD12x12\r
141 #define jpeg_idct_13x13         jRD13x13\r
142 #define jpeg_idct_14x14         jRD14x14\r
143 #define jpeg_idct_15x15         jRD15x15\r
144 #define jpeg_idct_16x16         jRD16x16\r
145 #define jpeg_idct_16x8          jRD16x8\r
146 #define jpeg_idct_14x7          jRD14x7\r
147 #define jpeg_idct_12x6          jRD12x6\r
148 #define jpeg_idct_10x5          jRD10x5\r
149 #define jpeg_idct_8x4           jRD8x4\r
150 #define jpeg_idct_6x3           jRD6x3\r
151 #define jpeg_idct_4x2           jRD4x2\r
152 #define jpeg_idct_2x1           jRD2x1\r
153 #define jpeg_idct_8x16          jRD8x16\r
154 #define jpeg_idct_7x14          jRD7x14\r
155 #define jpeg_idct_6x12          jRD6x12\r
156 #define jpeg_idct_5x10          jRD5x10\r
157 #define jpeg_idct_4x8           jRD4x8\r
158 #define jpeg_idct_3x6           jRD3x8\r
159 #define jpeg_idct_2x4           jRD2x4\r
160 #define jpeg_idct_1x2           jRD1x2\r
161 #endif /* NEED_SHORT_EXTERNAL_NAMES */\r
162 \r
163 /* Extern declarations for the forward and inverse DCT routines. */\r
164 \r
165 EXTERN(void) jpeg_fdct_islow\r
166     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
167 EXTERN(void) jpeg_fdct_ifast\r
168     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
169 EXTERN(void) jpeg_fdct_float\r
170     JPP((FAST_FLOAT * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
171 EXTERN(void) jpeg_fdct_7x7\r
172     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
173 EXTERN(void) jpeg_fdct_6x6\r
174     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
175 EXTERN(void) jpeg_fdct_5x5\r
176     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
177 EXTERN(void) jpeg_fdct_4x4\r
178     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
179 EXTERN(void) jpeg_fdct_3x3\r
180     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
181 EXTERN(void) jpeg_fdct_2x2\r
182     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
183 EXTERN(void) jpeg_fdct_1x1\r
184     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
185 EXTERN(void) jpeg_fdct_9x9\r
186     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
187 EXTERN(void) jpeg_fdct_10x10\r
188     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
189 EXTERN(void) jpeg_fdct_11x11\r
190     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
191 EXTERN(void) jpeg_fdct_12x12\r
192     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
193 EXTERN(void) jpeg_fdct_13x13\r
194     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
195 EXTERN(void) jpeg_fdct_14x14\r
196     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
197 EXTERN(void) jpeg_fdct_15x15\r
198     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
199 EXTERN(void) jpeg_fdct_16x16\r
200     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
201 EXTERN(void) jpeg_fdct_16x8\r
202     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
203 EXTERN(void) jpeg_fdct_14x7\r
204     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
205 EXTERN(void) jpeg_fdct_12x6\r
206     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
207 EXTERN(void) jpeg_fdct_10x5\r
208     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
209 EXTERN(void) jpeg_fdct_8x4\r
210     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
211 EXTERN(void) jpeg_fdct_6x3\r
212     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
213 EXTERN(void) jpeg_fdct_4x2\r
214     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
215 EXTERN(void) jpeg_fdct_2x1\r
216     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
217 EXTERN(void) jpeg_fdct_8x16\r
218     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
219 EXTERN(void) jpeg_fdct_7x14\r
220     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
221 EXTERN(void) jpeg_fdct_6x12\r
222     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
223 EXTERN(void) jpeg_fdct_5x10\r
224     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
225 EXTERN(void) jpeg_fdct_4x8\r
226     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
227 EXTERN(void) jpeg_fdct_3x6\r
228     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
229 EXTERN(void) jpeg_fdct_2x4\r
230     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
231 EXTERN(void) jpeg_fdct_1x2\r
232     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));\r
233 \r
234 EXTERN(void) jpeg_idct_islow\r
235     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
236          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
237 EXTERN(void) jpeg_idct_ifast\r
238     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
239          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
240 EXTERN(void) jpeg_idct_float\r
241     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
242          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
243 EXTERN(void) jpeg_idct_7x7\r
244     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
245          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
246 EXTERN(void) jpeg_idct_6x6\r
247     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
248          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
249 EXTERN(void) jpeg_idct_5x5\r
250     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
251          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
252 EXTERN(void) jpeg_idct_4x4\r
253     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
254          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
255 EXTERN(void) jpeg_idct_3x3\r
256     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
257          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
258 EXTERN(void) jpeg_idct_2x2\r
259     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
260          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
261 EXTERN(void) jpeg_idct_1x1\r
262     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
263          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
264 EXTERN(void) jpeg_idct_9x9\r
265     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
266          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
267 EXTERN(void) jpeg_idct_10x10\r
268     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
269          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
270 EXTERN(void) jpeg_idct_11x11\r
271     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
272          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
273 EXTERN(void) jpeg_idct_12x12\r
274     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
275          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
276 EXTERN(void) jpeg_idct_13x13\r
277     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
278          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
279 EXTERN(void) jpeg_idct_14x14\r
280     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
281          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
282 EXTERN(void) jpeg_idct_15x15\r
283     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
284          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
285 EXTERN(void) jpeg_idct_16x16\r
286     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
287          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
288 EXTERN(void) jpeg_idct_16x8\r
289     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
290          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
291 EXTERN(void) jpeg_idct_14x7\r
292     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
293          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
294 EXTERN(void) jpeg_idct_12x6\r
295     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
296          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
297 EXTERN(void) jpeg_idct_10x5\r
298     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
299          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
300 EXTERN(void) jpeg_idct_8x4\r
301     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
302          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
303 EXTERN(void) jpeg_idct_6x3\r
304     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
305          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
306 EXTERN(void) jpeg_idct_4x2\r
307     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
308          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
309 EXTERN(void) jpeg_idct_2x1\r
310     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
311          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
312 EXTERN(void) jpeg_idct_8x16\r
313     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
314          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
315 EXTERN(void) jpeg_idct_7x14\r
316     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
317          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
318 EXTERN(void) jpeg_idct_6x12\r
319     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
320          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
321 EXTERN(void) jpeg_idct_5x10\r
322     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
323          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
324 EXTERN(void) jpeg_idct_4x8\r
325     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
326          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
327 EXTERN(void) jpeg_idct_3x6\r
328     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
329          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
330 EXTERN(void) jpeg_idct_2x4\r
331     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
332          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
333 EXTERN(void) jpeg_idct_1x2\r
334     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,\r
335          JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));\r
336 \r
337 \r
338 /*\r
339  * Macros for handling fixed-point arithmetic; these are used by many\r
340  * but not all of the DCT/IDCT modules.\r
341  *\r
342  * All values are expected to be of type INT32.\r
343  * Fractional constants are scaled left by CONST_BITS bits.\r
344  * CONST_BITS is defined within each module using these macros,\r
345  * and may differ from one module to the next.\r
346  */\r
347 \r
348 #define ONE     ((INT32) 1)\r
349 #define CONST_SCALE (ONE << CONST_BITS)\r
350 \r
351 /* Convert a positive real constant to an integer scaled by CONST_SCALE.\r
352  * Caution: some C compilers fail to reduce "FIX(constant)" at compile time,\r
353  * thus causing a lot of useless floating-point operations at run time.\r
354  */\r
355 \r
356 #define FIX(x)  ((INT32) ((x) * CONST_SCALE + 0.5))\r
357 \r
358 /* Descale and correctly round an INT32 value that's scaled by N bits.\r
359  * We assume RIGHT_SHIFT rounds towards minus infinity, so adding\r
360  * the fudge factor is correct for either sign of X.\r
361  */\r
362 \r
363 #define DESCALE(x,n)  RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)\r
364 \r
365 /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.\r
366  * This macro is used only when the two inputs will actually be no more than\r
367  * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a\r
368  * full 32x32 multiply.  This provides a useful speedup on many machines.\r
369  * Unfortunately there is no way to specify a 16x16->32 multiply portably\r
370  * in C, but some C compilers will do the right thing if you provide the\r
371  * correct combination of casts.\r
372  */\r
373 \r
374 #ifdef SHORTxSHORT_32           /* may work if 'int' is 32 bits */\r
375 #define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT16) (const)))\r
376 #endif\r
377 #ifdef SHORTxLCONST_32          /* known to work with Microsoft C 6.0 */\r
378 #define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT32) (const)))\r
379 #endif\r
380 \r
381 #ifndef MULTIPLY16C16           /* default definition */\r
382 #define MULTIPLY16C16(var,const)  ((var) * (const))\r
383 #endif\r
384 \r
385 /* Same except both inputs are variables. */\r
386 \r
387 #ifdef SHORTxSHORT_32           /* may work if 'int' is 32 bits */\r
388 #define MULTIPLY16V16(var1,var2)  (((INT16) (var1)) * ((INT16) (var2)))\r
389 #endif\r
390 \r
391 #ifndef MULTIPLY16V16           /* default definition */\r
392 #define MULTIPLY16V16(var1,var2)  ((var1) * (var2))\r
393 #endif\r