ReactOS  0.4.15-dev-1184-g23e04ae
jdmaster.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Include dependency graph for jdmaster.c:

Go to the source code of this file.

Classes

struct  my_decomp_master
 

Macros

#define JPEG_INTERNALS
 

Typedefs

typedef my_decomp_mastermy_master_ptr
 

Functions

 use_merged_upsample (j_decompress_ptr cinfo)
 
 jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
 
 prepare_range_limit_table (j_decompress_ptr cinfo)
 
 master_selection (j_decompress_ptr cinfo)
 
 prepare_for_output_pass (j_decompress_ptr cinfo)
 
 finish_output_pass (j_decompress_ptr cinfo)
 
 jinit_master_decompress (j_decompress_ptr cinfo)
 

Macro Definition Documentation

◆ JPEG_INTERNALS

#define JPEG_INTERNALS

Definition at line 15 of file jdmaster.c.

Typedef Documentation

◆ my_master_ptr

Definition at line 36 of file jdmaster.c.

Function Documentation

◆ finish_output_pass()

finish_output_pass ( j_decompress_ptr  cinfo)

Definition at line 481 of file jdmaster.c.

482 {
483  my_master_ptr master = (my_master_ptr) cinfo->master;
484 
485  if (cinfo->quantize_colors)
486  (*cinfo->cquantize->finish_pass) (cinfo);
487  master->pass_number++;
488 }
boolean quantize_colors
Definition: jpeglib.h:491
int pass_number
Definition: jcmaster.c:33
struct jpeg_color_quantizer * cquantize
Definition: jpeglib.h:688
if(!(yy_init))
Definition: macro.lex.yy.c:714
struct jpeg_decomp_master * master
Definition: jpeglib.h:678
my_decomp_master * my_master_ptr
Definition: jdmaster.c:36

Referenced by jinit_master_decompress().

◆ jinit_master_decompress()

jinit_master_decompress ( j_decompress_ptr  cinfo)

Definition at line 526 of file jdmaster.c.

527 {
528  my_master_ptr master;
529 
530  master = (my_master_ptr) (*cinfo->mem->alloc_small)
532  cinfo->master = &master->pub;
533  master->pub.prepare_for_output_pass = prepare_for_output_pass;
534  master->pub.finish_output_pass = finish_output_pass;
535 
536  master->pub.is_dummy_pass = FALSE;
537 
538  master_selection(cinfo);
539 }
struct jpeg_common_struct * j_common_ptr
Definition: jpeglib.h:284
#define SIZEOF(_ar)
Definition: calc.h:97
#define JPOOL_IMAGE
Definition: jpeglib.h:808
struct jpeg_comp_master pub
Definition: jcmaster.c:29
#define FALSE
Definition: types.h:117
finish_output_pass(j_decompress_ptr cinfo)
Definition: jdmaster.c:481
struct jpeg_decomp_master * master
Definition: jpeglib.h:678
master_selection(j_decompress_ptr cinfo)
Definition: jdmaster.c:269
my_decomp_master * my_master_ptr
Definition: jdmaster.c:36
prepare_for_output_pass(j_decompress_ptr cinfo)
Definition: jdmaster.c:421

◆ jpeg_calc_output_dimensions()

jpeg_calc_output_dimensions ( j_decompress_ptr  cinfo)

Definition at line 101 of file jdmaster.c.

