0N/A * reserved comment block 0N/A * DO NOT REMOVE OR ALTER! 0N/A * Copyright (C) 1994-1996, 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 the inverse-DCT management logic. 0N/A * This code selects a particular IDCT implementation to be used, 0N/A * and it performs related housekeeping chores. No code in this file 0N/A * is executed per IDCT step, only during output pass setup. 0N/A * Note that the IDCT routines are responsible for performing coefficient 0N/A * dequantization as well as the IDCT proper. This module sets up the 0N/A * dequantization multiplier table needed by the IDCT routine. 0N/A#
include "jdct.h" /* Private declarations for DCT subsystem */ 0N/A * The decompressor input side (jdinput.c) saves away the appropriate 0N/A * quantization table for each component at the start of the first scan 0N/A * involving that component. (This is necessary in order to correctly 0N/A * decode files that reuse Q-table slots.) 0N/A * When we are ready to make an output pass, the saved Q-table is converted 0N/A * to a multiplier table that will actually be used by the IDCT routine. 0N/A * The multiplier table contents are IDCT-method-dependent. To support 0N/A * application changes in IDCT method between scans, we can remake the 0N/A * multiplier tables if necessary. 0N/A * In buffered-image mode, the first output pass may occur before any data 0N/A * has been seen for some components, and thus before their Q-tables have 0N/A * been saved away. To handle this case, multiplier tables are preset 0N/A * to zeroes; the result of the IDCT will be a neutral gray level. 0N/A/* Private subobject for this module */ 0N/A /* This array contains the IDCT method code that each multiplier table 0N/A * is currently set up for, or -1 if it's not yet set up. 0N/A * The actual multiplier tables are pointed to by dct_table in the 0N/A * per-component comp_info structures. 0N/A/* Allocated multiplier tables: big enough for any supported variant */ 0N/A/* The current scaled-IDCT routines require ISLOW-style multiplier tables, 0N/A * so be sure to compile that code if either ISLOW or SCALING is requested. 0N/A * Prepare for an output pass. 0N/A * Here we select the proper IDCT routine for each component and build 0N/A * a matching multiplier table. 0N/A /* Select the proper IDCT routine for this component's scaling */ 0N/A /* Create multiplier table from quant table. 0N/A * However, we can skip this if the component is uninteresting 0N/A * or if we already built the table. Also, if no quant table 0N/A * has yet been saved for the component, we leave the 0N/A * multiplier table all-zero; we'll be reading zeroes from the 0N/A * coefficient controller's buffer anyway. 0N/A if (
qtbl ==
NULL)
/* happens if no data yet for component */ 0N/A /* For LL&M IDCT method, multipliers are equal to raw quantization 0N/A * coefficients, but are stored as ints to ensure access efficiency. 0N/A /* For AA&N IDCT method, multipliers are equal to quantization 0N/A * coefficients scaled by scalefactor[row]*scalefactor[col], where 0N/A * scalefactor[0] = 1 0N/A * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 0N/A * For integer operation, the multiplier table is to be scaled by 0N/A /* precomputed values scaled up by 14 bits */ 0N/A 16384,
22725,
21407,
19266,
16384,
12873,
8867,
4520,
0N/A 22725,
31521,
29692,
26722,
22725,
17855,
12299,
6270,
0N/A 21407,
29692,
27969,
25172,
21407,
16819,
11585,
5906,
0N/A 19266,
26722,
25172,
22654,
19266,
15137,
10426,
5315,
0N/A 16384,
22725,
21407,
19266,
16384,
12873,
8867,
4520,
0N/A 12873,
17855,
16819,
15137,
12873,
10114,
6967,
3552,
0N/A 8867,
12299,
11585,
10426,
8867,
6967,
4799,
2446,
0N/A 4520,
6270,
5906,
5315,
4520,
3552,
2446,
1247 0N/A /* For float AA&N IDCT method, multipliers are equal to quantization 0N/A * coefficients scaled by scalefactor[row]*scalefactor[col], where 0N/A * scalefactor[0] = 1 0N/A * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 0N/A 1.0,
1.387039845,
1.306562965,
1.175875602,
0N/A 1.0,
0.785694958,
0.541196100,
0.275899379 0N/A * Initialize IDCT manager. 0N/A /* Allocate and pre-zero a multiplier table for each component */ 0N/A /* Mark multiplier table not yet set up for any method */