Coverage Report

Created: 2026-07-24 07:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ghostpdl/obj/jcdctmgr.c
Line
Count
Source
1
/*
2
 * jcdctmgr.c
3
 *
4
 * Copyright (C) 1994-1996, Thomas G. Lane.
5
 * Modified 2003-2025 by Guido Vollbeding.
6
 * This file is part of the Independent JPEG Group's software.
7
 * For conditions of distribution and use, see the accompanying README file.
8
 *
9
 * This file contains the forward-DCT management logic.
10
 * This code selects a particular DCT implementation to be used,
11
 * and it performs related housekeeping chores including coefficient
12
 * quantization.
13
 */
14
15
#define JPEG_INTERNALS
16
#include "jinclude.h"
17
#include "jpeglib.h"
18
#include "jdct.h"   /* Private declarations for DCT subsystem */
19
20
21
/* Private subobject for this module */
22
23
typedef struct {
24
  struct jpeg_forward_dct pub;  /* public fields */
25
26
  /* Pointer to the DCT routine actually in use */
27
  forward_DCT_method_ptr do_dct[MAX_COMPONENTS];
28
29
#ifdef DCT_FLOAT_SUPPORTED
30
  /* Same as above for the floating-point case. */
31
  float_DCT_method_ptr do_float_dct[MAX_COMPONENTS];
32
#endif
33
} my_fdct_controller;
34
35
typedef my_fdct_controller * my_fdct_ptr;
36
37
38
/* The allocated post-DCT divisor tables -- big enough for any
39
 * supported variant and not identical to the quant table entries,
40
 * because of scaling (especially for an unnormalized DCT) --
41
 * are pointed to by dct_table in the per-component comp_info
42
 * structures.  Each table is given in normal array order.
43
 */
44
45
typedef union {
46
  DCTELEM int_array[DCTSIZE2];
47
#ifdef DCT_FLOAT_SUPPORTED
48
  FAST_FLOAT float_array[DCTSIZE2];
49
#endif
50
} divisor_table;
51
52
53
/*
54
 * Perform forward DCT on one or more blocks of a component.
55
 *
56
 * The input samples are taken from the sample_data[] array starting at
57
 * position start_col, and moving to the right for any additional blocks.
58
 * The quantized coefficients are returned in coef_blocks[].
59
 */
60
61
METHODDEF(void)
62
forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
63
       JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
64
       JDIMENSION start_col, JDIMENSION num_blocks)
65
/* This version is used for integer DCT implementations. */
66
3.12M
{
67
  /* This routine is heavily used, so it's worth coding it tightly. */
68
3.12M
  my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
69
3.12M
  forward_DCT_method_ptr do_dct = fdct->do_dct[compptr->component_index];
70
3.12M
  DCTELEM * divisors = (DCTELEM *) compptr->dct_table;
71
3.12M
  DCTELEM workspace[DCTSIZE2];  /* work area for FDCT subroutine */
72
3.12M
  JDIMENSION bi;
73
74
7.69M
  for (bi = 0; bi < num_blocks; bi++, start_col += compptr->DCT_h_scaled_size) {
75
    /* Perform the DCT */
76
4.57M
    (*do_dct) (workspace, sample_data, start_col);
77
78
    /* Quantize/descale the coefficients, and store into coef_blocks[] */
79
4.57M
    { register DCTELEM temp, qval;
80
4.57M
      register int i;
81
4.57M
      register JCOEFPTR output_ptr = coef_blocks[bi];
82
83
297M
      for (i = 0; i < DCTSIZE2; i++) {
84
292M
  qval = divisors[i];
85
292M
  temp = workspace[i];
86
  /* Divide the coefficient value by qval, ensuring proper rounding.
87
   * Since C does not specify the direction of rounding for negative
88
   * quotients, we have to force the dividend positive for portability.
89
   *
90
   * In most files, at least half of the output values will be zero
91
   * (at default quantization settings, more like three-quarters...)
92
   * so we should ensure that this case is fast.  On many machines,
93
   * a comparison is enough cheaper than a divide to make a special
94
   * test a win.  Since both inputs will be nonnegative, we need
95
   * only test for a < b to discover whether a/b is 0.
96
   * If your machine's division is fast enough, define FAST_DIVIDE.
97
   */
98
#ifdef FAST_DIVIDE
99
#define DIVIDE_BY(a,b)  a /= b
100
#else
101
292M
#define DIVIDE_BY(a,b)  if (a >= b) a /= b; else a = 0
102
292M
#endif
103
292M
  if (temp < 0) {
104
20.2M
    temp = -temp;
105
20.2M
    temp += qval>>1;  /* for rounding */
106
20.2M
    DIVIDE_BY(temp, qval);
107
20.2M
    temp = -temp;
108
272M
  } else {
109
272M
    temp += qval>>1;  /* for rounding */
110
272M
    DIVIDE_BY(temp, qval);
111
272M
  }
112
292M
  output_ptr[i] = (JCOEF) temp;
113
292M
      }
114
4.57M
    }
115
4.57M
  }
116
3.12M
}
117
118
119
#ifdef DCT_FLOAT_SUPPORTED
120
121
METHODDEF(void)
122
forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr,
123
       JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