105 {
106 #ifdef IDCT_SCALING_SUPPORTED
107  int ci, ssize;
109 #endif
110 
111  /* Prevent application from calling me at wrong times */
112  if (cinfo->global_state != DSTATE_READY)
113  ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
114 
115  /* Compute core output image dimensions and DCT scaling choices. */
116  jpeg_core_output_dimensions(cinfo);
117 
118 #ifdef IDCT_SCALING_SUPPORTED
119 
120  /* In selecting the actual DCT scaling for each component, we try to
121  * scale up the chroma components via IDCT scaling rather than upsampling.
122  * This saves time if the upsampler gets to use 1:1 scaling.
123  * Note this code adapts subsampling ratios which are powers of 2.
124  */
125  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
126  ci++, compptr++) {
127  ssize = 1;
128  if (! cinfo->raw_data_out)
129  while (cinfo->min_DCT_h_scaled_size * ssize <=
130  (cinfo->do_fancy_upsampling ? DCTSIZE : DCTSIZE / 2) &&
131  (cinfo->max_h_samp_factor % (compptr->h_samp_factor * ssize * 2)) ==
132  0) {
133  ssize = ssize * 2;
134  }
136  ssize = 1;
137  if (! cinfo->raw_data_out)
138  while (cinfo->min_DCT_v_scaled_size * ssize <=
139  (cinfo->do_fancy_upsampling ? DCTSIZE : DCTSIZE / 2) &&
140  (cinfo->max_v_samp_factor % (compptr->v_samp_factor * ssize * 2)) ==
141  0) {
142  ssize = ssize * 2;
143  }
145 
146  /* We don't support IDCT ratios larger than 2. */
151 
152  /* Recompute downsampled dimensions of components;
153  * application needs to know these if using raw downsampled data.
154  */
155  /* Size in samples, after IDCT scaling */
157  jdiv_round_up((long) cinfo->image_width *
159  (long) (cinfo->max_h_samp_factor * cinfo->block_size));
161  jdiv_round_up((long) cinfo->image_height *
163  (long) (cinfo->max_v_samp_factor * cinfo->block_size));
164  }
165 
166 #endif /* IDCT_SCALING_SUPPORTED */
167 
168  /* Report number of components in selected colorspace. */
169  /* Probably this should be in the color conversion module... */
170  switch (cinfo->out_color_space) {
171  case JCS_GRAYSCALE:
172  cinfo->out_color_components = 1;
173  break;
174  case JCS_RGB:
175  case JCS_BG_RGB:
176 #if RGB_PIXELSIZE != 3
177  cinfo->out_color_components = RGB_PIXELSIZE;
178  break;
179 #endif /* else share code with YCbCr */
180  case JCS_YCbCr:
181  case JCS_BG_YCC:
182  cinfo->out_color_components = 3;
183  break;
184  case JCS_CMYK:
185  case JCS_YCCK:
186  cinfo->out_color_components = 4;
187  break;
188  default: /* else must be same colorspace as in file */
189  cinfo->out_color_components = cinfo->num_components;
190  }
191  cinfo->output_components = (cinfo->quantize_colors ? 1 :
192  cinfo->out_color_components);
193 
194  /* See if upsampler will want to emit more than one row at a time */
195  if (use_merged_upsample(cinfo))
196  cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
197  else
198  cinfo->rec_outbuf_height = 1;
199 }
JDIMENSION downsampled_width
Definition: jpeglib.h:164
jpeg_component_info * comp_info
Definition: jpeglib.h:583
boolean do_fancy_upsampling
Definition: jpeglib.h:488
boolean quantize_colors
Definition: jpeglib.h:491
JDIMENSION image_width
Definition: jpeglib.h:468
JDIMENSION image_height
Definition: jpeglib.h:469
jpeg_component_info * compptr
Definition: jdct.h:238
J_COLOR_SPACE out_color_space
Definition: jpeglib.h:478
use_merged_upsample(j_decompress_ptr cinfo)
Definition: jdmaster.c:45
#define DSTATE_READY
Definition: jpegint.h:32
jdiv_round_up(long a, long b)
Definition: jutils.c:124
#define ERREXIT1(cinfo, code, p1)
Definition: jerror.h:212
#define long
Definition: qsort.c:33
#define DCTSIZE
Definition: jpeglib.h:50
unsigned int JDIMENSION
Definition: jmorecfg.h:229
JDIMENSION downsampled_height
Definition: jpeglib.h:165

Referenced by master_selection().

◆ master_selection()

master_selection ( j_decompress_ptr  cinfo)

