OLD | NEW |
1 /* | 1 /* |
2 * jidctint.c | 2 * jidctint.c |
3 * | 3 * |
| 4 * This file was part of the Independent JPEG Group's software. |
4 * Copyright (C) 1991-1998, Thomas G. Lane. | 5 * Copyright (C) 1991-1998, Thomas G. Lane. |
5 * Modification developed 2002-2009 by Guido Vollbeding. | 6 * Modification developed 2002-2009 by Guido Vollbeding. |
6 * This file is part of the Independent JPEG Group's software. | 7 * libjpeg-turbo Modifications: |
7 * For conditions of distribution and use, see the accompanying README file. | 8 * Copyright (C) 2015, D. R. Commander |
| 9 * For conditions of distribution and use, see the accompanying README.ijg |
| 10 * file. |
8 * | 11 * |
9 * This file contains a slow-but-accurate integer implementation of the | 12 * This file contains a slow-but-accurate integer implementation of the |
10 * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine | 13 * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine |
11 * must also perform dequantization of the input coefficients. | 14 * must also perform dequantization of the input coefficients. |
12 * | 15 * |
13 * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT | 16 * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT |
14 * on each row (or vice versa, but it's more convenient to emit a row at | 17 * on each row (or vice versa, but it's more convenient to emit a row at |
15 * a time). Direct algorithms are also available, but they are much more | 18 * a time). Direct algorithms are also available, but they are much more |
16 * complex and seem not to be any faster when reduced to code. | 19 * complex and seem not to be any faster when reduced to code. |
17 * | 20 * |
(...skipping 25 matching lines...) Expand all Loading... |
43 * regarding the output size. | 46 * regarding the output size. |
44 * Furthermore, the scaling and descaling is the same for all IDCT sizes. | 47 * Furthermore, the scaling and descaling is the same for all IDCT sizes. |
45 * | 48 * |
46 * CAUTION: We rely on the FIX() macro except for the N=1,2,4,8 cases | 49 * CAUTION: We rely on the FIX() macro except for the N=1,2,4,8 cases |
47 * since there would be too many additional constants to pre-calculate. | 50 * since there would be too many additional constants to pre-calculate. |
48 */ | 51 */ |
49 | 52 |
50 #define JPEG_INTERNALS | 53 #define JPEG_INTERNALS |
51 #include "jinclude.h" | 54 #include "jinclude.h" |
52 #include "jpeglib.h" | 55 #include "jpeglib.h" |
53 #include "jdct.h"» » /* Private declarations for DCT subsystem */ | 56 #include "jdct.h" /* Private declarations for DCT subsystem */ |
54 | 57 |
55 #ifdef DCT_ISLOW_SUPPORTED | 58 #ifdef DCT_ISLOW_SUPPORTED |
56 | 59 |
57 | 60 |
58 /* | 61 /* |
59 * This module is specialized to the case DCTSIZE = 8. | 62 * This module is specialized to the case DCTSIZE = 8. |
60 */ | 63 */ |
61 | 64 |
62 #if DCTSIZE != 8 | 65 #if DCTSIZE != 8 |
63 Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */ | 66 Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */ |
(...skipping 18 matching lines...) Expand all Loading... |
82 * multiplication we have to divide the product by CONST_SCALE, with proper | 85 * multiplication we have to divide the product by CONST_SCALE, with proper |
83 * rounding, to produce the correct output. This division can be done | 86 * rounding, to produce the correct output. This division can be done |
84 * cheaply as a right shift of CONST_BITS bits. We postpone shifting | 87 * cheaply as a right shift of CONST_BITS bits. We postpone shifting |
85 * as long as possible so that partial sums can be added together with | 88 * as long as possible so that partial sums can be added together with |
86 * full fractional precision. | 89 * full fractional precision. |
87 * | 90 * |
88 * The outputs of the first pass are scaled up by PASS1_BITS bits so that | 91 * The outputs of the first pass are scaled up by PASS1_BITS bits so that |
89 * they are represented to better-than-integral precision. These outputs | 92 * they are represented to better-than-integral precision. These outputs |
90 * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word | 93 * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word |
91 * with the recommended scaling. (To scale up 12-bit sample data further, an | 94 * with the recommended scaling. (To scale up 12-bit sample data further, an |
92 * intermediate INT32 array would be needed.) | 95 * intermediate JLONG array would be needed.) |
93 * | 96 * |
94 * To avoid overflow of the 32-bit intermediate results in pass 2, we must | 97 * To avoid overflow of the 32-bit intermediate results in pass 2, we must |
95 * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis | 98 * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis |
96 * shows that the values given below are the most effective. | 99 * shows that the values given below are the most effective. |
97 */ | 100 */ |
98 | 101 |
99 #if BITS_IN_JSAMPLE == 8 | 102 #if BITS_IN_JSAMPLE == 8 |
100 #define CONST_BITS 13 | 103 #define CONST_BITS 13 |
101 #define PASS1_BITS 2 | 104 #define PASS1_BITS 2 |
102 #else | 105 #else |
103 #define CONST_BITS 13 | 106 #define CONST_BITS 13 |
104 #define PASS1_BITS 1» » /* lose a little precision to avoid overflow */ | 107 #define PASS1_BITS 1 /* lose a little precision to avoid overflow */ |
105 #endif | 108 #endif |
106 | 109 |
107 /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus | 110 /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus |
108 * causing a lot of useless floating-point operations at run time. | 111 * causing a lot of useless floating-point operations at run time. |
109 * To get around this we use the following pre-calculated constants. | 112 * To get around this we use the following pre-calculated constants. |
110 * If you change CONST_BITS you may want to add appropriate values. | 113 * If you change CONST_BITS you may want to add appropriate values. |
111 * (With a reasonable C compiler, you can just rely on the FIX() macro...) | 114 * (With a reasonable C compiler, you can just rely on the FIX() macro...) |
112 */ | 115 */ |
113 | 116 |
114 #if CONST_BITS == 13 | 117 #if CONST_BITS == 13 |
115 #define FIX_0_298631336 ((INT32) 2446)» /* FIX(0.298631336) */ | 118 #define FIX_0_298631336 ((JLONG) 2446) /* FIX(0.298631336) */ |
116 #define FIX_0_390180644 ((INT32) 3196)» /* FIX(0.390180644) */ | 119 #define FIX_0_390180644 ((JLONG) 3196) /* FIX(0.390180644) */ |
117 #define FIX_0_541196100 ((INT32) 4433)» /* FIX(0.541196100) */ | 120 #define FIX_0_541196100 ((JLONG) 4433) /* FIX(0.541196100) */ |
118 #define FIX_0_765366865 ((INT32) 6270)» /* FIX(0.765366865) */ | 121 #define FIX_0_765366865 ((JLONG) 6270) /* FIX(0.765366865) */ |
119 #define FIX_0_899976223 ((INT32) 7373)» /* FIX(0.899976223) */ | 122 #define FIX_0_899976223 ((JLONG) 7373) /* FIX(0.899976223) */ |
120 #define FIX_1_175875602 ((INT32) 9633)» /* FIX(1.175875602) */ | 123 #define FIX_1_175875602 ((JLONG) 9633) /* FIX(1.175875602) */ |
121 #define FIX_1_501321110 ((INT32) 12299)» /* FIX(1.501321110) */ | 124 #define FIX_1_501321110 ((JLONG) 12299) /* FIX(1.501321110) */ |
122 #define FIX_1_847759065 ((INT32) 15137)» /* FIX(1.847759065) */ | 125 #define FIX_1_847759065 ((JLONG) 15137) /* FIX(1.847759065) */ |
123 #define FIX_1_961570560 ((INT32) 16069)» /* FIX(1.961570560) */ | 126 #define FIX_1_961570560 ((JLONG) 16069) /* FIX(1.961570560) */ |
124 #define FIX_2_053119869 ((INT32) 16819)» /* FIX(2.053119869) */ | 127 #define FIX_2_053119869 ((JLONG) 16819) /* FIX(2.053119869) */ |
125 #define FIX_2_562915447 ((INT32) 20995)» /* FIX(2.562915447) */ | 128 #define FIX_2_562915447 ((JLONG) 20995) /* FIX(2.562915447) */ |
126 #define FIX_3_072711026 ((INT32) 25172)» /* FIX(3.072711026) */ | 129 #define FIX_3_072711026 ((JLONG) 25172) /* FIX(3.072711026) */ |
127 #else | 130 #else |
128 #define FIX_0_298631336 FIX(0.298631336) | 131 #define FIX_0_298631336 FIX(0.298631336) |
129 #define FIX_0_390180644 FIX(0.390180644) | 132 #define FIX_0_390180644 FIX(0.390180644) |
130 #define FIX_0_541196100 FIX(0.541196100) | 133 #define FIX_0_541196100 FIX(0.541196100) |
131 #define FIX_0_765366865 FIX(0.765366865) | 134 #define FIX_0_765366865 FIX(0.765366865) |
132 #define FIX_0_899976223 FIX(0.899976223) | 135 #define FIX_0_899976223 FIX(0.899976223) |
133 #define FIX_1_175875602 FIX(1.175875602) | 136 #define FIX_1_175875602 FIX(1.175875602) |
134 #define FIX_1_501321110 FIX(1.501321110) | 137 #define FIX_1_501321110 FIX(1.501321110) |
135 #define FIX_1_847759065 FIX(1.847759065) | 138 #define FIX_1_847759065 FIX(1.847759065) |
136 #define FIX_1_961570560 FIX(1.961570560) | 139 #define FIX_1_961570560 FIX(1.961570560) |
137 #define FIX_2_053119869 FIX(2.053119869) | 140 #define FIX_2_053119869 FIX(2.053119869) |
138 #define FIX_2_562915447 FIX(2.562915447) | 141 #define FIX_2_562915447 FIX(2.562915447) |
139 #define FIX_3_072711026 FIX(3.072711026) | 142 #define FIX_3_072711026 FIX(3.072711026) |
140 #endif | 143 #endif |
141 | 144 |
142 | 145 |
143 /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. | 146 /* Multiply an JLONG variable by an JLONG constant to yield an JLONG result. |
144 * For 8-bit samples with the recommended scaling, all the variable | 147 * For 8-bit samples with the recommended scaling, all the variable |
145 * and constant values involved are no more than 16 bits wide, so a | 148 * and constant values involved are no more than 16 bits wide, so a |
146 * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. | 149 * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. |
147 * For 12-bit samples, a full 32-bit multiplication will be needed. | 150 * For 12-bit samples, a full 32-bit multiplication will be needed. |
148 */ | 151 */ |
149 | 152 |
150 #if BITS_IN_JSAMPLE == 8 | 153 #if BITS_IN_JSAMPLE == 8 |
151 #define MULTIPLY(var,const) MULTIPLY16C16(var,const) | 154 #define MULTIPLY(var,const) MULTIPLY16C16(var,const) |
152 #else | 155 #else |
153 #define MULTIPLY(var,const) ((var) * (const)) | 156 #define MULTIPLY(var,const) ((var) * (const)) |
154 #endif | 157 #endif |
155 | 158 |
156 | 159 |
157 /* Dequantize a coefficient by multiplying it by the multiplier-table | 160 /* Dequantize a coefficient by multiplying it by the multiplier-table |
158 * entry; produce an int result. In this module, both inputs and result | 161 * entry; produce an int result. In this module, both inputs and result |
159 * are 16 bits or less, so either int or short multiply will work. | 162 * are 16 bits or less, so either int or short multiply will work. |
160 */ | 163 */ |
161 | 164 |
162 #define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval)) | 165 #define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval)) |
163 | 166 |
164 | 167 |
165 /* | 168 /* |
166 * Perform dequantization and inverse DCT on one block of coefficients. | 169 * Perform dequantization and inverse DCT on one block of coefficients. |
167 */ | 170 */ |
168 | 171 |
169 GLOBAL(void) | 172 GLOBAL(void) |
170 jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 173 jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
171 » » JCOEFPTR coef_block, | 174 JCOEFPTR coef_block, |
172 » » JSAMPARRAY output_buf, JDIMENSION output_col) | 175 JSAMPARRAY output_buf, JDIMENSION output_col) |
173 { | 176 { |
174 INT32 tmp0, tmp1, tmp2, tmp3; | 177 JLONG tmp0, tmp1, tmp2, tmp3; |
175 INT32 tmp10, tmp11, tmp12, tmp13; | 178 JLONG tmp10, tmp11, tmp12, tmp13; |
176 INT32 z1, z2, z3, z4, z5; | 179 JLONG z1, z2, z3, z4, z5; |
177 JCOEFPTR inptr; | 180 JCOEFPTR inptr; |
178 ISLOW_MULT_TYPE * quantptr; | 181 ISLOW_MULT_TYPE *quantptr; |
179 int * wsptr; | 182 int *wsptr; |
180 JSAMPROW outptr; | 183 JSAMPROW outptr; |
181 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 184 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
182 int ctr; | 185 int ctr; |
183 int workspace[DCTSIZE2];» /* buffers data between passes */ | 186 int workspace[DCTSIZE2]; /* buffers data between passes */ |
184 SHIFT_TEMPS | 187 SHIFT_TEMPS |
185 | 188 |
186 /* Pass 1: process columns from input, store into work array. */ | 189 /* Pass 1: process columns from input, store into work array. */ |
187 /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ | 190 /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ |
188 /* furthermore, we scale the results by 2**PASS1_BITS. */ | 191 /* furthermore, we scale the results by 2**PASS1_BITS. */ |
189 | 192 |
190 inptr = coef_block; | 193 inptr = coef_block; |
191 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 194 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
192 wsptr = workspace; | 195 wsptr = workspace; |
193 for (ctr = DCTSIZE; ctr > 0; ctr--) { | 196 for (ctr = DCTSIZE; ctr > 0; ctr--) { |
194 /* Due to quantization, we will usually find that many of the input | 197 /* Due to quantization, we will usually find that many of the input |
195 * coefficients are zero, especially the AC terms. We can exploit this | 198 * coefficients are zero, especially the AC terms. We can exploit this |
196 * by short-circuiting the IDCT calculation for any column in which all | 199 * by short-circuiting the IDCT calculation for any column in which all |
197 * the AC terms are zero. In that case each output is equal to the | 200 * the AC terms are zero. In that case each output is equal to the |
198 * DC coefficient (with scale factor as needed). | 201 * DC coefficient (with scale factor as needed). |
199 * With typical images and quantization tables, half or more of the | 202 * With typical images and quantization tables, half or more of the |
200 * column DCT calculations can be simplified this way. | 203 * column DCT calculations can be simplified this way. |
201 */ | 204 */ |
202 | 205 |
203 if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && | 206 if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && |
204 » inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && | 207 inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && |
205 » inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && | 208 inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && |
206 » inptr[DCTSIZE*7] == 0) { | 209 inptr[DCTSIZE*7] == 0) { |
207 /* AC terms all zero */ | 210 /* AC terms all zero */ |
208 int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BIT
S; | 211 int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]), |
209 | 212 PASS1_BITS); |
| 213 |
210 wsptr[DCTSIZE*0] = dcval; | 214 wsptr[DCTSIZE*0] = dcval; |
211 wsptr[DCTSIZE*1] = dcval; | 215 wsptr[DCTSIZE*1] = dcval; |
212 wsptr[DCTSIZE*2] = dcval; | 216 wsptr[DCTSIZE*2] = dcval; |
213 wsptr[DCTSIZE*3] = dcval; | 217 wsptr[DCTSIZE*3] = dcval; |
214 wsptr[DCTSIZE*4] = dcval; | 218 wsptr[DCTSIZE*4] = dcval; |
215 wsptr[DCTSIZE*5] = dcval; | 219 wsptr[DCTSIZE*5] = dcval; |
216 wsptr[DCTSIZE*6] = dcval; | 220 wsptr[DCTSIZE*6] = dcval; |
217 wsptr[DCTSIZE*7] = dcval; | 221 wsptr[DCTSIZE*7] = dcval; |
218 | 222 |
219 inptr++;» » » /* advance pointers to next column */ | 223 inptr++; /* advance pointers to next column */ |
220 quantptr++; | 224 quantptr++; |
221 wsptr++; | 225 wsptr++; |
222 continue; | 226 continue; |
223 } | 227 } |
224 | 228 |
225 /* Even part: reverse the even part of the forward DCT. */ | 229 /* Even part: reverse the even part of the forward DCT. */ |
226 /* The rotator is sqrt(2)*c(-6). */ | 230 /* The rotator is sqrt(2)*c(-6). */ |
227 | 231 |
228 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 232 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
229 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); | 233 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); |
230 | 234 |
231 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); | 235 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); |
232 tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); | 236 tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); |
233 tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); | 237 tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); |
234 | 238 |
235 z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 239 z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
236 z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 240 z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
237 | 241 |
238 tmp0 = (z2 + z3) << CONST_BITS; | 242 tmp0 = LEFT_SHIFT(z2 + z3, CONST_BITS); |
239 tmp1 = (z2 - z3) << CONST_BITS; | 243 tmp1 = LEFT_SHIFT(z2 - z3, CONST_BITS); |
240 | 244 |
241 tmp10 = tmp0 + tmp3; | 245 tmp10 = tmp0 + tmp3; |
242 tmp13 = tmp0 - tmp3; | 246 tmp13 = tmp0 - tmp3; |
243 tmp11 = tmp1 + tmp2; | 247 tmp11 = tmp1 + tmp2; |
244 tmp12 = tmp1 - tmp2; | 248 tmp12 = tmp1 - tmp2; |
245 | 249 |
246 /* Odd part per figure 8; the matrix is unitary and hence its | 250 /* Odd part per figure 8; the matrix is unitary and hence its |
247 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. | 251 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. |
248 */ | 252 */ |
249 | 253 |
250 tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); | 254 tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); |
251 tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); | 255 tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); |
252 tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); | 256 tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); |
253 tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); | 257 tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); |
254 | 258 |
255 z1 = tmp0 + tmp3; | 259 z1 = tmp0 + tmp3; |
256 z2 = tmp1 + tmp2; | 260 z2 = tmp1 + tmp2; |
257 z3 = tmp0 + tmp2; | 261 z3 = tmp0 + tmp2; |
258 z4 = tmp1 + tmp3; | 262 z4 = tmp1 + tmp3; |
259 z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ | 263 z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ |
260 | 264 |
261 tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ | 265 tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ |
262 tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ | 266 tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ |
263 tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ | 267 tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ |
264 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ | 268 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ |
265 z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ | 269 z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ |
266 z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ | 270 z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ |
267 z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ | 271 z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ |
268 z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ | 272 z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ |
269 | 273 |
270 z3 += z5; | 274 z3 += z5; |
271 z4 += z5; | 275 z4 += z5; |
272 | 276 |
273 tmp0 += z1 + z3; | 277 tmp0 += z1 + z3; |
274 tmp1 += z2 + z4; | 278 tmp1 += z2 + z4; |
275 tmp2 += z2 + z3; | 279 tmp2 += z2 + z3; |
276 tmp3 += z1 + z4; | 280 tmp3 += z1 + z4; |
277 | 281 |
278 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ | 282 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ |
279 | 283 |
280 wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); | 284 wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); |
281 wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); | 285 wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); |
282 wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); | 286 wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); |
283 wsptr[DCTSIZE*6] = (int) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS); | 287 wsptr[DCTSIZE*6] = (int) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS); |
284 wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS); | 288 wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS); |
285 wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); | 289 wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); |
286 wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); | 290 wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); |
287 wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); | 291 wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); |
288 | 292 |
289 inptr++;» » » /* advance pointers to next column */ | 293 inptr++; /* advance pointers to next column */ |
290 quantptr++; | 294 quantptr++; |
291 wsptr++; | 295 wsptr++; |
292 } | 296 } |
293 | 297 |
294 /* Pass 2: process rows from work array, store into output array. */ | 298 /* Pass 2: process rows from work array, store into output array. */ |
295 /* Note that we must descale the results by a factor of 8 == 2**3, */ | 299 /* Note that we must descale the results by a factor of 8 == 2**3, */ |
296 /* and also undo the PASS1_BITS scaling. */ | 300 /* and also undo the PASS1_BITS scaling. */ |
297 | 301 |
298 wsptr = workspace; | 302 wsptr = workspace; |
299 for (ctr = 0; ctr < DCTSIZE; ctr++) { | 303 for (ctr = 0; ctr < DCTSIZE; ctr++) { |
300 outptr = output_buf[ctr] + output_col; | 304 outptr = output_buf[ctr] + output_col; |
301 /* Rows of zeroes can be exploited in the same way as we did with columns. | 305 /* Rows of zeroes can be exploited in the same way as we did with columns. |
302 * However, the column calculation has created many nonzero AC terms, so | 306 * However, the column calculation has created many nonzero AC terms, so |
303 * the simplification applies less often (typically 5% to 10% of the time). | 307 * the simplification applies less often (typically 5% to 10% of the time). |
304 * On machines with very fast multiplication, it's possible that the | 308 * On machines with very fast multiplication, it's possible that the |
305 * test takes more time than it's worth. In that case this section | 309 * test takes more time than it's worth. In that case this section |
306 * may be commented out. | 310 * may be commented out. |
307 */ | 311 */ |
308 | 312 |
309 #ifndef NO_ZERO_ROW_TEST | 313 #ifndef NO_ZERO_ROW_TEST |
310 if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && | 314 if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && |
311 » wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { | 315 wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { |
312 /* AC terms all zero */ | 316 /* AC terms all zero */ |
313 JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) | 317 JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3) |
314 » » » » & RANGE_MASK]; | 318 & RANGE_MASK]; |
315 | 319 |
316 outptr[0] = dcval; | 320 outptr[0] = dcval; |
317 outptr[1] = dcval; | 321 outptr[1] = dcval; |
318 outptr[2] = dcval; | 322 outptr[2] = dcval; |
319 outptr[3] = dcval; | 323 outptr[3] = dcval; |
320 outptr[4] = dcval; | 324 outptr[4] = dcval; |
321 outptr[5] = dcval; | 325 outptr[5] = dcval; |
322 outptr[6] = dcval; | 326 outptr[6] = dcval; |
323 outptr[7] = dcval; | 327 outptr[7] = dcval; |
324 | 328 |
325 wsptr += DCTSIZE;»» /* advance pointer to next row */ | 329 wsptr += DCTSIZE; /* advance pointer to next row */ |
326 continue; | 330 continue; |
327 } | 331 } |
328 #endif | 332 #endif |
329 | 333 |
330 /* Even part: reverse the even part of the forward DCT. */ | 334 /* Even part: reverse the even part of the forward DCT. */ |
331 /* The rotator is sqrt(2)*c(-6). */ | 335 /* The rotator is sqrt(2)*c(-6). */ |
332 | 336 |
333 z2 = (INT32) wsptr[2]; | 337 z2 = (JLONG) wsptr[2]; |
334 z3 = (INT32) wsptr[6]; | 338 z3 = (JLONG) wsptr[6]; |
335 | 339 |
336 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); | 340 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); |
337 tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); | 341 tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); |
338 tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); | 342 tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); |
339 | 343 |
340 tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS; | 344 tmp0 = LEFT_SHIFT((JLONG) wsptr[0] + (JLONG) wsptr[4], CONST_BITS); |
341 tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS; | 345 tmp1 = LEFT_SHIFT((JLONG) wsptr[0] - (JLONG) wsptr[4], CONST_BITS); |
342 | 346 |
343 tmp10 = tmp0 + tmp3; | 347 tmp10 = tmp0 + tmp3; |
344 tmp13 = tmp0 - tmp3; | 348 tmp13 = tmp0 - tmp3; |
345 tmp11 = tmp1 + tmp2; | 349 tmp11 = tmp1 + tmp2; |
346 tmp12 = tmp1 - tmp2; | 350 tmp12 = tmp1 - tmp2; |
347 | 351 |
348 /* Odd part per figure 8; the matrix is unitary and hence its | 352 /* Odd part per figure 8; the matrix is unitary and hence its |
349 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. | 353 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. |
350 */ | 354 */ |
351 | 355 |
352 tmp0 = (INT32) wsptr[7]; | 356 tmp0 = (JLONG) wsptr[7]; |
353 tmp1 = (INT32) wsptr[5]; | 357 tmp1 = (JLONG) wsptr[5]; |
354 tmp2 = (INT32) wsptr[3]; | 358 tmp2 = (JLONG) wsptr[3]; |
355 tmp3 = (INT32) wsptr[1]; | 359 tmp3 = (JLONG) wsptr[1]; |
356 | 360 |
357 z1 = tmp0 + tmp3; | 361 z1 = tmp0 + tmp3; |
358 z2 = tmp1 + tmp2; | 362 z2 = tmp1 + tmp2; |
359 z3 = tmp0 + tmp2; | 363 z3 = tmp0 + tmp2; |
360 z4 = tmp1 + tmp3; | 364 z4 = tmp1 + tmp3; |
361 z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ | 365 z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ |
362 | 366 |
363 tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ | 367 tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ |
364 tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ | 368 tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ |
365 tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ | 369 tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ |
366 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ | 370 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ |
367 z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ | 371 z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ |
368 z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ | 372 z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ |
369 z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ | 373 z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ |
370 z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ | 374 z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ |
371 | 375 |
372 z3 += z5; | 376 z3 += z5; |
373 z4 += z5; | 377 z4 += z5; |
374 | 378 |
375 tmp0 += z1 + z3; | 379 tmp0 += z1 + z3; |
376 tmp1 += z2 + z4; | 380 tmp1 += z2 + z4; |
377 tmp2 += z2 + z3; | 381 tmp2 += z2 + z3; |
378 tmp3 += z1 + z4; | 382 tmp3 += z1 + z4; |
379 | 383 |
380 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ | 384 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ |
381 | 385 |
382 outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3, | 386 outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3, |
383 » » » » » CONST_BITS+PASS1_BITS+3) | 387 CONST_BITS+PASS1_BITS+3) |
384 » » » & RANGE_MASK]; | 388 & RANGE_MASK]; |
385 outptr[7] = range_limit[(int) DESCALE(tmp10 - tmp3, | 389 outptr[7] = range_limit[(int) DESCALE(tmp10 - tmp3, |
386 » » » » » CONST_BITS+PASS1_BITS+3) | 390 CONST_BITS+PASS1_BITS+3) |
387 » » » & RANGE_MASK]; | 391 & RANGE_MASK]; |
388 outptr[1] = range_limit[(int) DESCALE(tmp11 + tmp2, | 392 outptr[1] = range_limit[(int) DESCALE(tmp11 + tmp2, |
389 » » » » » CONST_BITS+PASS1_BITS+3) | 393 CONST_BITS+PASS1_BITS+3) |
390 » » » & RANGE_MASK]; | 394 & RANGE_MASK]; |
391 outptr[6] = range_limit[(int) DESCALE(tmp11 - tmp2, | 395 outptr[6] = range_limit[(int) DESCALE(tmp11 - tmp2, |
392 » » » » » CONST_BITS+PASS1_BITS+3) | 396 CONST_BITS+PASS1_BITS+3) |
393 » » » & RANGE_MASK]; | 397 & RANGE_MASK]; |
394 outptr[2] = range_limit[(int) DESCALE(tmp12 + tmp1, | 398 outptr[2] = range_limit[(int) DESCALE(tmp12 + tmp1, |
395 » » » » » CONST_BITS+PASS1_BITS+3) | 399 CONST_BITS+PASS1_BITS+3) |
396 » » » & RANGE_MASK]; | 400 & RANGE_MASK]; |
397 outptr[5] = range_limit[(int) DESCALE(tmp12 - tmp1, | 401 outptr[5] = range_limit[(int) DESCALE(tmp12 - tmp1, |
398 » » » » » CONST_BITS+PASS1_BITS+3) | 402 CONST_BITS+PASS1_BITS+3) |
399 » » » & RANGE_MASK]; | 403 & RANGE_MASK]; |
400 outptr[3] = range_limit[(int) DESCALE(tmp13 + tmp0, | 404 outptr[3] = range_limit[(int) DESCALE(tmp13 + tmp0, |
401 » » » » » CONST_BITS+PASS1_BITS+3) | 405 CONST_BITS+PASS1_BITS+3) |
402 » » » & RANGE_MASK]; | 406 & RANGE_MASK]; |
403 outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0, | 407 outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0, |
404 » » » » » CONST_BITS+PASS1_BITS+3) | 408 CONST_BITS+PASS1_BITS+3) |
405 » » » & RANGE_MASK]; | 409 & RANGE_MASK]; |
406 | 410 |
407 wsptr += DCTSIZE;» » /* advance pointer to next row */ | 411 wsptr += DCTSIZE; /* advance pointer to next row */ |
408 } | 412 } |
409 } | 413 } |
410 | 414 |
411 #ifdef IDCT_SCALING_SUPPORTED | 415 #ifdef IDCT_SCALING_SUPPORTED |
412 | 416 |
413 | 417 |
414 /* | 418 /* |
415 * Perform dequantization and inverse DCT on one block of coefficients, | 419 * Perform dequantization and inverse DCT on one block of coefficients, |
416 * producing a 7x7 output block. | 420 * producing a 7x7 output block. |
417 * | 421 * |
418 * Optimized algorithm with 12 multiplications in the 1-D kernel. | 422 * Optimized algorithm with 12 multiplications in the 1-D kernel. |
419 * cK represents sqrt(2) * cos(K*pi/14). | 423 * cK represents sqrt(2) * cos(K*pi/14). |
420 */ | 424 */ |
421 | 425 |
422 GLOBAL(void) | 426 GLOBAL(void) |
423 jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 427 jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
424 » JCOEFPTR coef_block, | 428 JCOEFPTR coef_block, |
425 » JSAMPARRAY output_buf, JDIMENSION output_col) | 429 JSAMPARRAY output_buf, JDIMENSION output_col) |
426 { | 430 { |
427 INT32 tmp0, tmp1, tmp2, tmp10, tmp11, tmp12, tmp13; | 431 JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12, tmp13; |
428 INT32 z1, z2, z3; | 432 JLONG z1, z2, z3; |
429 JCOEFPTR inptr; | 433 JCOEFPTR inptr; |
430 ISLOW_MULT_TYPE * quantptr; | 434 ISLOW_MULT_TYPE *quantptr; |
431 int * wsptr; | 435 int *wsptr; |
432 JSAMPROW outptr; | 436 JSAMPROW outptr; |
433 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 437 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
434 int ctr; | 438 int ctr; |
435 int workspace[7*7];» /* buffers data between passes */ | 439 int workspace[7*7]; /* buffers data between passes */ |
436 SHIFT_TEMPS | 440 SHIFT_TEMPS |
437 | 441 |
438 /* Pass 1: process columns from input, store into work array. */ | 442 /* Pass 1: process columns from input, store into work array. */ |
439 | 443 |
440 inptr = coef_block; | 444 inptr = coef_block; |
441 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 445 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
442 wsptr = workspace; | 446 wsptr = workspace; |
443 for (ctr = 0; ctr < 7; ctr++, inptr++, quantptr++, wsptr++) { | 447 for (ctr = 0; ctr < 7; ctr++, inptr++, quantptr++, wsptr++) { |
444 /* Even part */ | 448 /* Even part */ |
445 | 449 |
446 tmp13 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 450 tmp13 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
447 tmp13 <<= CONST_BITS; | 451 tmp13 = LEFT_SHIFT(tmp13, CONST_BITS); |
448 /* Add fudge factor here for final descale. */ | 452 /* Add fudge factor here for final descale. */ |
449 tmp13 += ONE << (CONST_BITS-PASS1_BITS-1); | 453 tmp13 += ONE << (CONST_BITS-PASS1_BITS-1); |
450 | 454 |
451 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 455 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
452 z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 456 z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
453 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); | 457 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); |
454 | 458 |
455 tmp10 = MULTIPLY(z2 - z3, FIX(0.881747734)); /* c4 */ | 459 tmp10 = MULTIPLY(z2 - z3, FIX(0.881747734)); /* c4 */ |
456 tmp12 = MULTIPLY(z1 - z2, FIX(0.314692123)); /* c6 */ | 460 tmp12 = MULTIPLY(z1 - z2, FIX(0.314692123)); /* c6 */ |
457 tmp11 = tmp10 + tmp12 + tmp13 - MULTIPLY(z2, FIX(1.841218003)); /* c2+c4-c6
*/ | 461 tmp11 = tmp10 + tmp12 + tmp13 - MULTIPLY(z2, FIX(1.841218003)); /* c2+c4-c6
*/ |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 495 |
492 /* Pass 2: process 7 rows from work array, store into output array. */ | 496 /* Pass 2: process 7 rows from work array, store into output array. */ |
493 | 497 |
494 wsptr = workspace; | 498 wsptr = workspace; |
495 for (ctr = 0; ctr < 7; ctr++) { | 499 for (ctr = 0; ctr < 7; ctr++) { |
496 outptr = output_buf[ctr] + output_col; | 500 outptr = output_buf[ctr] + output_col; |
497 | 501 |
498 /* Even part */ | 502 /* Even part */ |
499 | 503 |
500 /* Add fudge factor here for final descale. */ | 504 /* Add fudge factor here for final descale. */ |
501 tmp13 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 505 tmp13 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
502 tmp13 <<= CONST_BITS; | 506 tmp13 = LEFT_SHIFT(tmp13, CONST_BITS); |
503 | 507 |
504 z1 = (INT32) wsptr[2]; | 508 z1 = (JLONG) wsptr[2]; |
505 z2 = (INT32) wsptr[4]; | 509 z2 = (JLONG) wsptr[4]; |
506 z3 = (INT32) wsptr[6]; | 510 z3 = (JLONG) wsptr[6]; |
507 | 511 |
508 tmp10 = MULTIPLY(z2 - z3, FIX(0.881747734)); /* c4 */ | 512 tmp10 = MULTIPLY(z2 - z3, FIX(0.881747734)); /* c4 */ |
509 tmp12 = MULTIPLY(z1 - z2, FIX(0.314692123)); /* c6 */ | 513 tmp12 = MULTIPLY(z1 - z2, FIX(0.314692123)); /* c6 */ |
510 tmp11 = tmp10 + tmp12 + tmp13 - MULTIPLY(z2, FIX(1.841218003)); /* c2+c4-c6
*/ | 514 tmp11 = tmp10 + tmp12 + tmp13 - MULTIPLY(z2, FIX(1.841218003)); /* c2+c4-c6
*/ |
511 tmp0 = z1 + z3; | 515 tmp0 = z1 + z3; |
512 z2 -= tmp0; | 516 z2 -= tmp0; |
513 tmp0 = MULTIPLY(tmp0, FIX(1.274162392)) + tmp13; /* c2 */ | 517 tmp0 = MULTIPLY(tmp0, FIX(1.274162392)) + tmp13; /* c2 */ |
514 tmp10 += tmp0 - MULTIPLY(z3, FIX(0.077722536)); /* c2-c4-c6 */ | 518 tmp10 += tmp0 - MULTIPLY(z3, FIX(0.077722536)); /* c2-c4-c6 */ |
515 tmp12 += tmp0 - MULTIPLY(z1, FIX(2.470602249)); /* c2+c4+c6 */ | 519 tmp12 += tmp0 - MULTIPLY(z1, FIX(2.470602249)); /* c2+c4+c6 */ |
516 tmp13 += MULTIPLY(z2, FIX(1.414213562)); /* c0 */ | 520 tmp13 += MULTIPLY(z2, FIX(1.414213562)); /* c0 */ |
517 | 521 |
518 /* Odd part */ | 522 /* Odd part */ |
519 | 523 |
520 z1 = (INT32) wsptr[1]; | 524 z1 = (JLONG) wsptr[1]; |
521 z2 = (INT32) wsptr[3]; | 525 z2 = (JLONG) wsptr[3]; |
522 z3 = (INT32) wsptr[5]; | 526 z3 = (JLONG) wsptr[5]; |
523 | 527 |
524 tmp1 = MULTIPLY(z1 + z2, FIX(0.935414347)); /* (c3+c1-c5)/2 */ | 528 tmp1 = MULTIPLY(z1 + z2, FIX(0.935414347)); /* (c3+c1-c5)/2 */ |
525 tmp2 = MULTIPLY(z1 - z2, FIX(0.170262339)); /* (c3+c5-c1)/2 */ | 529 tmp2 = MULTIPLY(z1 - z2, FIX(0.170262339)); /* (c3+c5-c1)/2 */ |
526 tmp0 = tmp1 - tmp2; | 530 tmp0 = tmp1 - tmp2; |
527 tmp1 += tmp2; | 531 tmp1 += tmp2; |
528 tmp2 = MULTIPLY(z2 + z3, - FIX(1.378756276)); /* -c1 */ | 532 tmp2 = MULTIPLY(z2 + z3, - FIX(1.378756276)); /* -c1 */ |
529 tmp1 += tmp2; | 533 tmp1 += tmp2; |
530 z2 = MULTIPLY(z1 + z3, FIX(0.613604268)); /* c5 */ | 534 z2 = MULTIPLY(z1 + z3, FIX(0.613604268)); /* c5 */ |
531 tmp0 += z2; | 535 tmp0 += z2; |
532 tmp2 += z2 + MULTIPLY(z3, FIX(1.870828693)); /* c3+c1-c5 */ | 536 tmp2 += z2 + MULTIPLY(z3, FIX(1.870828693)); /* c3+c1-c5 */ |
533 | 537 |
534 /* Final output stage */ | 538 /* Final output stage */ |
535 | 539 |
536 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, | 540 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, |
537 » » » » » CONST_BITS+PASS1_BITS+3) | 541 CONST_BITS+PASS1_BITS+3) |
538 » » » & RANGE_MASK]; | 542 & RANGE_MASK]; |
539 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, | 543 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, |
540 » » » » » CONST_BITS+PASS1_BITS+3) | 544 CONST_BITS+PASS1_BITS+3) |
541 » » » & RANGE_MASK]; | 545 & RANGE_MASK]; |
542 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, | 546 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, |
543 » » » » » CONST_BITS+PASS1_BITS+3) | 547 CONST_BITS+PASS1_BITS+3) |
544 » » » & RANGE_MASK]; | 548 & RANGE_MASK]; |
545 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, | 549 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, |
546 » » » » » CONST_BITS+PASS1_BITS+3) | 550 CONST_BITS+PASS1_BITS+3) |
547 » » » & RANGE_MASK]; | 551 & RANGE_MASK]; |
548 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, | 552 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, |
549 » » » » » CONST_BITS+PASS1_BITS+3) | 553 CONST_BITS+PASS1_BITS+3) |
550 » » » & RANGE_MASK]; | 554 & RANGE_MASK]; |
551 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, | 555 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, |
552 » » » » » CONST_BITS+PASS1_BITS+3) | 556 CONST_BITS+PASS1_BITS+3) |
553 » » » & RANGE_MASK]; | 557 & RANGE_MASK]; |
554 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13, | 558 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13, |
555 » » » » » CONST_BITS+PASS1_BITS+3) | 559 CONST_BITS+PASS1_BITS+3) |
556 » » » & RANGE_MASK]; | 560 & RANGE_MASK]; |
557 | 561 |
558 wsptr += 7;»» /* advance pointer to next row */ | 562 wsptr += 7; /* advance pointer to next row */ |
559 } | 563 } |
560 } | 564 } |
561 | 565 |
562 | 566 |
563 /* | 567 /* |
564 * Perform dequantization and inverse DCT on one block of coefficients, | 568 * Perform dequantization and inverse DCT on one block of coefficients, |
565 * producing a reduced-size 6x6 output block. | 569 * producing a reduced-size 6x6 output block. |
566 * | 570 * |
567 * Optimized algorithm with 3 multiplications in the 1-D kernel. | 571 * Optimized algorithm with 3 multiplications in the 1-D kernel. |
568 * cK represents sqrt(2) * cos(K*pi/12). | 572 * cK represents sqrt(2) * cos(K*pi/12). |
569 */ | 573 */ |
570 | 574 |
571 GLOBAL(void) | 575 GLOBAL(void) |
572 jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 576 jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
573 » JCOEFPTR coef_block, | 577 JCOEFPTR coef_block, |
574 » JSAMPARRAY output_buf, JDIMENSION output_col) | 578 JSAMPARRAY output_buf, JDIMENSION output_col) |
575 { | 579 { |
576 INT32 tmp0, tmp1, tmp2, tmp10, tmp11, tmp12; | 580 JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12; |
577 INT32 z1, z2, z3; | 581 JLONG z1, z2, z3; |
578 JCOEFPTR inptr; | 582 JCOEFPTR inptr; |
579 ISLOW_MULT_TYPE * quantptr; | 583 ISLOW_MULT_TYPE *quantptr; |
580 int * wsptr; | 584 int *wsptr; |
581 JSAMPROW outptr; | 585 JSAMPROW outptr; |
582 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 586 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
583 int ctr; | 587 int ctr; |
584 int workspace[6*6];» /* buffers data between passes */ | 588 int workspace[6*6]; /* buffers data between passes */ |
585 SHIFT_TEMPS | 589 SHIFT_TEMPS |
586 | 590 |
587 /* Pass 1: process columns from input, store into work array. */ | 591 /* Pass 1: process columns from input, store into work array. */ |
588 | 592 |
589 inptr = coef_block; | 593 inptr = coef_block; |
590 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 594 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
591 wsptr = workspace; | 595 wsptr = workspace; |
592 for (ctr = 0; ctr < 6; ctr++, inptr++, quantptr++, wsptr++) { | 596 for (ctr = 0; ctr < 6; ctr++, inptr++, quantptr++, wsptr++) { |
593 /* Even part */ | 597 /* Even part */ |
594 | 598 |
595 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 599 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
596 tmp0 <<= CONST_BITS; | 600 tmp0 = LEFT_SHIFT(tmp0, CONST_BITS); |
597 /* Add fudge factor here for final descale. */ | 601 /* Add fudge factor here for final descale. */ |
598 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); | 602 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); |
599 tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 603 tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
600 tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */ | 604 tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */ |
601 tmp1 = tmp0 + tmp10; | 605 tmp1 = tmp0 + tmp10; |
602 tmp11 = RIGHT_SHIFT(tmp0 - tmp10 - tmp10, CONST_BITS-PASS1_BITS); | 606 tmp11 = RIGHT_SHIFT(tmp0 - tmp10 - tmp10, CONST_BITS-PASS1_BITS); |
603 tmp10 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 607 tmp10 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
604 tmp0 = MULTIPLY(tmp10, FIX(1.224744871)); /* c2 */ | 608 tmp0 = MULTIPLY(tmp10, FIX(1.224744871)); /* c2 */ |
605 tmp10 = tmp1 + tmp0; | 609 tmp10 = tmp1 + tmp0; |
606 tmp12 = tmp1 - tmp0; | 610 tmp12 = tmp1 - tmp0; |
607 | 611 |
608 /* Odd part */ | 612 /* Odd part */ |
609 | 613 |
610 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); | 614 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); |
611 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); | 615 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); |
612 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); | 616 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); |
613 tmp1 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */ | 617 tmp1 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */ |
614 tmp0 = tmp1 + ((z1 + z2) << CONST_BITS); | 618 tmp0 = tmp1 + LEFT_SHIFT(z1 + z2, CONST_BITS); |
615 tmp2 = tmp1 + ((z3 - z2) << CONST_BITS); | 619 tmp2 = tmp1 + LEFT_SHIFT(z3 - z2, CONST_BITS); |
616 tmp1 = (z1 - z2 - z3) << PASS1_BITS; | 620 tmp1 = LEFT_SHIFT(z1 - z2 - z3, PASS1_BITS); |
617 | 621 |
618 /* Final output stage */ | 622 /* Final output stage */ |
619 | 623 |
620 wsptr[6*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); | 624 wsptr[6*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); |
621 wsptr[6*5] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); | 625 wsptr[6*5] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); |
622 wsptr[6*1] = (int) (tmp11 + tmp1); | 626 wsptr[6*1] = (int) (tmp11 + tmp1); |
623 wsptr[6*4] = (int) (tmp11 - tmp1); | 627 wsptr[6*4] = (int) (tmp11 - tmp1); |
624 wsptr[6*2] = (int) RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS-PASS1_BITS); | 628 wsptr[6*2] = (int) RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS-PASS1_BITS); |
625 wsptr[6*3] = (int) RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS-PASS1_BITS); | 629 wsptr[6*3] = (int) RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS-PASS1_BITS); |
626 } | 630 } |
627 | 631 |
628 /* Pass 2: process 6 rows from work array, store into output array. */ | 632 /* Pass 2: process 6 rows from work array, store into output array. */ |
629 | 633 |
630 wsptr = workspace; | 634 wsptr = workspace; |
631 for (ctr = 0; ctr < 6; ctr++) { | 635 for (ctr = 0; ctr < 6; ctr++) { |
632 outptr = output_buf[ctr] + output_col; | 636 outptr = output_buf[ctr] + output_col; |
633 | 637 |
634 /* Even part */ | 638 /* Even part */ |
635 | 639 |
636 /* Add fudge factor here for final descale. */ | 640 /* Add fudge factor here for final descale. */ |
637 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 641 tmp0 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
638 tmp0 <<= CONST_BITS; | 642 tmp0 = LEFT_SHIFT(tmp0, CONST_BITS); |
639 tmp2 = (INT32) wsptr[4]; | 643 tmp2 = (JLONG) wsptr[4]; |
640 tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */ | 644 tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */ |
641 tmp1 = tmp0 + tmp10; | 645 tmp1 = tmp0 + tmp10; |
642 tmp11 = tmp0 - tmp10 - tmp10; | 646 tmp11 = tmp0 - tmp10 - tmp10; |
643 tmp10 = (INT32) wsptr[2]; | 647 tmp10 = (JLONG) wsptr[2]; |
644 tmp0 = MULTIPLY(tmp10, FIX(1.224744871)); /* c2 */ | 648 tmp0 = MULTIPLY(tmp10, FIX(1.224744871)); /* c2 */ |
645 tmp10 = tmp1 + tmp0; | 649 tmp10 = tmp1 + tmp0; |
646 tmp12 = tmp1 - tmp0; | 650 tmp12 = tmp1 - tmp0; |
647 | 651 |
648 /* Odd part */ | 652 /* Odd part */ |
649 | 653 |
650 z1 = (INT32) wsptr[1]; | 654 z1 = (JLONG) wsptr[1]; |
651 z2 = (INT32) wsptr[3]; | 655 z2 = (JLONG) wsptr[3]; |
652 z3 = (INT32) wsptr[5]; | 656 z3 = (JLONG) wsptr[5]; |
653 tmp1 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */ | 657 tmp1 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */ |
654 tmp0 = tmp1 + ((z1 + z2) << CONST_BITS); | 658 tmp0 = tmp1 + LEFT_SHIFT(z1 + z2, CONST_BITS); |
655 tmp2 = tmp1 + ((z3 - z2) << CONST_BITS); | 659 tmp2 = tmp1 + LEFT_SHIFT(z3 - z2, CONST_BITS); |
656 tmp1 = (z1 - z2 - z3) << CONST_BITS; | 660 tmp1 = LEFT_SHIFT(z1 - z2 - z3, CONST_BITS); |
657 | 661 |
658 /* Final output stage */ | 662 /* Final output stage */ |
659 | 663 |
660 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, | 664 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, |
661 » » » » » CONST_BITS+PASS1_BITS+3) | 665 CONST_BITS+PASS1_BITS+3) |
662 » » » & RANGE_MASK]; | 666 & RANGE_MASK]; |
663 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, | 667 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, |
664 » » » » » CONST_BITS+PASS1_BITS+3) | 668 CONST_BITS+PASS1_BITS+3) |
665 » » » & RANGE_MASK]; | 669 & RANGE_MASK]; |
666 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, | 670 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, |
667 » » » » » CONST_BITS+PASS1_BITS+3) | 671 CONST_BITS+PASS1_BITS+3) |
668 » » » & RANGE_MASK]; | 672 & RANGE_MASK]; |
669 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, | 673 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, |
670 » » » » » CONST_BITS+PASS1_BITS+3) | 674 CONST_BITS+PASS1_BITS+3) |
671 » » » & RANGE_MASK]; | 675 & RANGE_MASK]; |
672 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, | 676 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, |
673 » » » » » CONST_BITS+PASS1_BITS+3) | 677 CONST_BITS+PASS1_BITS+3) |
674 » » » & RANGE_MASK]; | 678 & RANGE_MASK]; |
675 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, | 679 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, |
676 » » » » » CONST_BITS+PASS1_BITS+3) | 680 CONST_BITS+PASS1_BITS+3) |
677 » » » & RANGE_MASK]; | 681 & RANGE_MASK]; |
678 | 682 |
679 wsptr += 6;»» /* advance pointer to next row */ | 683 wsptr += 6; /* advance pointer to next row */ |
680 } | 684 } |
681 } | 685 } |
682 | 686 |
683 | 687 |
684 /* | 688 /* |
685 * Perform dequantization and inverse DCT on one block of coefficients, | 689 * Perform dequantization and inverse DCT on one block of coefficients, |
686 * producing a reduced-size 5x5 output block. | 690 * producing a reduced-size 5x5 output block. |
687 * | 691 * |
688 * Optimized algorithm with 5 multiplications in the 1-D kernel. | 692 * Optimized algorithm with 5 multiplications in the 1-D kernel. |
689 * cK represents sqrt(2) * cos(K*pi/10). | 693 * cK represents sqrt(2) * cos(K*pi/10). |
690 */ | 694 */ |
691 | 695 |
692 GLOBAL(void) | 696 GLOBAL(void) |
693 jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 697 jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
694 » JCOEFPTR coef_block, | 698 JCOEFPTR coef_block, |
695 » JSAMPARRAY output_buf, JDIMENSION output_col) | 699 JSAMPARRAY output_buf, JDIMENSION output_col) |
696 { | 700 { |
697 INT32 tmp0, tmp1, tmp10, tmp11, tmp12; | 701 JLONG tmp0, tmp1, tmp10, tmp11, tmp12; |
698 INT32 z1, z2, z3; | 702 JLONG z1, z2, z3; |
699 JCOEFPTR inptr; | 703 JCOEFPTR inptr; |
700 ISLOW_MULT_TYPE * quantptr; | 704 ISLOW_MULT_TYPE *quantptr; |
701 int * wsptr; | 705 int *wsptr; |
702 JSAMPROW outptr; | 706 JSAMPROW outptr; |
703 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 707 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
704 int ctr; | 708 int ctr; |
705 int workspace[5*5];» /* buffers data between passes */ | 709 int workspace[5*5]; /* buffers data between passes */ |
706 SHIFT_TEMPS | 710 SHIFT_TEMPS |
707 | 711 |
708 /* Pass 1: process columns from input, store into work array. */ | 712 /* Pass 1: process columns from input, store into work array. */ |
709 | 713 |
710 inptr = coef_block; | 714 inptr = coef_block; |
711 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 715 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
712 wsptr = workspace; | 716 wsptr = workspace; |
713 for (ctr = 0; ctr < 5; ctr++, inptr++, quantptr++, wsptr++) { | 717 for (ctr = 0; ctr < 5; ctr++, inptr++, quantptr++, wsptr++) { |
714 /* Even part */ | 718 /* Even part */ |
715 | 719 |
716 tmp12 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 720 tmp12 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
717 tmp12 <<= CONST_BITS; | 721 tmp12 = LEFT_SHIFT(tmp12, CONST_BITS); |
718 /* Add fudge factor here for final descale. */ | 722 /* Add fudge factor here for final descale. */ |
719 tmp12 += ONE << (CONST_BITS-PASS1_BITS-1); | 723 tmp12 += ONE << (CONST_BITS-PASS1_BITS-1); |
720 tmp0 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 724 tmp0 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
721 tmp1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 725 tmp1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
722 z1 = MULTIPLY(tmp0 + tmp1, FIX(0.790569415)); /* (c2+c4)/2 */ | 726 z1 = MULTIPLY(tmp0 + tmp1, FIX(0.790569415)); /* (c2+c4)/2 */ |
723 z2 = MULTIPLY(tmp0 - tmp1, FIX(0.353553391)); /* (c2-c4)/2 */ | 727 z2 = MULTIPLY(tmp0 - tmp1, FIX(0.353553391)); /* (c2-c4)/2 */ |
724 z3 = tmp12 + z2; | 728 z3 = tmp12 + z2; |
725 tmp10 = z3 + z1; | 729 tmp10 = z3 + z1; |
726 tmp11 = z3 - z1; | 730 tmp11 = z3 - z1; |
727 tmp12 -= z2 << 2; | 731 tmp12 -= LEFT_SHIFT(z2, 2); |
728 | 732 |
729 /* Odd part */ | 733 /* Odd part */ |
730 | 734 |
731 z2 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); | 735 z2 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); |
732 z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); | 736 z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); |
733 | 737 |
734 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c3 */ | 738 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c3 */ |
735 tmp0 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c1-c3 */ | 739 tmp0 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c1-c3 */ |
736 tmp1 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c1+c3 */ | 740 tmp1 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c1+c3 */ |
737 | 741 |
738 /* Final output stage */ | 742 /* Final output stage */ |
739 | 743 |
740 wsptr[5*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); | 744 wsptr[5*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); |
741 wsptr[5*4] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); | 745 wsptr[5*4] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); |
742 wsptr[5*1] = (int) RIGHT_SHIFT(tmp11 + tmp1, CONST_BITS-PASS1_BITS); | 746 wsptr[5*1] = (int) RIGHT_SHIFT(tmp11 + tmp1, CONST_BITS-PASS1_BITS); |
743 wsptr[5*3] = (int) RIGHT_SHIFT(tmp11 - tmp1, CONST_BITS-PASS1_BITS); | 747 wsptr[5*3] = (int) RIGHT_SHIFT(tmp11 - tmp1, CONST_BITS-PASS1_BITS); |
744 wsptr[5*2] = (int) RIGHT_SHIFT(tmp12, CONST_BITS-PASS1_BITS); | 748 wsptr[5*2] = (int) RIGHT_SHIFT(tmp12, CONST_BITS-PASS1_BITS); |
745 } | 749 } |
746 | 750 |
747 /* Pass 2: process 5 rows from work array, store into output array. */ | 751 /* Pass 2: process 5 rows from work array, store into output array. */ |
748 | 752 |
749 wsptr = workspace; | 753 wsptr = workspace; |
750 for (ctr = 0; ctr < 5; ctr++) { | 754 for (ctr = 0; ctr < 5; ctr++) { |
751 outptr = output_buf[ctr] + output_col; | 755 outptr = output_buf[ctr] + output_col; |
752 | 756 |
753 /* Even part */ | 757 /* Even part */ |
754 | 758 |
755 /* Add fudge factor here for final descale. */ | 759 /* Add fudge factor here for final descale. */ |
756 tmp12 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 760 tmp12 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
757 tmp12 <<= CONST_BITS; | 761 tmp12 = LEFT_SHIFT(tmp12, CONST_BITS); |
758 tmp0 = (INT32) wsptr[2]; | 762 tmp0 = (JLONG) wsptr[2]; |
759 tmp1 = (INT32) wsptr[4]; | 763 tmp1 = (JLONG) wsptr[4]; |
760 z1 = MULTIPLY(tmp0 + tmp1, FIX(0.790569415)); /* (c2+c4)/2 */ | 764 z1 = MULTIPLY(tmp0 + tmp1, FIX(0.790569415)); /* (c2+c4)/2 */ |
761 z2 = MULTIPLY(tmp0 - tmp1, FIX(0.353553391)); /* (c2-c4)/2 */ | 765 z2 = MULTIPLY(tmp0 - tmp1, FIX(0.353553391)); /* (c2-c4)/2 */ |
762 z3 = tmp12 + z2; | 766 z3 = tmp12 + z2; |
763 tmp10 = z3 + z1; | 767 tmp10 = z3 + z1; |
764 tmp11 = z3 - z1; | 768 tmp11 = z3 - z1; |
765 tmp12 -= z2 << 2; | 769 tmp12 -= LEFT_SHIFT(z2, 2); |
766 | 770 |
767 /* Odd part */ | 771 /* Odd part */ |
768 | 772 |
769 z2 = (INT32) wsptr[1]; | 773 z2 = (JLONG) wsptr[1]; |
770 z3 = (INT32) wsptr[3]; | 774 z3 = (JLONG) wsptr[3]; |
771 | 775 |
772 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c3 */ | 776 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c3 */ |
773 tmp0 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c1-c3 */ | 777 tmp0 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c1-c3 */ |
774 tmp1 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c1+c3 */ | 778 tmp1 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c1+c3 */ |
775 | 779 |
776 /* Final output stage */ | 780 /* Final output stage */ |
777 | 781 |
778 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, | 782 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, |
779 » » » » » CONST_BITS+PASS1_BITS+3) | 783 CONST_BITS+PASS1_BITS+3) |
780 » » » & RANGE_MASK]; | 784 & RANGE_MASK]; |
781 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, | 785 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, |
782 » » » » » CONST_BITS+PASS1_BITS+3) | 786 CONST_BITS+PASS1_BITS+3) |
783 » » » & RANGE_MASK]; | 787 & RANGE_MASK]; |
784 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, | 788 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, |
785 » » » » » CONST_BITS+PASS1_BITS+3) | 789 CONST_BITS+PASS1_BITS+3) |
786 » » » & RANGE_MASK]; | 790 & RANGE_MASK]; |
787 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, | 791 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, |
788 » » » » » CONST_BITS+PASS1_BITS+3) | 792 CONST_BITS+PASS1_BITS+3) |
789 » » » & RANGE_MASK]; | 793 & RANGE_MASK]; |
790 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12, | 794 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12, |
791 » » » » » CONST_BITS+PASS1_BITS+3) | 795 CONST_BITS+PASS1_BITS+3) |
792 » » » & RANGE_MASK]; | 796 & RANGE_MASK]; |
793 | 797 |
794 wsptr += 5;»» /* advance pointer to next row */ | 798 wsptr += 5; /* advance pointer to next row */ |
795 } | 799 } |
796 } | 800 } |
797 | 801 |
798 | 802 |
799 /* | 803 /* |
800 * Perform dequantization and inverse DCT on one block of coefficients, | 804 * Perform dequantization and inverse DCT on one block of coefficients, |
801 * producing a reduced-size 3x3 output block. | 805 * producing a reduced-size 3x3 output block. |
802 * | 806 * |
803 * Optimized algorithm with 2 multiplications in the 1-D kernel. | 807 * Optimized algorithm with 2 multiplications in the 1-D kernel. |
804 * cK represents sqrt(2) * cos(K*pi/6). | 808 * cK represents sqrt(2) * cos(K*pi/6). |
805 */ | 809 */ |
806 | 810 |
807 GLOBAL(void) | 811 GLOBAL(void) |
808 jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 812 jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
809 » JCOEFPTR coef_block, | 813 JCOEFPTR coef_block, |
810 » JSAMPARRAY output_buf, JDIMENSION output_col) | 814 JSAMPARRAY output_buf, JDIMENSION output_col) |
811 { | 815 { |
812 INT32 tmp0, tmp2, tmp10, tmp12; | 816 JLONG tmp0, tmp2, tmp10, tmp12; |
813 JCOEFPTR inptr; | 817 JCOEFPTR inptr; |
814 ISLOW_MULT_TYPE * quantptr; | 818 ISLOW_MULT_TYPE *quantptr; |
815 int * wsptr; | 819 int *wsptr; |
816 JSAMPROW outptr; | 820 JSAMPROW outptr; |
817 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 821 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
818 int ctr; | 822 int ctr; |
819 int workspace[3*3];» /* buffers data between passes */ | 823 int workspace[3*3]; /* buffers data between passes */ |
820 SHIFT_TEMPS | 824 SHIFT_TEMPS |
821 | 825 |
822 /* Pass 1: process columns from input, store into work array. */ | 826 /* Pass 1: process columns from input, store into work array. */ |
823 | 827 |
824 inptr = coef_block; | 828 inptr = coef_block; |
825 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 829 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
826 wsptr = workspace; | 830 wsptr = workspace; |
827 for (ctr = 0; ctr < 3; ctr++, inptr++, quantptr++, wsptr++) { | 831 for (ctr = 0; ctr < 3; ctr++, inptr++, quantptr++, wsptr++) { |
828 /* Even part */ | 832 /* Even part */ |
829 | 833 |
830 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 834 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
831 tmp0 <<= CONST_BITS; | 835 tmp0 = LEFT_SHIFT(tmp0, CONST_BITS); |
832 /* Add fudge factor here for final descale. */ | 836 /* Add fudge factor here for final descale. */ |
833 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); | 837 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); |
834 tmp2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 838 tmp2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
835 tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */ | 839 tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */ |
836 tmp10 = tmp0 + tmp12; | 840 tmp10 = tmp0 + tmp12; |
837 tmp2 = tmp0 - tmp12 - tmp12; | 841 tmp2 = tmp0 - tmp12 - tmp12; |
838 | 842 |
839 /* Odd part */ | 843 /* Odd part */ |
840 | 844 |
841 tmp12 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); | 845 tmp12 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); |
842 tmp0 = MULTIPLY(tmp12, FIX(1.224744871)); /* c1 */ | 846 tmp0 = MULTIPLY(tmp12, FIX(1.224744871)); /* c1 */ |
843 | 847 |
844 /* Final output stage */ | 848 /* Final output stage */ |
845 | 849 |
846 wsptr[3*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); | 850 wsptr[3*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); |
847 wsptr[3*2] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); | 851 wsptr[3*2] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); |
848 wsptr[3*1] = (int) RIGHT_SHIFT(tmp2, CONST_BITS-PASS1_BITS); | 852 wsptr[3*1] = (int) RIGHT_SHIFT(tmp2, CONST_BITS-PASS1_BITS); |
849 } | 853 } |
850 | 854 |
851 /* Pass 2: process 3 rows from work array, store into output array. */ | 855 /* Pass 2: process 3 rows from work array, store into output array. */ |
852 | 856 |
853 wsptr = workspace; | 857 wsptr = workspace; |
854 for (ctr = 0; ctr < 3; ctr++) { | 858 for (ctr = 0; ctr < 3; ctr++) { |
855 outptr = output_buf[ctr] + output_col; | 859 outptr = output_buf[ctr] + output_col; |
856 | 860 |
857 /* Even part */ | 861 /* Even part */ |
858 | 862 |
859 /* Add fudge factor here for final descale. */ | 863 /* Add fudge factor here for final descale. */ |
860 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 864 tmp0 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
861 tmp0 <<= CONST_BITS; | 865 tmp0 = LEFT_SHIFT(tmp0, CONST_BITS); |
862 tmp2 = (INT32) wsptr[2]; | 866 tmp2 = (JLONG) wsptr[2]; |
863 tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */ | 867 tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */ |
864 tmp10 = tmp0 + tmp12; | 868 tmp10 = tmp0 + tmp12; |
865 tmp2 = tmp0 - tmp12 - tmp12; | 869 tmp2 = tmp0 - tmp12 - tmp12; |
866 | 870 |
867 /* Odd part */ | 871 /* Odd part */ |
868 | 872 |
869 tmp12 = (INT32) wsptr[1]; | 873 tmp12 = (JLONG) wsptr[1]; |
870 tmp0 = MULTIPLY(tmp12, FIX(1.224744871)); /* c1 */ | 874 tmp0 = MULTIPLY(tmp12, FIX(1.224744871)); /* c1 */ |
871 | 875 |
872 /* Final output stage */ | 876 /* Final output stage */ |
873 | 877 |
874 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, | 878 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, |
875 » » » » » CONST_BITS+PASS1_BITS+3) | 879 CONST_BITS+PASS1_BITS+3) |
876 » » » & RANGE_MASK]; | 880 & RANGE_MASK]; |
877 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, | 881 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, |
878 » » » » » CONST_BITS+PASS1_BITS+3) | 882 CONST_BITS+PASS1_BITS+3) |
879 » » » & RANGE_MASK]; | 883 & RANGE_MASK]; |
880 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp2, | 884 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp2, |
881 » » » » » CONST_BITS+PASS1_BITS+3) | 885 CONST_BITS+PASS1_BITS+3) |
882 » » » & RANGE_MASK]; | 886 & RANGE_MASK]; |
883 | 887 |
884 wsptr += 3;»» /* advance pointer to next row */ | 888 wsptr += 3; /* advance pointer to next row */ |
885 } | 889 } |
886 } | 890 } |
887 | 891 |
888 | 892 |
889 /* | 893 /* |
890 * Perform dequantization and inverse DCT on one block of coefficients, | 894 * Perform dequantization and inverse DCT on one block of coefficients, |
891 * producing a 9x9 output block. | 895 * producing a 9x9 output block. |
892 * | 896 * |
893 * Optimized algorithm with 10 multiplications in the 1-D kernel. | 897 * Optimized algorithm with 10 multiplications in the 1-D kernel. |
894 * cK represents sqrt(2) * cos(K*pi/18). | 898 * cK represents sqrt(2) * cos(K*pi/18). |
895 */ | 899 */ |
896 | 900 |
897 GLOBAL(void) | 901 GLOBAL(void) |
898 jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 902 jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
899 » JCOEFPTR coef_block, | 903 JCOEFPTR coef_block, |
900 » JSAMPARRAY output_buf, JDIMENSION output_col) | 904 JSAMPARRAY output_buf, JDIMENSION output_col) |
901 { | 905 { |
902 INT32 tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13, tmp14; | 906 JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13, tmp14; |
903 INT32 z1, z2, z3, z4; | 907 JLONG z1, z2, z3, z4; |
904 JCOEFPTR inptr; | 908 JCOEFPTR inptr; |
905 ISLOW_MULT_TYPE * quantptr; | 909 ISLOW_MULT_TYPE *quantptr; |
906 int * wsptr; | 910 int *wsptr; |
907 JSAMPROW outptr; | 911 JSAMPROW outptr; |
908 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 912 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
909 int ctr; | 913 int ctr; |
910 int workspace[8*9];» /* buffers data between passes */ | 914 int workspace[8*9]; /* buffers data between passes */ |
911 SHIFT_TEMPS | 915 SHIFT_TEMPS |
912 | 916 |
913 /* Pass 1: process columns from input, store into work array. */ | 917 /* Pass 1: process columns from input, store into work array. */ |
914 | 918 |
915 inptr = coef_block; | 919 inptr = coef_block; |
916 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 920 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
917 wsptr = workspace; | 921 wsptr = workspace; |
918 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { | 922 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { |
919 /* Even part */ | 923 /* Even part */ |
920 | 924 |
921 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 925 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
922 tmp0 <<= CONST_BITS; | 926 tmp0 = LEFT_SHIFT(tmp0, CONST_BITS); |
923 /* Add fudge factor here for final descale. */ | 927 /* Add fudge factor here for final descale. */ |
924 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); | 928 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); |
925 | 929 |
926 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 930 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
927 z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 931 z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
928 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); | 932 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); |
929 | 933 |
930 tmp3 = MULTIPLY(z3, FIX(0.707106781)); /* c6 */ | 934 tmp3 = MULTIPLY(z3, FIX(0.707106781)); /* c6 */ |
931 tmp1 = tmp0 + tmp3; | 935 tmp1 = tmp0 + tmp3; |
932 tmp2 = tmp0 - tmp3 - tmp3; | 936 tmp2 = tmp0 - tmp3 - tmp3; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 | 979 |
976 /* Pass 2: process 9 rows from work array, store into output array. */ | 980 /* Pass 2: process 9 rows from work array, store into output array. */ |
977 | 981 |
978 wsptr = workspace; | 982 wsptr = workspace; |
979 for (ctr = 0; ctr < 9; ctr++) { | 983 for (ctr = 0; ctr < 9; ctr++) { |
980 outptr = output_buf[ctr] + output_col; | 984 outptr = output_buf[ctr] + output_col; |
981 | 985 |
982 /* Even part */ | 986 /* Even part */ |
983 | 987 |
984 /* Add fudge factor here for final descale. */ | 988 /* Add fudge factor here for final descale. */ |
985 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 989 tmp0 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
986 tmp0 <<= CONST_BITS; | 990 tmp0 = LEFT_SHIFT(tmp0, CONST_BITS); |
987 | 991 |
988 z1 = (INT32) wsptr[2]; | 992 z1 = (JLONG) wsptr[2]; |
989 z2 = (INT32) wsptr[4]; | 993 z2 = (JLONG) wsptr[4]; |
990 z3 = (INT32) wsptr[6]; | 994 z3 = (JLONG) wsptr[6]; |
991 | 995 |
992 tmp3 = MULTIPLY(z3, FIX(0.707106781)); /* c6 */ | 996 tmp3 = MULTIPLY(z3, FIX(0.707106781)); /* c6 */ |
993 tmp1 = tmp0 + tmp3; | 997 tmp1 = tmp0 + tmp3; |
994 tmp2 = tmp0 - tmp3 - tmp3; | 998 tmp2 = tmp0 - tmp3 - tmp3; |
995 | 999 |
996 tmp0 = MULTIPLY(z1 - z2, FIX(0.707106781)); /* c6 */ | 1000 tmp0 = MULTIPLY(z1 - z2, FIX(0.707106781)); /* c6 */ |
997 tmp11 = tmp2 + tmp0; | 1001 tmp11 = tmp2 + tmp0; |
998 tmp14 = tmp2 - tmp0 - tmp0; | 1002 tmp14 = tmp2 - tmp0 - tmp0; |
999 | 1003 |
1000 tmp0 = MULTIPLY(z1 + z2, FIX(1.328926049)); /* c2 */ | 1004 tmp0 = MULTIPLY(z1 + z2, FIX(1.328926049)); /* c2 */ |
1001 tmp2 = MULTIPLY(z1, FIX(1.083350441)); /* c4 */ | 1005 tmp2 = MULTIPLY(z1, FIX(1.083350441)); /* c4 */ |
1002 tmp3 = MULTIPLY(z2, FIX(0.245575608)); /* c8 */ | 1006 tmp3 = MULTIPLY(z2, FIX(0.245575608)); /* c8 */ |
1003 | 1007 |
1004 tmp10 = tmp1 + tmp0 - tmp3; | 1008 tmp10 = tmp1 + tmp0 - tmp3; |
1005 tmp12 = tmp1 - tmp0 + tmp2; | 1009 tmp12 = tmp1 - tmp0 + tmp2; |
1006 tmp13 = tmp1 - tmp2 + tmp3; | 1010 tmp13 = tmp1 - tmp2 + tmp3; |
1007 | 1011 |
1008 /* Odd part */ | 1012 /* Odd part */ |
1009 | 1013 |
1010 z1 = (INT32) wsptr[1]; | 1014 z1 = (JLONG) wsptr[1]; |
1011 z2 = (INT32) wsptr[3]; | 1015 z2 = (JLONG) wsptr[3]; |
1012 z3 = (INT32) wsptr[5]; | 1016 z3 = (JLONG) wsptr[5]; |
1013 z4 = (INT32) wsptr[7]; | 1017 z4 = (JLONG) wsptr[7]; |
1014 | 1018 |
1015 z2 = MULTIPLY(z2, - FIX(1.224744871)); /* -c3 */ | 1019 z2 = MULTIPLY(z2, - FIX(1.224744871)); /* -c3 */ |
1016 | 1020 |
1017 tmp2 = MULTIPLY(z1 + z3, FIX(0.909038955)); /* c5 */ | 1021 tmp2 = MULTIPLY(z1 + z3, FIX(0.909038955)); /* c5 */ |
1018 tmp3 = MULTIPLY(z1 + z4, FIX(0.483689525)); /* c7 */ | 1022 tmp3 = MULTIPLY(z1 + z4, FIX(0.483689525)); /* c7 */ |
1019 tmp0 = tmp2 + tmp3 - z2; | 1023 tmp0 = tmp2 + tmp3 - z2; |
1020 tmp1 = MULTIPLY(z3 - z4, FIX(1.392728481)); /* c1 */ | 1024 tmp1 = MULTIPLY(z3 - z4, FIX(1.392728481)); /* c1 */ |
1021 tmp2 += z2 - tmp1; | 1025 tmp2 += z2 - tmp1; |
1022 tmp3 += z2 + tmp1; | 1026 tmp3 += z2 + tmp1; |
1023 tmp1 = MULTIPLY(z1 - z3 - z4, FIX(1.224744871)); /* c3 */ | 1027 tmp1 = MULTIPLY(z1 - z3 - z4, FIX(1.224744871)); /* c3 */ |
1024 | 1028 |
1025 /* Final output stage */ | 1029 /* Final output stage */ |
1026 | 1030 |
1027 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, | 1031 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, |
1028 » » » » » CONST_BITS+PASS1_BITS+3) | 1032 CONST_BITS+PASS1_BITS+3) |
1029 » » » & RANGE_MASK]; | 1033 & RANGE_MASK]; |
1030 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, | 1034 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, |
1031 » » » » » CONST_BITS+PASS1_BITS+3) | 1035 CONST_BITS+PASS1_BITS+3) |
1032 » » » & RANGE_MASK]; | 1036 & RANGE_MASK]; |
1033 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, | 1037 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, |
1034 » » » » » CONST_BITS+PASS1_BITS+3) | 1038 CONST_BITS+PASS1_BITS+3) |
1035 » » » & RANGE_MASK]; | 1039 & RANGE_MASK]; |
1036 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, | 1040 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, |
1037 » » » » » CONST_BITS+PASS1_BITS+3) | 1041 CONST_BITS+PASS1_BITS+3) |
1038 » » » & RANGE_MASK]; | 1042 & RANGE_MASK]; |
1039 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, | 1043 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, |
1040 » » » » » CONST_BITS+PASS1_BITS+3) | 1044 CONST_BITS+PASS1_BITS+3) |
1041 » » » & RANGE_MASK]; | 1045 & RANGE_MASK]; |
1042 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, | 1046 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, |
1043 » » » » » CONST_BITS+PASS1_BITS+3) | 1047 CONST_BITS+PASS1_BITS+3) |
1044 » » » & RANGE_MASK]; | 1048 & RANGE_MASK]; |
1045 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13 + tmp3, | 1049 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13 + tmp3, |
1046 » » » » » CONST_BITS+PASS1_BITS+3) | 1050 CONST_BITS+PASS1_BITS+3) |
1047 » » » & RANGE_MASK]; | 1051 & RANGE_MASK]; |
1048 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp13 - tmp3, | 1052 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp13 - tmp3, |
1049 » » » » » CONST_BITS+PASS1_BITS+3) | 1053 CONST_BITS+PASS1_BITS+3) |
1050 » » » & RANGE_MASK]; | 1054 & RANGE_MASK]; |
1051 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp14, | 1055 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp14, |
1052 » » » » » CONST_BITS+PASS1_BITS+3) | 1056 CONST_BITS+PASS1_BITS+3) |
1053 » » » & RANGE_MASK]; | 1057 & RANGE_MASK]; |
1054 | 1058 |
1055 wsptr += 8;»» /* advance pointer to next row */ | 1059 wsptr += 8; /* advance pointer to next row */ |
1056 } | 1060 } |
1057 } | 1061 } |
1058 | 1062 |
1059 | 1063 |
1060 /* | 1064 /* |
1061 * Perform dequantization and inverse DCT on one block of coefficients, | 1065 * Perform dequantization and inverse DCT on one block of coefficients, |
1062 * producing a 10x10 output block. | 1066 * producing a 10x10 output block. |
1063 * | 1067 * |
1064 * Optimized algorithm with 12 multiplications in the 1-D kernel. | 1068 * Optimized algorithm with 12 multiplications in the 1-D kernel. |
1065 * cK represents sqrt(2) * cos(K*pi/20). | 1069 * cK represents sqrt(2) * cos(K*pi/20). |
1066 */ | 1070 */ |
1067 | 1071 |
1068 GLOBAL(void) | 1072 GLOBAL(void) |
1069 jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 1073 jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
1070 » » JCOEFPTR coef_block, | 1074 JCOEFPTR coef_block, |
1071 » » JSAMPARRAY output_buf, JDIMENSION output_col) | 1075 JSAMPARRAY output_buf, JDIMENSION output_col) |
1072 { | 1076 { |
1073 INT32 tmp10, tmp11, tmp12, tmp13, tmp14; | 1077 JLONG tmp10, tmp11, tmp12, tmp13, tmp14; |
1074 INT32 tmp20, tmp21, tmp22, tmp23, tmp24; | 1078 JLONG tmp20, tmp21, tmp22, tmp23, tmp24; |
1075 INT32 z1, z2, z3, z4, z5; | 1079 JLONG z1, z2, z3, z4, z5; |
1076 JCOEFPTR inptr; | 1080 JCOEFPTR inptr; |
1077 ISLOW_MULT_TYPE * quantptr; | 1081 ISLOW_MULT_TYPE *quantptr; |
1078 int * wsptr; | 1082 int *wsptr; |
1079 JSAMPROW outptr; | 1083 JSAMPROW outptr; |
1080 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 1084 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
1081 int ctr; | 1085 int ctr; |
1082 int workspace[8*10];» /* buffers data between passes */ | 1086 int workspace[8*10]; /* buffers data between passes */ |
1083 SHIFT_TEMPS | 1087 SHIFT_TEMPS |
1084 | 1088 |
1085 /* Pass 1: process columns from input, store into work array. */ | 1089 /* Pass 1: process columns from input, store into work array. */ |
1086 | 1090 |
1087 inptr = coef_block; | 1091 inptr = coef_block; |
1088 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 1092 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
1089 wsptr = workspace; | 1093 wsptr = workspace; |
1090 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { | 1094 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { |
1091 /* Even part */ | 1095 /* Even part */ |
1092 | 1096 |
1093 z3 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 1097 z3 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
1094 z3 <<= CONST_BITS; | 1098 z3 = LEFT_SHIFT(z3, CONST_BITS); |
1095 /* Add fudge factor here for final descale. */ | 1099 /* Add fudge factor here for final descale. */ |
1096 z3 += ONE << (CONST_BITS-PASS1_BITS-1); | 1100 z3 += ONE << (CONST_BITS-PASS1_BITS-1); |
1097 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 1101 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
1098 z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */ | 1102 z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */ |
1099 z2 = MULTIPLY(z4, FIX(0.437016024)); /* c8 */ | 1103 z2 = MULTIPLY(z4, FIX(0.437016024)); /* c8 */ |
1100 tmp10 = z3 + z1; | 1104 tmp10 = z3 + z1; |
1101 tmp11 = z3 - z2; | 1105 tmp11 = z3 - z2; |
1102 | 1106 |
1103 tmp22 = RIGHT_SHIFT(z3 - ((z1 - z2) << 1), /* c0 = (c4-c8)*2 */ | 1107 tmp22 = RIGHT_SHIFT(z3 - LEFT_SHIFT(z1 - z2, 1), |
1104 » » » CONST_BITS-PASS1_BITS); | 1108 CONST_BITS-PASS1_BITS); /* c0 = (c4-c8)*2 */ |
1105 | 1109 |
1106 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 1110 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
1107 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); | 1111 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); |
1108 | 1112 |
1109 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c6 */ | 1113 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c6 */ |
1110 tmp12 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c2-c6 */ | 1114 tmp12 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c2-c6 */ |
1111 tmp13 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c2+c6 */ | 1115 tmp13 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c2+c6 */ |
1112 | 1116 |
1113 tmp20 = tmp10 + tmp12; | 1117 tmp20 = tmp10 + tmp12; |
1114 tmp24 = tmp10 - tmp12; | 1118 tmp24 = tmp10 - tmp12; |
1115 tmp21 = tmp11 + tmp13; | 1119 tmp21 = tmp11 + tmp13; |
1116 tmp23 = tmp11 - tmp13; | 1120 tmp23 = tmp11 - tmp13; |
1117 | 1121 |
1118 /* Odd part */ | 1122 /* Odd part */ |
1119 | 1123 |
1120 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); | 1124 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); |
1121 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); | 1125 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); |
1122 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); | 1126 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); |
1123 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); | 1127 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); |
1124 | 1128 |
1125 tmp11 = z2 + z4; | 1129 tmp11 = z2 + z4; |
1126 tmp13 = z2 - z4; | 1130 tmp13 = z2 - z4; |
1127 | 1131 |
1128 tmp12 = MULTIPLY(tmp13, FIX(0.309016994)); /* (c3-c7)/2 */ | 1132 tmp12 = MULTIPLY(tmp13, FIX(0.309016994)); /* (c3-c7)/2 */ |
1129 z5 = z3 << CONST_BITS; | 1133 z5 = LEFT_SHIFT(z3, CONST_BITS); |
1130 | 1134 |
1131 z2 = MULTIPLY(tmp11, FIX(0.951056516)); /* (c3+c7)/2 */ | 1135 z2 = MULTIPLY(tmp11, FIX(0.951056516)); /* (c3+c7)/2 */ |
1132 z4 = z5 + tmp12; | 1136 z4 = z5 + tmp12; |
1133 | 1137 |
1134 tmp10 = MULTIPLY(z1, FIX(1.396802247)) + z2 + z4; /* c1 */ | 1138 tmp10 = MULTIPLY(z1, FIX(1.396802247)) + z2 + z4; /* c1 */ |
1135 tmp14 = MULTIPLY(z1, FIX(0.221231742)) - z2 + z4; /* c9 */ | 1139 tmp14 = MULTIPLY(z1, FIX(0.221231742)) - z2 + z4; /* c9 */ |
1136 | 1140 |
1137 z2 = MULTIPLY(tmp11, FIX(0.587785252)); /* (c1-c9)/2 */ | 1141 z2 = MULTIPLY(tmp11, FIX(0.587785252)); /* (c1-c9)/2 */ |
1138 z4 = z5 - tmp12 - (tmp13 << (CONST_BITS - 1)); | 1142 z4 = z5 - tmp12 - LEFT_SHIFT(tmp13, CONST_BITS - 1); |
1139 | 1143 |
1140 tmp12 = (z1 - tmp13 - z3) << PASS1_BITS; | 1144 tmp12 = LEFT_SHIFT(z1 - tmp13 - z3, PASS1_BITS); |
1141 | 1145 |
1142 tmp11 = MULTIPLY(z1, FIX(1.260073511)) - z2 - z4; /* c3 */ | 1146 tmp11 = MULTIPLY(z1, FIX(1.260073511)) - z2 - z4; /* c3 */ |
1143 tmp13 = MULTIPLY(z1, FIX(0.642039522)) - z2 + z4; /* c7 */ | 1147 tmp13 = MULTIPLY(z1, FIX(0.642039522)) - z2 + z4; /* c7 */ |
1144 | 1148 |
1145 /* Final output stage */ | 1149 /* Final output stage */ |
1146 | 1150 |
1147 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); | 1151 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); |
1148 wsptr[8*9] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); | 1152 wsptr[8*9] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); |
1149 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); | 1153 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); |
1150 wsptr[8*8] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); | 1154 wsptr[8*8] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); |
1151 wsptr[8*2] = (int) (tmp22 + tmp12); | 1155 wsptr[8*2] = (int) (tmp22 + tmp12); |
1152 wsptr[8*7] = (int) (tmp22 - tmp12); | 1156 wsptr[8*7] = (int) (tmp22 - tmp12); |
1153 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); | 1157 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); |
1154 wsptr[8*6] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); | 1158 wsptr[8*6] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); |
1155 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); | 1159 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); |
1156 wsptr[8*5] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); | 1160 wsptr[8*5] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); |
1157 } | 1161 } |
1158 | 1162 |
1159 /* Pass 2: process 10 rows from work array, store into output array. */ | 1163 /* Pass 2: process 10 rows from work array, store into output array. */ |
1160 | 1164 |
1161 wsptr = workspace; | 1165 wsptr = workspace; |
1162 for (ctr = 0; ctr < 10; ctr++) { | 1166 for (ctr = 0; ctr < 10; ctr++) { |
1163 outptr = output_buf[ctr] + output_col; | 1167 outptr = output_buf[ctr] + output_col; |
1164 | 1168 |
1165 /* Even part */ | 1169 /* Even part */ |
1166 | 1170 |
1167 /* Add fudge factor here for final descale. */ | 1171 /* Add fudge factor here for final descale. */ |
1168 z3 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 1172 z3 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
1169 z3 <<= CONST_BITS; | 1173 z3 = LEFT_SHIFT(z3, CONST_BITS); |
1170 z4 = (INT32) wsptr[4]; | 1174 z4 = (JLONG) wsptr[4]; |
1171 z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */ | 1175 z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */ |
1172 z2 = MULTIPLY(z4, FIX(0.437016024)); /* c8 */ | 1176 z2 = MULTIPLY(z4, FIX(0.437016024)); /* c8 */ |
1173 tmp10 = z3 + z1; | 1177 tmp10 = z3 + z1; |
1174 tmp11 = z3 - z2; | 1178 tmp11 = z3 - z2; |
1175 | 1179 |
1176 tmp22 = z3 - ((z1 - z2) << 1); /* c0 = (c4-c8)*2 */ | 1180 tmp22 = z3 - LEFT_SHIFT(z1 - z2, 1); /* c0 = (c4-c8)*2 */ |
1177 | 1181 |
1178 z2 = (INT32) wsptr[2]; | 1182 z2 = (JLONG) wsptr[2]; |
1179 z3 = (INT32) wsptr[6]; | 1183 z3 = (JLONG) wsptr[6]; |
1180 | 1184 |
1181 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c6 */ | 1185 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c6 */ |
1182 tmp12 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c2-c6 */ | 1186 tmp12 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c2-c6 */ |
1183 tmp13 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c2+c6 */ | 1187 tmp13 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c2+c6 */ |
1184 | 1188 |
1185 tmp20 = tmp10 + tmp12; | 1189 tmp20 = tmp10 + tmp12; |
1186 tmp24 = tmp10 - tmp12; | 1190 tmp24 = tmp10 - tmp12; |
1187 tmp21 = tmp11 + tmp13; | 1191 tmp21 = tmp11 + tmp13; |
1188 tmp23 = tmp11 - tmp13; | 1192 tmp23 = tmp11 - tmp13; |
1189 | 1193 |
1190 /* Odd part */ | 1194 /* Odd part */ |
1191 | 1195 |
1192 z1 = (INT32) wsptr[1]; | 1196 z1 = (JLONG) wsptr[1]; |
1193 z2 = (INT32) wsptr[3]; | 1197 z2 = (JLONG) wsptr[3]; |
1194 z3 = (INT32) wsptr[5]; | 1198 z3 = (JLONG) wsptr[5]; |
1195 z3 <<= CONST_BITS; | 1199 z3 = LEFT_SHIFT(z3, CONST_BITS); |
1196 z4 = (INT32) wsptr[7]; | 1200 z4 = (JLONG) wsptr[7]; |
1197 | 1201 |
1198 tmp11 = z2 + z4; | 1202 tmp11 = z2 + z4; |
1199 tmp13 = z2 - z4; | 1203 tmp13 = z2 - z4; |
1200 | 1204 |
1201 tmp12 = MULTIPLY(tmp13, FIX(0.309016994)); /* (c3-c7)/2 */ | 1205 tmp12 = MULTIPLY(tmp13, FIX(0.309016994)); /* (c3-c7)/2 */ |
1202 | 1206 |
1203 z2 = MULTIPLY(tmp11, FIX(0.951056516)); /* (c3+c7)/2 */ | 1207 z2 = MULTIPLY(tmp11, FIX(0.951056516)); /* (c3+c7)/2 */ |
1204 z4 = z3 + tmp12; | 1208 z4 = z3 + tmp12; |
1205 | 1209 |
1206 tmp10 = MULTIPLY(z1, FIX(1.396802247)) + z2 + z4; /* c1 */ | 1210 tmp10 = MULTIPLY(z1, FIX(1.396802247)) + z2 + z4; /* c1 */ |
1207 tmp14 = MULTIPLY(z1, FIX(0.221231742)) - z2 + z4; /* c9 */ | 1211 tmp14 = MULTIPLY(z1, FIX(0.221231742)) - z2 + z4; /* c9 */ |
1208 | 1212 |
1209 z2 = MULTIPLY(tmp11, FIX(0.587785252)); /* (c1-c9)/2 */ | 1213 z2 = MULTIPLY(tmp11, FIX(0.587785252)); /* (c1-c9)/2 */ |
1210 z4 = z3 - tmp12 - (tmp13 << (CONST_BITS - 1)); | 1214 z4 = z3 - tmp12 - LEFT_SHIFT(tmp13, CONST_BITS - 1); |
1211 | 1215 |
1212 tmp12 = ((z1 - tmp13) << CONST_BITS) - z3; | 1216 tmp12 = LEFT_SHIFT(z1 - tmp13, CONST_BITS) - z3; |
1213 | 1217 |
1214 tmp11 = MULTIPLY(z1, FIX(1.260073511)) - z2 - z4; /* c3 */ | 1218 tmp11 = MULTIPLY(z1, FIX(1.260073511)) - z2 - z4; /* c3 */ |
1215 tmp13 = MULTIPLY(z1, FIX(0.642039522)) - z2 + z4; /* c7 */ | 1219 tmp13 = MULTIPLY(z1, FIX(0.642039522)) - z2 + z4; /* c7 */ |
1216 | 1220 |
1217 /* Final output stage */ | 1221 /* Final output stage */ |
1218 | 1222 |
1219 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, | 1223 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, |
1220 » » » » » CONST_BITS+PASS1_BITS+3) | 1224 CONST_BITS+PASS1_BITS+3) |
1221 » » » & RANGE_MASK]; | 1225 & RANGE_MASK]; |
1222 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, | 1226 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, |
1223 » » » » » CONST_BITS+PASS1_BITS+3) | 1227 CONST_BITS+PASS1_BITS+3) |
1224 » » » & RANGE_MASK]; | 1228 & RANGE_MASK]; |
1225 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, | 1229 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, |
1226 » » » » » CONST_BITS+PASS1_BITS+3) | 1230 CONST_BITS+PASS1_BITS+3) |
1227 » » » & RANGE_MASK]; | 1231 & RANGE_MASK]; |
1228 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, | 1232 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, |
1229 » » » » » CONST_BITS+PASS1_BITS+3) | 1233 CONST_BITS+PASS1_BITS+3) |
1230 » » » & RANGE_MASK]; | 1234 & RANGE_MASK]; |
1231 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, | 1235 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, |
1232 » » » » » CONST_BITS+PASS1_BITS+3) | 1236 CONST_BITS+PASS1_BITS+3) |
1233 » » » & RANGE_MASK]; | 1237 & RANGE_MASK]; |
1234 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, | 1238 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, |
1235 » » » » » CONST_BITS+PASS1_BITS+3) | 1239 CONST_BITS+PASS1_BITS+3) |
1236 » » » & RANGE_MASK]; | 1240 & RANGE_MASK]; |
1237 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, | 1241 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, |
1238 » » » » » CONST_BITS+PASS1_BITS+3) | 1242 CONST_BITS+PASS1_BITS+3) |
1239 » » » & RANGE_MASK]; | 1243 & RANGE_MASK]; |
1240 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, | 1244 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, |
1241 » » » » » CONST_BITS+PASS1_BITS+3) | 1245 CONST_BITS+PASS1_BITS+3) |
1242 » » » & RANGE_MASK]; | 1246 & RANGE_MASK]; |
1243 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, | 1247 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, |
1244 » » » » » CONST_BITS+PASS1_BITS+3) | 1248 CONST_BITS+PASS1_BITS+3) |
1245 » » » & RANGE_MASK]; | 1249 & RANGE_MASK]; |
1246 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, | 1250 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, |
1247 » » » » » CONST_BITS+PASS1_BITS+3) | 1251 CONST_BITS+PASS1_BITS+3) |
1248 » » » & RANGE_MASK]; | 1252 & RANGE_MASK]; |
1249 | 1253 |
1250 wsptr += 8;»» /* advance pointer to next row */ | 1254 wsptr += 8; /* advance pointer to next row */ |
1251 } | 1255 } |
1252 } | 1256 } |
1253 | 1257 |
1254 | 1258 |
1255 /* | 1259 /* |
1256 * Perform dequantization and inverse DCT on one block of coefficients, | 1260 * Perform dequantization and inverse DCT on one block of coefficients, |
1257 * producing a 11x11 output block. | 1261 * producing a 11x11 output block. |
1258 * | 1262 * |
1259 * Optimized algorithm with 24 multiplications in the 1-D kernel. | 1263 * Optimized algorithm with 24 multiplications in the 1-D kernel. |
1260 * cK represents sqrt(2) * cos(K*pi/22). | 1264 * cK represents sqrt(2) * cos(K*pi/22). |
1261 */ | 1265 */ |
1262 | 1266 |
1263 GLOBAL(void) | 1267 GLOBAL(void) |
1264 jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 1268 jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
1265 » » JCOEFPTR coef_block, | 1269 JCOEFPTR coef_block, |
1266 » » JSAMPARRAY output_buf, JDIMENSION output_col) | 1270 JSAMPARRAY output_buf, JDIMENSION output_col) |
1267 { | 1271 { |
1268 INT32 tmp10, tmp11, tmp12, tmp13, tmp14; | 1272 JLONG tmp10, tmp11, tmp12, tmp13, tmp14; |
1269 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; | 1273 JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; |
1270 INT32 z1, z2, z3, z4; | 1274 JLONG z1, z2, z3, z4; |
1271 JCOEFPTR inptr; | 1275 JCOEFPTR inptr; |
1272 ISLOW_MULT_TYPE * quantptr; | 1276 ISLOW_MULT_TYPE *quantptr; |
1273 int * wsptr; | 1277 int *wsptr; |
1274 JSAMPROW outptr; | 1278 JSAMPROW outptr; |
1275 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 1279 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
1276 int ctr; | 1280 int ctr; |
1277 int workspace[8*11];» /* buffers data between passes */ | 1281 int workspace[8*11]; /* buffers data between passes */ |
1278 SHIFT_TEMPS | 1282 SHIFT_TEMPS |
1279 | 1283 |
1280 /* Pass 1: process columns from input, store into work array. */ | 1284 /* Pass 1: process columns from input, store into work array. */ |
1281 | 1285 |
1282 inptr = coef_block; | 1286 inptr = coef_block; |
1283 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 1287 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
1284 wsptr = workspace; | 1288 wsptr = workspace; |
1285 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { | 1289 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { |
1286 /* Even part */ | 1290 /* Even part */ |
1287 | 1291 |
1288 tmp10 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 1292 tmp10 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
1289 tmp10 <<= CONST_BITS; | 1293 tmp10 = LEFT_SHIFT(tmp10, CONST_BITS); |
1290 /* Add fudge factor here for final descale. */ | 1294 /* Add fudge factor here for final descale. */ |
1291 tmp10 += ONE << (CONST_BITS-PASS1_BITS-1); | 1295 tmp10 += ONE << (CONST_BITS-PASS1_BITS-1); |
1292 | 1296 |
1293 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 1297 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
1294 z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 1298 z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
1295 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); | 1299 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); |
1296 | 1300 |
1297 tmp20 = MULTIPLY(z2 - z3, FIX(2.546640132)); /* c2+c4 */ | 1301 tmp20 = MULTIPLY(z2 - z3, FIX(2.546640132)); /* c2+c4 */ |
1298 tmp23 = MULTIPLY(z2 - z1, FIX(0.430815045)); /* c2-c6 */ | 1302 tmp23 = MULTIPLY(z2 - z1, FIX(0.430815045)); /* c2-c6 */ |
1299 z4 = z1 + z3; | 1303 z4 = z1 + z3; |
1300 tmp24 = MULTIPLY(z4, - FIX(1.155664402)); /* -(c2-c10) */ | 1304 tmp24 = MULTIPLY(z4, - FIX(1.155664402)); /* -(c2-c10) */ |
1301 z4 -= z2; | 1305 z4 -= z2; |
1302 tmp25 = tmp10 + MULTIPLY(z4, FIX(1.356927976)); /* c2 */ | 1306 tmp25 = tmp10 + MULTIPLY(z4, FIX(1.356927976)); /* c2 */ |
1303 tmp21 = tmp20 + tmp23 + tmp25 - | 1307 tmp21 = tmp20 + tmp23 + tmp25 - |
1304 » MULTIPLY(z2, FIX(1.821790775)); /* c2+c4+c10-c6 */ | 1308 MULTIPLY(z2, FIX(1.821790775)); /* c2+c4+c10-c6 */ |
1305 tmp20 += tmp25 + MULTIPLY(z3, FIX(2.115825087)); /* c4+c6 */ | 1309 tmp20 += tmp25 + MULTIPLY(z3, FIX(2.115825087)); /* c4+c6 */ |
1306 tmp23 += tmp25 - MULTIPLY(z1, FIX(1.513598477)); /* c6+c8 */ | 1310 tmp23 += tmp25 - MULTIPLY(z1, FIX(1.513598477)); /* c6+c8 */ |
1307 tmp24 += tmp25; | 1311 tmp24 += tmp25; |
1308 tmp22 = tmp24 - MULTIPLY(z3, FIX(0.788749120)); /* c8+c10 */ | 1312 tmp22 = tmp24 - MULTIPLY(z3, FIX(0.788749120)); /* c8+c10 */ |
1309 tmp24 += MULTIPLY(z2, FIX(1.944413522)) - /* c2+c8 */ | 1313 tmp24 += MULTIPLY(z2, FIX(1.944413522)) - /* c2+c8 */ |
1310 » MULTIPLY(z1, FIX(1.390975730)); /* c4+c10 */ | 1314 MULTIPLY(z1, FIX(1.390975730)); /* c4+c10 */ |
1311 tmp25 = tmp10 - MULTIPLY(z4, FIX(1.414213562)); /* c0 */ | 1315 tmp25 = tmp10 - MULTIPLY(z4, FIX(1.414213562)); /* c0 */ |
1312 | 1316 |
1313 /* Odd part */ | 1317 /* Odd part */ |
1314 | 1318 |
1315 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); | 1319 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); |
1316 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); | 1320 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); |
1317 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); | 1321 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); |
1318 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); | 1322 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); |
1319 | 1323 |
1320 tmp11 = z1 + z2; | 1324 tmp11 = z1 + z2; |
1321 tmp14 = MULTIPLY(tmp11 + z3 + z4, FIX(0.398430003)); /* c9 */ | 1325 tmp14 = MULTIPLY(tmp11 + z3 + z4, FIX(0.398430003)); /* c9 */ |
1322 tmp11 = MULTIPLY(tmp11, FIX(0.887983902)); /* c3-c9 */ | 1326 tmp11 = MULTIPLY(tmp11, FIX(0.887983902)); /* c3-c9 */ |
1323 tmp12 = MULTIPLY(z1 + z3, FIX(0.670361295)); /* c5-c9 */ | 1327 tmp12 = MULTIPLY(z1 + z3, FIX(0.670361295)); /* c5-c9 */ |
1324 tmp13 = tmp14 + MULTIPLY(z1 + z4, FIX(0.366151574)); /* c7-c9 */ | 1328 tmp13 = tmp14 + MULTIPLY(z1 + z4, FIX(0.366151574)); /* c7-c9 */ |
1325 tmp10 = tmp11 + tmp12 + tmp13 - | 1329 tmp10 = tmp11 + tmp12 + tmp13 - |
1326 » MULTIPLY(z1, FIX(0.923107866)); /* c7+c5+c3-c1-2*c9 */ | 1330 MULTIPLY(z1, FIX(0.923107866)); /* c7+c5+c3-c1-2*c9 */ |
1327 z1 = tmp14 - MULTIPLY(z2 + z3, FIX(1.163011579)); /* c7+c9 */ | 1331 z1 = tmp14 - MULTIPLY(z2 + z3, FIX(1.163011579)); /* c7+c9 */ |
1328 tmp11 += z1 + MULTIPLY(z2, FIX(2.073276588)); /* c1+c7+3*c9-c3 */ | 1332 tmp11 += z1 + MULTIPLY(z2, FIX(2.073276588)); /* c1+c7+3*c9-c3 */ |
1329 tmp12 += z1 - MULTIPLY(z3, FIX(1.192193623)); /* c3+c5-c7-c9 */ | 1333 tmp12 += z1 - MULTIPLY(z3, FIX(1.192193623)); /* c3+c5-c7-c9 */ |
1330 z1 = MULTIPLY(z2 + z4, - FIX(1.798248910)); /* -(c1+c9) */ | 1334 z1 = MULTIPLY(z2 + z4, - FIX(1.798248910)); /* -(c1+c9) */ |
1331 tmp11 += z1; | 1335 tmp11 += z1; |
1332 tmp13 += z1 + MULTIPLY(z4, FIX(2.102458632)); /* c1+c5+c9-c7 */ | 1336 tmp13 += z1 + MULTIPLY(z4, FIX(2.102458632)); /* c1+c5+c9-c7 */ |
1333 tmp14 += MULTIPLY(z2, - FIX(1.467221301)) + /* -(c5+c9) */ | 1337 tmp14 += MULTIPLY(z2, - FIX(1.467221301)) + /* -(c5+c9) */ |
1334 » MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */ | 1338 MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */ |
1335 » MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */ | 1339 MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */ |
1336 | 1340 |
1337 /* Final output stage */ | 1341 /* Final output stage */ |
1338 | 1342 |
1339 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); | 1343 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); |
1340 wsptr[8*10] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); | 1344 wsptr[8*10] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); |
1341 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); | 1345 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); |
1342 wsptr[8*9] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); | 1346 wsptr[8*9] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); |
1343 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); | 1347 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); |
1344 wsptr[8*8] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); | 1348 wsptr[8*8] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); |
1345 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); | 1349 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); |
1346 wsptr[8*7] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); | 1350 wsptr[8*7] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); |
1347 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); | 1351 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); |
1348 wsptr[8*6] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); | 1352 wsptr[8*6] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); |
1349 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25, CONST_BITS-PASS1_BITS); | 1353 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25, CONST_BITS-PASS1_BITS); |
1350 } | 1354 } |
1351 | 1355 |
1352 /* Pass 2: process 11 rows from work array, store into output array. */ | 1356 /* Pass 2: process 11 rows from work array, store into output array. */ |
1353 | 1357 |
1354 wsptr = workspace; | 1358 wsptr = workspace; |
1355 for (ctr = 0; ctr < 11; ctr++) { | 1359 for (ctr = 0; ctr < 11; ctr++) { |
1356 outptr = output_buf[ctr] + output_col; | 1360 outptr = output_buf[ctr] + output_col; |
1357 | 1361 |
1358 /* Even part */ | 1362 /* Even part */ |
1359 | 1363 |
1360 /* Add fudge factor here for final descale. */ | 1364 /* Add fudge factor here for final descale. */ |
1361 tmp10 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 1365 tmp10 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
1362 tmp10 <<= CONST_BITS; | 1366 tmp10 = LEFT_SHIFT(tmp10, CONST_BITS); |
1363 | 1367 |
1364 z1 = (INT32) wsptr[2]; | 1368 z1 = (JLONG) wsptr[2]; |
1365 z2 = (INT32) wsptr[4]; | 1369 z2 = (JLONG) wsptr[4]; |
1366 z3 = (INT32) wsptr[6]; | 1370 z3 = (JLONG) wsptr[6]; |
1367 | 1371 |
1368 tmp20 = MULTIPLY(z2 - z3, FIX(2.546640132)); /* c2+c4 */ | 1372 tmp20 = MULTIPLY(z2 - z3, FIX(2.546640132)); /* c2+c4 */ |
1369 tmp23 = MULTIPLY(z2 - z1, FIX(0.430815045)); /* c2-c6 */ | 1373 tmp23 = MULTIPLY(z2 - z1, FIX(0.430815045)); /* c2-c6 */ |
1370 z4 = z1 + z3; | 1374 z4 = z1 + z3; |
1371 tmp24 = MULTIPLY(z4, - FIX(1.155664402)); /* -(c2-c10) */ | 1375 tmp24 = MULTIPLY(z4, - FIX(1.155664402)); /* -(c2-c10) */ |
1372 z4 -= z2; | 1376 z4 -= z2; |
1373 tmp25 = tmp10 + MULTIPLY(z4, FIX(1.356927976)); /* c2 */ | 1377 tmp25 = tmp10 + MULTIPLY(z4, FIX(1.356927976)); /* c2 */ |
1374 tmp21 = tmp20 + tmp23 + tmp25 - | 1378 tmp21 = tmp20 + tmp23 + tmp25 - |
1375 » MULTIPLY(z2, FIX(1.821790775)); /* c2+c4+c10-c6 */ | 1379 MULTIPLY(z2, FIX(1.821790775)); /* c2+c4+c10-c6 */ |
1376 tmp20 += tmp25 + MULTIPLY(z3, FIX(2.115825087)); /* c4+c6 */ | 1380 tmp20 += tmp25 + MULTIPLY(z3, FIX(2.115825087)); /* c4+c6 */ |
1377 tmp23 += tmp25 - MULTIPLY(z1, FIX(1.513598477)); /* c6+c8 */ | 1381 tmp23 += tmp25 - MULTIPLY(z1, FIX(1.513598477)); /* c6+c8 */ |
1378 tmp24 += tmp25; | 1382 tmp24 += tmp25; |
1379 tmp22 = tmp24 - MULTIPLY(z3, FIX(0.788749120)); /* c8+c10 */ | 1383 tmp22 = tmp24 - MULTIPLY(z3, FIX(0.788749120)); /* c8+c10 */ |
1380 tmp24 += MULTIPLY(z2, FIX(1.944413522)) - /* c2+c8 */ | 1384 tmp24 += MULTIPLY(z2, FIX(1.944413522)) - /* c2+c8 */ |
1381 » MULTIPLY(z1, FIX(1.390975730)); /* c4+c10 */ | 1385 MULTIPLY(z1, FIX(1.390975730)); /* c4+c10 */ |
1382 tmp25 = tmp10 - MULTIPLY(z4, FIX(1.414213562)); /* c0 */ | 1386 tmp25 = tmp10 - MULTIPLY(z4, FIX(1.414213562)); /* c0 */ |
1383 | 1387 |
1384 /* Odd part */ | 1388 /* Odd part */ |
1385 | 1389 |
1386 z1 = (INT32) wsptr[1]; | 1390 z1 = (JLONG) wsptr[1]; |
1387 z2 = (INT32) wsptr[3]; | 1391 z2 = (JLONG) wsptr[3]; |
1388 z3 = (INT32) wsptr[5]; | 1392 z3 = (JLONG) wsptr[5]; |
1389 z4 = (INT32) wsptr[7]; | 1393 z4 = (JLONG) wsptr[7]; |
1390 | 1394 |
1391 tmp11 = z1 + z2; | 1395 tmp11 = z1 + z2; |
1392 tmp14 = MULTIPLY(tmp11 + z3 + z4, FIX(0.398430003)); /* c9 */ | 1396 tmp14 = MULTIPLY(tmp11 + z3 + z4, FIX(0.398430003)); /* c9 */ |
1393 tmp11 = MULTIPLY(tmp11, FIX(0.887983902)); /* c3-c9 */ | 1397 tmp11 = MULTIPLY(tmp11, FIX(0.887983902)); /* c3-c9 */ |
1394 tmp12 = MULTIPLY(z1 + z3, FIX(0.670361295)); /* c5-c9 */ | 1398 tmp12 = MULTIPLY(z1 + z3, FIX(0.670361295)); /* c5-c9 */ |
1395 tmp13 = tmp14 + MULTIPLY(z1 + z4, FIX(0.366151574)); /* c7-c9 */ | 1399 tmp13 = tmp14 + MULTIPLY(z1 + z4, FIX(0.366151574)); /* c7-c9 */ |
1396 tmp10 = tmp11 + tmp12 + tmp13 - | 1400 tmp10 = tmp11 + tmp12 + tmp13 - |
1397 » MULTIPLY(z1, FIX(0.923107866)); /* c7+c5+c3-c1-2*c9 */ | 1401 MULTIPLY(z1, FIX(0.923107866)); /* c7+c5+c3-c1-2*c9 */ |
1398 z1 = tmp14 - MULTIPLY(z2 + z3, FIX(1.163011579)); /* c7+c9 */ | 1402 z1 = tmp14 - MULTIPLY(z2 + z3, FIX(1.163011579)); /* c7+c9 */ |
1399 tmp11 += z1 + MULTIPLY(z2, FIX(2.073276588)); /* c1+c7+3*c9-c3 */ | 1403 tmp11 += z1 + MULTIPLY(z2, FIX(2.073276588)); /* c1+c7+3*c9-c3 */ |
1400 tmp12 += z1 - MULTIPLY(z3, FIX(1.192193623)); /* c3+c5-c7-c9 */ | 1404 tmp12 += z1 - MULTIPLY(z3, FIX(1.192193623)); /* c3+c5-c7-c9 */ |
1401 z1 = MULTIPLY(z2 + z4, - FIX(1.798248910)); /* -(c1+c9) */ | 1405 z1 = MULTIPLY(z2 + z4, - FIX(1.798248910)); /* -(c1+c9) */ |
1402 tmp11 += z1; | 1406 tmp11 += z1; |
1403 tmp13 += z1 + MULTIPLY(z4, FIX(2.102458632)); /* c1+c5+c9-c7 */ | 1407 tmp13 += z1 + MULTIPLY(z4, FIX(2.102458632)); /* c1+c5+c9-c7 */ |
1404 tmp14 += MULTIPLY(z2, - FIX(1.467221301)) + /* -(c5+c9) */ | 1408 tmp14 += MULTIPLY(z2, - FIX(1.467221301)) + /* -(c5+c9) */ |
1405 » MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */ | 1409 MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */ |
1406 » MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */ | 1410 MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */ |
1407 | 1411 |
1408 /* Final output stage */ | 1412 /* Final output stage */ |
1409 | 1413 |
1410 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, | 1414 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, |
1411 » » » » » CONST_BITS+PASS1_BITS+3) | 1415 CONST_BITS+PASS1_BITS+3) |
1412 » » » & RANGE_MASK]; | 1416 & RANGE_MASK]; |
1413 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, | 1417 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, |
1414 » » » » » CONST_BITS+PASS1_BITS+3) | 1418 CONST_BITS+PASS1_BITS+3) |
1415 » » » & RANGE_MASK]; | 1419 & RANGE_MASK]; |
1416 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, | 1420 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, |
1417 » » » » » CONST_BITS+PASS1_BITS+3) | 1421 CONST_BITS+PASS1_BITS+3) |
1418 » » » & RANGE_MASK]; | 1422 & RANGE_MASK]; |
1419 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, | 1423 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, |
1420 » » » » » CONST_BITS+PASS1_BITS+3) | 1424 CONST_BITS+PASS1_BITS+3) |
1421 » » » & RANGE_MASK]; | 1425 & RANGE_MASK]; |
1422 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, | 1426 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, |
1423 » » » » » CONST_BITS+PASS1_BITS+3) | 1427 CONST_BITS+PASS1_BITS+3) |
1424 » » » & RANGE_MASK]; | 1428 & RANGE_MASK]; |
1425 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, | 1429 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, |
1426 » » » » » CONST_BITS+PASS1_BITS+3) | 1430 CONST_BITS+PASS1_BITS+3) |
1427 » » » & RANGE_MASK]; | 1431 & RANGE_MASK]; |
1428 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, | 1432 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, |
1429 » » » » » CONST_BITS+PASS1_BITS+3) | 1433 CONST_BITS+PASS1_BITS+3) |
1430 » » » & RANGE_MASK]; | 1434 & RANGE_MASK]; |
1431 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, | 1435 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, |
1432 » » » » » CONST_BITS+PASS1_BITS+3) | 1436 CONST_BITS+PASS1_BITS+3) |
1433 » » » & RANGE_MASK]; | 1437 & RANGE_MASK]; |
1434 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, | 1438 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, |
1435 » » » » » CONST_BITS+PASS1_BITS+3) | 1439 CONST_BITS+PASS1_BITS+3) |
1436 » » » & RANGE_MASK]; | 1440 & RANGE_MASK]; |
1437 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, | 1441 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, |
1438 » » » » » CONST_BITS+PASS1_BITS+3) | 1442 CONST_BITS+PASS1_BITS+3) |
1439 » » » & RANGE_MASK]; | 1443 & RANGE_MASK]; |
1440 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25, | 1444 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25, |
1441 » » » » » CONST_BITS+PASS1_BITS+3) | 1445 CONST_BITS+PASS1_BITS+3) |
1442 » » » & RANGE_MASK]; | 1446 & RANGE_MASK]; |
1443 | 1447 |
1444 wsptr += 8;»» /* advance pointer to next row */ | 1448 wsptr += 8; /* advance pointer to next row */ |
1445 } | 1449 } |
1446 } | 1450 } |
1447 | 1451 |
1448 | 1452 |
1449 /* | 1453 /* |
1450 * Perform dequantization and inverse DCT on one block of coefficients, | 1454 * Perform dequantization and inverse DCT on one block of coefficients, |
1451 * producing a 12x12 output block. | 1455 * producing a 12x12 output block. |
1452 * | 1456 * |
1453 * Optimized algorithm with 15 multiplications in the 1-D kernel. | 1457 * Optimized algorithm with 15 multiplications in the 1-D kernel. |
1454 * cK represents sqrt(2) * cos(K*pi/24). | 1458 * cK represents sqrt(2) * cos(K*pi/24). |
1455 */ | 1459 */ |
1456 | 1460 |
1457 GLOBAL(void) | 1461 GLOBAL(void) |
1458 jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 1462 jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
1459 » » JCOEFPTR coef_block, | 1463 JCOEFPTR coef_block, |
1460 » » JSAMPARRAY output_buf, JDIMENSION output_col) | 1464 JSAMPARRAY output_buf, JDIMENSION output_col) |
1461 { | 1465 { |
1462 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; | 1466 JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; |
1463 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; | 1467 JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; |
1464 INT32 z1, z2, z3, z4; | 1468 JLONG z1, z2, z3, z4; |
1465 JCOEFPTR inptr; | 1469 JCOEFPTR inptr; |
1466 ISLOW_MULT_TYPE * quantptr; | 1470 ISLOW_MULT_TYPE *quantptr; |
1467 int * wsptr; | 1471 int *wsptr; |
1468 JSAMPROW outptr; | 1472 JSAMPROW outptr; |
1469 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 1473 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
1470 int ctr; | 1474 int ctr; |
1471 int workspace[8*12];» /* buffers data between passes */ | 1475 int workspace[8*12]; /* buffers data between passes */ |
1472 SHIFT_TEMPS | 1476 SHIFT_TEMPS |
1473 | 1477 |
1474 /* Pass 1: process columns from input, store into work array. */ | 1478 /* Pass 1: process columns from input, store into work array. */ |
1475 | 1479 |
1476 inptr = coef_block; | 1480 inptr = coef_block; |
1477 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 1481 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
1478 wsptr = workspace; | 1482 wsptr = workspace; |
1479 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { | 1483 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { |
1480 /* Even part */ | 1484 /* Even part */ |
1481 | 1485 |
1482 z3 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 1486 z3 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
1483 z3 <<= CONST_BITS; | 1487 z3 = LEFT_SHIFT(z3, CONST_BITS); |
1484 /* Add fudge factor here for final descale. */ | 1488 /* Add fudge factor here for final descale. */ |
1485 z3 += ONE << (CONST_BITS-PASS1_BITS-1); | 1489 z3 += ONE << (CONST_BITS-PASS1_BITS-1); |
1486 | 1490 |
1487 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 1491 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
1488 z4 = MULTIPLY(z4, FIX(1.224744871)); /* c4 */ | 1492 z4 = MULTIPLY(z4, FIX(1.224744871)); /* c4 */ |
1489 | 1493 |
1490 tmp10 = z3 + z4; | 1494 tmp10 = z3 + z4; |
1491 tmp11 = z3 - z4; | 1495 tmp11 = z3 - z4; |
1492 | 1496 |
1493 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 1497 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
1494 z4 = MULTIPLY(z1, FIX(1.366025404)); /* c2 */ | 1498 z4 = MULTIPLY(z1, FIX(1.366025404)); /* c2 */ |
1495 z1 <<= CONST_BITS; | 1499 z1 = LEFT_SHIFT(z1, CONST_BITS); |
1496 z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); | 1500 z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); |
1497 z2 <<= CONST_BITS; | 1501 z2 = LEFT_SHIFT(z2, CONST_BITS); |
1498 | 1502 |
1499 tmp12 = z1 - z2; | 1503 tmp12 = z1 - z2; |
1500 | 1504 |
1501 tmp21 = z3 + tmp12; | 1505 tmp21 = z3 + tmp12; |
1502 tmp24 = z3 - tmp12; | 1506 tmp24 = z3 - tmp12; |
1503 | 1507 |
1504 tmp12 = z4 + z2; | 1508 tmp12 = z4 + z2; |
1505 | 1509 |
1506 tmp20 = tmp10 + tmp12; | 1510 tmp20 = tmp10 + tmp12; |
1507 tmp25 = tmp10 - tmp12; | 1511 tmp25 = tmp10 - tmp12; |
(...skipping 14 matching lines...) Expand all Loading... |
1522 tmp14 = MULTIPLY(z2, - FIX_0_541196100); /* -c9 */ | 1526 tmp14 = MULTIPLY(z2, - FIX_0_541196100); /* -c9 */ |
1523 | 1527 |
1524 tmp10 = z1 + z3; | 1528 tmp10 = z1 + z3; |
1525 tmp15 = MULTIPLY(tmp10 + z4, FIX(0.860918669)); /* c7 */ | 1529 tmp15 = MULTIPLY(tmp10 + z4, FIX(0.860918669)); /* c7 */ |
1526 tmp12 = tmp15 + MULTIPLY(tmp10, FIX(0.261052384)); /* c5-c7 */ | 1530 tmp12 = tmp15 + MULTIPLY(tmp10, FIX(0.261052384)); /* c5-c7 */ |
1527 tmp10 = tmp12 + tmp11 + MULTIPLY(z1, FIX(0.280143716)); /* c1-c5 */ | 1531 tmp10 = tmp12 + tmp11 + MULTIPLY(z1, FIX(0.280143716)); /* c1-c5 */ |
1528 tmp13 = MULTIPLY(z3 + z4, - FIX(1.045510580)); /* -(c7+c11) */ | 1532 tmp13 = MULTIPLY(z3 + z4, - FIX(1.045510580)); /* -(c7+c11) */ |
1529 tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */ | 1533 tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */ |
1530 tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */ | 1534 tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */ |
1531 tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */ | 1535 tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */ |
1532 » MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ | 1536 MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ |
1533 | 1537 |
1534 z1 -= z4; | 1538 z1 -= z4; |
1535 z2 -= z3; | 1539 z2 -= z3; |
1536 z3 = MULTIPLY(z1 + z2, FIX_0_541196100); /* c9 */ | 1540 z3 = MULTIPLY(z1 + z2, FIX_0_541196100); /* c9 */ |
1537 tmp11 = z3 + MULTIPLY(z1, FIX_0_765366865); /* c3-c9 */ | 1541 tmp11 = z3 + MULTIPLY(z1, FIX_0_765366865); /* c3-c9 */ |
1538 tmp14 = z3 - MULTIPLY(z2, FIX_1_847759065); /* c3+c9 */ | 1542 tmp14 = z3 - MULTIPLY(z2, FIX_1_847759065); /* c3+c9 */ |
1539 | 1543 |
1540 /* Final output stage */ | 1544 /* Final output stage */ |
1541 | 1545 |
1542 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); | 1546 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); |
(...skipping 12 matching lines...) Expand all Loading... |
1555 | 1559 |
1556 /* Pass 2: process 12 rows from work array, store into output array. */ | 1560 /* Pass 2: process 12 rows from work array, store into output array. */ |
1557 | 1561 |
1558 wsptr = workspace; | 1562 wsptr = workspace; |
1559 for (ctr = 0; ctr < 12; ctr++) { | 1563 for (ctr = 0; ctr < 12; ctr++) { |
1560 outptr = output_buf[ctr] + output_col; | 1564 outptr = output_buf[ctr] + output_col; |
1561 | 1565 |
1562 /* Even part */ | 1566 /* Even part */ |
1563 | 1567 |
1564 /* Add fudge factor here for final descale. */ | 1568 /* Add fudge factor here for final descale. */ |
1565 z3 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 1569 z3 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
1566 z3 <<= CONST_BITS; | 1570 z3 = LEFT_SHIFT(z3, CONST_BITS); |
1567 | 1571 |
1568 z4 = (INT32) wsptr[4]; | 1572 z4 = (JLONG) wsptr[4]; |
1569 z4 = MULTIPLY(z4, FIX(1.224744871)); /* c4 */ | 1573 z4 = MULTIPLY(z4, FIX(1.224744871)); /* c4 */ |
1570 | 1574 |
1571 tmp10 = z3 + z4; | 1575 tmp10 = z3 + z4; |
1572 tmp11 = z3 - z4; | 1576 tmp11 = z3 - z4; |
1573 | 1577 |
1574 z1 = (INT32) wsptr[2]; | 1578 z1 = (JLONG) wsptr[2]; |
1575 z4 = MULTIPLY(z1, FIX(1.366025404)); /* c2 */ | 1579 z4 = MULTIPLY(z1, FIX(1.366025404)); /* c2 */ |
1576 z1 <<= CONST_BITS; | 1580 z1 = LEFT_SHIFT(z1, CONST_BITS); |
1577 z2 = (INT32) wsptr[6]; | 1581 z2 = (JLONG) wsptr[6]; |
1578 z2 <<= CONST_BITS; | 1582 z2 = LEFT_SHIFT(z2, CONST_BITS); |
1579 | 1583 |
1580 tmp12 = z1 - z2; | 1584 tmp12 = z1 - z2; |
1581 | 1585 |
1582 tmp21 = z3 + tmp12; | 1586 tmp21 = z3 + tmp12; |
1583 tmp24 = z3 - tmp12; | 1587 tmp24 = z3 - tmp12; |
1584 | 1588 |
1585 tmp12 = z4 + z2; | 1589 tmp12 = z4 + z2; |
1586 | 1590 |
1587 tmp20 = tmp10 + tmp12; | 1591 tmp20 = tmp10 + tmp12; |
1588 tmp25 = tmp10 - tmp12; | 1592 tmp25 = tmp10 - tmp12; |
1589 | 1593 |
1590 tmp12 = z4 - z1 - z2; | 1594 tmp12 = z4 - z1 - z2; |
1591 | 1595 |
1592 tmp22 = tmp11 + tmp12; | 1596 tmp22 = tmp11 + tmp12; |
1593 tmp23 = tmp11 - tmp12; | 1597 tmp23 = tmp11 - tmp12; |
1594 | 1598 |
1595 /* Odd part */ | 1599 /* Odd part */ |
1596 | 1600 |
1597 z1 = (INT32) wsptr[1]; | 1601 z1 = (JLONG) wsptr[1]; |
1598 z2 = (INT32) wsptr[3]; | 1602 z2 = (JLONG) wsptr[3]; |
1599 z3 = (INT32) wsptr[5]; | 1603 z3 = (JLONG) wsptr[5]; |
1600 z4 = (INT32) wsptr[7]; | 1604 z4 = (JLONG) wsptr[7]; |
1601 | 1605 |
1602 tmp11 = MULTIPLY(z2, FIX(1.306562965)); /* c3 */ | 1606 tmp11 = MULTIPLY(z2, FIX(1.306562965)); /* c3 */ |
1603 tmp14 = MULTIPLY(z2, - FIX_0_541196100); /* -c9 */ | 1607 tmp14 = MULTIPLY(z2, - FIX_0_541196100); /* -c9 */ |
1604 | 1608 |
1605 tmp10 = z1 + z3; | 1609 tmp10 = z1 + z3; |
1606 tmp15 = MULTIPLY(tmp10 + z4, FIX(0.860918669)); /* c7 */ | 1610 tmp15 = MULTIPLY(tmp10 + z4, FIX(0.860918669)); /* c7 */ |
1607 tmp12 = tmp15 + MULTIPLY(tmp10, FIX(0.261052384)); /* c5-c7 */ | 1611 tmp12 = tmp15 + MULTIPLY(tmp10, FIX(0.261052384)); /* c5-c7 */ |
1608 tmp10 = tmp12 + tmp11 + MULTIPLY(z1, FIX(0.280143716)); /* c1-c5 */ | 1612 tmp10 = tmp12 + tmp11 + MULTIPLY(z1, FIX(0.280143716)); /* c1-c5 */ |
1609 tmp13 = MULTIPLY(z3 + z4, - FIX(1.045510580)); /* -(c7+c11) */ | 1613 tmp13 = MULTIPLY(z3 + z4, - FIX(1.045510580)); /* -(c7+c11) */ |
1610 tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */ | 1614 tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */ |
1611 tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */ | 1615 tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */ |
1612 tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */ | 1616 tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */ |
1613 » MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ | 1617 MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ |
1614 | 1618 |
1615 z1 -= z4; | 1619 z1 -= z4; |
1616 z2 -= z3; | 1620 z2 -= z3; |
1617 z3 = MULTIPLY(z1 + z2, FIX_0_541196100); /* c9 */ | 1621 z3 = MULTIPLY(z1 + z2, FIX_0_541196100); /* c9 */ |
1618 tmp11 = z3 + MULTIPLY(z1, FIX_0_765366865); /* c3-c9 */ | 1622 tmp11 = z3 + MULTIPLY(z1, FIX_0_765366865); /* c3-c9 */ |
1619 tmp14 = z3 - MULTIPLY(z2, FIX_1_847759065); /* c3+c9 */ | 1623 tmp14 = z3 - MULTIPLY(z2, FIX_1_847759065); /* c3+c9 */ |
1620 | 1624 |
1621 /* Final output stage */ | 1625 /* Final output stage */ |
1622 | 1626 |
1623 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, | 1627 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, |
1624 » » » » » CONST_BITS+PASS1_BITS+3) | 1628 CONST_BITS+PASS1_BITS+3) |
1625 » » » & RANGE_MASK]; | 1629 & RANGE_MASK]; |
1626 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, | 1630 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, |
1627 » » » » » CONST_BITS+PASS1_BITS+3) | 1631 CONST_BITS+PASS1_BITS+3) |
1628 » » » & RANGE_MASK]; | 1632 & RANGE_MASK]; |
1629 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, | 1633 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, |
1630 » » » » » CONST_BITS+PASS1_BITS+3) | 1634 CONST_BITS+PASS1_BITS+3) |
1631 » » » & RANGE_MASK]; | 1635 & RANGE_MASK]; |
1632 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, | 1636 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, |
1633 » » » » » CONST_BITS+PASS1_BITS+3) | 1637 CONST_BITS+PASS1_BITS+3) |
1634 » » » & RANGE_MASK]; | 1638 & RANGE_MASK]; |
1635 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, | 1639 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, |
1636 » » » » » CONST_BITS+PASS1_BITS+3) | 1640 CONST_BITS+PASS1_BITS+3) |
1637 » » » & RANGE_MASK]; | 1641 & RANGE_MASK]; |
1638 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, | 1642 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, |
1639 » » » » » CONST_BITS+PASS1_BITS+3) | 1643 CONST_BITS+PASS1_BITS+3) |
1640 » » » & RANGE_MASK]; | 1644 & RANGE_MASK]; |
1641 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, | 1645 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, |
1642 » » » » » CONST_BITS+PASS1_BITS+3) | 1646 CONST_BITS+PASS1_BITS+3) |
1643 » » » & RANGE_MASK]; | 1647 & RANGE_MASK]; |
1644 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, | 1648 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, |
1645 » » » » » CONST_BITS+PASS1_BITS+3) | 1649 CONST_BITS+PASS1_BITS+3) |
1646 » » » & RANGE_MASK]; | 1650 & RANGE_MASK]; |
1647 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, | 1651 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, |
1648 » » » » » CONST_BITS+PASS1_BITS+3) | 1652 CONST_BITS+PASS1_BITS+3) |
1649 » » » & RANGE_MASK]; | 1653 & RANGE_MASK]; |
1650 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, | 1654 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, |
1651 » » » » » CONST_BITS+PASS1_BITS+3) | 1655 CONST_BITS+PASS1_BITS+3) |
1652 » » » & RANGE_MASK]; | 1656 & RANGE_MASK]; |
1653 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, | 1657 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, |
1654 » » » » » CONST_BITS+PASS1_BITS+3) | 1658 CONST_BITS+PASS1_BITS+3) |
1655 » » » & RANGE_MASK]; | 1659 & RANGE_MASK]; |
1656 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, | 1660 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, |
1657 » » » » » CONST_BITS+PASS1_BITS+3) | 1661 CONST_BITS+PASS1_BITS+3) |
1658 » » » & RANGE_MASK]; | 1662 & RANGE_MASK]; |
1659 | 1663 |
1660 wsptr += 8;»» /* advance pointer to next row */ | 1664 wsptr += 8; /* advance pointer to next row */ |
1661 } | 1665 } |
1662 } | 1666 } |
1663 | 1667 |
1664 | 1668 |
1665 /* | 1669 /* |
1666 * Perform dequantization and inverse DCT on one block of coefficients, | 1670 * Perform dequantization and inverse DCT on one block of coefficients, |
1667 * producing a 13x13 output block. | 1671 * producing a 13x13 output block. |
1668 * | 1672 * |
1669 * Optimized algorithm with 29 multiplications in the 1-D kernel. | 1673 * Optimized algorithm with 29 multiplications in the 1-D kernel. |
1670 * cK represents sqrt(2) * cos(K*pi/26). | 1674 * cK represents sqrt(2) * cos(K*pi/26). |
1671 */ | 1675 */ |
1672 | 1676 |
1673 GLOBAL(void) | 1677 GLOBAL(void) |
1674 jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 1678 jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
1675 » » JCOEFPTR coef_block, | 1679 JCOEFPTR coef_block, |
1676 » » JSAMPARRAY output_buf, JDIMENSION output_col) | 1680 JSAMPARRAY output_buf, JDIMENSION output_col) |
1677 { | 1681 { |
1678 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; | 1682 JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; |
1679 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; | 1683 JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; |
1680 INT32 z1, z2, z3, z4; | 1684 JLONG z1, z2, z3, z4; |
1681 JCOEFPTR inptr; | 1685 JCOEFPTR inptr; |
1682 ISLOW_MULT_TYPE * quantptr; | 1686 ISLOW_MULT_TYPE *quantptr; |
1683 int * wsptr; | 1687 int *wsptr; |
1684 JSAMPROW outptr; | 1688 JSAMPROW outptr; |
1685 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 1689 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
1686 int ctr; | 1690 int ctr; |
1687 int workspace[8*13];» /* buffers data between passes */ | 1691 int workspace[8*13]; /* buffers data between passes */ |
1688 SHIFT_TEMPS | 1692 SHIFT_TEMPS |
1689 | 1693 |
1690 /* Pass 1: process columns from input, store into work array. */ | 1694 /* Pass 1: process columns from input, store into work array. */ |
1691 | 1695 |
1692 inptr = coef_block; | 1696 inptr = coef_block; |
1693 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 1697 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
1694 wsptr = workspace; | 1698 wsptr = workspace; |
1695 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { | 1699 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { |
1696 /* Even part */ | 1700 /* Even part */ |
1697 | 1701 |
1698 z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 1702 z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
1699 z1 <<= CONST_BITS; | 1703 z1 = LEFT_SHIFT(z1, CONST_BITS); |
1700 /* Add fudge factor here for final descale. */ | 1704 /* Add fudge factor here for final descale. */ |
1701 z1 += ONE << (CONST_BITS-PASS1_BITS-1); | 1705 z1 += ONE << (CONST_BITS-PASS1_BITS-1); |
1702 | 1706 |
1703 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 1707 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
1704 z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 1708 z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
1705 z4 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); | 1709 z4 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); |
1706 | 1710 |
1707 tmp10 = z3 + z4; | 1711 tmp10 = z3 + z4; |
1708 tmp11 = z3 - z4; | 1712 tmp11 = z3 - z4; |
1709 | 1713 |
(...skipping 22 matching lines...) Expand all Loading... |
1732 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); | 1736 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); |
1733 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); | 1737 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); |
1734 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); | 1738 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); |
1735 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); | 1739 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); |
1736 | 1740 |
1737 tmp11 = MULTIPLY(z1 + z2, FIX(1.322312651)); /* c3 */ | 1741 tmp11 = MULTIPLY(z1 + z2, FIX(1.322312651)); /* c3 */ |
1738 tmp12 = MULTIPLY(z1 + z3, FIX(1.163874945)); /* c5 */ | 1742 tmp12 = MULTIPLY(z1 + z3, FIX(1.163874945)); /* c5 */ |
1739 tmp15 = z1 + z4; | 1743 tmp15 = z1 + z4; |
1740 tmp13 = MULTIPLY(tmp15, FIX(0.937797057)); /* c7 */ | 1744 tmp13 = MULTIPLY(tmp15, FIX(0.937797057)); /* c7 */ |
1741 tmp10 = tmp11 + tmp12 + tmp13 - | 1745 tmp10 = tmp11 + tmp12 + tmp13 - |
1742 » MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */ | 1746 MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */ |
1743 tmp14 = MULTIPLY(z2 + z3, - FIX(0.338443458)); /* -c11 */ | 1747 tmp14 = MULTIPLY(z2 + z3, - FIX(0.338443458)); /* -c11 */ |
1744 tmp11 += tmp14 + MULTIPLY(z2, FIX(0.837223564)); /* c5+c9+c11-c3 */ | 1748 tmp11 += tmp14 + MULTIPLY(z2, FIX(0.837223564)); /* c5+c9+c11-c3 */ |
1745 tmp12 += tmp14 - MULTIPLY(z3, FIX(1.572116027)); /* c1+c5-c9-c11 */ | 1749 tmp12 += tmp14 - MULTIPLY(z3, FIX(1.572116027)); /* c1+c5-c9-c11 */ |
1746 tmp14 = MULTIPLY(z2 + z4, - FIX(1.163874945)); /* -c5 */ | 1750 tmp14 = MULTIPLY(z2 + z4, - FIX(1.163874945)); /* -c5 */ |
1747 tmp11 += tmp14; | 1751 tmp11 += tmp14; |
1748 tmp13 += tmp14 + MULTIPLY(z4, FIX(2.205608352)); /* c3+c5+c9-c7 */ | 1752 tmp13 += tmp14 + MULTIPLY(z4, FIX(2.205608352)); /* c3+c5+c9-c7 */ |
1749 tmp14 = MULTIPLY(z3 + z4, - FIX(0.657217813)); /* -c9 */ | 1753 tmp14 = MULTIPLY(z3 + z4, - FIX(0.657217813)); /* -c9 */ |
1750 tmp12 += tmp14; | 1754 tmp12 += tmp14; |
1751 tmp13 += tmp14; | 1755 tmp13 += tmp14; |
1752 tmp15 = MULTIPLY(tmp15, FIX(0.338443458)); /* c11 */ | 1756 tmp15 = MULTIPLY(tmp15, FIX(0.338443458)); /* c11 */ |
1753 tmp14 = tmp15 + MULTIPLY(z1, FIX(0.318774355)) - /* c9-c11 */ | 1757 tmp14 = tmp15 + MULTIPLY(z1, FIX(0.318774355)) - /* c9-c11 */ |
1754 » MULTIPLY(z2, FIX(0.466105296)); /* c1-c7 */ | 1758 MULTIPLY(z2, FIX(0.466105296)); /* c1-c7 */ |
1755 z1 = MULTIPLY(z3 - z2, FIX(0.937797057)); /* c7 */ | 1759 z1 = MULTIPLY(z3 - z2, FIX(0.937797057)); /* c7 */ |
1756 tmp14 += z1; | 1760 tmp14 += z1; |
1757 tmp15 += z1 + MULTIPLY(z3, FIX(0.384515595)) - /* c3-c7 */ | 1761 tmp15 += z1 + MULTIPLY(z3, FIX(0.384515595)) - /* c3-c7 */ |
1758 » MULTIPLY(z4, FIX(1.742345811)); /* c1+c11 */ | 1762 MULTIPLY(z4, FIX(1.742345811)); /* c1+c11 */ |
1759 | 1763 |
1760 /* Final output stage */ | 1764 /* Final output stage */ |
1761 | 1765 |
1762 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); | 1766 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); |
1763 wsptr[8*12] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); | 1767 wsptr[8*12] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); |
1764 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); | 1768 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); |
1765 wsptr[8*11] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); | 1769 wsptr[8*11] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); |
1766 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); | 1770 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); |
1767 wsptr[8*10] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); | 1771 wsptr[8*10] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); |
1768 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); | 1772 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); |
1769 wsptr[8*9] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); | 1773 wsptr[8*9] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); |
1770 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); | 1774 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); |
1771 wsptr[8*8] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); | 1775 wsptr[8*8] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); |
1772 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS); | 1776 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS); |
1773 wsptr[8*7] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS); | 1777 wsptr[8*7] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS); |
1774 wsptr[8*6] = (int) RIGHT_SHIFT(tmp26, CONST_BITS-PASS1_BITS); | 1778 wsptr[8*6] = (int) RIGHT_SHIFT(tmp26, CONST_BITS-PASS1_BITS); |
1775 } | 1779 } |
1776 | 1780 |
1777 /* Pass 2: process 13 rows from work array, store into output array. */ | 1781 /* Pass 2: process 13 rows from work array, store into output array. */ |
1778 | 1782 |
1779 wsptr = workspace; | 1783 wsptr = workspace; |
1780 for (ctr = 0; ctr < 13; ctr++) { | 1784 for (ctr = 0; ctr < 13; ctr++) { |
1781 outptr = output_buf[ctr] + output_col; | 1785 outptr = output_buf[ctr] + output_col; |
1782 | 1786 |
1783 /* Even part */ | 1787 /* Even part */ |
1784 | 1788 |
1785 /* Add fudge factor here for final descale. */ | 1789 /* Add fudge factor here for final descale. */ |
1786 z1 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 1790 z1 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
1787 z1 <<= CONST_BITS; | 1791 z1 = LEFT_SHIFT(z1, CONST_BITS); |
1788 | 1792 |
1789 z2 = (INT32) wsptr[2]; | 1793 z2 = (JLONG) wsptr[2]; |
1790 z3 = (INT32) wsptr[4]; | 1794 z3 = (JLONG) wsptr[4]; |
1791 z4 = (INT32) wsptr[6]; | 1795 z4 = (JLONG) wsptr[6]; |
1792 | 1796 |
1793 tmp10 = z3 + z4; | 1797 tmp10 = z3 + z4; |
1794 tmp11 = z3 - z4; | 1798 tmp11 = z3 - z4; |
1795 | 1799 |
1796 tmp12 = MULTIPLY(tmp10, FIX(1.155388986)); /* (c4+c6)/2 */ | 1800 tmp12 = MULTIPLY(tmp10, FIX(1.155388986)); /* (c4+c6)/2 */ |
1797 tmp13 = MULTIPLY(tmp11, FIX(0.096834934)) + z1; /* (c4-c6)/2 */ | 1801 tmp13 = MULTIPLY(tmp11, FIX(0.096834934)) + z1; /* (c4-c6)/2 */ |
1798 | 1802 |
1799 tmp20 = MULTIPLY(z2, FIX(1.373119086)) + tmp12 + tmp13; /* c2 */ | 1803 tmp20 = MULTIPLY(z2, FIX(1.373119086)) + tmp12 + tmp13; /* c2 */ |
1800 tmp22 = MULTIPLY(z2, FIX(0.501487041)) - tmp12 + tmp13; /* c10 */ | 1804 tmp22 = MULTIPLY(z2, FIX(0.501487041)) - tmp12 + tmp13; /* c10 */ |
1801 | 1805 |
1802 tmp12 = MULTIPLY(tmp10, FIX(0.316450131)); /* (c8-c12)/2 */ | 1806 tmp12 = MULTIPLY(tmp10, FIX(0.316450131)); /* (c8-c12)/2 */ |
1803 tmp13 = MULTIPLY(tmp11, FIX(0.486914739)) + z1; /* (c8+c12)/2 */ | 1807 tmp13 = MULTIPLY(tmp11, FIX(0.486914739)) + z1; /* (c8+c12)/2 */ |
1804 | 1808 |
1805 tmp21 = MULTIPLY(z2, FIX(1.058554052)) - tmp12 + tmp13; /* c6 */ | 1809 tmp21 = MULTIPLY(z2, FIX(1.058554052)) - tmp12 + tmp13; /* c6 */ |
1806 tmp25 = MULTIPLY(z2, - FIX(1.252223920)) + tmp12 + tmp13; /* c4 */ | 1810 tmp25 = MULTIPLY(z2, - FIX(1.252223920)) + tmp12 + tmp13; /* c4 */ |
1807 | 1811 |
1808 tmp12 = MULTIPLY(tmp10, FIX(0.435816023)); /* (c2-c10)/2 */ | 1812 tmp12 = MULTIPLY(tmp10, FIX(0.435816023)); /* (c2-c10)/2 */ |
1809 tmp13 = MULTIPLY(tmp11, FIX(0.937303064)) - z1; /* (c2+c10)/2 */ | 1813 tmp13 = MULTIPLY(tmp11, FIX(0.937303064)) - z1; /* (c2+c10)/2 */ |
1810 | 1814 |
1811 tmp23 = MULTIPLY(z2, - FIX(0.170464608)) - tmp12 - tmp13; /* c12 */ | 1815 tmp23 = MULTIPLY(z2, - FIX(0.170464608)) - tmp12 - tmp13; /* c12 */ |
1812 tmp24 = MULTIPLY(z2, - FIX(0.803364869)) + tmp12 - tmp13; /* c8 */ | 1816 tmp24 = MULTIPLY(z2, - FIX(0.803364869)) + tmp12 - tmp13; /* c8 */ |
1813 | 1817 |
1814 tmp26 = MULTIPLY(tmp11 - z2, FIX(1.414213562)) + z1; /* c0 */ | 1818 tmp26 = MULTIPLY(tmp11 - z2, FIX(1.414213562)) + z1; /* c0 */ |
1815 | 1819 |
1816 /* Odd part */ | 1820 /* Odd part */ |
1817 | 1821 |
1818 z1 = (INT32) wsptr[1]; | 1822 z1 = (JLONG) wsptr[1]; |
1819 z2 = (INT32) wsptr[3]; | 1823 z2 = (JLONG) wsptr[3]; |
1820 z3 = (INT32) wsptr[5]; | 1824 z3 = (JLONG) wsptr[5]; |
1821 z4 = (INT32) wsptr[7]; | 1825 z4 = (JLONG) wsptr[7]; |
1822 | 1826 |
1823 tmp11 = MULTIPLY(z1 + z2, FIX(1.322312651)); /* c3 */ | 1827 tmp11 = MULTIPLY(z1 + z2, FIX(1.322312651)); /* c3 */ |
1824 tmp12 = MULTIPLY(z1 + z3, FIX(1.163874945)); /* c5 */ | 1828 tmp12 = MULTIPLY(z1 + z3, FIX(1.163874945)); /* c5 */ |
1825 tmp15 = z1 + z4; | 1829 tmp15 = z1 + z4; |
1826 tmp13 = MULTIPLY(tmp15, FIX(0.937797057)); /* c7 */ | 1830 tmp13 = MULTIPLY(tmp15, FIX(0.937797057)); /* c7 */ |
1827 tmp10 = tmp11 + tmp12 + tmp13 - | 1831 tmp10 = tmp11 + tmp12 + tmp13 - |
1828 » MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */ | 1832 MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */ |
1829 tmp14 = MULTIPLY(z2 + z3, - FIX(0.338443458)); /* -c11 */ | 1833 tmp14 = MULTIPLY(z2 + z3, - FIX(0.338443458)); /* -c11 */ |
1830 tmp11 += tmp14 + MULTIPLY(z2, FIX(0.837223564)); /* c5+c9+c11-c3 */ | 1834 tmp11 += tmp14 + MULTIPLY(z2, FIX(0.837223564)); /* c5+c9+c11-c3 */ |
1831 tmp12 += tmp14 - MULTIPLY(z3, FIX(1.572116027)); /* c1+c5-c9-c11 */ | 1835 tmp12 += tmp14 - MULTIPLY(z3, FIX(1.572116027)); /* c1+c5-c9-c11 */ |
1832 tmp14 = MULTIPLY(z2 + z4, - FIX(1.163874945)); /* -c5 */ | 1836 tmp14 = MULTIPLY(z2 + z4, - FIX(1.163874945)); /* -c5 */ |
1833 tmp11 += tmp14; | 1837 tmp11 += tmp14; |
1834 tmp13 += tmp14 + MULTIPLY(z4, FIX(2.205608352)); /* c3+c5+c9-c7 */ | 1838 tmp13 += tmp14 + MULTIPLY(z4, FIX(2.205608352)); /* c3+c5+c9-c7 */ |
1835 tmp14 = MULTIPLY(z3 + z4, - FIX(0.657217813)); /* -c9 */ | 1839 tmp14 = MULTIPLY(z3 + z4, - FIX(0.657217813)); /* -c9 */ |
1836 tmp12 += tmp14; | 1840 tmp12 += tmp14; |
1837 tmp13 += tmp14; | 1841 tmp13 += tmp14; |
1838 tmp15 = MULTIPLY(tmp15, FIX(0.338443458)); /* c11 */ | 1842 tmp15 = MULTIPLY(tmp15, FIX(0.338443458)); /* c11 */ |
1839 tmp14 = tmp15 + MULTIPLY(z1, FIX(0.318774355)) - /* c9-c11 */ | 1843 tmp14 = tmp15 + MULTIPLY(z1, FIX(0.318774355)) - /* c9-c11 */ |
1840 » MULTIPLY(z2, FIX(0.466105296)); /* c1-c7 */ | 1844 MULTIPLY(z2, FIX(0.466105296)); /* c1-c7 */ |
1841 z1 = MULTIPLY(z3 - z2, FIX(0.937797057)); /* c7 */ | 1845 z1 = MULTIPLY(z3 - z2, FIX(0.937797057)); /* c7 */ |
1842 tmp14 += z1; | 1846 tmp14 += z1; |
1843 tmp15 += z1 + MULTIPLY(z3, FIX(0.384515595)) - /* c3-c7 */ | 1847 tmp15 += z1 + MULTIPLY(z3, FIX(0.384515595)) - /* c3-c7 */ |
1844 » MULTIPLY(z4, FIX(1.742345811)); /* c1+c11 */ | 1848 MULTIPLY(z4, FIX(1.742345811)); /* c1+c11 */ |
1845 | 1849 |
1846 /* Final output stage */ | 1850 /* Final output stage */ |
1847 | 1851 |
1848 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, | 1852 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, |
1849 » » » » » CONST_BITS+PASS1_BITS+3) | 1853 CONST_BITS+PASS1_BITS+3) |
1850 » » » & RANGE_MASK]; | 1854 & RANGE_MASK]; |
1851 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, | 1855 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, |
1852 » » » » » CONST_BITS+PASS1_BITS+3) | 1856 CONST_BITS+PASS1_BITS+3) |
1853 » » » & RANGE_MASK]; | 1857 & RANGE_MASK]; |
1854 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, | 1858 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, |
1855 » » » » » CONST_BITS+PASS1_BITS+3) | 1859 CONST_BITS+PASS1_BITS+3) |
1856 » » » & RANGE_MASK]; | 1860 & RANGE_MASK]; |
1857 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, | 1861 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, |
1858 » » » » » CONST_BITS+PASS1_BITS+3) | 1862 CONST_BITS+PASS1_BITS+3) |
1859 » » » & RANGE_MASK]; | 1863 & RANGE_MASK]; |
1860 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, | 1864 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, |
1861 » » » » » CONST_BITS+PASS1_BITS+3) | 1865 CONST_BITS+PASS1_BITS+3) |
1862 » » » & RANGE_MASK]; | 1866 & RANGE_MASK]; |
1863 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, | 1867 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, |
1864 » » » » » CONST_BITS+PASS1_BITS+3) | 1868 CONST_BITS+PASS1_BITS+3) |
1865 » » » & RANGE_MASK]; | 1869 & RANGE_MASK]; |
1866 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, | 1870 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, |
1867 » » » » » CONST_BITS+PASS1_BITS+3) | 1871 CONST_BITS+PASS1_BITS+3) |
1868 » » » & RANGE_MASK]; | 1872 & RANGE_MASK]; |
1869 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, | 1873 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, |
1870 » » » » » CONST_BITS+PASS1_BITS+3) | 1874 CONST_BITS+PASS1_BITS+3) |
1871 » » » & RANGE_MASK]; | 1875 & RANGE_MASK]; |
1872 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, | 1876 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, |
1873 » » » » » CONST_BITS+PASS1_BITS+3) | 1877 CONST_BITS+PASS1_BITS+3) |
1874 » » » & RANGE_MASK]; | 1878 & RANGE_MASK]; |
1875 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, | 1879 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, |
1876 » » » » » CONST_BITS+PASS1_BITS+3) | 1880 CONST_BITS+PASS1_BITS+3) |
1877 » » » & RANGE_MASK]; | 1881 & RANGE_MASK]; |
1878 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, | 1882 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, |
1879 » » » » » CONST_BITS+PASS1_BITS+3) | 1883 CONST_BITS+PASS1_BITS+3) |
1880 » » » & RANGE_MASK]; | 1884 & RANGE_MASK]; |
1881 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, | 1885 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, |
1882 » » » » » CONST_BITS+PASS1_BITS+3) | 1886 CONST_BITS+PASS1_BITS+3) |
1883 » » » & RANGE_MASK]; | 1887 & RANGE_MASK]; |
1884 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26, | 1888 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26, |
1885 » » » » » CONST_BITS+PASS1_BITS+3) | 1889 CONST_BITS+PASS1_BITS+3) |
1886 » » » & RANGE_MASK]; | 1890 & RANGE_MASK]; |
1887 | 1891 |
1888 wsptr += 8;»» /* advance pointer to next row */ | 1892 wsptr += 8; /* advance pointer to next row */ |
1889 } | 1893 } |
1890 } | 1894 } |
1891 | 1895 |
1892 | 1896 |
1893 /* | 1897 /* |
1894 * Perform dequantization and inverse DCT on one block of coefficients, | 1898 * Perform dequantization and inverse DCT on one block of coefficients, |
1895 * producing a 14x14 output block. | 1899 * producing a 14x14 output block. |
1896 * | 1900 * |
1897 * Optimized algorithm with 20 multiplications in the 1-D kernel. | 1901 * Optimized algorithm with 20 multiplications in the 1-D kernel. |
1898 * cK represents sqrt(2) * cos(K*pi/28). | 1902 * cK represents sqrt(2) * cos(K*pi/28). |
1899 */ | 1903 */ |
1900 | 1904 |
1901 GLOBAL(void) | 1905 GLOBAL(void) |
1902 jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 1906 jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
1903 » » JCOEFPTR coef_block, | 1907 JCOEFPTR coef_block, |
1904 » » JSAMPARRAY output_buf, JDIMENSION output_col) | 1908 JSAMPARRAY output_buf, JDIMENSION output_col) |
1905 { | 1909 { |
1906 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; | 1910 JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; |
1907 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; | 1911 JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; |
1908 INT32 z1, z2, z3, z4; | 1912 JLONG z1, z2, z3, z4; |
1909 JCOEFPTR inptr; | 1913 JCOEFPTR inptr; |
1910 ISLOW_MULT_TYPE * quantptr; | 1914 ISLOW_MULT_TYPE *quantptr; |
1911 int * wsptr; | 1915 int *wsptr; |
1912 JSAMPROW outptr; | 1916 JSAMPROW outptr; |
1913 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 1917 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
1914 int ctr; | 1918 int ctr; |
1915 int workspace[8*14];» /* buffers data between passes */ | 1919 int workspace[8*14]; /* buffers data between passes */ |
1916 SHIFT_TEMPS | 1920 SHIFT_TEMPS |
1917 | 1921 |
1918 /* Pass 1: process columns from input, store into work array. */ | 1922 /* Pass 1: process columns from input, store into work array. */ |
1919 | 1923 |
1920 inptr = coef_block; | 1924 inptr = coef_block; |
1921 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 1925 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
1922 wsptr = workspace; | 1926 wsptr = workspace; |
1923 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { | 1927 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { |
1924 /* Even part */ | 1928 /* Even part */ |
1925 | 1929 |
1926 z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 1930 z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
1927 z1 <<= CONST_BITS; | 1931 z1 = LEFT_SHIFT(z1, CONST_BITS); |
1928 /* Add fudge factor here for final descale. */ | 1932 /* Add fudge factor here for final descale. */ |
1929 z1 += ONE << (CONST_BITS-PASS1_BITS-1); | 1933 z1 += ONE << (CONST_BITS-PASS1_BITS-1); |
1930 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 1934 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
1931 z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */ | 1935 z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */ |
1932 z3 = MULTIPLY(z4, FIX(0.314692123)); /* c12 */ | 1936 z3 = MULTIPLY(z4, FIX(0.314692123)); /* c12 */ |
1933 z4 = MULTIPLY(z4, FIX(0.881747734)); /* c8 */ | 1937 z4 = MULTIPLY(z4, FIX(0.881747734)); /* c8 */ |
1934 | 1938 |
1935 tmp10 = z1 + z2; | 1939 tmp10 = z1 + z2; |
1936 tmp11 = z1 + z3; | 1940 tmp11 = z1 + z3; |
1937 tmp12 = z1 - z4; | 1941 tmp12 = z1 - z4; |
1938 | 1942 |
1939 tmp23 = RIGHT_SHIFT(z1 - ((z2 + z3 - z4) << 1), /* c0 = (c4+c12-c8)*2 */ | 1943 tmp23 = RIGHT_SHIFT(z1 - LEFT_SHIFT(z2 + z3 - z4, 1), |
1940 » » » CONST_BITS-PASS1_BITS); | 1944 CONST_BITS-PASS1_BITS); /* c0 = (c4+c12-c8)*2 */ |
1941 | 1945 |
1942 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 1946 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
1943 z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); | 1947 z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); |
1944 | 1948 |
1945 z3 = MULTIPLY(z1 + z2, FIX(1.105676686)); /* c6 */ | 1949 z3 = MULTIPLY(z1 + z2, FIX(1.105676686)); /* c6 */ |
1946 | 1950 |
1947 tmp13 = z3 + MULTIPLY(z1, FIX(0.273079590)); /* c2-c6 */ | 1951 tmp13 = z3 + MULTIPLY(z1, FIX(0.273079590)); /* c2-c6 */ |
1948 tmp14 = z3 - MULTIPLY(z2, FIX(1.719280954)); /* c6+c10 */ | 1952 tmp14 = z3 - MULTIPLY(z2, FIX(1.719280954)); /* c6+c10 */ |
1949 tmp15 = MULTIPLY(z1, FIX(0.613604268)) - /* c10 */ | 1953 tmp15 = MULTIPLY(z1, FIX(0.613604268)) - /* c10 */ |
1950 » MULTIPLY(z2, FIX(1.378756276)); /* c2 */ | 1954 MULTIPLY(z2, FIX(1.378756276)); /* c2 */ |
1951 | 1955 |
1952 tmp20 = tmp10 + tmp13; | 1956 tmp20 = tmp10 + tmp13; |
1953 tmp26 = tmp10 - tmp13; | 1957 tmp26 = tmp10 - tmp13; |
1954 tmp21 = tmp11 + tmp14; | 1958 tmp21 = tmp11 + tmp14; |
1955 tmp25 = tmp11 - tmp14; | 1959 tmp25 = tmp11 - tmp14; |
1956 tmp22 = tmp12 + tmp15; | 1960 tmp22 = tmp12 + tmp15; |
1957 tmp24 = tmp12 - tmp15; | 1961 tmp24 = tmp12 - tmp15; |
1958 | 1962 |
1959 /* Odd part */ | 1963 /* Odd part */ |
1960 | 1964 |
1961 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); | 1965 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); |
1962 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); | 1966 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); |
1963 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); | 1967 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); |
1964 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); | 1968 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); |
1965 tmp13 = z4 << CONST_BITS; | 1969 tmp13 = LEFT_SHIFT(z4, CONST_BITS); |
1966 | 1970 |
1967 tmp14 = z1 + z3; | 1971 tmp14 = z1 + z3; |
1968 tmp11 = MULTIPLY(z1 + z2, FIX(1.334852607)); /* c3 */ | 1972 tmp11 = MULTIPLY(z1 + z2, FIX(1.334852607)); /* c3 */ |
1969 tmp12 = MULTIPLY(tmp14, FIX(1.197448846)); /* c5 */ | 1973 tmp12 = MULTIPLY(tmp14, FIX(1.197448846)); /* c5 */ |
1970 tmp10 = tmp11 + tmp12 + tmp13 - MULTIPLY(z1, FIX(1.126980169)); /* c3+c5-c1
*/ | 1974 tmp10 = tmp11 + tmp12 + tmp13 - MULTIPLY(z1, FIX(1.126980169)); /* c3+c5-c1
*/ |
1971 tmp14 = MULTIPLY(tmp14, FIX(0.752406978)); /* c9 */ | 1975 tmp14 = MULTIPLY(tmp14, FIX(0.752406978)); /* c9 */ |
1972 tmp16 = tmp14 - MULTIPLY(z1, FIX(1.061150426)); /* c9+c11-c13 */ | 1976 tmp16 = tmp14 - MULTIPLY(z1, FIX(1.061150426)); /* c9+c11-c13 */ |
1973 z1 -= z2; | 1977 z1 -= z2; |
1974 tmp15 = MULTIPLY(z1, FIX(0.467085129)) - tmp13; /* c11 */ | 1978 tmp15 = MULTIPLY(z1, FIX(0.467085129)) - tmp13; /* c11 */ |
1975 tmp16 += tmp15; | 1979 tmp16 += tmp15; |
1976 z1 += z4; | 1980 z1 += z4; |
1977 z4 = MULTIPLY(z2 + z3, - FIX(0.158341681)) - tmp13; /* -c13 */ | 1981 z4 = MULTIPLY(z2 + z3, - FIX(0.158341681)) - tmp13; /* -c13 */ |
1978 tmp11 += z4 - MULTIPLY(z2, FIX(0.424103948)); /* c3-c9-c13 */ | 1982 tmp11 += z4 - MULTIPLY(z2, FIX(0.424103948)); /* c3-c9-c13 */ |
1979 tmp12 += z4 - MULTIPLY(z3, FIX(2.373959773)); /* c3+c5-c13 */ | 1983 tmp12 += z4 - MULTIPLY(z3, FIX(2.373959773)); /* c3+c5-c13 */ |
1980 z4 = MULTIPLY(z3 - z2, FIX(1.405321284)); /* c1 */ | 1984 z4 = MULTIPLY(z3 - z2, FIX(1.405321284)); /* c1 */ |
1981 tmp14 += z4 + tmp13 - MULTIPLY(z3, FIX(1.6906431334)); /* c1+c9-c11 */ | 1985 tmp14 += z4 + tmp13 - MULTIPLY(z3, FIX(1.6906431334)); /* c1+c9-c11 */ |
1982 tmp15 += z4 + MULTIPLY(z2, FIX(0.674957567)); /* c1+c11-c5 */ | 1986 tmp15 += z4 + MULTIPLY(z2, FIX(0.674957567)); /* c1+c11-c5 */ |
1983 | 1987 |
1984 tmp13 = (z1 - z3) << PASS1_BITS; | 1988 tmp13 = LEFT_SHIFT(z1 - z3, PASS1_BITS); |
1985 | 1989 |
1986 /* Final output stage */ | 1990 /* Final output stage */ |
1987 | 1991 |
1988 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); | 1992 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); |
1989 wsptr[8*13] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); | 1993 wsptr[8*13] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); |
1990 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); | 1994 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); |
1991 wsptr[8*12] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); | 1995 wsptr[8*12] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); |
1992 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); | 1996 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); |
1993 wsptr[8*11] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); | 1997 wsptr[8*11] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); |
1994 wsptr[8*3] = (int) (tmp23 + tmp13); | 1998 wsptr[8*3] = (int) (tmp23 + tmp13); |
1995 wsptr[8*10] = (int) (tmp23 - tmp13); | 1999 wsptr[8*10] = (int) (tmp23 - tmp13); |
1996 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); | 2000 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); |
1997 wsptr[8*9] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); | 2001 wsptr[8*9] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); |
1998 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS); | 2002 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS); |
1999 wsptr[8*8] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS); | 2003 wsptr[8*8] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS); |
2000 wsptr[8*6] = (int) RIGHT_SHIFT(tmp26 + tmp16, CONST_BITS-PASS1_BITS); | 2004 wsptr[8*6] = (int) RIGHT_SHIFT(tmp26 + tmp16, CONST_BITS-PASS1_BITS); |
2001 wsptr[8*7] = (int) RIGHT_SHIFT(tmp26 - tmp16, CONST_BITS-PASS1_BITS); | 2005 wsptr[8*7] = (int) RIGHT_SHIFT(tmp26 - tmp16, CONST_BITS-PASS1_BITS); |
2002 } | 2006 } |
2003 | 2007 |
2004 /* Pass 2: process 14 rows from work array, store into output array. */ | 2008 /* Pass 2: process 14 rows from work array, store into output array. */ |
2005 | 2009 |
2006 wsptr = workspace; | 2010 wsptr = workspace; |
2007 for (ctr = 0; ctr < 14; ctr++) { | 2011 for (ctr = 0; ctr < 14; ctr++) { |
2008 outptr = output_buf[ctr] + output_col; | 2012 outptr = output_buf[ctr] + output_col; |
2009 | 2013 |
2010 /* Even part */ | 2014 /* Even part */ |
2011 | 2015 |
2012 /* Add fudge factor here for final descale. */ | 2016 /* Add fudge factor here for final descale. */ |
2013 z1 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 2017 z1 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
2014 z1 <<= CONST_BITS; | 2018 z1 = LEFT_SHIFT(z1, CONST_BITS); |
2015 z4 = (INT32) wsptr[4]; | 2019 z4 = (JLONG) wsptr[4]; |
2016 z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */ | 2020 z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */ |
2017 z3 = MULTIPLY(z4, FIX(0.314692123)); /* c12 */ | 2021 z3 = MULTIPLY(z4, FIX(0.314692123)); /* c12 */ |
2018 z4 = MULTIPLY(z4, FIX(0.881747734)); /* c8 */ | 2022 z4 = MULTIPLY(z4, FIX(0.881747734)); /* c8 */ |
2019 | 2023 |
2020 tmp10 = z1 + z2; | 2024 tmp10 = z1 + z2; |
2021 tmp11 = z1 + z3; | 2025 tmp11 = z1 + z3; |
2022 tmp12 = z1 - z4; | 2026 tmp12 = z1 - z4; |
2023 | 2027 |
2024 tmp23 = z1 - ((z2 + z3 - z4) << 1); /* c0 = (c4+c12-c8)*2 */ | 2028 tmp23 = z1 - LEFT_SHIFT(z2 + z3 - z4, 1); /* c0 = (c4+c12-c8)*2 */ |
2025 | 2029 |
2026 z1 = (INT32) wsptr[2]; | 2030 z1 = (JLONG) wsptr[2]; |
2027 z2 = (INT32) wsptr[6]; | 2031 z2 = (JLONG) wsptr[6]; |
2028 | 2032 |
2029 z3 = MULTIPLY(z1 + z2, FIX(1.105676686)); /* c6 */ | 2033 z3 = MULTIPLY(z1 + z2, FIX(1.105676686)); /* c6 */ |
2030 | 2034 |
2031 tmp13 = z3 + MULTIPLY(z1, FIX(0.273079590)); /* c2-c6 */ | 2035 tmp13 = z3 + MULTIPLY(z1, FIX(0.273079590)); /* c2-c6 */ |
2032 tmp14 = z3 - MULTIPLY(z2, FIX(1.719280954)); /* c6+c10 */ | 2036 tmp14 = z3 - MULTIPLY(z2, FIX(1.719280954)); /* c6+c10 */ |
2033 tmp15 = MULTIPLY(z1, FIX(0.613604268)) - /* c10 */ | 2037 tmp15 = MULTIPLY(z1, FIX(0.613604268)) - /* c10 */ |
2034 » MULTIPLY(z2, FIX(1.378756276)); /* c2 */ | 2038 MULTIPLY(z2, FIX(1.378756276)); /* c2 */ |
2035 | 2039 |
2036 tmp20 = tmp10 + tmp13; | 2040 tmp20 = tmp10 + tmp13; |
2037 tmp26 = tmp10 - tmp13; | 2041 tmp26 = tmp10 - tmp13; |
2038 tmp21 = tmp11 + tmp14; | 2042 tmp21 = tmp11 + tmp14; |
2039 tmp25 = tmp11 - tmp14; | 2043 tmp25 = tmp11 - tmp14; |
2040 tmp22 = tmp12 + tmp15; | 2044 tmp22 = tmp12 + tmp15; |
2041 tmp24 = tmp12 - tmp15; | 2045 tmp24 = tmp12 - tmp15; |
2042 | 2046 |
2043 /* Odd part */ | 2047 /* Odd part */ |
2044 | 2048 |
2045 z1 = (INT32) wsptr[1]; | 2049 z1 = (JLONG) wsptr[1]; |
2046 z2 = (INT32) wsptr[3]; | 2050 z2 = (JLONG) wsptr[3]; |
2047 z3 = (INT32) wsptr[5]; | 2051 z3 = (JLONG) wsptr[5]; |
2048 z4 = (INT32) wsptr[7]; | 2052 z4 = (JLONG) wsptr[7]; |
2049 z4 <<= CONST_BITS; | 2053 z4 = LEFT_SHIFT(z4, CONST_BITS); |
2050 | 2054 |
2051 tmp14 = z1 + z3; | 2055 tmp14 = z1 + z3; |
2052 tmp11 = MULTIPLY(z1 + z2, FIX(1.334852607)); /* c3 */ | 2056 tmp11 = MULTIPLY(z1 + z2, FIX(1.334852607)); /* c3 */ |
2053 tmp12 = MULTIPLY(tmp14, FIX(1.197448846)); /* c5 */ | 2057 tmp12 = MULTIPLY(tmp14, FIX(1.197448846)); /* c5 */ |
2054 tmp10 = tmp11 + tmp12 + z4 - MULTIPLY(z1, FIX(1.126980169)); /* c3+c5-c1 */ | 2058 tmp10 = tmp11 + tmp12 + z4 - MULTIPLY(z1, FIX(1.126980169)); /* c3+c5-c1 */ |
2055 tmp14 = MULTIPLY(tmp14, FIX(0.752406978)); /* c9 */ | 2059 tmp14 = MULTIPLY(tmp14, FIX(0.752406978)); /* c9 */ |
2056 tmp16 = tmp14 - MULTIPLY(z1, FIX(1.061150426)); /* c9+c11-c13 */ | 2060 tmp16 = tmp14 - MULTIPLY(z1, FIX(1.061150426)); /* c9+c11-c13 */ |
2057 z1 -= z2; | 2061 z1 -= z2; |
2058 tmp15 = MULTIPLY(z1, FIX(0.467085129)) - z4; /* c11 */ | 2062 tmp15 = MULTIPLY(z1, FIX(0.467085129)) - z4; /* c11 */ |
2059 tmp16 += tmp15; | 2063 tmp16 += tmp15; |
2060 tmp13 = MULTIPLY(z2 + z3, - FIX(0.158341681)) - z4; /* -c13 */ | 2064 tmp13 = MULTIPLY(z2 + z3, - FIX(0.158341681)) - z4; /* -c13 */ |
2061 tmp11 += tmp13 - MULTIPLY(z2, FIX(0.424103948)); /* c3-c9-c13 */ | 2065 tmp11 += tmp13 - MULTIPLY(z2, FIX(0.424103948)); /* c3-c9-c13 */ |
2062 tmp12 += tmp13 - MULTIPLY(z3, FIX(2.373959773)); /* c3+c5-c13 */ | 2066 tmp12 += tmp13 - MULTIPLY(z3, FIX(2.373959773)); /* c3+c5-c13 */ |
2063 tmp13 = MULTIPLY(z3 - z2, FIX(1.405321284)); /* c1 */ | 2067 tmp13 = MULTIPLY(z3 - z2, FIX(1.405321284)); /* c1 */ |
2064 tmp14 += tmp13 + z4 - MULTIPLY(z3, FIX(1.6906431334)); /* c1+c9-c11 */ | 2068 tmp14 += tmp13 + z4 - MULTIPLY(z3, FIX(1.6906431334)); /* c1+c9-c11 */ |
2065 tmp15 += tmp13 + MULTIPLY(z2, FIX(0.674957567)); /* c1+c11-c5 */ | 2069 tmp15 += tmp13 + MULTIPLY(z2, FIX(0.674957567)); /* c1+c11-c5 */ |
2066 | 2070 |
2067 tmp13 = ((z1 - z3) << CONST_BITS) + z4; | 2071 tmp13 = LEFT_SHIFT(z1 - z3, CONST_BITS) + z4; |
2068 | 2072 |
2069 /* Final output stage */ | 2073 /* Final output stage */ |
2070 | 2074 |
2071 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, | 2075 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, |
2072 » » » » » CONST_BITS+PASS1_BITS+3) | 2076 CONST_BITS+PASS1_BITS+3) |
2073 » » » & RANGE_MASK]; | 2077 & RANGE_MASK]; |
2074 outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, | 2078 outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, |
2075 » » » » » CONST_BITS+PASS1_BITS+3) | 2079 CONST_BITS+PASS1_BITS+3) |
2076 » » » & RANGE_MASK]; | 2080 & RANGE_MASK]; |
2077 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, | 2081 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, |
2078 » » » » » CONST_BITS+PASS1_BITS+3) | 2082 CONST_BITS+PASS1_BITS+3) |
2079 » » » & RANGE_MASK]; | 2083 & RANGE_MASK]; |
2080 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, | 2084 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, |
2081 » » » » » CONST_BITS+PASS1_BITS+3) | 2085 CONST_BITS+PASS1_BITS+3) |
2082 » » » & RANGE_MASK]; | 2086 & RANGE_MASK]; |
2083 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, | 2087 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, |
2084 » » » » » CONST_BITS+PASS1_BITS+3) | 2088 CONST_BITS+PASS1_BITS+3) |
2085 » » » & RANGE_MASK]; | 2089 & RANGE_MASK]; |
2086 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, | 2090 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, |
2087 » » » » » CONST_BITS+PASS1_BITS+3) | 2091 CONST_BITS+PASS1_BITS+3) |
2088 » » » & RANGE_MASK]; | 2092 & RANGE_MASK]; |
2089 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, | 2093 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, |
2090 » » » » » CONST_BITS+PASS1_BITS+3) | 2094 CONST_BITS+PASS1_BITS+3) |
2091 » » » & RANGE_MASK]; | 2095 & RANGE_MASK]; |
2092 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, | 2096 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, |
2093 » » » » » CONST_BITS+PASS1_BITS+3) | 2097 CONST_BITS+PASS1_BITS+3) |
2094 » » » & RANGE_MASK]; | 2098 & RANGE_MASK]; |
2095 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, | 2099 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, |
2096 » » » » » CONST_BITS+PASS1_BITS+3) | 2100 CONST_BITS+PASS1_BITS+3) |
2097 » » » & RANGE_MASK]; | 2101 & RANGE_MASK]; |
2098 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, | 2102 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, |
2099 » » » » » CONST_BITS+PASS1_BITS+3) | 2103 CONST_BITS+PASS1_BITS+3) |
2100 » » » & RANGE_MASK]; | 2104 & RANGE_MASK]; |
2101 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, | 2105 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, |
2102 » » » » » CONST_BITS+PASS1_BITS+3) | 2106 CONST_BITS+PASS1_BITS+3) |
2103 » » » & RANGE_MASK]; | 2107 & RANGE_MASK]; |
2104 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, | 2108 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, |
2105 » » » » » CONST_BITS+PASS1_BITS+3) | 2109 CONST_BITS+PASS1_BITS+3) |
2106 » » » & RANGE_MASK]; | 2110 & RANGE_MASK]; |
2107 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp16, | 2111 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp16, |
2108 » » » » » CONST_BITS+PASS1_BITS+3) | 2112 CONST_BITS+PASS1_BITS+3) |
2109 » » » & RANGE_MASK]; | 2113 & RANGE_MASK]; |
2110 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp16, | 2114 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp16, |
2111 » » » » » CONST_BITS+PASS1_BITS+3) | 2115 CONST_BITS+PASS1_BITS+3) |
2112 » » » & RANGE_MASK]; | 2116 & RANGE_MASK]; |
2113 | 2117 |
2114 wsptr += 8;»» /* advance pointer to next row */ | 2118 wsptr += 8; /* advance pointer to next row */ |
2115 } | 2119 } |
2116 } | 2120 } |
2117 | 2121 |
2118 | 2122 |
2119 /* | 2123 /* |
2120 * Perform dequantization and inverse DCT on one block of coefficients, | 2124 * Perform dequantization and inverse DCT on one block of coefficients, |
2121 * producing a 15x15 output block. | 2125 * producing a 15x15 output block. |
2122 * | 2126 * |
2123 * Optimized algorithm with 22 multiplications in the 1-D kernel. | 2127 * Optimized algorithm with 22 multiplications in the 1-D kernel. |
2124 * cK represents sqrt(2) * cos(K*pi/30). | 2128 * cK represents sqrt(2) * cos(K*pi/30). |
2125 */ | 2129 */ |
2126 | 2130 |
2127 GLOBAL(void) | 2131 GLOBAL(void) |
2128 jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 2132 jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
2129 » » JCOEFPTR coef_block, | 2133 JCOEFPTR coef_block, |
2130 » » JSAMPARRAY output_buf, JDIMENSION output_col) | 2134 JSAMPARRAY output_buf, JDIMENSION output_col) |
2131 { | 2135 { |
2132 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; | 2136 JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; |
2133 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; | 2137 JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; |
2134 INT32 z1, z2, z3, z4; | 2138 JLONG z1, z2, z3, z4; |
2135 JCOEFPTR inptr; | 2139 JCOEFPTR inptr; |
2136 ISLOW_MULT_TYPE * quantptr; | 2140 ISLOW_MULT_TYPE *quantptr; |
2137 int * wsptr; | 2141 int *wsptr; |
2138 JSAMPROW outptr; | 2142 JSAMPROW outptr; |
2139 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 2143 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
2140 int ctr; | 2144 int ctr; |
2141 int workspace[8*15];» /* buffers data between passes */ | 2145 int workspace[8*15]; /* buffers data between passes */ |
2142 SHIFT_TEMPS | 2146 SHIFT_TEMPS |
2143 | 2147 |
2144 /* Pass 1: process columns from input, store into work array. */ | 2148 /* Pass 1: process columns from input, store into work array. */ |
2145 | 2149 |
2146 inptr = coef_block; | 2150 inptr = coef_block; |
2147 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 2151 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
2148 wsptr = workspace; | 2152 wsptr = workspace; |
2149 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { | 2153 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { |
2150 /* Even part */ | 2154 /* Even part */ |
2151 | 2155 |
2152 z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 2156 z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
2153 z1 <<= CONST_BITS; | 2157 z1 = LEFT_SHIFT(z1, CONST_BITS); |
2154 /* Add fudge factor here for final descale. */ | 2158 /* Add fudge factor here for final descale. */ |
2155 z1 += ONE << (CONST_BITS-PASS1_BITS-1); | 2159 z1 += ONE << (CONST_BITS-PASS1_BITS-1); |
2156 | 2160 |
2157 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); | 2161 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); |
2158 z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 2162 z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
2159 z4 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); | 2163 z4 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); |
2160 | 2164 |
2161 tmp10 = MULTIPLY(z4, FIX(0.437016024)); /* c12 */ | 2165 tmp10 = MULTIPLY(z4, FIX(0.437016024)); /* c12 */ |
2162 tmp11 = MULTIPLY(z4, FIX(1.144122806)); /* c6 */ | 2166 tmp11 = MULTIPLY(z4, FIX(1.144122806)); /* c6 */ |
2163 | 2167 |
2164 tmp12 = z1 - tmp10; | 2168 tmp12 = z1 - tmp10; |
2165 tmp13 = z1 + tmp11; | 2169 tmp13 = z1 + tmp11; |
2166 z1 -= (tmp11 - tmp10) << 1; /* c0 = (c6-c12)*2 */ | 2170 z1 -= LEFT_SHIFT(tmp11 - tmp10, 1); /* c0 = (c6-c12)*2 */ |
2167 | 2171 |
2168 z4 = z2 - z3; | 2172 z4 = z2 - z3; |
2169 z3 += z2; | 2173 z3 += z2; |
2170 tmp10 = MULTIPLY(z3, FIX(1.337628990)); /* (c2+c4)/2 */ | 2174 tmp10 = MULTIPLY(z3, FIX(1.337628990)); /* (c2+c4)/2 */ |
2171 tmp11 = MULTIPLY(z4, FIX(0.045680613)); /* (c2-c4)/2 */ | 2175 tmp11 = MULTIPLY(z4, FIX(0.045680613)); /* (c2-c4)/2 */ |
2172 z2 = MULTIPLY(z2, FIX(1.439773946)); /* c4+c14 */ | 2176 z2 = MULTIPLY(z2, FIX(1.439773946)); /* c4+c14 */ |
2173 | 2177 |
2174 tmp20 = tmp13 + tmp10 + tmp11; | 2178 tmp20 = tmp13 + tmp10 + tmp11; |
2175 tmp23 = tmp12 - tmp10 + tmp11 + z2; | 2179 tmp23 = tmp12 - tmp10 + tmp11 + z2; |
2176 | 2180 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2235 | 2239 |
2236 /* Pass 2: process 15 rows from work array, store into output array. */ | 2240 /* Pass 2: process 15 rows from work array, store into output array. */ |
2237 | 2241 |
2238 wsptr = workspace; | 2242 wsptr = workspace; |
2239 for (ctr = 0; ctr < 15; ctr++) { | 2243 for (ctr = 0; ctr < 15; ctr++) { |
2240 outptr = output_buf[ctr] + output_col; | 2244 outptr = output_buf[ctr] + output_col; |
2241 | 2245 |
2242 /* Even part */ | 2246 /* Even part */ |
2243 | 2247 |
2244 /* Add fudge factor here for final descale. */ | 2248 /* Add fudge factor here for final descale. */ |
2245 z1 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 2249 z1 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
2246 z1 <<= CONST_BITS; | 2250 z1 = LEFT_SHIFT(z1, CONST_BITS); |
2247 | 2251 |
2248 z2 = (INT32) wsptr[2]; | 2252 z2 = (JLONG) wsptr[2]; |
2249 z3 = (INT32) wsptr[4]; | 2253 z3 = (JLONG) wsptr[4]; |
2250 z4 = (INT32) wsptr[6]; | 2254 z4 = (JLONG) wsptr[6]; |
2251 | 2255 |
2252 tmp10 = MULTIPLY(z4, FIX(0.437016024)); /* c12 */ | 2256 tmp10 = MULTIPLY(z4, FIX(0.437016024)); /* c12 */ |
2253 tmp11 = MULTIPLY(z4, FIX(1.144122806)); /* c6 */ | 2257 tmp11 = MULTIPLY(z4, FIX(1.144122806)); /* c6 */ |
2254 | 2258 |
2255 tmp12 = z1 - tmp10; | 2259 tmp12 = z1 - tmp10; |
2256 tmp13 = z1 + tmp11; | 2260 tmp13 = z1 + tmp11; |
2257 z1 -= (tmp11 - tmp10) << 1; /* c0 = (c6-c12)*2 */ | 2261 z1 -= LEFT_SHIFT(tmp11 - tmp10, 1); /* c0 = (c6-c12)*2 */ |
2258 | 2262 |
2259 z4 = z2 - z3; | 2263 z4 = z2 - z3; |
2260 z3 += z2; | 2264 z3 += z2; |
2261 tmp10 = MULTIPLY(z3, FIX(1.337628990)); /* (c2+c4)/2 */ | 2265 tmp10 = MULTIPLY(z3, FIX(1.337628990)); /* (c2+c4)/2 */ |
2262 tmp11 = MULTIPLY(z4, FIX(0.045680613)); /* (c2-c4)/2 */ | 2266 tmp11 = MULTIPLY(z4, FIX(0.045680613)); /* (c2-c4)/2 */ |
2263 z2 = MULTIPLY(z2, FIX(1.439773946)); /* c4+c14 */ | 2267 z2 = MULTIPLY(z2, FIX(1.439773946)); /* c4+c14 */ |
2264 | 2268 |
2265 tmp20 = tmp13 + tmp10 + tmp11; | 2269 tmp20 = tmp13 + tmp10 + tmp11; |
2266 tmp23 = tmp12 - tmp10 + tmp11 + z2; | 2270 tmp23 = tmp12 - tmp10 + tmp11 + z2; |
2267 | 2271 |
2268 tmp10 = MULTIPLY(z3, FIX(0.547059574)); /* (c8+c14)/2 */ | 2272 tmp10 = MULTIPLY(z3, FIX(0.547059574)); /* (c8+c14)/2 */ |
2269 tmp11 = MULTIPLY(z4, FIX(0.399234004)); /* (c8-c14)/2 */ | 2273 tmp11 = MULTIPLY(z4, FIX(0.399234004)); /* (c8-c14)/2 */ |
2270 | 2274 |
2271 tmp25 = tmp13 - tmp10 - tmp11; | 2275 tmp25 = tmp13 - tmp10 - tmp11; |
2272 tmp26 = tmp12 + tmp10 - tmp11 - z2; | 2276 tmp26 = tmp12 + tmp10 - tmp11 - z2; |
2273 | 2277 |
2274 tmp10 = MULTIPLY(z3, FIX(0.790569415)); /* (c6+c12)/2 */ | 2278 tmp10 = MULTIPLY(z3, FIX(0.790569415)); /* (c6+c12)/2 */ |
2275 tmp11 = MULTIPLY(z4, FIX(0.353553391)); /* (c6-c12)/2 */ | 2279 tmp11 = MULTIPLY(z4, FIX(0.353553391)); /* (c6-c12)/2 */ |
2276 | 2280 |
2277 tmp21 = tmp12 + tmp10 + tmp11; | 2281 tmp21 = tmp12 + tmp10 + tmp11; |
2278 tmp24 = tmp13 - tmp10 + tmp11; | 2282 tmp24 = tmp13 - tmp10 + tmp11; |
2279 tmp11 += tmp11; | 2283 tmp11 += tmp11; |
2280 tmp22 = z1 + tmp11; /* c10 = c6-c12 */ | 2284 tmp22 = z1 + tmp11; /* c10 = c6-c12 */ |
2281 tmp27 = z1 - tmp11 - tmp11; /* c0 = (c6-c12)*2 */ | 2285 tmp27 = z1 - tmp11 - tmp11; /* c0 = (c6-c12)*2 */ |
2282 | 2286 |
2283 /* Odd part */ | 2287 /* Odd part */ |
2284 | 2288 |
2285 z1 = (INT32) wsptr[1]; | 2289 z1 = (JLONG) wsptr[1]; |
2286 z2 = (INT32) wsptr[3]; | 2290 z2 = (JLONG) wsptr[3]; |
2287 z4 = (INT32) wsptr[5]; | 2291 z4 = (JLONG) wsptr[5]; |
2288 z3 = MULTIPLY(z4, FIX(1.224744871)); /* c5 */ | 2292 z3 = MULTIPLY(z4, FIX(1.224744871)); /* c5 */ |
2289 z4 = (INT32) wsptr[7]; | 2293 z4 = (JLONG) wsptr[7]; |
2290 | 2294 |
2291 tmp13 = z2 - z4; | 2295 tmp13 = z2 - z4; |
2292 tmp15 = MULTIPLY(z1 + tmp13, FIX(0.831253876)); /* c9 */ | 2296 tmp15 = MULTIPLY(z1 + tmp13, FIX(0.831253876)); /* c9 */ |
2293 tmp11 = tmp15 + MULTIPLY(z1, FIX(0.513743148)); /* c3-c9 */ | 2297 tmp11 = tmp15 + MULTIPLY(z1, FIX(0.513743148)); /* c3-c9 */ |
2294 tmp14 = tmp15 - MULTIPLY(tmp13, FIX(2.176250899)); /* c3+c9 */ | 2298 tmp14 = tmp15 - MULTIPLY(tmp13, FIX(2.176250899)); /* c3+c9 */ |
2295 | 2299 |
2296 tmp13 = MULTIPLY(z2, - FIX(0.831253876)); /* -c9 */ | 2300 tmp13 = MULTIPLY(z2, - FIX(0.831253876)); /* -c9 */ |
2297 tmp15 = MULTIPLY(z2, - FIX(1.344997024)); /* -c3 */ | 2301 tmp15 = MULTIPLY(z2, - FIX(1.344997024)); /* -c3 */ |
2298 z2 = z1 - z4; | 2302 z2 = z1 - z4; |
2299 tmp12 = z3 + MULTIPLY(z2, FIX(1.406466353)); /* c1 */ | 2303 tmp12 = z3 + MULTIPLY(z2, FIX(1.406466353)); /* c1 */ |
2300 | 2304 |
2301 tmp10 = tmp12 + MULTIPLY(z4, FIX(2.457431844)) - tmp15; /* c1+c7 */ | 2305 tmp10 = tmp12 + MULTIPLY(z4, FIX(2.457431844)) - tmp15; /* c1+c7 */ |
2302 tmp16 = tmp12 - MULTIPLY(z1, FIX(1.112434820)) + tmp13; /* c1-c13 */ | 2306 tmp16 = tmp12 - MULTIPLY(z1, FIX(1.112434820)) + tmp13; /* c1-c13 */ |
2303 tmp12 = MULTIPLY(z2, FIX(1.224744871)) - z3; /* c5 */ | 2307 tmp12 = MULTIPLY(z2, FIX(1.224744871)) - z3; /* c5 */ |
2304 z2 = MULTIPLY(z1 + z4, FIX(0.575212477)); /* c11 */ | 2308 z2 = MULTIPLY(z1 + z4, FIX(0.575212477)); /* c11 */ |
2305 tmp13 += z2 + MULTIPLY(z1, FIX(0.475753014)) - z3; /* c7-c11 */ | 2309 tmp13 += z2 + MULTIPLY(z1, FIX(0.475753014)) - z3; /* c7-c11 */ |
2306 tmp15 += z2 - MULTIPLY(z4, FIX(0.869244010)) + z3; /* c11+c13 */ | 2310 tmp15 += z2 - MULTIPLY(z4, FIX(0.869244010)) + z3; /* c11+c13 */ |
2307 | 2311 |
2308 /* Final output stage */ | 2312 /* Final output stage */ |
2309 | 2313 |
2310 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, | 2314 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, |
2311 » » » » » CONST_BITS+PASS1_BITS+3) | 2315 CONST_BITS+PASS1_BITS+3) |
2312 » » » & RANGE_MASK]; | 2316 & RANGE_MASK]; |
2313 outptr[14] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, | 2317 outptr[14] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, |
2314 » » » » » CONST_BITS+PASS1_BITS+3) | 2318 CONST_BITS+PASS1_BITS+3) |
2315 » » » & RANGE_MASK]; | 2319 & RANGE_MASK]; |
2316 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, | 2320 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, |
2317 » » » » » CONST_BITS+PASS1_BITS+3) | 2321 CONST_BITS+PASS1_BITS+3) |
2318 » » » & RANGE_MASK]; | 2322 & RANGE_MASK]; |
2319 outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, | 2323 outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, |
2320 » » » » » CONST_BITS+PASS1_BITS+3) | 2324 CONST_BITS+PASS1_BITS+3) |
2321 » » » & RANGE_MASK]; | 2325 & RANGE_MASK]; |
2322 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, | 2326 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, |
2323 » » » » » CONST_BITS+PASS1_BITS+3) | 2327 CONST_BITS+PASS1_BITS+3) |
2324 » » » & RANGE_MASK]; | 2328 & RANGE_MASK]; |
2325 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, | 2329 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, |
2326 » » » » » CONST_BITS+PASS1_BITS+3) | 2330 CONST_BITS+PASS1_BITS+3) |
2327 » » » & RANGE_MASK]; | 2331 & RANGE_MASK]; |
2328 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, | 2332 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, |
2329 » » » » » CONST_BITS+PASS1_BITS+3) | 2333 CONST_BITS+PASS1_BITS+3) |
2330 » » » & RANGE_MASK]; | 2334 & RANGE_MASK]; |
2331 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, | 2335 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, |
2332 » » » » » CONST_BITS+PASS1_BITS+3) | 2336 CONST_BITS+PASS1_BITS+3) |
2333 » » » & RANGE_MASK]; | 2337 & RANGE_MASK]; |
2334 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, | 2338 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, |
2335 » » » » » CONST_BITS+PASS1_BITS+3) | 2339 CONST_BITS+PASS1_BITS+3) |
2336 » » » & RANGE_MASK]; | 2340 & RANGE_MASK]; |
2337 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, | 2341 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, |
2338 » » » » » CONST_BITS+PASS1_BITS+3) | 2342 CONST_BITS+PASS1_BITS+3) |
2339 » » » & RANGE_MASK]; | 2343 & RANGE_MASK]; |
2340 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, | 2344 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, |
2341 » » » » » CONST_BITS+PASS1_BITS+3) | 2345 CONST_BITS+PASS1_BITS+3) |
2342 » » » & RANGE_MASK]; | 2346 & RANGE_MASK]; |
2343 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, | 2347 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, |
2344 » » » » » CONST_BITS+PASS1_BITS+3) | 2348 CONST_BITS+PASS1_BITS+3) |
2345 » » » & RANGE_MASK]; | 2349 & RANGE_MASK]; |
2346 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp16, | 2350 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp16, |
2347 » » » » » CONST_BITS+PASS1_BITS+3) | 2351 CONST_BITS+PASS1_BITS+3) |
2348 » » » & RANGE_MASK]; | 2352 & RANGE_MASK]; |
2349 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp16, | 2353 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp16, |
2350 » » » » » CONST_BITS+PASS1_BITS+3) | 2354 CONST_BITS+PASS1_BITS+3) |
2351 » » » & RANGE_MASK]; | 2355 & RANGE_MASK]; |
2352 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp27, | 2356 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp27, |
2353 » » » » » CONST_BITS+PASS1_BITS+3) | 2357 CONST_BITS+PASS1_BITS+3) |
2354 » » » & RANGE_MASK]; | 2358 & RANGE_MASK]; |
2355 | 2359 |
2356 wsptr += 8;»» /* advance pointer to next row */ | 2360 wsptr += 8; /* advance pointer to next row */ |
2357 } | 2361 } |
2358 } | 2362 } |
2359 | 2363 |
2360 | 2364 |
2361 /* | 2365 /* |
2362 * Perform dequantization and inverse DCT on one block of coefficients, | 2366 * Perform dequantization and inverse DCT on one block of coefficients, |
2363 * producing a 16x16 output block. | 2367 * producing a 16x16 output block. |
2364 * | 2368 * |
2365 * Optimized algorithm with 28 multiplications in the 1-D kernel. | 2369 * Optimized algorithm with 28 multiplications in the 1-D kernel. |
2366 * cK represents sqrt(2) * cos(K*pi/32). | 2370 * cK represents sqrt(2) * cos(K*pi/32). |
2367 */ | 2371 */ |
2368 | 2372 |
2369 GLOBAL(void) | 2373 GLOBAL(void) |
2370 jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 2374 jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr, |
2371 » » JCOEFPTR coef_block, | 2375 JCOEFPTR coef_block, |
2372 » » JSAMPARRAY output_buf, JDIMENSION output_col) | 2376 JSAMPARRAY output_buf, JDIMENSION output_col) |
2373 { | 2377 { |
2374 INT32 tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13; | 2378 JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13; |
2375 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; | 2379 JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; |
2376 INT32 z1, z2, z3, z4; | 2380 JLONG z1, z2, z3, z4; |
2377 JCOEFPTR inptr; | 2381 JCOEFPTR inptr; |
2378 ISLOW_MULT_TYPE * quantptr; | 2382 ISLOW_MULT_TYPE *quantptr; |
2379 int * wsptr; | 2383 int *wsptr; |
2380 JSAMPROW outptr; | 2384 JSAMPROW outptr; |
2381 JSAMPLE *range_limit = IDCT_range_limit(cinfo); | 2385 JSAMPLE *range_limit = IDCT_range_limit(cinfo); |
2382 int ctr; | 2386 int ctr; |
2383 int workspace[8*16];» /* buffers data between passes */ | 2387 int workspace[8*16]; /* buffers data between passes */ |
2384 SHIFT_TEMPS | 2388 SHIFT_TEMPS |
2385 | 2389 |
2386 /* Pass 1: process columns from input, store into work array. */ | 2390 /* Pass 1: process columns from input, store into work array. */ |
2387 | 2391 |
2388 inptr = coef_block; | 2392 inptr = coef_block; |
2389 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; | 2393 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; |
2390 wsptr = workspace; | 2394 wsptr = workspace; |
2391 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { | 2395 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { |
2392 /* Even part */ | 2396 /* Even part */ |
2393 | 2397 |
2394 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); | 2398 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); |
2395 tmp0 <<= CONST_BITS; | 2399 tmp0 = LEFT_SHIFT(tmp0, CONST_BITS); |
2396 /* Add fudge factor here for final descale. */ | 2400 /* Add fudge factor here for final descale. */ |
2397 tmp0 += 1 << (CONST_BITS-PASS1_BITS-1); | 2401 tmp0 += 1 << (CONST_BITS-PASS1_BITS-1); |
2398 | 2402 |
2399 z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); | 2403 z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); |
2400 tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */ | 2404 tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */ |
2401 tmp2 = MULTIPLY(z1, FIX_0_541196100); /* c12[16] = c6[8] */ | 2405 tmp2 = MULTIPLY(z1, FIX_0_541196100); /* c12[16] = c6[8] */ |
2402 | 2406 |
2403 tmp10 = tmp0 + tmp1; | 2407 tmp10 = tmp0 + tmp1; |
2404 tmp11 = tmp0 - tmp1; | 2408 tmp11 = tmp0 - tmp1; |
2405 tmp12 = tmp0 + tmp2; | 2409 tmp12 = tmp0 + tmp2; |
(...skipping 28 matching lines...) Expand all Loading... |
2434 | 2438 |
2435 tmp11 = z1 + z3; | 2439 tmp11 = z1 + z3; |
2436 | 2440 |
2437 tmp1 = MULTIPLY(z1 + z2, FIX(1.353318001)); /* c3 */ | 2441 tmp1 = MULTIPLY(z1 + z2, FIX(1.353318001)); /* c3 */ |
2438 tmp2 = MULTIPLY(tmp11, FIX(1.247225013)); /* c5 */ | 2442 tmp2 = MULTIPLY(tmp11, FIX(1.247225013)); /* c5 */ |
2439 tmp3 = MULTIPLY(z1 + z4, FIX(1.093201867)); /* c7 */ | 2443 tmp3 = MULTIPLY(z1 + z4, FIX(1.093201867)); /* c7 */ |
2440 tmp10 = MULTIPLY(z1 - z4, FIX(0.897167586)); /* c9 */ | 2444 tmp10 = MULTIPLY(z1 - z4, FIX(0.897167586)); /* c9 */ |
2441 tmp11 = MULTIPLY(tmp11, FIX(0.666655658)); /* c11 */ | 2445 tmp11 = MULTIPLY(tmp11, FIX(0.666655658)); /* c11 */ |
2442 tmp12 = MULTIPLY(z1 - z2, FIX(0.410524528)); /* c13 */ | 2446 tmp12 = MULTIPLY(z1 - z2, FIX(0.410524528)); /* c13 */ |
2443 tmp0 = tmp1 + tmp2 + tmp3 - | 2447 tmp0 = tmp1 + tmp2 + tmp3 - |
2444 » MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ | 2448 MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ |
2445 tmp13 = tmp10 + tmp11 + tmp12 - | 2449 tmp13 = tmp10 + tmp11 + tmp12 - |
2446 » MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ | 2450 MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ |
2447 z1 = MULTIPLY(z2 + z3, FIX(0.138617169)); /* c15 */ | 2451 z1 = MULTIPLY(z2 + z3, FIX(0.138617169)); /* c15 */ |
2448 tmp1 += z1 + MULTIPLY(z2, FIX(0.071888074)); /* c9+c11-c3-c15 */ | 2452 tmp1 += z1 + MULTIPLY(z2, FIX(0.071888074)); /* c9+c11-c3-c15 */ |
2449 tmp2 += z1 - MULTIPLY(z3, FIX(1.125726048)); /* c5+c7+c15-c3 */ | 2453 tmp2 += z1 - MULTIPLY(z3, FIX(1.125726048)); /* c5+c7+c15-c3 */ |
2450 z1 = MULTIPLY(z3 - z2, FIX(1.407403738)); /* c1 */ | 2454 z1 = MULTIPLY(z3 - z2, FIX(1.407403738)); /* c1 */ |
2451 tmp11 += z1 - MULTIPLY(z3, FIX(0.766367282)); /* c1+c11-c9-c13 */ | 2455 tmp11 += z1 - MULTIPLY(z3, FIX(0.766367282)); /* c1+c11-c9-c13 */ |
2452 tmp12 += z1 + MULTIPLY(z2, FIX(1.971951411)); /* c1+c5+c13-c7 */ | 2456 tmp12 += z1 + MULTIPLY(z2, FIX(1.971951411)); /* c1+c5+c13-c7 */ |
2453 z2 += z4; | 2457 z2 += z4; |
2454 z1 = MULTIPLY(z2, - FIX(0.666655658)); /* -c11 */ | 2458 z1 = MULTIPLY(z2, - FIX(0.666655658)); /* -c11 */ |
2455 tmp1 += z1; | 2459 tmp1 += z1; |
2456 tmp3 += z1 + MULTIPLY(z4, FIX(1.065388962)); /* c3+c11+c15-c7 */ | 2460 tmp3 += z1 + MULTIPLY(z4, FIX(1.065388962)); /* c3+c11+c15-c7 */ |
(...skipping 29 matching lines...) Expand all Loading... |
2486 | 2490 |
2487 /* Pass 2: process 16 rows from work array, store into output array. */ | 2491 /* Pass 2: process 16 rows from work array, store into output array. */ |
2488 | 2492 |
2489 wsptr = workspace; | 2493 wsptr = workspace; |
2490 for (ctr = 0; ctr < 16; ctr++) { | 2494 for (ctr = 0; ctr < 16; ctr++) { |
2491 outptr = output_buf[ctr] + output_col; | 2495 outptr = output_buf[ctr] + output_col; |
2492 | 2496 |
2493 /* Even part */ | 2497 /* Even part */ |
2494 | 2498 |
2495 /* Add fudge factor here for final descale. */ | 2499 /* Add fudge factor here for final descale. */ |
2496 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); | 2500 tmp0 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2)); |
2497 tmp0 <<= CONST_BITS; | 2501 tmp0 = LEFT_SHIFT(tmp0, CONST_BITS); |
2498 | 2502 |
2499 z1 = (INT32) wsptr[4]; | 2503 z1 = (JLONG) wsptr[4]; |
2500 tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */ | 2504 tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */ |
2501 tmp2 = MULTIPLY(z1, FIX_0_541196100); /* c12[16] = c6[8] */ | 2505 tmp2 = MULTIPLY(z1, FIX_0_541196100); /* c12[16] = c6[8] */ |
2502 | 2506 |
2503 tmp10 = tmp0 + tmp1; | 2507 tmp10 = tmp0 + tmp1; |
2504 tmp11 = tmp0 - tmp1; | 2508 tmp11 = tmp0 - tmp1; |
2505 tmp12 = tmp0 + tmp2; | 2509 tmp12 = tmp0 + tmp2; |
2506 tmp13 = tmp0 - tmp2; | 2510 tmp13 = tmp0 - tmp2; |
2507 | 2511 |
2508 z1 = (INT32) wsptr[2]; | 2512 z1 = (JLONG) wsptr[2]; |
2509 z2 = (INT32) wsptr[6]; | 2513 z2 = (JLONG) wsptr[6]; |
2510 z3 = z1 - z2; | 2514 z3 = z1 - z2; |
2511 z4 = MULTIPLY(z3, FIX(0.275899379)); /* c14[16] = c7[8] */ | 2515 z4 = MULTIPLY(z3, FIX(0.275899379)); /* c14[16] = c7[8] */ |
2512 z3 = MULTIPLY(z3, FIX(1.387039845)); /* c2[16] = c1[8] */ | 2516 z3 = MULTIPLY(z3, FIX(1.387039845)); /* c2[16] = c1[8] */ |
2513 | 2517 |
2514 tmp0 = z3 + MULTIPLY(z2, FIX_2_562915447); /* (c6+c2)[16] = (c3+c1)[8] */ | 2518 tmp0 = z3 + MULTIPLY(z2, FIX_2_562915447); /* (c6+c2)[16] = (c3+c1)[8] */ |
2515 tmp1 = z4 + MULTIPLY(z1, FIX_0_899976223); /* (c6-c14)[16] = (c3-c7)[8] */ | 2519 tmp1 = z4 + MULTIPLY(z1, FIX_0_899976223); /* (c6-c14)[16] = (c3-c7)[8] */ |
2516 tmp2 = z3 - MULTIPLY(z1, FIX(0.601344887)); /* (c2-c10)[16] = (c1-c5)[8] */ | 2520 tmp2 = z3 - MULTIPLY(z1, FIX(0.601344887)); /* (c2-c10)[16] = (c1-c5)[8] */ |
2517 tmp3 = z4 - MULTIPLY(z2, FIX(0.509795579)); /* (c10-c14)[16] = (c5-c7)[8] */ | 2521 tmp3 = z4 - MULTIPLY(z2, FIX(0.509795579)); /* (c10-c14)[16] = (c5-c7)[8] */ |
2518 | 2522 |
2519 tmp20 = tmp10 + tmp0; | 2523 tmp20 = tmp10 + tmp0; |
2520 tmp27 = tmp10 - tmp0; | 2524 tmp27 = tmp10 - tmp0; |
2521 tmp21 = tmp12 + tmp1; | 2525 tmp21 = tmp12 + tmp1; |
2522 tmp26 = tmp12 - tmp1; | 2526 tmp26 = tmp12 - tmp1; |
2523 tmp22 = tmp13 + tmp2; | 2527 tmp22 = tmp13 + tmp2; |
2524 tmp25 = tmp13 - tmp2; | 2528 tmp25 = tmp13 - tmp2; |
2525 tmp23 = tmp11 + tmp3; | 2529 tmp23 = tmp11 + tmp3; |
2526 tmp24 = tmp11 - tmp3; | 2530 tmp24 = tmp11 - tmp3; |
2527 | 2531 |
2528 /* Odd part */ | 2532 /* Odd part */ |
2529 | 2533 |
2530 z1 = (INT32) wsptr[1]; | 2534 z1 = (JLONG) wsptr[1]; |
2531 z2 = (INT32) wsptr[3]; | 2535 z2 = (JLONG) wsptr[3]; |
2532 z3 = (INT32) wsptr[5]; | 2536 z3 = (JLONG) wsptr[5]; |
2533 z4 = (INT32) wsptr[7]; | 2537 z4 = (JLONG) wsptr[7]; |
2534 | 2538 |
2535 tmp11 = z1 + z3; | 2539 tmp11 = z1 + z3; |
2536 | 2540 |
2537 tmp1 = MULTIPLY(z1 + z2, FIX(1.353318001)); /* c3 */ | 2541 tmp1 = MULTIPLY(z1 + z2, FIX(1.353318001)); /* c3 */ |
2538 tmp2 = MULTIPLY(tmp11, FIX(1.247225013)); /* c5 */ | 2542 tmp2 = MULTIPLY(tmp11, FIX(1.247225013)); /* c5 */ |
2539 tmp3 = MULTIPLY(z1 + z4, FIX(1.093201867)); /* c7 */ | 2543 tmp3 = MULTIPLY(z1 + z4, FIX(1.093201867)); /* c7 */ |
2540 tmp10 = MULTIPLY(z1 - z4, FIX(0.897167586)); /* c9 */ | 2544 tmp10 = MULTIPLY(z1 - z4, FIX(0.897167586)); /* c9 */ |
2541 tmp11 = MULTIPLY(tmp11, FIX(0.666655658)); /* c11 */ | 2545 tmp11 = MULTIPLY(tmp11, FIX(0.666655658)); /* c11 */ |
2542 tmp12 = MULTIPLY(z1 - z2, FIX(0.410524528)); /* c13 */ | 2546 tmp12 = MULTIPLY(z1 - z2, FIX(0.410524528)); /* c13 */ |
2543 tmp0 = tmp1 + tmp2 + tmp3 - | 2547 tmp0 = tmp1 + tmp2 + tmp3 - |
2544 » MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ | 2548 MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ |
2545 tmp13 = tmp10 + tmp11 + tmp12 - | 2549 tmp13 = tmp10 + tmp11 + tmp12 - |
2546 » MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ | 2550 MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ |
2547 z1 = MULTIPLY(z2 + z3, FIX(0.138617169)); /* c15 */ | 2551 z1 = MULTIPLY(z2 + z3, FIX(0.138617169)); /* c15 */ |
2548 tmp1 += z1 + MULTIPLY(z2, FIX(0.071888074)); /* c9+c11-c3-c15 */ | 2552 tmp1 += z1 + MULTIPLY(z2, FIX(0.071888074)); /* c9+c11-c3-c15 */ |
2549 tmp2 += z1 - MULTIPLY(z3, FIX(1.125726048)); /* c5+c7+c15-c3 */ | 2553 tmp2 += z1 - MULTIPLY(z3, FIX(1.125726048)); /* c5+c7+c15-c3 */ |
2550 z1 = MULTIPLY(z3 - z2, FIX(1.407403738)); /* c1 */ | 2554 z1 = MULTIPLY(z3 - z2, FIX(1.407403738)); /* c1 */ |
2551 tmp11 += z1 - MULTIPLY(z3, FIX(0.766367282)); /* c1+c11-c9-c13 */ | 2555 tmp11 += z1 - MULTIPLY(z3, FIX(0.766367282)); /* c1+c11-c9-c13 */ |
2552 tmp12 += z1 + MULTIPLY(z2, FIX(1.971951411)); /* c1+c5+c13-c7 */ | 2556 tmp12 += z1 + MULTIPLY(z2, FIX(1.971951411)); /* c1+c5+c13-c7 */ |
2553 z2 += z4; | 2557 z2 += z4; |
2554 z1 = MULTIPLY(z2, - FIX(0.666655658)); /* -c11 */ | 2558 z1 = MULTIPLY(z2, - FIX(0.666655658)); /* -c11 */ |
2555 tmp1 += z1; | 2559 tmp1 += z1; |
2556 tmp3 += z1 + MULTIPLY(z4, FIX(1.065388962)); /* c3+c11+c15-c7 */ | 2560 tmp3 += z1 + MULTIPLY(z4, FIX(1.065388962)); /* c3+c11+c15-c7 */ |
2557 z2 = MULTIPLY(z2, - FIX(1.247225013)); /* -c5 */ | 2561 z2 = MULTIPLY(z2, - FIX(1.247225013)); /* -c5 */ |
2558 tmp10 += z2 + MULTIPLY(z4, FIX(3.141271809)); /* c1+c5+c9-c13 */ | 2562 tmp10 += z2 + MULTIPLY(z4, FIX(3.141271809)); /* c1+c5+c9-c13 */ |
2559 tmp12 += z2; | 2563 tmp12 += z2; |
2560 z2 = MULTIPLY(z3 + z4, - FIX(1.353318001)); /* -c3 */ | 2564 z2 = MULTIPLY(z3 + z4, - FIX(1.353318001)); /* -c3 */ |
2561 tmp2 += z2; | 2565 tmp2 += z2; |
2562 tmp3 += z2; | 2566 tmp3 += z2; |
2563 z2 = MULTIPLY(z4 - z3, FIX(0.410524528)); /* c13 */ | 2567 z2 = MULTIPLY(z4 - z3, FIX(0.410524528)); /* c13 */ |
2564 tmp10 += z2; | 2568 tmp10 += z2; |
2565 tmp11 += z2; | 2569 tmp11 += z2; |
2566 | 2570 |
2567 /* Final output stage */ | 2571 /* Final output stage */ |
2568 | 2572 |
2569 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp0, | 2573 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp0, |
2570 » » » » » CONST_BITS+PASS1_BITS+3) | 2574 CONST_BITS+PASS1_BITS+3) |
2571 » » » & RANGE_MASK]; | 2575 & RANGE_MASK]; |
2572 outptr[15] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp0, | 2576 outptr[15] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp0, |
2573 » » » » » CONST_BITS+PASS1_BITS+3) | 2577 CONST_BITS+PASS1_BITS+3) |
2574 » » » & RANGE_MASK]; | 2578 & RANGE_MASK]; |
2575 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp1, | 2579 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp1, |
2576 » » » » » CONST_BITS+PASS1_BITS+3) | 2580 CONST_BITS+PASS1_BITS+3) |
2577 » » » & RANGE_MASK]; | 2581 & RANGE_MASK]; |
2578 outptr[14] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp1, | 2582 outptr[14] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp1, |
2579 » » » » » CONST_BITS+PASS1_BITS+3) | 2583 CONST_BITS+PASS1_BITS+3) |
2580 » » » & RANGE_MASK]; | 2584 & RANGE_MASK]; |
2581 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp2, | 2585 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp2, |
2582 » » » » » CONST_BITS+PASS1_BITS+3) | 2586 CONST_BITS+PASS1_BITS+3) |
2583 » » » & RANGE_MASK]; | 2587 & RANGE_MASK]; |
2584 outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp2, | 2588 outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp2, |
2585 » » » » » CONST_BITS+PASS1_BITS+3) | 2589 CONST_BITS+PASS1_BITS+3) |
2586 » » » & RANGE_MASK]; | 2590 & RANGE_MASK]; |
2587 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp3, | 2591 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp3, |
2588 » » » » » CONST_BITS+PASS1_BITS+3) | 2592 CONST_BITS+PASS1_BITS+3) |
2589 » » » & RANGE_MASK]; | 2593 & RANGE_MASK]; |
2590 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp3, | 2594 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp3, |
2591 » » » » » CONST_BITS+PASS1_BITS+3) | 2595 CONST_BITS+PASS1_BITS+3) |
2592 » » » & RANGE_MASK]; | 2596 & RANGE_MASK]; |
2593 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp10, | 2597 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp10, |
2594 » » » » » CONST_BITS+PASS1_BITS+3) | 2598 CONST_BITS+PASS1_BITS+3) |
2595 » » » & RANGE_MASK]; | 2599 & RANGE_MASK]; |
2596 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp10, | 2600 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp10, |
2597 » » » » » CONST_BITS+PASS1_BITS+3) | 2601 CONST_BITS+PASS1_BITS+3) |
2598 » » » & RANGE_MASK]; | 2602 & RANGE_MASK]; |
2599 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp11, | 2603 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp11, |
2600 » » » » » CONST_BITS+PASS1_BITS+3) | 2604 CONST_BITS+PASS1_BITS+3) |
2601 » » » & RANGE_MASK]; | 2605 & RANGE_MASK]; |
2602 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp11, | 2606 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp11, |
2603 » » » » » CONST_BITS+PASS1_BITS+3) | 2607 CONST_BITS+PASS1_BITS+3) |
2604 » » » & RANGE_MASK]; | 2608 & RANGE_MASK]; |
2605 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp12, | 2609 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp12, |
2606 » » » » » CONST_BITS+PASS1_BITS+3) | 2610 CONST_BITS+PASS1_BITS+3) |
2607 » » » & RANGE_MASK]; | 2611 & RANGE_MASK]; |
2608 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp12, | 2612 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp12, |
2609 » » » » » CONST_BITS+PASS1_BITS+3) | 2613 CONST_BITS+PASS1_BITS+3) |
2610 » » » & RANGE_MASK]; | 2614 & RANGE_MASK]; |
2611 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp27 + tmp13, | 2615 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp27 + tmp13, |
2612 » » » » » CONST_BITS+PASS1_BITS+3) | 2616 CONST_BITS+PASS1_BITS+3) |
2613 » » » & RANGE_MASK]; | 2617 & RANGE_MASK]; |
2614 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp27 - tmp13, | 2618 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp27 - tmp13, |
2615 » » » » » CONST_BITS+PASS1_BITS+3) | 2619 CONST_BITS+PASS1_BITS+3) |
2616 » » » & RANGE_MASK]; | 2620 & RANGE_MASK]; |
2617 | 2621 |
2618 wsptr += 8;»» /* advance pointer to next row */ | 2622 wsptr += 8; /* advance pointer to next row */ |
2619 } | 2623 } |
2620 } | 2624 } |
2621 | 2625 |
2622 #endif /* IDCT_SCALING_SUPPORTED */ | 2626 #endif /* IDCT_SCALING_SUPPORTED */ |
2623 #endif /* DCT_ISLOW_SUPPORTED */ | 2627 #endif /* DCT_ISLOW_SUPPORTED */ |
OLD | NEW |