istereo2

annotate libs/libjpeg/jidctred.c @ 7:a3c4fcc9f8f3

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