Definition at line 269 of file jdmaster.c.

270 {
271  my_master_ptr master = (my_master_ptr) cinfo->master;
272  boolean use_c_buffer;
273  long samplesperrow;
274  JDIMENSION jd_samplesperrow;
275 
276  /* For now, precision must match compiled-in value... */
277  if (cinfo->data_precision != BITS_IN_JSAMPLE)
278  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
279 
280  /* Initialize dimensions and other stuff */
283 
284  /* Sanity check on image dimensions */
285  if (cinfo->output_height <= 0 || cinfo->output_width <= 0 ||
286  cinfo->out_color_components <= 0)
287  ERREXIT(cinfo, JERR_EMPTY_IMAGE);
288 
289  /* Width of an output scanline must be representable as JDIMENSION. */
290  samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components;
291  jd_samplesperrow = (JDIMENSION) samplesperrow;
292  if ((long) jd_samplesperrow != samplesperrow)
293  ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
294 
295  /* Initialize my private state */
296  master->pass_number = 0;
297  master->using_merged_upsample = use_merged_upsample(cinfo);
298 
299  /* Color quantizer selection */
300  master->quantizer_1pass = NULL;
301  master->quantizer_2pass = NULL;
302  /* No mode changes if not using buffered-image mode. */
303  if (! cinfo->quantize_colors || ! cinfo->buffered_image) {
304  cinfo->enable_1pass_quant = FALSE;
305  cinfo->enable_external_quant = FALSE;
306  cinfo->enable_2pass_quant = FALSE;
307  }
308  if (cinfo->quantize_colors) {
309  if (cinfo->raw_data_out)
310  ERREXIT(cinfo, JERR_NOTIMPL);
311  /* 2-pass quantizer only works in 3-component color space. */
312  if (cinfo->out_color_components != 3) {
313  cinfo->enable_1pass_quant = TRUE;
314  cinfo->enable_external_quant = FALSE;
315  cinfo->enable_2pass_quant = FALSE;
316  cinfo->colormap = NULL;
317  } else if (cinfo->colormap != NULL) {
318  cinfo->enable_external_quant = TRUE;
319  } else if (cinfo->two_pass_quantize) {
320  cinfo->enable_2pass_quant = TRUE;
321  } else {
322  cinfo->enable_1pass_quant = TRUE;
323  }
324 
325  if (cinfo->enable_1pass_quant) {
326 #ifdef QUANT_1PASS_SUPPORTED
327  jinit_1pass_quantizer(cinfo);
328  master->quantizer_1pass = cinfo->cquantize;
329 #else
330  ERREXIT(cinfo, JERR_NOT_COMPILED);
331 #endif
332  }
333 
334  /* We use the 2-pass code to map to external colormaps. */
335  if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) {
336 #ifdef QUANT_2PASS_SUPPORTED
337  jinit_2pass_quantizer(cinfo);
338  master->quantizer_2pass = cinfo->cquantize;
339 #else
340  ERREXIT(cinfo, JERR_NOT_COMPILED);
341 #endif
342  }
343  /* If both quantizers are initialized, the 2-pass one is left active;
344  * this is necessary for starting with quantization to an external map.
345  */
346  }
347 
348  /* Post-processing: in particular, color conversion first */
349  if (! cinfo->raw_data_out) {
350  if (master->using_merged_upsample) {
351 #ifdef UPSAMPLE_MERGING_SUPPORTED
352  jinit_merged_upsampler(cinfo); /* does color conversion too */
353 #else
354  ERREXIT(cinfo, JERR_NOT_COMPILED);
355 #endif
356  } else {
358  jinit_upsampler(cinfo);
359  }
361  }
362  /* Inverse DCT */
363  jinit_inverse_dct(cinfo);
364  /* Entropy decoding: either Huffman or arithmetic coding. */
365  if (cinfo->arith_code)
366  jinit_arith_decoder(cinfo);
367  else {
368  jinit_huff_decoder(cinfo);
369  }
370 
371  /* Initialize principal buffer controllers. */
372  use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image;
373  jinit_d_coef_controller(cinfo, use_c_buffer);
374 
375  if (! cinfo->raw_data_out)
376  jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
377 
378  /* We can now tell the memory manager to allocate virtual arrays. */
379  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
380 
381  /* Initialize input side of decompressor to consume first scan. */
382  (*cinfo->inputctl->start_input_pass) (cinfo);
383 
384 #ifdef D_MULTISCAN_FILES_SUPPORTED
385  /* If jpeg_start_decompress will read the whole file, initialize
386  * progress monitoring appropriately. The input step is counted
387  * as one pass.
388  */
389  if (cinfo->progress != NULL && ! cinfo->buffered_image &&
390  cinfo->inputctl->has_multiple_scans) {
391  int nscans;
392  /* Estimate number of scans to set pass_limit. */
393  if (cinfo->progressive_mode) {
394  /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
395  nscans = 2 + 3 * cinfo->num_components;
396  } else {
397  /* For a nonprogressive multiscan file, estimate 1 scan per component. */
398  nscans = cinfo->num_components;
399  }
400  cinfo->progress->pass_counter = 0L;
401  cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
402  cinfo->progress->completed_passes = 0;
403  cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);
404  /* Count the input pass as done */
405  master->pass_number++;
406  }
407 #endif /* D_MULTISCAN_FILES_SUPPORTED */
408 }
#define BITS_IN_JSAMPLE
Definition: jmorecfg.h:33
jinit_d_main_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
Definition: jdmainct.c:469
JDIMENSION output_height
Definition: jpeglib.h:508
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
#define TRUE
Definition: types.h:120
struct jpeg_input_controller * inputctl
Definition: jpeglib.h:682
boolean enable_2pass_quant
Definition: jpeglib.h:499
boolean quantize_colors
Definition: jpeglib.h:491
jinit_d_coef_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
Definition: jdcoefct.c:678
boolean enable_external_quant
Definition: jpeglib.h:498
JDIMENSION output_width
Definition: jpeglib.h:507
jinit_d_post_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
Definition: jdpostct.c:250
jinit_upsampler(j_decompress_ptr cinfo)
Definition: jdsample.c:294
jinit_color_deconverter(j_decompress_ptr cinfo)
Definition: jdcolor.c:568
int pass_number
Definition: jcmaster.c:33
boolean two_pass_quantize
Definition: jpeglib.h:494
jpeg_calc_output_dimensions(j_decompress_ptr cinfo)
Definition: jdmaster.c:101
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
prepare_range_limit_table(j_decompress_ptr cinfo)
Definition: jdmaster.c:236
use_merged_upsample(j_decompress_ptr cinfo)
Definition: jdmaster.c:45
struct jpeg_color_quantizer * cquantize
Definition: jpeglib.h:688
if(!(yy_init))
Definition: macro.lex.yy.c:714
jinit_arith_decoder(j_decompress_ptr cinfo)
Definition: jdarith.c:765
struct jpeg_decomp_master * master
Definition: jpeglib.h:678
boolean enable_1pass_quant
Definition: jpeglib.h:497
static const WCHAR L[]
Definition: oid.c:1250
#define ERREXIT1(cinfo, code, p1)
Definition: jerror.h:212
JSAMPARRAY colormap
Definition: jpeglib.h:527
my_decomp_master * my_master_ptr
Definition: jdmaster.c:36
#define long
Definition: qsort.c:33
boolean progressive_mode
Definition: jpeglib.h:587
unsigned int JDIMENSION
Definition: jmorecfg.h:229
jinit_inverse_dct(j_decompress_ptr cinfo)
Definition: jddctmgr.c:362
boolean buffered_image
Definition: jpeglib.h:484
JDIMENSION total_iMCU_rows
Definition: jpeglib.h:633
jinit_huff_decoder(j_decompress_ptr cinfo)
Definition: jdhuff.c:1527