124
       JDIMENSION start_col, JDIMENSION num_blocks)
125
/* This version is used for floating-point DCT implementations. */
126
{
127
  /* This routine is heavily used, so it's worth coding it tightly. */
128
  my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
129
  float_DCT_method_ptr do_dct = fdct->do_float_dct[compptr->component_index];
130
  FAST_FLOAT * divisors = (FAST_FLOAT *) compptr->dct_table;
131
  FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */
132
  JDIMENSION bi;
133
134
  for (bi = 0; bi < num_blocks; bi++, start_col += compptr->DCT_h_scaled_size) {
135
    /* Perform the DCT */
136
    (*do_dct) (workspace, sample_data, start_col);
137
138
    /* Quantize/descale the coefficients, and store into coef_blocks[] */
139
    { register FAST_FLOAT temp;
140
      register int i;
141
      register JCOEFPTR output_ptr = coef_blocks[bi];
142
143
      for (i = 0; i < DCTSIZE2; i++) {
144
  /* Apply the quantization and scaling factor */
145
  temp = workspace[i] * divisors[i];
146
  /* Round to nearest integer.
147
   * Since C does not specify the direction of rounding for negative
148
   * quotients, we have to force the dividend positive for portability.
149
   * The maximum coefficient size is +-16K (for 12-bit data), so this
150
   * code should work for either 16-bit or 32-bit ints.
151
   */
152
  output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384);
153
      }
154
    }
155
  }
156
}
157
158
#endif /* DCT_FLOAT_SUPPORTED */
159
160
161
/*
162
 * Initialize for a processing pass.
163
 * Verify that all referenced Q-tables are present, and set up
164
 * the divisor table for each one.
165
 * In the current implementation, DCT of all components is done during
166
 * the first pass, even if only some components will be output in the
167
 * first scan.  Hence all components should be examined here.
168
 */
