ReactOS 0.4.16-dev-91-g764881a
jddctmgr.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
#include "jdct.h"
Include dependency graph for jddctmgr.c:

Go to the source code of this file.

Classes

struct  my_idct_controller
 
union  multiplier_table
 

Macros

#define JPEG_INTERNALS
 

Typedefs

typedef my_idct_controllermy_idct_ptr
 

Functions

 start_pass (j_decompress_ptr cinfo)
 
 jinit_inverse_dct (j_decompress_ptr cinfo)
 

Macro Definition Documentation

◆ JPEG_INTERNALS

#define JPEG_INTERNALS

Definition at line 19 of file jddctmgr.c.

Typedef Documentation

◆ my_idct_ptr

Definition at line 55 of file jddctmgr.c.

Function Documentation

◆ jinit_inverse_dct()

jinit_inverse_dct ( j_decompress_ptr  cinfo)

Definition at line 362 of file jddctmgr.c.

363{
364 my_idct_ptr idct;
365 int ci;
367
368 idct = (my_idct_ptr)
369 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
371 cinfo->idct = &idct->pub;
372 idct->pub.start_pass = start_pass;
373
374 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
375 ci++, compptr++) {
376 /* Allocate and pre-zero a multiplier table for each component */
378 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
381 /* Mark multiplier table not yet set up for any method */
382 idct->cur_method[ci] = -1;
383 }
384}
#define SIZEOF(_ar)
Definition: calc.h:97
jpeg_component_info * compptr
Definition: jdct.h:238
start_pass(j_decompress_ptr cinfo)
Definition: jddctmgr.c:90
my_idct_controller * my_idct_ptr
Definition: jddctmgr.c:55
struct jpeg_common_struct * j_common_ptr
Definition: jpeglib.h:284
#define JPOOL_IMAGE
Definition: jpeglib.h:808
struct jpeg_inverse_dct * idct
Definition: jpeglib.h:685
jpeg_component_info * comp_info
Definition: jpeglib.h:583
int cur_method[MAX_COMPONENTS]
Definition: jddctmgr.c:52
struct jpeg_inverse_dct pub
Definition: jddctmgr.c:45
#define MEMZERO(addr, type, size)
Definition: svc_dg.c:324

Referenced by master_selection().

◆ start_pass()

start_pass ( j_decompress_ptr  cinfo)

Definition at line 90 of file jddctmgr.c.

