3dphotoshoot

annotate libs/libjpeg/jidctred.c @ 14:06dc8b9b4f89

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