Referenced by jinit_master_decompress().

◆ prepare_for_output_pass()

prepare_for_output_pass ( j_decompress_ptr  cinfo)

Definition at line 421 of file jdmaster.c.

422 {
423  my_master_ptr master = (my_master_ptr) cinfo->master;
424 
425  if (master->pub.is_dummy_pass) {
426 #ifdef QUANT_2PASS_SUPPORTED
427  /* Final pass of 2-pass quantization */
428  master->pub.is_dummy_pass = FALSE;
429  (*cinfo->cquantize->start_pass) (cinfo, FALSE);
430  (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST);
431  (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST);
432 #else
433  ERREXIT(cinfo, JERR_NOT_COMPILED);
434 #endif /* QUANT_2PASS_SUPPORTED */
435  } else {
436  if (cinfo->quantize_colors && cinfo->colormap == NULL) {
437  /* Select new quantization method */
438  if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) {
439  cinfo->cquantize = master->quantizer_2pass;
440  master->pub.is_dummy_pass = TRUE;
441  } else if (cinfo->enable_1pass_quant) {
442  cinfo->cquantize = master->quantizer_1pass;
443  } else {
444  ERREXIT(cinfo, JERR_MODE_CHANGE);
445  }
446  }
447  (*cinfo->idct->start_pass) (cinfo);
448  (*cinfo->coef->start_output_pass) (cinfo);
449  if (! cinfo->raw_data_out) {
450  if (! master->using_merged_upsample)
451  (*cinfo->cconvert->start_pass) (cinfo);
452  (*cinfo->upsample->start_pass) (cinfo);
453  if (cinfo->quantize_colors)
454  (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass);
455  (*cinfo->post->start_pass) (cinfo,
456  (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
457  (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
458  }
459  }
460 
461  /* Set up progress monitor's pass info if present */
462  if (cinfo->progress != NULL) {
463  cinfo->progress->completed_passes = master->pass_number;
464  cinfo->progress->total_passes = master->pass_number +
465  (master->pub.is_dummy_pass ? 2 : 1);
466  /* In buffered-image mode, we assume one more output pass if EOI not
467  * yet reached, but no more passes if EOI has been reached.
468  */
469  if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) {
470  cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1);
471  }
472  }
473 }
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
struct jpeg_d_post_controller * post
Definition: jpeglib.h:681
#define TRUE
Definition: types.h:120
struct jpeg_input_controller * inputctl
Definition: jpeglib.h:682
struct jpeg_d_main_controller * main
Definition: jpeglib.h:679
boolean enable_2pass_quant
Definition: jpeglib.h:499
boolean quantize_colors
Definition: jpeglib.h:491
struct jpeg_d_coef_controller * coef
Definition: jpeglib.h:680
int pass_number
Definition: jcmaster.c:33
boolean two_pass_quantize
Definition: jpeglib.h:494
struct jpeg_comp_master pub
Definition: jcmaster.c:29
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
struct jpeg_color_quantizer * cquantize
Definition: jpeglib.h:688
if(!(yy_init))
Definition: macro.lex.yy.c:714
struct jpeg_decomp_master * master
Definition: jpeglib.h:678
boolean enable_1pass_quant
Definition: jpeglib.h:497
struct jpeg_color_deconverter * cconvert
Definition: jpeglib.h:687
JSAMPARRAY colormap
Definition: jpeglib.h:527
my_decomp_master * my_master_ptr
Definition: jdmaster.c:36
struct jpeg_upsampler * upsample
Definition: jpeglib.h:686
struct jpeg_inverse_dct * idct
Definition: jpeglib.h:685
boolean buffered_image
Definition: jpeglib.h:484