91{
92 my_idct_ptr idct = (my_idct_ptr) cinfo->idct;
93 int ci, i;
95 int method = 0;
96 inverse_DCT_method_ptr method_ptr = NULL;
97 JQUANT_TBL * qtbl;
98
99 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
100 ci++, compptr++) {
101 /* Select the proper IDCT routine for this component's scaling */
103#ifdef IDCT_SCALING_SUPPORTED
104 case ((1 << 8) + 1):
105 method_ptr = jpeg_idct_1x1;
106 method = JDCT_ISLOW; /* jidctint uses islow-style table */
107 break;
108 case ((2 << 8) + 2):
109 method_ptr = jpeg_idct_2x2;
110 method = JDCT_ISLOW; /* jidctint uses islow-style table */
111 break;
112 case ((3 << 8) + 3):
113 method_ptr = jpeg_idct_3x3;
114 method = JDCT_ISLOW; /* jidctint uses islow-style table */
115 break;
116 case ((4 << 8) + 4):
117 method_ptr = jpeg_idct_4x4;
118 method = JDCT_ISLOW; /* jidctint uses islow-style table */
119 break;
120 case ((5 << 8) + 5):
121 method_ptr = jpeg_idct_5x5;
122 method = JDCT_ISLOW; /* jidctint uses islow-style table */
123 break;
124 case ((6 << 8) + 6):
125 method_ptr = jpeg_idct_6x6;
126 method = JDCT_ISLOW; /* jidctint uses islow-style table */
127 break;
128 case ((7 << 8) + 7):
129 method_ptr = jpeg_idct_7x7;
130 method = JDCT_ISLOW; /* jidctint uses islow-style table */
131 break;
132 case ((9 << 8) + 9):
133 method_ptr = jpeg_idct_9x9;
134 method = JDCT_ISLOW; /* jidctint uses islow-style table */
135 break;
136 case ((10 << 8) + 10):
137 method_ptr = jpeg_idct_10x10;
138 method = JDCT_ISLOW; /* jidctint uses islow-style table */
139 break;
140 case ((11 << 8) + 11):
141 method_ptr = jpeg_idct_11x11;
142 method = JDCT_ISLOW; /* jidctint uses islow-style table */
143 break;
144 case ((12 << 8) + 12):
145 method_ptr = jpeg_idct_12x12;
146 method = JDCT_ISLOW; /* jidctint uses islow-style table */
147 break;
148 case ((13 << 8) + 13):
149 method_ptr = jpeg_idct_13x13;
150 method = JDCT_ISLOW; /* jidctint uses islow-style table */
151 break;
152 case ((14 << 8) + 14):
153 method_ptr = jpeg_idct_14x14;
154 method = JDCT_ISLOW; /* jidctint uses islow-style table */
155 break;
156 case ((15 << 8) + 15):
157 method_ptr = jpeg_idct_15x15;
158 method = JDCT_ISLOW; /* jidctint uses islow-style table */
159 break;
160 case ((16 << 8) + 16):
161 method_ptr = jpeg_idct_16x16;
162 method = JDCT_ISLOW; /* jidctint uses islow-style table */
163 break;
164 case ((16 << 8) + 8):
165 method_ptr = jpeg_idct_16x8;
166 method = JDCT_ISLOW; /* jidctint uses islow-style table */
167 break;
168 case ((14 << 8) + 7):
169 method_ptr = jpeg_idct_14x7;
170 method = JDCT_ISLOW; /* jidctint uses islow-style table */
171 break;
172 case ((12 << 8) + 6):
173 method_ptr = jpeg_idct_12x6;
174 method = JDCT_ISLOW; /* jidctint uses islow-style table */
175 break;
176 case ((10 << 8) + 5):
177 method_ptr = jpeg_idct_10x5;
178 method = JDCT_ISLOW; /* jidctint uses islow-style table */
179 break;
180 case ((8 << 8) + 4):
181 method_ptr = jpeg_idct_8x4;
182 method = JDCT_ISLOW; /* jidctint uses islow-style table */
183 break;
184 case ((6 << 8) + 3):
185 method_ptr = jpeg_idct_6x3;
186 method = JDCT_ISLOW; /* jidctint uses islow-style table */
187 break;
188 case ((4 << 8) + 2):
189 method_ptr = jpeg_idct_4x2;
190 method = JDCT_ISLOW; /* jidctint uses islow-style table */
191 break;
192 case ((2 << 8) + 1):
193 method_ptr = jpeg_idct_2x1;
194 method = JDCT_ISLOW; /* jidctint uses islow-style table */
195 break;
196 case ((8 << 8) + 16):
197 method_ptr = jpeg_idct_8x16;
198 method = JDCT_ISLOW; /* jidctint uses islow-style table */
199 break;
200 case ((7 << 8) + 14):
201 method_ptr = jpeg_idct_7x14;
202 method = JDCT_ISLOW; /* jidctint uses islow-style table */
203 break;
204 case ((6 << 8) + 12):
205 method_ptr = jpeg_idct_6x12;
206 method = JDCT_ISLOW; /* jidctint uses islow-style table */
207 break;
208 case ((5 << 8) + 10):
209 method_ptr = jpeg_idct_5x10;
210 method = JDCT_ISLOW; /* jidctint uses islow-style table */
211 break;
212 case ((4 << 8) + 8):
213 method_ptr = jpeg_idct_4x8;
214 method = JDCT_ISLOW; /* jidctint uses islow-style table */
215 break;
216 case ((3 << 8) + 6):
217 method_ptr = jpeg_idct_3x6;
218 method = JDCT_ISLOW; /* jidctint uses islow-style table */
219 break;
220 case ((2 << 8) + 4):
221 method_ptr = jpeg_idct_2x4;
222 method = JDCT_ISLOW; /* jidctint uses islow-style table */
223 break;
224 case ((1 << 8) + 2):
225 method_ptr = jpeg_idct_1x2;
226 method = JDCT_ISLOW; /* jidctint uses islow-style table */
227 break;
228#endif
229 case ((DCTSIZE << 8) + DCTSIZE):
230 switch (cinfo->dct_method) {
231#ifdef DCT_ISLOW_SUPPORTED
232 case JDCT_ISLOW:
233 method_ptr = jpeg_idct_islow;
235 break;
236#endif
237#ifdef DCT_IFAST_SUPPORTED
238 case JDCT_IFAST:
239 method_ptr = jpeg_idct_ifast;
241 break;
242#endif
243#ifdef DCT_FLOAT_SUPPORTED
244 case JDCT_FLOAT:
245 method_ptr = jpeg_idct_float;
247 break;
248#endif
249 default:
250 ERREXIT(cinfo, JERR_NOT_COMPILED);
251 break;
252 }
253 break;
254 default:
255 ERREXIT2(cinfo, JERR_BAD_DCTSIZE,
257 break;
258 }
259 idct->pub.inverse_DCT[ci] = method_ptr;
260 /* Create multiplier table from quant table.
261 * However, we can skip this if the component is uninteresting
262 * or if we already built the table. Also, if no quant table
263 * has yet been saved for the component, we leave the
264 * multiplier table all-zero; we'll be reading zeroes from the
265 * coefficient controller's buffer anyway.
266 */
267 if (! compptr->component_needed || idct->cur_method[ci] == method)
268 continue;
269 qtbl = compptr->quant_table;
270 if (qtbl == NULL) /* happens if no data yet for component */
271 continue;
272 idct->cur_method[ci] = method;
273 switch (method) {
274#ifdef PROVIDE_ISLOW_TABLES
275 case JDCT_ISLOW:
276 {
277 /* For LL&M IDCT method, multipliers are equal to raw quantization
278 * coefficients, but are stored as ints to ensure access efficiency.
279 */
281 for (i = 0; i < DCTSIZE2; i++) {
282 ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i];
283 }
284 }
285 break;
286#endif
287#ifdef DCT_IFAST_SUPPORTED
288 case JDCT_IFAST:
289 {
290 /* For AA&N IDCT method, multipliers are equal to quantization
291 * coefficients scaled by scalefactor[row]*scalefactor[col], where
292 * scalefactor[0] = 1
293 * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
294 * For integer operation, the multiplier table is to be scaled by
295 * IFAST_SCALE_BITS.
296 */
298#define CONST_BITS 14
299 static const INT16 aanscales[DCTSIZE2] = {
300 /* precomputed values scaled up by 14 bits */
301 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
302 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270,
303 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906,
304 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315,
305 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
306 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552,
307 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446,
308 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247
309 };
311
312 for (i = 0; i < DCTSIZE2; i++) {
313 ifmtbl[i] = (IFAST_MULT_TYPE)
314 DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
315 (INT32) aanscales[i]),
316 CONST_BITS-IFAST_SCALE_BITS);
317 }
318 }
319 break;
320#endif
321#ifdef DCT_FLOAT_SUPPORTED
322 case JDCT_FLOAT:
323 {
324 /* For float AA&N IDCT method, multipliers are equal to quantization
325 * coefficients scaled by scalefactor[row]*scalefactor[col], where
326 * scalefactor[0] = 1
327 * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
328 * We apply a further scale factor of 1/8.
329 */
331 int row, col;
332 static const double aanscalefactor[DCTSIZE] = {
333 1.0, 1.387039845, 1.306562965, 1.175875602,
334 1.0, 0.785694958, 0.541196100, 0.275899379
335 };
336
337 i = 0;
338 for (row = 0; row < DCTSIZE; row++) {
339 for (col = 0; col < DCTSIZE; col++) {
340 fmtbl[i] = (FLOAT_MULT_TYPE)
341 ((double) qtbl->quantval[i] *
342 aanscalefactor[row] * aanscalefactor[col] * 0.125);
343 i++;
344 }
345 }
346 }
347 break;
348#endif
349 default:
350 ERREXIT(cinfo, JERR_NOT_COMPILED);
351 break;
352 }
353 }
354}
signed int INT32
signed short INT16
#define NULL
Definition: types.h:112
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
method
Definition: dragdrop.c:54
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
MULTIPLIER ISLOW_MULT_TYPE
Definition: jdct.h:66
INT32 IFAST_MULT_TYPE
Definition: jdct.h:71
#define MULTIPLY16V16(var1, var2)
Definition: jdct.h:388
#define IFAST_SCALE_BITS
Definition: jdct.h:72
FAST_FLOAT FLOAT_MULT_TYPE
Definition: jdct.h:74
#define ERREXIT2(cinfo, code, p1, p2)
Definition: jerror.h:216
#define SHIFT_TEMPS
Definition: jpegint.h:301
#define DESCALE(x, n)
Definition: jpegint.h:310
#define DCTSIZE
Definition: jpeglib.h:50
@ JDCT_IFAST
Definition: jpeglib.h:242
@ JDCT_FLOAT
Definition: jpeglib.h:243
@ JDCT_ISLOW
Definition: jpeglib.h:241
#define DCTSIZE2
Definition: jpeglib.h:51
#define for
Definition: utility.h:88
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
boolean component_needed
Definition: jpeglib.h:174
JQUANT_TBL * quant_table
Definition: jpeglib.h:189
J_DCT_METHOD dct_method
Definition: jpeglib.h:487

Referenced by jinit_inverse_dct().