169
170
METHODDEF(void)
171
start_pass_fdctmgr (j_compress_ptr cinfo)
172
11.7k
{
173
11.7k
  my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
174
11.7k
  int ci, qtblno, i;
175
11.7k
  jpeg_component_info *compptr;
176
11.7k
  J_DCT_METHOD method = JDCT_DEFAULT;
177
11.7k
  JQUANT_TBL * qtbl;
178
11.7k
  DCTELEM * dtbl;
179
180
35.4k
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
181
23.7k
       ci++, compptr++) {
182
    /* Select the proper DCT routine for this component's scaling */
183
23.7k
    switch ((compptr->DCT_h_scaled_size << 8) + compptr->DCT_v_scaled_size) {
184
0
#ifdef DCT_SCALING_SUPPORTED
185
/*
186
 * The current scaled-DCT routines require ISLOW-style divisor tables,
187
 * so be sure to compile that code if either ISLOW or SCALING is requested.
188
 */
189
0
#ifndef PROVIDE_ISLOW_TABLES
190
0
#define PROVIDE_ISLOW_TABLES
191
0
#endif
192
0
    case ((1 << 8) + 1):
193
0
      fdct->do_dct[ci] = jpeg_fdct_1x1;
194
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
195
0
      break;
196
0
    case ((2 << 8) + 2):
197
0
      fdct->do_dct[ci] = jpeg_fdct_2x2;
198
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
199
0
      break;
200
0
    case ((3 << 8) + 3):
201
0
      fdct->do_dct[ci] = jpeg_fdct_3x3;
202
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
203
0
      break;
204
0
    case ((4 << 8) + 4):
205
0
      fdct->do_dct[ci] = jpeg_fdct_4x4;
206
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
207
0
      break;
208
0
    case ((5 << 8) + 5):
209
0
      fdct->do_dct[ci] = jpeg_fdct_5x5;
210
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
211
0
      break;
212
0
    case ((6 << 8) + 6):
213
0
      fdct->do_dct[ci] = jpeg_fdct_6x6;
214
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
215
0
      break;
216
0
    case ((7 << 8) + 7):
217
0
      fdct->do_dct[ci] = jpeg_fdct_7x7;
218
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
219
0
      break;
220
0
    case ((9 << 8) + 9):
221
0
      fdct->do_dct[ci] = jpeg_fdct_9x9;
222
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
223
0
      break;
224
0
    case ((10 << 8) + 10):
225
0
      fdct->do_dct[ci] = jpeg_fdct_10x10;
226
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
227
0
      break;
228
0
    case ((11 << 8) + 11):
229
0
      fdct->do_dct[ci] = jpeg_fdct_11x11;
230
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
231
0
      break;
232
0
    case ((12 << 8) + 12):
233
0
      fdct->do_dct[ci] = jpeg_fdct_12x12;
234
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
235
0
      break;
236
0
    case ((13 << 8) + 13):
237
0
      fdct->do_dct[ci] = jpeg_fdct_13x13;
238
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
239
0
      break;
240
0
    case ((14 << 8) + 14):
241
0
      fdct->do_dct[ci] = jpeg_fdct_14x14;
242
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
243
0
      break;
244
0
    case ((15 << 8) + 15):
245
0
      fdct->do_dct[ci] = jpeg_fdct_15x15;
246
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
247
0
      break;
248
11.9k
    case ((16 << 8) + 16):
249
11.9k
      fdct->do_dct[ci] = jpeg_fdct_16x16;
250
11.9k
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
251
11.9k
      break;
252
0
    case ((16 << 8) + 8):
253
0
      fdct->do_dct[ci] = jpeg_fdct_16x8;
254
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
255
0
      break;
256
0
    case ((14 << 8) + 7):
257
0
      fdct->do_dct[ci] = jpeg_fdct_14x7;
258
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
259
0
      break;
260
0
    case ((12 << 8) + 6):
261
0
      fdct->do_dct[ci] = jpeg_fdct_12x6;
262
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
263
0
      break;
264
0
    case ((10 << 8) + 5):
265
0
      fdct->do_dct[ci] = jpeg_fdct_10x5;
266
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
267
0
      break;
268
0
    case ((8 << 8) + 4):
269
0
      fdct->do_dct[ci] = jpeg_fdct_8x4;
270
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
271
0
      break;
272
0
    case ((6 << 8) + 3):
273
0
      fdct->do_dct[ci] = jpeg_fdct_6x3;
274
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
275
0
      break;
276
0
    case ((4 << 8) + 2):
277
0
      fdct->do_dct[ci] = jpeg_fdct_4x2;
278
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
279
0
      break;
280
0
    case ((2 << 8) + 1):
281
0
      fdct->do_dct[ci] = jpeg_fdct_2x1;
282
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
283
0
      break;
284
0
    case ((8 << 8) + 16):
285
0
      fdct->do_dct[ci] = jpeg_fdct_8x16;
286
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
287
0
      break;
288
0
    case ((7 << 8) + 14):
289
0
      fdct->do_dct[ci] = jpeg_fdct_7x14;
290
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
291
0
      break;
292
0
    case ((6 << 8) + 12):
293
0
      fdct->do_dct[ci] = jpeg_fdct_6x12;
294
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
295
0
      break;
296
0
    case ((5 << 8) + 10):
297
0
      fdct->do_dct[ci] = jpeg_fdct_5x10;
298
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
299
0
      break;
300
0
    case ((4 << 8) + 8):
301
0
      fdct->do_dct[ci] = jpeg_fdct_4x8;
302
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
303
0
      break;
304
0
    case ((3 << 8) + 6):
305
0
      fdct->do_dct[ci] = jpeg_fdct_3x6;
306
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
307
0
      break;
308
0
    case ((2 << 8) + 4):
309
0
      fdct->do_dct[ci] = jpeg_fdct_2x4;
310
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
311
0
      break;
312
0
    case ((1 << 8) + 2):
313
0
      fdct->do_dct[ci] = jpeg_fdct_1x2;
314
0
      method = JDCT_ISLOW;  /* jfdctint uses islow-style table */
315
0
      break;
316
0
#endif
317
11.7k
    case ((DCTSIZE << 8) + DCTSIZE):
318
11.7k
      switch (cinfo->dct_method) {
319
0
#ifdef DCT_ISLOW_SUPPORTED
320
11.7k
      case JDCT_ISLOW:
321
#ifndef PROVIDE_ISLOW_TABLES
322
#define PROVIDE_ISLOW_TABLES
323
#endif
324
11.7k
  fdct->do_dct[ci] = jpeg_fdct_islow;
325
11.7k
  method = JDCT_ISLOW;
326
11.7k
  break;
327
0
#endif
328
#ifdef DCT_IFAST_SUPPORTED
329
      case JDCT_IFAST:
330
#if BITS_IN_JSAMPLE < JPEG_DATA_PRECISION || \
331
    BITS_IN_JSAMPLE > JPEG_DATA_PRECISION + 8
332
  /*
333
   * Adjustment of divisor tables in JDCT_IFAST
334
   * below doesn't work well in this condition.
335
   * Use JDCT_ISLOW instead.
336
   */
337
#ifndef PROVIDE_ISLOW_TABLES
338
#define PROVIDE_ISLOW_TABLES
339
#endif
340
  fdct->do_dct[ci] = jpeg_fdct_islow;
341
  method = JDCT_ISLOW;
342
#else
343
#ifndef PROVIDE_IFAST_TABLES
344
#define PROVIDE_IFAST_TABLES
345
#endif
346
  fdct->do_dct[ci] = jpeg_fdct_ifast;
347
  method = JDCT_IFAST;
348
#endif
349
  break;
350
#endif
351
#ifdef DCT_FLOAT_SUPPORTED
352
      case JDCT_FLOAT:
353
  fdct->do_float_dct[ci] = jpeg_fdct_float;
354
  method = JDCT_FLOAT;
355
  break;
356
#endif
357
0
      default:
358
0
  ERREXIT(cinfo, JERR_NOT_COMPILED);
359
11.7k
      }
360
11.7k
      break;
361
11.7k
    default:
362
0
      ERREXIT2(cinfo, JERR_BAD_DCTSIZE,
363
23.7k
         compptr->DCT_h_scaled_size, compptr->DCT_v_scaled_size);
364
23.7k
    }
365
23.7k
    qtblno = compptr->quant_tbl_no;
366
    /* Make sure specified quantization table is present */
367
23.7k
    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
368
23.7k
  cinfo->quant_tbl_ptrs[qtblno] == NULL)
