23 #define JPEG_INTERNALS
28 #ifdef IDCT_SCALING_SUPPORTED
36 Sorry,
this code only copes with 8x8 DCTs.
42 #if BITS_IN_JSAMPLE == 8
58 #define FIX_0_211164243 ((INT32) 1730)
59 #define FIX_0_509795579 ((INT32) 4176)
60 #define FIX_0_601344887 ((INT32) 4926)
61 #define FIX_0_720959822 ((INT32) 5906)
62 #define FIX_0_765366865 ((INT32) 6270)
63 #define FIX_0_850430095 ((INT32) 6967)
64 #define FIX_0_899976223 ((INT32) 7373)
65 #define FIX_1_061594337 ((INT32) 8697)
66 #define FIX_1_272758580 ((INT32) 10426)
67 #define FIX_1_451774981 ((INT32) 11893)
68 #define FIX_1_847759065 ((INT32) 15137)
69 #define FIX_2_172734803 ((INT32) 17799)
70 #define FIX_2_562915447 ((INT32) 20995)
71 #define FIX_3_624509785 ((INT32) 29692)
73 #define FIX_0_211164243 FIX(0.211164243)
74 #define FIX_0_509795579 FIX(0.509795579)
75 #define FIX_0_601344887 FIX(0.601344887)
76 #define FIX_0_720959822 FIX(0.720959822)
77 #define FIX_0_765366865 FIX(0.765366865)
78 #define FIX_0_850430095 FIX(0.850430095)
79 #define FIX_0_899976223 FIX(0.899976223)
80 #define FIX_1_061594337 FIX(1.061594337)
81 #define FIX_1_272758580 FIX(1.272758580)
82 #define FIX_1_451774981 FIX(1.451774981)
83 #define FIX_1_847759065 FIX(1.847759065)
84 #define FIX_2_172734803 FIX(2.172734803)
85 #define FIX_2_562915447 FIX(2.562915447)
86 #define FIX_3_624509785 FIX(3.624509785)
97 #if BITS_IN_JSAMPLE == 8
98 #define MULTIPLY(var,const) MULTIPLY16C16(var,const)
100 #define MULTIPLY(var,const) ((var) * (const))
109 #define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval))
122 INT32 tmp0, tmp2, tmp10, tmp12;
123 INT32 z1, z2, z3, z4;
138 for (ctr =
DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
145 int dcval =
DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
147 wsptr[DCTSIZE*0] = dcval;
148 wsptr[DCTSIZE*1] = dcval;
149 wsptr[DCTSIZE*2] = dcval;
150 wsptr[DCTSIZE*3] = dcval;
157 tmp0 =
DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
158 tmp0 <<= (CONST_BITS+1);
160 z2 =
DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
161 z3 =
DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
163 tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865);
170 z1 =
DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
171 z2 =
DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
172 z3 =
DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
173 z4 =
DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
175 tmp0 = MULTIPLY(z1, - FIX_0_211164243)
176 + MULTIPLY(z2, FIX_1_451774981)
177 + MULTIPLY(z3, - FIX_2_172734803)
178 + MULTIPLY(z4, FIX_1_061594337);
180 tmp2 = MULTIPLY(z1, - FIX_0_509795579)
181 + MULTIPLY(z2, - FIX_0_601344887)
182 + MULTIPLY(z3, FIX_0_899976223)
183 + MULTIPLY(z4, FIX_2_562915447);
187 wsptr[DCTSIZE*0] = (
int)
DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1);
188 wsptr[DCTSIZE*3] = (
int)
DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1);
189 wsptr[DCTSIZE*1] = (
int)
DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1);
190 wsptr[DCTSIZE*2] = (
int)
DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1);
196 for (ctr = 0; ctr < 4; ctr++) {
197 outptr = output_buf[ctr] + output_col;
200 #ifndef NO_ZERO_ROW_TEST
201 if ((wsptr[1] | wsptr[2] | wsptr[3] | wsptr[5] | wsptr[6] |
219 tmp0 = ((
INT32) wsptr[0]) << (CONST_BITS+1);
221 tmp2 = MULTIPLY((
INT32) wsptr[2], FIX_1_847759065)
222 + MULTIPLY((
INT32) wsptr[6], - FIX_0_765366865);
229 z1 = (
INT32) wsptr[7];
230 z2 = (
INT32) wsptr[5];
231 z3 = (
INT32) wsptr[3];
232 z4 = (
INT32) wsptr[1];
234 tmp0 = MULTIPLY(z1, - FIX_0_211164243)
235 + MULTIPLY(z2, FIX_1_451774981)
236 + MULTIPLY(z3, - FIX_2_172734803)
237 + MULTIPLY(z4, FIX_1_061594337);
239 tmp2 = MULTIPLY(z1, - FIX_0_509795579)
240 + MULTIPLY(z2, - FIX_0_601344887)
241 + MULTIPLY(z3, FIX_0_899976223)
242 + MULTIPLY(z4, FIX_2_562915447);
246 outptr[0] = range_limit[(
int)
DESCALE(tmp10 + tmp2,
247 CONST_BITS+PASS1_BITS+3+1)
249 outptr[3] = range_limit[(
int)
DESCALE(tmp10 - tmp2,
250 CONST_BITS+PASS1_BITS+3+1)
252 outptr[1] = range_limit[(
int)
DESCALE(tmp12 + tmp0,
253 CONST_BITS+PASS1_BITS+3+1)
255 outptr[2] = range_limit[(
int)
DESCALE(tmp12 - tmp0,
256 CONST_BITS+PASS1_BITS+3+1)
274 INT32 tmp0, tmp10, z1;
289 for (ctr =
DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
296 int dcval =
DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
298 wsptr[DCTSIZE*0] = dcval;
299 wsptr[DCTSIZE*1] = dcval;
306 z1 =
DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
307 tmp10 = z1 << (CONST_BITS+2);
311 z1 =
DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
312 tmp0 = MULTIPLY(z1, - FIX_0_720959822);
313 z1 =
DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
314 tmp0 += MULTIPLY(z1, FIX_0_850430095);
315 z1 =
DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
316 tmp0 += MULTIPLY(z1, - FIX_1_272758580);
317 z1 =
DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
318 tmp0 += MULTIPLY(z1, FIX_3_624509785);
322 wsptr[DCTSIZE*0] = (
int)
DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2);
323 wsptr[DCTSIZE*1] = (
int)
DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2);
329 for (ctr = 0; ctr < 2; ctr++) {
330 outptr = output_buf[ctr] + output_col;
333 #ifndef NO_ZERO_ROW_TEST
334 if ((wsptr[1] | wsptr[3] | wsptr[5] | wsptr[7]) == 0) {
349 tmp10 = ((
INT32) wsptr[0]) << (CONST_BITS+2);
353 tmp0 = MULTIPLY((
INT32) wsptr[7], - FIX_0_720959822)
354 + MULTIPLY((
INT32) wsptr[5], FIX_0_850430095)
355 + MULTIPLY((
INT32) wsptr[3], - FIX_1_272758580)
356 + MULTIPLY((
INT32) wsptr[1], FIX_3_624509785);
360 outptr[0] = range_limit[(
int)
DESCALE(tmp10 + tmp0,
361 CONST_BITS+PASS1_BITS+3+2)
363 outptr[1] = range_limit[(
int)
DESCALE(tmp10 - tmp0,
364 CONST_BITS+PASS1_BITS+3+2)
391 dcval =
DEQUANTIZE(coef_block[0], quantptr[0]);
394 output_buf[0][output_col] = range_limit[dcval &
RANGE_MASK];
#define IDCT_range_limit(cinfo)
MULTIPLIER ISLOW_MULT_TYPE
#define DEQUANTIZE(coef, quantval)