47#ifdef UPSAMPLE_MERGING_SUPPORTED
56 if (cinfo->do_fancy_upsampling)
59 if (cinfo->CCIR601_sampling)
62 if ((cinfo->jpeg_color_space !=
JCS_YCbCr &&
64 cinfo->num_components != 3 ||
65 cinfo->out_color_space !=
JCS_RGB ||
66 cinfo->out_color_components != RGB_PIXELSIZE ||
67 cinfo->color_transform)
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)
78 if (cinfo->comp_info[0].DCT_h_scaled_size != cinfo->min_DCT_h_scaled_size ||
79 cinfo->comp_info[1].DCT_h_scaled_size != cinfo->min_DCT_h_scaled_size ||
80 cinfo->comp_info[2].DCT_h_scaled_size != cinfo->min_DCT_h_scaled_size ||
81 cinfo->comp_info[0].DCT_v_scaled_size != cinfo->min_DCT_v_scaled_size ||
82 cinfo->comp_info[1].DCT_v_scaled_size != cinfo->min_DCT_v_scaled_size ||
83 cinfo->comp_info[2].DCT_v_scaled_size != cinfo->min_DCT_v_scaled_size)
111 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
114 jpeg_core_output_dimensions(cinfo);
116#ifdef IDCT_SCALING_SUPPORTED
123 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
126 if (! cinfo->raw_data_out)
127 while (cinfo->min_DCT_h_scaled_size * ssize <=
135 if (! cinfo->raw_data_out)
136 while (cinfo->min_DCT_v_scaled_size * ssize <=
157 (
long) (cinfo->max_h_samp_factor * cinfo->block_size));
161 (
long) (cinfo->max_v_samp_factor * cinfo->block_size));
168 switch (cinfo->out_color_space) {
170 cinfo->out_color_components = 1;
174 cinfo->out_color_components = RGB_PIXELSIZE;
178 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
182 cinfo->out_color_components =
i;
184 cinfo->output_components = (cinfo->quantize_colors ? 1 :
185 cinfo->out_color_components);
189 cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
191 cinfo->rec_outbuf_height = 1;
240 cinfo->sample_range_limit =
table;
265 boolean use_c_buffer;
271 ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
278 if (cinfo->output_height <= 0 || cinfo->output_width <= 0 ||
279 cinfo->out_color_components <= 0)
280 ERREXIT(cinfo, JERR_EMPTY_IMAGE);
283 samplesperrow = (
long) cinfo->output_width * (
long) cinfo->out_color_components;
284 jd_samplesperrow = (
JDIMENSION) samplesperrow;
285 if ((
long) jd_samplesperrow != samplesperrow)
286 ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
293 master->quantizer_1pass =
NULL;
294 master->quantizer_2pass =
NULL;
296 if (! cinfo->quantize_colors || ! cinfo->buffered_image) {
297 cinfo->enable_1pass_quant =
FALSE;
298 cinfo->enable_external_quant =
FALSE;
299 cinfo->enable_2pass_quant =
FALSE;
301 if (cinfo->quantize_colors) {
302 if (cinfo->raw_data_out)
305 if (cinfo->out_color_components != 3) {
306 cinfo->enable_1pass_quant =
TRUE;
307 cinfo->enable_external_quant =
FALSE;
308 cinfo->enable_2pass_quant =
FALSE;
309 cinfo->colormap =
NULL;
310 }
else if (cinfo->colormap !=
NULL) {
311 cinfo->enable_external_quant =
TRUE;
312 }
else if (cinfo->two_pass_quantize) {
313 cinfo->enable_2pass_quant =
TRUE;
315 cinfo->enable_1pass_quant =
TRUE;
318 if (cinfo->enable_1pass_quant) {
319#ifdef QUANT_1PASS_SUPPORTED
320 jinit_1pass_quantizer(cinfo);
321 master->quantizer_1pass = cinfo->cquantize;
323 ERREXIT(cinfo, JERR_NOT_COMPILED);
328 if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) {
329#ifdef QUANT_2PASS_SUPPORTED
330 jinit_2pass_quantizer(cinfo);
331 master->quantizer_2pass = cinfo->cquantize;
333 ERREXIT(cinfo, JERR_NOT_COMPILED);
342 if (! cinfo->raw_data_out) {
343 if (master->using_merged_upsample) {
344#ifdef UPSAMPLE_MERGING_SUPPORTED
345 jinit_merged_upsampler(cinfo);
347 ERREXIT(cinfo, JERR_NOT_COMPILED);
358 if (cinfo->arith_code)
365 use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image;
368 if (! cinfo->raw_data_out)
372 (*cinfo->mem->realize_virt_arrays) ((
j_common_ptr) cinfo);
375 (*cinfo->inputctl->start_input_pass) (cinfo);
377#ifdef D_MULTISCAN_FILES_SUPPORTED
382 if (cinfo->progress !=
NULL && ! cinfo->buffered_image &&
383 cinfo->inputctl->has_multiple_scans) {
386 if (cinfo->progressive_mode) {
388 nscans = 2 + 3 * cinfo->num_components;
391 nscans = cinfo->num_components;
393 cinfo->progress->pass_counter = 0
L;
394 cinfo->progress->pass_limit = (
long) cinfo->total_iMCU_rows * nscans;
395 cinfo->progress->completed_passes = 0;
396 cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);
418 if (master->
pub.is_dummy_pass) {
419#ifdef QUANT_2PASS_SUPPORTED
422 (*cinfo->cquantize->start_pass) (cinfo,
FALSE);
426 ERREXIT(cinfo, JERR_NOT_COMPILED);
429 if (cinfo->quantize_colors && cinfo->colormap ==
NULL) {
431 if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) {
432 cinfo->cquantize = master->quantizer_2pass;
433 master->
pub.is_dummy_pass =
TRUE;
434 }
else if (cinfo->enable_1pass_quant) {
435 cinfo->cquantize = master->quantizer_1pass;
437 ERREXIT(cinfo, JERR_MODE_CHANGE);
440 (*cinfo->idct->start_pass) (cinfo);
441 (*cinfo->coef->start_output_pass) (cinfo);
442 if (! cinfo->raw_data_out) {
443 if (! master->using_merged_upsample)
444 (*cinfo->cconvert->start_pass) (cinfo);
445 (*cinfo->upsample->start_pass) (cinfo);
446 if (cinfo->quantize_colors)
447 (*cinfo->cquantize->start_pass) (cinfo, master->
pub.is_dummy_pass);
448 (*cinfo->post->start_pass) (cinfo,
455 if (cinfo->progress !=
NULL) {
456 cinfo->progress->completed_passes = master->
pass_number;
457 cinfo->progress->total_passes = master->
pass_number +
458 (master->
pub.is_dummy_pass ? 2 : 1);
462 if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) {
463 cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1);
478 if (cinfo->quantize_colors)
479 (*cinfo->cquantize->finish_pass) (cinfo);
484#ifdef D_MULTISCAN_FILES_SUPPORTED
497 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
502 cinfo->
cquantize = master->quantizer_2pass;
504 (*cinfo->
cquantize->new_color_map) (cinfo);
507 ERREXIT(cinfo, JERR_MODE_CHANGE);
525 cinfo->master = &master->
pub;
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
jinit_arith_decoder(j_decompress_ptr cinfo)
jinit_d_coef_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
jinit_color_deconverter(j_decompress_ptr cinfo)
jpeg_component_info * compptr
jinit_inverse_dct(j_decompress_ptr cinfo)
jinit_huff_decoder(j_decompress_ptr cinfo)
jinit_d_main_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
jinit_master_decompress(j_decompress_ptr cinfo)
finish_output_pass(j_decompress_ptr cinfo)
master_selection(j_decompress_ptr cinfo)
jpeg_calc_output_dimensions(j_decompress_ptr cinfo)
prepare_for_output_pass(j_decompress_ptr cinfo)
use_merged_upsample(j_decompress_ptr cinfo)
prepare_range_limit_table(j_decompress_ptr cinfo)
my_decomp_master * my_master_ptr
jinit_d_post_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
jinit_upsampler(j_decompress_ptr cinfo)
#define ERREXIT1(cinfo, code, p1)
#define JPEG_DATA_PRECISION
struct jpeg_common_struct * j_common_ptr
jdiv_round_up(long a, long b)
JDIMENSION downsampled_height
JDIMENSION downsampled_width
boolean enable_external_quant
struct jpeg_color_quantizer * cquantize
struct jpeg_decomp_master * master
struct jpeg_comp_master pub
struct jpeg_color_quantizer * quantizer_2pass
struct jpeg_color_quantizer * quantizer_1pass
boolean using_merged_upsample
#define MEMZERO(addr, type, size)