369
0
      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
370
23.7k
    qtbl = cinfo->quant_tbl_ptrs[qtblno];
371
    /* Create divisor table from quant table */
372
23.7k
    switch (method) {
373
0
#ifdef PROVIDE_ISLOW_TABLES
374
23.7k
    case JDCT_ISLOW:
375
      /* For LL&M FDCT method, divisors are equal to raw quantization
376
       * coefficients multiplied by 8 (to counteract scaling).
377
       */
378
23.7k
      dtbl = (DCTELEM *) compptr->dct_table;
379
1.54M
      for (i = 0; i < DCTSIZE2; i++) {
380
1.51M
  dtbl[i] =
381
1.51M
    ((DCTELEM) qtbl->quantval[i]) << (compptr->component_needed ? 4 : 3);
382
1.51M
      }
383
23.7k
      fdct->pub.forward_DCT[ci] = forward_DCT;
384
23.7k
      break;
385
0
#endif
386
#ifdef PROVIDE_IFAST_TABLES
387
    case JDCT_IFAST:
388
      {
389
  /* For AA&N FDCT method, divisors are equal to quantization
390
   * coefficients scaled by scalefactor[row]*scalefactor[col], where
391
   *   scalefactor[0] = 1
392
   *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
393
   * We apply a further scale factor of 8
394
   * with adjustment if necessary.
395
   */
396
#define CONST_BITS 14
397
  static const INT16 aanscales[DCTSIZE2] = {
398
    /* precomputed values scaled up by 14 bits */
399
    16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
400
    22725, 31521, 29692, 26722, 22725, 17855, 12299,  6270,
401
    21407, 29692, 27969, 25172, 21407, 16819, 11585,  5906,
402
    19266, 26722, 25172, 22654, 19266, 15137, 10426,  5315,
403
    16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
404
    12873, 17855, 16819, 15137, 12873, 10114,  6967,  3552,
405
     8867, 12299, 11585, 10426,  8867,  6967,  4799,  2446,
406
     4520,  6270,  5906,  5315,  4520,  3552,  2446,  1247
407
  };
408
  SHIFT_TEMPS
409
410
  dtbl = (DCTELEM *) compptr->dct_table;
411
  if (compptr->component_needed) {
412
    for (i = 0; i < DCTSIZE2; i++) {
413
      dtbl[i] = (DCTELEM)
414
        DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
415
            (INT32) aanscales[i]),
416
          CONST_BITS+JPEG_DATA_PRECISION-BITS_IN_JSAMPLE-4);
417
    }
418
  } else {
419
    for (i = 0; i < DCTSIZE2; i++) {
420
      dtbl[i] = (DCTELEM)
421
        DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
422
            (INT32) aanscales[i]),
423
          CONST_BITS+JPEG_DATA_PRECISION-BITS_IN_JSAMPLE-3);
