0N/A * reserved comment block 0N/A * DO NOT REMOVE OR ALTER! 0N/A * Copyright (C) 1994-1998, Thomas G. Lane. 0N/A * This file is part of the Independent JPEG Group's software. 0N/A * For conditions of distribution and use, see the accompanying README file. 0N/A * This file contains inverse-DCT routines that produce reduced-size output: 0N/A * either 4x4, 2x2, or 1x1 pixels from an 8x8 DCT block. 0N/A * The implementation is based on the Loeffler, Ligtenberg and Moschytz (LL&M) 0N/A * algorithm used in jidctint.c. We simply replace each 8-to-8 1-D IDCT step 0N/A * with an 8-to-4 step that produces the four averages of two adjacent outputs 0N/A * (or an 8-to-2 step producing two averages of four outputs, for 2x2 output). 0N/A * These steps were derived by computing the corresponding values at the end 0N/A * of the normal LL&M code, then simplifying as much as possible. 0N/A * 1x1 is trivial: just take the DC coefficient divided by 8. 0N/A#
include "jdct.h" /* Private declarations for DCT subsystem */ 0N/A * This module is specialized to the case DCTSIZE = 8. 0N/A#
define PASS1_BITS 1 /* lose a little precision to avoid overflow */ 0N/A/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus 0N/A * causing a lot of useless floating-point operations at run time. 0N/A * To get around this we use the following pre-calculated constants. 0N/A * If you change CONST_BITS you may want to add appropriate values. 0N/A * (With a reasonable C compiler, you can just rely on the FIX() macro...) 0N/A/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. 0N/A * For 8-bit samples with the recommended scaling, all the variable 0N/A * and constant values involved are no more than 16 bits wide, so a 0N/A * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. 0N/A * For 12-bit samples, a full 32-bit multiplication will be needed. 0N/A/* Dequantize a coefficient by multiplying it by the multiplier-table 0N/A * entry; produce an int result. In this module, both inputs and result 0N/A * are 16 bits or less, so either int or short multiply will work. 0N/A * Perform dequantization and inverse DCT on one block of coefficients, 0N/A * producing a reduced-size 4x4 output block. 0N/A /* Pass 1: process columns from input, store into work array. */ 0N/A /* Don't bother to process column 4, because second pass won't use it */ 0N/A /* AC terms all zero; we need not examine term 4 for 4x4 output */ 0N/A /* Final output stage */ 0N/A /* Pass 2: process 4 rows from work array, store into output array. */ 0N/A /* It's not clear whether a zero row test is worthwhile here ... */ 0N/A /* AC terms all zero */ 0N/A /* Final output stage */ 0N/A * Perform dequantization and inverse DCT on one block of coefficients, 0N/A * producing a reduced-size 2x2 output block. 0N/A /* Pass 1: process columns from input, store into work array. */ 0N/A /* Don't bother to process columns 2,4,6 */ 0N/A /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */ 0N/A /* Final output stage */ 0N/A /* Pass 2: process 2 rows from work array, store into output array. */ 0N/A /* It's not clear whether a zero row test is worthwhile here ... */ 0N/A /* AC terms all zero */ 0N/A /* Final output stage */ 0N/A * Perform dequantization and inverse DCT on one block of coefficients, 0N/A * producing a reduced-size 1x1 output block. 0N/A /* We hardly need an inverse DCT routine for this: just take the 0N/A * average pixel value, which is one-eighth of the DC coefficient. 0N/A#
endif /* IDCT_SCALING_SUPPORTED */