Referenced by jinit_master_decompress().

◆ prepare_range_limit_table()

prepare_range_limit_table ( j_decompress_ptr  cinfo)

Definition at line 236 of file jdmaster.c.

238 {
239  JSAMPLE * table;
240  int i;
241 
242  table = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
244  /* First segment of range limit table: limit[x] = 0 for x < 0 */
246  table += RANGE_CENTER; /* allow negative subscripts of table */
247  cinfo->sample_range_limit = table;
248  /* Main part of range limit table: limit[x] = x */
249  for (i = 0; i <= MAXJSAMPLE; i++)
250  table[i] = (JSAMPLE) i;
251  /* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */
252  for (; i <= MAXJSAMPLE + RANGE_CENTER; i++)
253  table[i] = MAXJSAMPLE;
254 }
char JSAMPLE
Definition: jmorecfg.h:74
struct jpeg_common_struct * j_common_ptr
Definition: jpeglib.h:284
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
#define MEMZERO(addr, type, size)
Definition: svc_dg.c:324
#define MAXJSAMPLE
Definition: jmorecfg.h:83
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
#define SIZEOF(_ar)
Definition: calc.h:97
#define JPOOL_IMAGE
Definition: jpeglib.h:808
JSAMPLE * sample_range_limit
Definition: jpeglib.h:642
#define RANGE_CENTER
Definition: jpegint.h:273