424
    }
425
  }
426
      }
427
      fdct->pub.forward_DCT[ci] = forward_DCT;
428
      break;
429
#endif
430
#ifdef DCT_FLOAT_SUPPORTED
431
    case JDCT_FLOAT:
432
      {
433
  /* For float AA&N FDCT method, divisors are equal to quantization
434
   * coefficients scaled by scalefactor[row]*scalefactor[col], where
435
   *   scalefactor[0] = 1
436
   *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
437
   * We apply a further scale factor of 8
438
   * with adjustment if necessary.
439
   * What's actually stored is 1/divisor so that the inner loop can
440
   * use a multiplication rather than a division.
441
   */
442
  FAST_FLOAT * fdtbl = (FAST_FLOAT *) compptr->dct_table;
443
  int row, col;
444
  static const double aanscalefactor[DCTSIZE] = {
445
    1.0, 1.387039845, 1.306562965, 1.175875602,
446
    1.0, 0.785694958, 0.541196100, 0.275899379
447
  };
448
#if BITS_IN_JSAMPLE == JPEG_DATA_PRECISION
449
450
  i = 0;
451
  for (row = 0; row < DCTSIZE; row++) {
452
    for (col = 0; col < DCTSIZE; col++) {
453
      fdtbl[i] = (FAST_FLOAT)
454
        (1.0 / ((double) qtbl->quantval[i] *
455
          aanscalefactor[row] * aanscalefactor[col] *
456
          (compptr->component_needed ? 16.0 : 8.0)));
457
#else
458
  double extrafactor = compptr->component_needed ? 16.0 : 8.0;
459
460
  /* Adjust extra factor */
461
#if BITS_IN_JSAMPLE < JPEG_DATA_PRECISION
462
  i = JPEG_DATA_PRECISION - BITS_IN_JSAMPLE;
463
  do { extrafactor *= 0.5; } while (--i);
464
#else
465
  i = BITS_IN_JSAMPLE - JPEG_DATA_PRECISION;
466
  do { extrafactor *= 2.0; } while (--i);
467
#endif
468
469
  i = 0;
470
  for (row = 0; row < DCTSIZE; row++) {
471
    for (col = 0; col < DCTSIZE; col++) {
472
      fdtbl[i] = (FAST_FLOAT)
473
        (1.0 / ((double) qtbl->quantval[i] *
474
          aanscalefactor[row] * aanscalefactor[col] *
475
          extrafactor));
476
#endif
477
      i++;
478
    }
479
  }
480
      }
481
      fdct->pub.forward_DCT[ci] = forward_DCT_float;
482
      break;
483
#endif
484
0
    default:
485
0
      ERREXIT(cinfo, JERR_NOT_COMPILED);
486
23.7k
    }
487
23.7k
  }
488
11.7k
}
489
490
491
/*
492
 * Initialize FDCT manager.
493
 */
494
495
GLOBAL(void)
496
jinit_forward_dct (j_compress_ptr cinfo)
497
11.7k
{
498
11.7k
  my_fdct_ptr fdct;
499
11.7k
  int ci;
500
11.7k
  jpeg_component_info *compptr;
501
502
11.7k
  fdct = (my_fdct_ptr) (*cinfo->mem->alloc_small)
503
11.7k
    ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_fdct_controller));
504
11.7k
  cinfo->fdct = &fdct->pub;
505
11.7k
  fdct->pub.start_pass = start_pass_fdctmgr;
506
507
35.4k
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
508
23.7k
       ci++, compptr++) {
509
    /* Allocate a divisor table for each component */
510
23.7k
    compptr->dct_table = (*cinfo->mem->alloc_small)
511
23.7k
      ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(divisor_table));
512
23.7k
  }
513
11.7k
}