istereo

annotate libs/libjpeg/jidctred.c @ 28:c0ae8e668447

added vmath library
author John Tsiombikas <nuclear@mutantstargoat.com>
date Thu, 08 Sep 2011 08:30:42 +0300
parents
children
rev   line source
nuclear@26 1 /*
nuclear@26 2 * jidctred.c
nuclear@26 3 *
nuclear@26 4 * Copyright (C) 1994-1998, Thomas G. Lane.
nuclear@26 5 * This file is part of the Independent JPEG Group's software.
nuclear@26 6 * For conditions of distribution and use, see the accompanying README file.
nuclear@26 7 *
nuclear@26 8 * This file contains inverse-DCT routines that produce reduced-size output:
nuclear@26 9 * either 4x4, 2x2, or 1x1 pixels from an 8x8 DCT block.
nuclear@26 10 *
nuclear@26 11 * The implementation is based on the Loeffler, Ligtenberg and Moschytz (LL&M)
nuclear@26 12 * algorithm used in jidctint.c. We simply replace each 8-to-8 1-D IDCT step
nuclear@26 13 * with an 8-to-4 step that produces the four averages of two adjacent outputs
nuclear@26 14 * (or an 8-to-2 step producing two averages of four outputs, for 2x2 output).
nuclear@26 15 * These steps were derived by computing the corresponding values at the end
nuclear@26 16 * of the normal LL&M code, then simplifying as much as possible.
nuclear@26 17 *
nuclear@26 18 * 1x1 is trivial: just take the DC coefficient divided by 8.
nuclear@26 19 *
nuclear@26 20 * See jidctint.c for additional comments.
nuclear@26 21 */
nuclear@26 22
nuclear@26 23 #define JPEG_INTERNALS
nuclear@26 24 #include "jinclude.h"
nuclear@26 25 #include "jpeglib.h"
nuclear@26 26 #include "jdct.h" /* Private declarations for DCT subsystem */
nuclear@26 27
nuclear@26 28 #ifdef IDCT_SCALING_SUPPORTED
nuclear@26 29
nuclear@26 30
nuclear@26 31 /*
nuclear@26 32 * This module is specialized to the case DCTSIZE = 8.
nuclear@26 33 */
nuclear@26 34
nuclear@26 35 #if DCTSIZE != 8
nuclear@26 36 Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
nuclear@26 37 #endif
nuclear@26 38
nuclear@26 39
nuclear@26 40 /* Scaling is the same as in jidctint.c. */
nuclear@26 41
nuclear@26 42 #if BITS_IN_JSAMPLE == 8
nuclear@26 43 #define CONST_BITS 13
nuclear@26 44 #define PASS1_BITS 2
nuclear@26 45 #else
nuclear@26 46 #define CONST_BITS 13
nuclear@26 47 #define PASS1_BITS 1 /* lose a little precision to avoid overflow */
nuclear@26 48 #endif
nuclear@26 49
nuclear@26 50 /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
nuclear@26 51 * causing a lot of useless floating-point operations at run time.
nuclear@26 52 * To get around this we use the following pre-calculated constants.
nuclear@26 53 * If you change CONST_BITS you may want to add appropriate values.
nuclear@26 54 * (With a reasonable C compiler, you can just rely on the FIX() macro...)
nuclear@26 55 */
nuclear@26 56
nuclear@26 57 #if CONST_BITS == 13
nuclear@26 58 #define FIX_0_211164243 ((INT32) 1730) /* FIX(0.211164243) */
nuclear@26 59 #define FIX_0_509795579 ((INT32) 4176) /* FIX(0.509795579) */
nuclear@26 60 #define FIX_0_601344887 ((INT32) 4926) /* FIX(0.601344887) */
nuclear@26 61 #define FIX_0_720959822 ((INT32) 5906) /* FIX(0.720959822) */
nuclear@26 62 #define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */
nuclear@26 63 #define FIX_0_850430095 ((INT32) 6967) /* FIX(0.850430095) */
nuclear@26 64 #define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */
nuclear@26 65 #define FIX_1_061594337 ((INT32) 8697) /* FIX(1.061594337) */
nuclear@26 66 #define FIX_1_272758580 ((INT32) 10426) /* FIX(1.272758580) */
nuclear@26 67 #define FIX_1_451774981 ((INT32) 11893) /* FIX(1.451774981) */
nuclear@26 68 #define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */
nuclear@26 69 #define FIX_2_172734803 ((INT32) 17799) /* FIX(2.172734803) */
nuclear@26 70 #define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */
nuclear@26 71 #define FIX_3_624509785 ((INT32) 29692) /* FIX(3.624509785) */
nuclear@26 72 #else
nuclear@26 73 #define FIX_0_211164243 FIX(0.211164243)
nuclear@26 74 #define FIX_0_509795579 FIX(0.509795579)
nuclear@26 75 #define FIX_0_601344887 FIX(0.601344887)
nuclear@26 76 #define FIX_0_720959822 FIX(0.720959822)
nuclear@26 77 #define FIX_0_765366865 FIX(0.765366865)
nuclear@26 78 #define FIX_0_850430095 FIX(0.850430095)
nuclear@26 79 #define FIX_0_899976223 FIX(0.899976223)
nuclear@26 80 #define FIX_1_061594337 FIX(1.061594337)
nuclear@26 81 #define FIX_1_272758580 FIX(1.272758580)
nuclear@26 82 #define FIX_1_451774981 FIX(1.451774981)
nuclear@26 83 #define FIX_1_847759065 FIX(1.847759065)
nuclear@26 84 #define FIX_2_172734803 FIX(2.172734803)
nuclear@26 85 #define FIX_2_562915447 FIX(2.562915447)
nuclear@26 86 #define FIX_3_624509785 FIX(3.624509785)
nuclear@26 87 #endif
nuclear@26 88
nuclear@26 89
nuclear@26 90 /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
nuclear@26 91 * For 8-bit samples with the recommended scaling, all the variable
nuclear@26 92 * and constant values involved are no more than 16 bits wide, so a
nuclear@26 93 * 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
nuclear@26 94 * For 12-bit samples, a full 32-bit multiplication will be needed.
nuclear@26 95 */
nuclear@26 96
nuclear@26 97 #if BITS_IN_JSAMPLE == 8
nuclear@26 98 #define MULTIPLY(var,const) MULTIPLY16C16(var,const)
nuclear@26 99 #else
nuclear@26 100 #define MULTIPLY(var,const) ((var) * (const))
nuclear@26 101 #endif
nuclear@26 102
nuclear@26 103
nuclear@26 104 /* Dequantize a coefficient by multiplying it by the multiplier-table
nuclear@26 105 * entry; produce an int result. In this module, both inputs and result
nuclear@26 106 * are 16 bits or less, so either int or short multiply will work.
nuclear@26 107 */
nuclear@26 108
nuclear@26 109 #define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval))
nuclear@26 110
nuclear@26 111
nuclear@26 112 /*
nuclear@26 113 * Perform dequantization and inverse DCT on one block of coefficients,
nuclear@26 114 * producing a reduced-size 4x4 output block.
nuclear@26 115 */
nuclear@26 116
nuclear@26 117 GLOBAL(void)
nuclear@26 118 jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
nuclear@26 119 JCOEFPTR coef_block,
nuclear@26 120 JSAMPARRAY output_buf, JDIMENSION output_col)
nuclear@26 121 {
nuclear@26 122 INT32 tmp0, tmp2, tmp10, tmp12;
nuclear@26 123 INT32 z1, z2, z3, z4;
nuclear@26 124 JCOEFPTR inptr;
nuclear@26 125 ISLOW_MULT_TYPE * quantptr;
nuclear@26 126 int * wsptr;
nuclear@26 127 JSAMPROW outptr;
nuclear@26 128 JSAMPLE *range_limit = IDCT_range_limit(cinfo);
nuclear@26 129 int ctr;
nuclear@26 130 int workspace[DCTSIZE*4]; /* buffers data between passes */
nuclear@26 131 SHIFT_TEMPS
nuclear@26 132
nuclear@26 133 /* Pass 1: process columns from input, store into work array. */
nuclear@26 134
nuclear@26 135 inptr = coef_block;
nuclear@26 136 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
nuclear@26 137 wsptr = workspace;
nuclear@26 138 for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
nuclear@26 139 /* Don't bother to process column 4, because second pass won't use it */
nuclear@26 140 if (ctr == DCTSIZE-4)
nuclear@26 141 continue;
nuclear@26 142 if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
nuclear@26 143 inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*5] == 0 &&
nuclear@26 144 inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) {
nuclear@26 145 /* AC terms all zero; we need not examine term 4 for 4x4 output */
nuclear@26 146 int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
nuclear@26 147
nuclear@26 148 wsptr[DCTSIZE*0] = dcval;
nuclear@26 149 wsptr[DCTSIZE*1] = dcval;
nuclear@26 150 wsptr[DCTSIZE*2] = dcval;
nuclear@26 151 wsptr[DCTSIZE*3] = dcval;
nuclear@26 152
nuclear@26 153 continue;
nuclear@26 154 }
nuclear@26 155
nuclear@26 156 /* Even part */
nuclear@26 157
nuclear@26 158 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
nuclear@26 159 tmp0 <<= (CONST_BITS+1);
nuclear@26 160
nuclear@26 161 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
nuclear@26 162 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
nuclear@26 163
nuclear@26 164 tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865);
nuclear@26 165
nuclear@26 166 tmp10 = tmp0 + tmp2;
nuclear@26 167 tmp12 = tmp0 - tmp2;
nuclear@26 168
nuclear@26 169 /* Odd part */
nuclear@26 170
nuclear@26 171 z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
nuclear@26 172 z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
nuclear@26 173 z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
nuclear@26 174 z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
nuclear@26 175
nuclear@26 176 tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
nuclear@26 177 + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
nuclear@26 178 + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
nuclear@26 179 + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
nuclear@26 180
nuclear@26 181 tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
nuclear@26 182 + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
nuclear@26 183 + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
nuclear@26 184 + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
nuclear@26 185
nuclear@26 186 /* Final output stage */
nuclear@26 187
nuclear@26 188 wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1);
nuclear@26 189 wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1);
nuclear@26 190 wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1);
nuclear@26 191 wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1);
nuclear@26 192 }
nuclear@26 193
nuclear@26 194 /* Pass 2: process 4 rows from work array, store into output array. */
nuclear@26 195
nuclear@26 196 wsptr = workspace;
nuclear@26 197 for (ctr = 0; ctr < 4; ctr++) {
nuclear@26 198 outptr = output_buf[ctr] + output_col;
nuclear@26 199 /* It's not clear whether a zero row test is worthwhile here ... */
nuclear@26 200
nuclear@26 201 #ifndef NO_ZERO_ROW_TEST
nuclear@26 202 if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 &&
nuclear@26 203 wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
nuclear@26 204 /* AC terms all zero */
nuclear@26 205 JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
nuclear@26 206 & RANGE_MASK];
nuclear@26 207
nuclear@26 208 outptr[0] = dcval;
nuclear@26 209 outptr[1] = dcval;
nuclear@26 210 outptr[2] = dcval;
nuclear@26 211 outptr[3] = dcval;
nuclear@26 212
nuclear@26 213 wsptr += DCTSIZE; /* advance pointer to next row */
nuclear@26 214 continue;
nuclear@26 215 }
nuclear@26 216 #endif
nuclear@26 217
nuclear@26 218 /* Even part */
nuclear@26 219
nuclear@26 220 tmp0 = ((INT32) wsptr[0]) << (CONST_BITS+1);
nuclear@26 221
nuclear@26 222 tmp2 = MULTIPLY((INT32) wsptr[2], FIX_1_847759065)
nuclear@26 223 + MULTIPLY((INT32) wsptr[6], - FIX_0_765366865);
nuclear@26 224
nuclear@26 225 tmp10 = tmp0 + tmp2;
nuclear@26 226 tmp12 = tmp0 - tmp2;
nuclear@26 227
nuclear@26 228 /* Odd part */
nuclear@26 229
nuclear@26 230 z1 = (INT32) wsptr[7];
nuclear@26 231 z2 = (INT32) wsptr[5];
nuclear@26 232 z3 = (INT32) wsptr[3];
nuclear@26 233 z4 = (INT32) wsptr[1];
nuclear@26 234
nuclear@26 235 tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
nuclear@26 236 + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
nuclear@26 237 + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
nuclear@26 238 + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
nuclear@26 239
nuclear@26 240 tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
nuclear@26 241 + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
nuclear@26 242 + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
nuclear@26 243 + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
nuclear@26 244
nuclear@26 245 /* Final output stage */
nuclear@26 246
nuclear@26 247 outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2,
nuclear@26 248 CONST_BITS+PASS1_BITS+3+1)
nuclear@26 249 & RANGE_MASK];
nuclear@26 250 outptr[3] = range_limit[(int) DESCALE(tmp10 - tmp2,
nuclear@26 251 CONST_BITS+PASS1_BITS+3+1)
nuclear@26 252 & RANGE_MASK];
nuclear@26 253 outptr[1] = range_limit[(int) DESCALE(tmp12 + tmp0,
nuclear@26 254 CONST_BITS+PASS1_BITS+3+1)
nuclear@26 255 & RANGE_MASK];
nuclear@26 256 outptr[2] = range_limit[(int) DESCALE(tmp12 - tmp0,
nuclear@26 257 CONST_BITS+PASS1_BITS+3+1)
nuclear@26 258 & RANGE_MASK];
nuclear@26 259
nuclear@26 260 wsptr += DCTSIZE; /* advance pointer to next row */
nuclear@26 261 }
nuclear@26 262 }
nuclear@26 263
nuclear@26 264
nuclear@26 265 /*
nuclear@26 266 * Perform dequantization and inverse DCT on one block of coefficients,
nuclear@26 267 * producing a reduced-size 2x2 output block.
nuclear@26 268 */
nuclear@26 269
nuclear@26 270 GLOBAL(void)
nuclear@26 271 jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
nuclear@26 272 JCOEFPTR coef_block,
nuclear@26 273 JSAMPARRAY output_buf, JDIMENSION output_col)
nuclear@26 274 {
nuclear@26 275 INT32 tmp0, tmp10, z1;
nuclear@26 276 JCOEFPTR inptr;
nuclear@26 277 ISLOW_MULT_TYPE * quantptr;
nuclear@26 278 int * wsptr;
nuclear@26 279 JSAMPROW outptr;
nuclear@26 280 JSAMPLE *range_limit = IDCT_range_limit(cinfo);
nuclear@26 281 int ctr;
nuclear@26 282 int workspace[DCTSIZE*2]; /* buffers data between passes */
nuclear@26 283 SHIFT_TEMPS
nuclear@26 284
nuclear@26 285 /* Pass 1: process columns from input, store into work array. */
nuclear@26 286
nuclear@26 287 inptr = coef_block;
nuclear@26 288 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
nuclear@26 289 wsptr = workspace;
nuclear@26 290 for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
nuclear@26 291 /* Don't bother to process columns 2,4,6 */
nuclear@26 292 if (ctr == DCTSIZE-2 || ctr == DCTSIZE-4 || ctr == DCTSIZE-6)
nuclear@26 293 continue;
nuclear@26 294 if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*3] == 0 &&
nuclear@26 295 inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) {
nuclear@26 296 /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */
nuclear@26 297 int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
nuclear@26 298
nuclear@26 299 wsptr[DCTSIZE*0] = dcval;
nuclear@26 300 wsptr[DCTSIZE*1] = dcval;
nuclear@26 301
nuclear@26 302 continue;
nuclear@26 303 }
nuclear@26 304
nuclear@26 305 /* Even part */
nuclear@26 306
nuclear@26 307 z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
nuclear@26 308 tmp10 = z1 << (CONST_BITS+2);
nuclear@26 309
nuclear@26 310 /* Odd part */
nuclear@26 311
nuclear@26 312 z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
nuclear@26 313 tmp0 = MULTIPLY(z1, - FIX_0_720959822); /* sqrt(2) * (c7-c5+c3-c1) */
nuclear@26 314 z1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
nuclear@26 315 tmp0 += MULTIPLY(z1, FIX_0_850430095); /* sqrt(2) * (-c1+c3+c5+c7) */
nuclear@26 316 z1 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
nuclear@26 317 tmp0 += MULTIPLY(z1, - FIX_1_272758580); /* sqrt(2) * (-c1+c3-c5-c7) */
nuclear@26 318 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
nuclear@26 319 tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */
nuclear@26 320
nuclear@26 321 /* Final output stage */
nuclear@26 322
nuclear@26 323 wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2);
nuclear@26 324 wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2);
nuclear@26 325 }
nuclear@26 326
nuclear@26 327 /* Pass 2: process 2 rows from work array, store into output array. */
nuclear@26 328
nuclear@26 329 wsptr = workspace;
nuclear@26 330 for (ctr = 0; ctr < 2; ctr++) {
nuclear@26 331 outptr = output_buf[ctr] + output_col;
nuclear@26 332 /* It's not clear whether a zero row test is worthwhile here ... */
nuclear@26 333
nuclear@26 334 #ifndef NO_ZERO_ROW_TEST
nuclear@26 335 if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) {
nuclear@26 336 /* AC terms all zero */
nuclear@26 337 JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
nuclear@26 338 & RANGE_MASK];
nuclear@26 339
nuclear@26 340 outptr[0] = dcval;
nuclear@26 341 outptr[1] = dcval;
nuclear@26 342
nuclear@26 343 wsptr += DCTSIZE; /* advance pointer to next row */
nuclear@26 344 continue;
nuclear@26 345 }
nuclear@26 346 #endif
nuclear@26 347
nuclear@26 348 /* Even part */
nuclear@26 349
nuclear@26 350 tmp10 = ((INT32) wsptr[0]) << (CONST_BITS+2);
nuclear@26 351
nuclear@26 352 /* Odd part */
nuclear@26 353
nuclear@26 354 tmp0 = MULTIPLY((INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */
nuclear@26 355 + MULTIPLY((INT32) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */
nuclear@26 356 + MULTIPLY((INT32) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */
nuclear@26 357 + MULTIPLY((INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */
nuclear@26 358
nuclear@26 359 /* Final output stage */
nuclear@26 360
nuclear@26 361 outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0,
nuclear@26 362 CONST_BITS+PASS1_BITS+3+2)
nuclear@26 363 & RANGE_MASK];
nuclear@26 364 outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0,
nuclear@26 365 CONST_BITS+PASS1_BITS+3+2)
nuclear@26 366 & RANGE_MASK];
nuclear@26 367
nuclear@26 368 wsptr += DCTSIZE; /* advance pointer to next row */
nuclear@26 369 }
nuclear@26 370 }
nuclear@26 371
nuclear@26 372
nuclear@26 373 /*
nuclear@26 374 * Perform dequantization and inverse DCT on one block of coefficients,
nuclear@26 375 * producing a reduced-size 1x1 output block.
nuclear@26 376 */
nuclear@26 377
nuclear@26 378 GLOBAL(void)
nuclear@26 379 jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
nuclear@26 380 JCOEFPTR coef_block,
nuclear@26 381 JSAMPARRAY output_buf, JDIMENSION output_col)
nuclear@26 382 {
nuclear@26 383 int dcval;
nuclear@26 384 ISLOW_MULT_TYPE * quantptr;
nuclear@26 385 JSAMPLE *range_limit = IDCT_range_limit(cinfo);
nuclear@26 386 SHIFT_TEMPS
nuclear@26 387
nuclear@26 388 /* We hardly need an inverse DCT routine for this: just take the
nuclear@26 389 * average pixel value, which is one-eighth of the DC coefficient.
nuclear@26 390 */
nuclear@26 391 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
nuclear@26 392 dcval = DEQUANTIZE(coef_block[0], quantptr[0]);
nuclear@26 393 dcval = (int) DESCALE((INT32) dcval, 3);
nuclear@26 394
nuclear@26 395 output_buf[0][output_col] = range_limit[dcval & RANGE_MASK];
nuclear@26 396 }
nuclear@26 397
nuclear@26 398 #endif /* IDCT_SCALING_SUPPORTED */