Referenced by master_selection().

◆ use_merged_upsample()

use_merged_upsample ( j_decompress_ptr  cinfo)

Definition at line 45 of file jdmaster.c.

46 {
47 #ifdef UPSAMPLE_MERGING_SUPPORTED
48  /* Merging is the equivalent of plain box-filter upsampling. */
49  /* The following condition is only needed if fancy shall select
50  * a different upsampling method. In our current implementation
51  * fancy only affects the DCT scaling, thus we can use fancy
52  * upsampling and merged upsample simultaneously, in particular
53  * with scaled DCT sizes larger than the default DCTSIZE.
54  */
55 #if 0
56  if (cinfo->do_fancy_upsampling)
57  return FALSE;
58 #endif
59  if (cinfo->CCIR601_sampling)
60  return FALSE;
61  /* jdmerge.c only supports YCC=>RGB color conversion */
62  if ((cinfo->jpeg_color_space != JCS_YCbCr &&
63  cinfo->jpeg_color_space != JCS_BG_YCC) ||
64  cinfo->num_components != 3 ||
65  cinfo->out_color_space != JCS_RGB ||
66  cinfo->out_color_components != RGB_PIXELSIZE ||
67  cinfo->color_transform)
68  return FALSE;
69  /* and it only handles 2h1v or 2h2v sampling ratios */
70  if (cinfo->comp_info[0].h_samp_factor != 2 ||
71  cinfo->comp_info[1].h_samp_factor != 1 ||
72  cinfo->comp_info[2].h_samp_factor != 1 ||
73  cinfo->comp_info[0].v_samp_factor > 2 ||
74  cinfo->comp_info[1].v_samp_factor != 1 ||
75  cinfo->comp_info[2].v_samp_factor != 1)
76  return FALSE;
77  /* furthermore, it doesn't work if we've scaled the IDCTs differently */
78  if (cinfo->comp_info[0].DCT_h_scaled_size != cinfo->min_DCT_h_scaled_size ||
84  return FALSE;
85  /* ??? also need to test for upsample-time rescaling, when & if supported */
86  return TRUE; /* by golly, it'll work... */
87 #else
88  return FALSE;
89 #endif
90 }
#define TRUE
Definition: types.h:120
jpeg_component_info * comp_info
Definition: jpeglib.h:583
boolean do_fancy_upsampling
Definition: jpeglib.h:488
#define FALSE
Definition: types.h:117
J_COLOR_SPACE out_color_space
Definition: jpeglib.h:478
boolean CCIR601_sampling
Definition: jpeglib.h:612
J_COLOR_TRANSFORM color_transform
Definition: jpeglib.h:609
J_COLOR_SPACE jpeg_color_space
Definition: jpeglib.h:471

Referenced by jpeg_calc_output_dimensions(), and master_selection().