35 #define JPEG_INTERNALS
40 #ifdef DCT_IFAST_SUPPORTED
48 Sorry,
this code only copes with 8x8 DCTs.
76 #if BITS_IN_JSAMPLE == 8
92 #define FIX_1_082392200 ((INT32) 277)
93 #define FIX_1_414213562 ((INT32) 362)
94 #define FIX_1_847759065 ((INT32) 473)
95 #define FIX_2_613125930 ((INT32) 669)
97 #define FIX_1_082392200 FIX(1.082392200)
98 #define FIX_1_414213562 FIX(1.414213562)
99 #define FIX_1_847759065 FIX(1.847759065)
100 #define FIX_2_613125930 FIX(2.613125930)
109 #ifndef USE_ACCURATE_ROUNDING
111 #define DESCALE(x,n) RIGHT_SHIFT(x, n)
119 #define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS))
128 #if BITS_IN_JSAMPLE == 8
129 #define DEQUANTIZE(coef,quantval) (((IFAST_MULT_TYPE) (coef)) * (quantval))
131 #define DEQUANTIZE(coef,quantval) \
132 DESCALE((coef)*(quantval), IFAST_SCALE_BITS-PASS1_BITS)
140 #ifdef RIGHT_SHIFT_IS_UNSIGNED
141 #define ISHIFT_TEMPS DCTELEM ishift_temp;
142 #if BITS_IN_JSAMPLE == 8
143 #define DCTELEMBITS 16
145 #define DCTELEMBITS 32
147 #define IRIGHT_SHIFT(x,shft) \
148 ((ishift_temp = (x)) < 0 ? \
149 (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \
150 (ishift_temp >> (shft)))
153 #define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
156 #ifdef USE_ACCURATE_ROUNDING
157 #define IDESCALE(x,n) ((int) IRIGHT_SHIFT((x) + (1 << ((n)-1)), n))
159 #define IDESCALE(x,n) ((int) IRIGHT_SHIFT(x, n))
172 DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
173 DCTELEM tmp10, tmp11, tmp12, tmp13;
174 DCTELEM z5, z10, z11, z12, z13;
190 for (ctr =
DCTSIZE; ctr > 0; ctr--) {
204 int dcval = (
int)
DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
206 wsptr[DCTSIZE*0] = dcval;
207 wsptr[DCTSIZE*1] = dcval;
208 wsptr[DCTSIZE*2] = dcval;
209 wsptr[DCTSIZE*3] = dcval;
210 wsptr[DCTSIZE*4] = dcval;
211 wsptr[DCTSIZE*5] = dcval;
212 wsptr[DCTSIZE*6] = dcval;
213 wsptr[DCTSIZE*7] = dcval;
223 tmp0 =
DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
224 tmp1 =
DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
225 tmp2 =
DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
226 tmp3 =
DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
232 tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13;
234 tmp0 = tmp10 + tmp13;
235 tmp3 = tmp10 - tmp13;
236 tmp1 = tmp11 + tmp12;
237 tmp2 = tmp11 - tmp12;
241 tmp4 =
DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
242 tmp5 =
DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
243 tmp6 =
DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
244 tmp7 =
DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
252 tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
254 z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
255 tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
256 tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
262 wsptr[DCTSIZE*0] = (
int) (tmp0 + tmp7);
263 wsptr[DCTSIZE*7] = (
int) (tmp0 - tmp7);
264 wsptr[DCTSIZE*1] = (
int) (tmp1 + tmp6);
265 wsptr[DCTSIZE*6] = (
int) (tmp1 - tmp6);
266 wsptr[DCTSIZE*2] = (
int) (tmp2 + tmp5);
267 wsptr[DCTSIZE*5] = (
int) (tmp2 - tmp5);
268 wsptr[DCTSIZE*4] = (
int) (tmp3 + tmp4);
269 wsptr[DCTSIZE*3] = (
int) (tmp3 - tmp4);
281 for (ctr = 0; ctr <
DCTSIZE; ctr++) {
282 outptr = output_buf[ctr] + output_col;
291 #ifndef NO_ZERO_ROW_TEST
292 if ((wsptr[1] | wsptr[2] | wsptr[3] | wsptr[4] | wsptr[5] | wsptr[6] |
295 JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3)
318 tmp12 = MULTIPLY((
DCTELEM) wsptr[2] - (
DCTELEM) wsptr[6], FIX_1_414213562)
321 tmp0 = tmp10 + tmp13;
322 tmp3 = tmp10 - tmp13;
323 tmp1 = tmp11 + tmp12;
324 tmp2 = tmp11 - tmp12;
334 tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
336 z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
337 tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
338 tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
346 outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3)
348 outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3)
350 outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3)
352 outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3)
354 outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3)
356 outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3)
358 outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3)
360 outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3)
#define IDCT_range_limit(cinfo)
#define DEQUANTIZE(coef, quantval)