Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * jddctmgr.c |
| 3 | * |
DRC | a73e870 | 2012-12-31 02:52:30 +0000 | [diff] [blame] | 4 | * This file was part of the Independent JPEG Group's software: |
Thomas G. Lane | 489583f | 1996-02-07 00:00:00 +0000 | [diff] [blame] | 5 | * Copyright (C) 1994-1996, Thomas G. Lane. |
Guido Vollbeding | f18f81b | 2010-02-28 00:00:00 +0000 | [diff] [blame] | 6 | * Modified 2002-2010 by Guido Vollbeding. |
DRC | a6ef282 | 2013-09-28 03:23:49 +0000 | [diff] [blame] | 7 | * libjpeg-turbo Modifications: |
Pierre Ossman | 59a3938 | 2009-03-09 13:15:56 +0000 | [diff] [blame] | 8 | * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB |
DRC | 36a6eec | 2010-10-08 08:05:44 +0000 | [diff] [blame] | 9 | * Copyright (C) 2010, D. R. Commander. |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 10 | * For conditions of distribution and use, see the accompanying README file. |
| 11 | * |
| 12 | * This file contains the inverse-DCT management logic. |
| 13 | * This code selects a particular IDCT implementation to be used, |
| 14 | * and it performs related housekeeping chores. No code in this file |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 15 | * is executed per IDCT step, only during output pass setup. |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 16 | * |
| 17 | * Note that the IDCT routines are responsible for performing coefficient |
| 18 | * dequantization as well as the IDCT proper. This module sets up the |
| 19 | * dequantization multiplier table needed by the IDCT routine. |
| 20 | */ |
| 21 | |
| 22 | #define JPEG_INTERNALS |
| 23 | #include "jinclude.h" |
| 24 | #include "jpeglib.h" |
| 25 | #include "jdct.h" /* Private declarations for DCT subsystem */ |
Pierre Ossman | 59a3938 | 2009-03-09 13:15:56 +0000 | [diff] [blame] | 26 | #include "jsimddct.h" |
DRC | 36a6eec | 2010-10-08 08:05:44 +0000 | [diff] [blame] | 27 | #include "jpegcomp.h" |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 28 | |
| 29 | |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 30 | /* |
| 31 | * The decompressor input side (jdinput.c) saves away the appropriate |
| 32 | * quantization table for each component at the start of the first scan |
| 33 | * involving that component. (This is necessary in order to correctly |
| 34 | * decode files that reuse Q-table slots.) |
| 35 | * When we are ready to make an output pass, the saved Q-table is converted |
| 36 | * to a multiplier table that will actually be used by the IDCT routine. |
| 37 | * The multiplier table contents are IDCT-method-dependent. To support |
| 38 | * application changes in IDCT method between scans, we can remake the |
| 39 | * multiplier tables if necessary. |
| 40 | * In buffered-image mode, the first output pass may occur before any data |
| 41 | * has been seen for some components, and thus before their Q-tables have |
| 42 | * been saved away. To handle this case, multiplier tables are preset |
| 43 | * to zeroes; the result of the IDCT will be a neutral gray level. |
| 44 | */ |
| 45 | |
| 46 | |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 47 | /* Private subobject for this module */ |
| 48 | |
| 49 | typedef struct { |
| 50 | struct jpeg_inverse_dct pub; /* public fields */ |
| 51 | |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 52 | /* This array contains the IDCT method code that each multiplier table |
| 53 | * is currently set up for, or -1 if it's not yet set up. |
| 54 | * The actual multiplier tables are pointed to by dct_table in the |
| 55 | * per-component comp_info structures. |
| 56 | */ |
| 57 | int cur_method[MAX_COMPONENTS]; |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 58 | } my_idct_controller; |
| 59 | |
| 60 | typedef my_idct_controller * my_idct_ptr; |
| 61 | |
| 62 | |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 63 | /* Allocated multiplier tables: big enough for any supported variant */ |
| 64 | |
| 65 | typedef union { |
| 66 | ISLOW_MULT_TYPE islow_array[DCTSIZE2]; |
| 67 | #ifdef DCT_IFAST_SUPPORTED |
| 68 | IFAST_MULT_TYPE ifast_array[DCTSIZE2]; |
| 69 | #endif |
| 70 | #ifdef DCT_FLOAT_SUPPORTED |
| 71 | FLOAT_MULT_TYPE float_array[DCTSIZE2]; |
| 72 | #endif |
| 73 | } multiplier_table; |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 74 | |
| 75 | |
| 76 | /* The current scaled-IDCT routines require ISLOW-style multiplier tables, |
| 77 | * so be sure to compile that code if either ISLOW or SCALING is requested. |
| 78 | */ |
| 79 | #ifdef DCT_ISLOW_SUPPORTED |
| 80 | #define PROVIDE_ISLOW_TABLES |
| 81 | #else |
| 82 | #ifdef IDCT_SCALING_SUPPORTED |
| 83 | #define PROVIDE_ISLOW_TABLES |
| 84 | #endif |
| 85 | #endif |
| 86 | |
| 87 | |
| 88 | /* |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 89 | * Prepare for an output pass. |
| 90 | * Here we select the proper IDCT routine for each component and build |
| 91 | * a matching multiplier table. |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 92 | */ |
| 93 | |
Thomas G. Lane | 489583f | 1996-02-07 00:00:00 +0000 | [diff] [blame] | 94 | METHODDEF(void) |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 95 | start_pass (j_decompress_ptr cinfo) |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 96 | { |
| 97 | my_idct_ptr idct = (my_idct_ptr) cinfo->idct; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 98 | int ci, i; |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 99 | jpeg_component_info *compptr; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 100 | int method = 0; |
| 101 | inverse_DCT_method_ptr method_ptr = NULL; |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 102 | JQUANT_TBL * qtbl; |
| 103 | |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 104 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
| 105 | ci++, compptr++) { |
| 106 | /* Select the proper IDCT routine for this component's scaling */ |
DRC | 49967cd | 2010-10-09 19:57:51 +0000 | [diff] [blame] | 107 | switch (compptr->_DCT_scaled_size) { |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 108 | #ifdef IDCT_SCALING_SUPPORTED |
| 109 | case 1: |
| 110 | method_ptr = jpeg_idct_1x1; |
| 111 | method = JDCT_ISLOW; /* jidctred uses islow-style table */ |
| 112 | break; |
| 113 | case 2: |
Pierre Ossman | 59a3938 | 2009-03-09 13:15:56 +0000 | [diff] [blame] | 114 | if (jsimd_can_idct_2x2()) |
| 115 | method_ptr = jsimd_idct_2x2; |
| 116 | else |
| 117 | method_ptr = jpeg_idct_2x2; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 118 | method = JDCT_ISLOW; /* jidctred uses islow-style table */ |
| 119 | break; |
DRC | 27fb3fc | 2012-01-28 01:48:07 +0000 | [diff] [blame] | 120 | case 3: |
Guido Vollbeding | 5996a25 | 2009-06-27 00:00:00 +0000 | [diff] [blame] | 121 | method_ptr = jpeg_idct_3x3; |
| 122 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 123 | break; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 124 | case 4: |
Pierre Ossman | 59a3938 | 2009-03-09 13:15:56 +0000 | [diff] [blame] | 125 | if (jsimd_can_idct_4x4()) |
| 126 | method_ptr = jsimd_idct_4x4; |
| 127 | else |
| 128 | method_ptr = jpeg_idct_4x4; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 129 | method = JDCT_ISLOW; /* jidctred uses islow-style table */ |
| 130 | break; |
DRC | 27fb3fc | 2012-01-28 01:48:07 +0000 | [diff] [blame] | 131 | case 5: |
Guido Vollbeding | 5996a25 | 2009-06-27 00:00:00 +0000 | [diff] [blame] | 132 | method_ptr = jpeg_idct_5x5; |
| 133 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 134 | break; |
DRC | 27fb3fc | 2012-01-28 01:48:07 +0000 | [diff] [blame] | 135 | case 6: |
DRC | e500591 | 2013-09-27 17:51:08 +0000 | [diff] [blame] | 136 | #if defined(__mips__) |
| 137 | if (jsimd_can_idct_6x6()) |
| 138 | method_ptr = jsimd_idct_6x6; |
| 139 | else |
| 140 | #endif |
Guido Vollbeding | 5996a25 | 2009-06-27 00:00:00 +0000 | [diff] [blame] | 141 | method_ptr = jpeg_idct_6x6; |
| 142 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 143 | break; |
DRC | 27fb3fc | 2012-01-28 01:48:07 +0000 | [diff] [blame] | 144 | case 7: |
Guido Vollbeding | 5996a25 | 2009-06-27 00:00:00 +0000 | [diff] [blame] | 145 | method_ptr = jpeg_idct_7x7; |
| 146 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 147 | break; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 148 | #endif |
| 149 | case DCTSIZE: |
| 150 | switch (cinfo->dct_method) { |
| 151 | #ifdef DCT_ISLOW_SUPPORTED |
| 152 | case JDCT_ISLOW: |
Pierre Ossman | 59a3938 | 2009-03-09 13:15:56 +0000 | [diff] [blame] | 153 | if (jsimd_can_idct_islow()) |
| 154 | method_ptr = jsimd_idct_islow; |
| 155 | else |
| 156 | method_ptr = jpeg_idct_islow; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 157 | method = JDCT_ISLOW; |
| 158 | break; |
| 159 | #endif |
| 160 | #ifdef DCT_IFAST_SUPPORTED |
| 161 | case JDCT_IFAST: |
Pierre Ossman | 59a3938 | 2009-03-09 13:15:56 +0000 | [diff] [blame] | 162 | if (jsimd_can_idct_ifast()) |
| 163 | method_ptr = jsimd_idct_ifast; |
| 164 | else |
| 165 | method_ptr = jpeg_idct_ifast; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 166 | method = JDCT_IFAST; |
| 167 | break; |
| 168 | #endif |
| 169 | #ifdef DCT_FLOAT_SUPPORTED |
| 170 | case JDCT_FLOAT: |
Pierre Ossman | 59a3938 | 2009-03-09 13:15:56 +0000 | [diff] [blame] | 171 | if (jsimd_can_idct_float()) |
| 172 | method_ptr = jsimd_idct_float; |
| 173 | else |
| 174 | method_ptr = jpeg_idct_float; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 175 | method = JDCT_FLOAT; |
| 176 | break; |
| 177 | #endif |
| 178 | default: |
| 179 | ERREXIT(cinfo, JERR_NOT_COMPILED); |
| 180 | break; |
| 181 | } |
| 182 | break; |
DRC | 27fb3fc | 2012-01-28 01:48:07 +0000 | [diff] [blame] | 183 | case 9: |
| 184 | method_ptr = jpeg_idct_9x9; |
| 185 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 186 | break; |
| 187 | case 10: |
| 188 | method_ptr = jpeg_idct_10x10; |
| 189 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 190 | break; |
| 191 | case 11: |
| 192 | method_ptr = jpeg_idct_11x11; |
| 193 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 194 | break; |
| 195 | case 12: |
DRC | e500591 | 2013-09-27 17:51:08 +0000 | [diff] [blame] | 196 | #if defined(__mips__) |
| 197 | if (jsimd_can_idct_12x12()) |
| 198 | method_ptr = jsimd_idct_12x12; |
| 199 | else |
| 200 | #endif |
DRC | 27fb3fc | 2012-01-28 01:48:07 +0000 | [diff] [blame] | 201 | method_ptr = jpeg_idct_12x12; |
| 202 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 203 | break; |
| 204 | case 13: |
| 205 | method_ptr = jpeg_idct_13x13; |
| 206 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 207 | break; |
| 208 | case 14: |
| 209 | method_ptr = jpeg_idct_14x14; |
| 210 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 211 | break; |
| 212 | case 15: |
| 213 | method_ptr = jpeg_idct_15x15; |
| 214 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 215 | break; |
| 216 | case 16: |
| 217 | method_ptr = jpeg_idct_16x16; |
| 218 | method = JDCT_ISLOW; /* jidctint uses islow-style table */ |
| 219 | break; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 220 | default: |
DRC | 49967cd | 2010-10-09 19:57:51 +0000 | [diff] [blame] | 221 | ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->_DCT_scaled_size); |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 222 | break; |
| 223 | } |
| 224 | idct->pub.inverse_DCT[ci] = method_ptr; |
| 225 | /* Create multiplier table from quant table. |
| 226 | * However, we can skip this if the component is uninteresting |
| 227 | * or if we already built the table. Also, if no quant table |
| 228 | * has yet been saved for the component, we leave the |
| 229 | * multiplier table all-zero; we'll be reading zeroes from the |
| 230 | * coefficient controller's buffer anyway. |
| 231 | */ |
| 232 | if (! compptr->component_needed || idct->cur_method[ci] == method) |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 233 | continue; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 234 | qtbl = compptr->quant_table; |
| 235 | if (qtbl == NULL) /* happens if no data yet for component */ |
| 236 | continue; |
| 237 | idct->cur_method[ci] = method; |
| 238 | switch (method) { |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 239 | #ifdef PROVIDE_ISLOW_TABLES |
| 240 | case JDCT_ISLOW: |
| 241 | { |
| 242 | /* For LL&M IDCT method, multipliers are equal to raw quantization |
Thomas G. Lane | 489583f | 1996-02-07 00:00:00 +0000 | [diff] [blame] | 243 | * coefficients, but are stored as ints to ensure access efficiency. |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 244 | */ |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 245 | ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table; |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 246 | for (i = 0; i < DCTSIZE2; i++) { |
Thomas G. Lane | 489583f | 1996-02-07 00:00:00 +0000 | [diff] [blame] | 247 | ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i]; |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 248 | } |
| 249 | } |
| 250 | break; |
| 251 | #endif |
| 252 | #ifdef DCT_IFAST_SUPPORTED |
| 253 | case JDCT_IFAST: |
| 254 | { |
| 255 | /* For AA&N IDCT method, multipliers are equal to quantization |
| 256 | * coefficients scaled by scalefactor[row]*scalefactor[col], where |
| 257 | * scalefactor[0] = 1 |
| 258 | * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 |
| 259 | * For integer operation, the multiplier table is to be scaled by |
Thomas G. Lane | 489583f | 1996-02-07 00:00:00 +0000 | [diff] [blame] | 260 | * IFAST_SCALE_BITS. |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 261 | */ |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 262 | IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table; |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 263 | #define CONST_BITS 14 |
| 264 | static const INT16 aanscales[DCTSIZE2] = { |
| 265 | /* precomputed values scaled up by 14 bits */ |
| 266 | 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, |
| 267 | 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, |
| 268 | 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, |
| 269 | 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, |
| 270 | 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, |
| 271 | 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, |
| 272 | 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, |
| 273 | 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 |
| 274 | }; |
| 275 | SHIFT_TEMPS |
| 276 | |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 277 | for (i = 0; i < DCTSIZE2; i++) { |
| 278 | ifmtbl[i] = (IFAST_MULT_TYPE) |
Thomas G. Lane | 489583f | 1996-02-07 00:00:00 +0000 | [diff] [blame] | 279 | DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 280 | (INT32) aanscales[i]), |
| 281 | CONST_BITS-IFAST_SCALE_BITS); |
| 282 | } |
| 283 | } |
| 284 | break; |
| 285 | #endif |
| 286 | #ifdef DCT_FLOAT_SUPPORTED |
| 287 | case JDCT_FLOAT: |
| 288 | { |
| 289 | /* For float AA&N IDCT method, multipliers are equal to quantization |
| 290 | * coefficients scaled by scalefactor[row]*scalefactor[col], where |
| 291 | * scalefactor[0] = 1 |
| 292 | * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 293 | */ |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 294 | FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table; |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 295 | int row, col; |
| 296 | static const double aanscalefactor[DCTSIZE] = { |
| 297 | 1.0, 1.387039845, 1.306562965, 1.175875602, |
| 298 | 1.0, 0.785694958, 0.541196100, 0.275899379 |
| 299 | }; |
| 300 | |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 301 | i = 0; |
| 302 | for (row = 0; row < DCTSIZE; row++) { |
| 303 | for (col = 0; col < DCTSIZE; col++) { |
| 304 | fmtbl[i] = (FLOAT_MULT_TYPE) |
Thomas G. Lane | 489583f | 1996-02-07 00:00:00 +0000 | [diff] [blame] | 305 | ((double) qtbl->quantval[i] * |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 306 | aanscalefactor[row] * aanscalefactor[col]); |
| 307 | i++; |
| 308 | } |
| 309 | } |
| 310 | } |
| 311 | break; |
| 312 | #endif |
| 313 | default: |
| 314 | ERREXIT(cinfo, JERR_NOT_COMPILED); |
| 315 | break; |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | |
| 321 | /* |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 322 | * Initialize IDCT manager. |
| 323 | */ |
| 324 | |
Thomas G. Lane | 489583f | 1996-02-07 00:00:00 +0000 | [diff] [blame] | 325 | GLOBAL(void) |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 326 | jinit_inverse_dct (j_decompress_ptr cinfo) |
| 327 | { |
| 328 | my_idct_ptr idct; |
| 329 | int ci; |
| 330 | jpeg_component_info *compptr; |
| 331 | |
| 332 | idct = (my_idct_ptr) |
| 333 | (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, |
| 334 | SIZEOF(my_idct_controller)); |
| 335 | cinfo->idct = (struct jpeg_inverse_dct *) idct; |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 336 | idct->pub.start_pass = start_pass; |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 337 | |
| 338 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
| 339 | ci++, compptr++) { |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 340 | /* Allocate and pre-zero a multiplier table for each component */ |
| 341 | compptr->dct_table = |
| 342 | (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, |
| 343 | SIZEOF(multiplier_table)); |
| 344 | MEMZERO(compptr->dct_table, SIZEOF(multiplier_table)); |
| 345 | /* Mark multiplier table not yet set up for any method */ |
| 346 | idct->cur_method[ci] = -1; |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 347 | } |
| 348 | } |