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)
106#ifdef IDCT_SCALING_SUPPORTED
113 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
116 jpeg_core_output_dimensions(cinfo);
118#ifdef IDCT_SCALING_SUPPORTED
125 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
128 if (! cinfo->raw_data_out)
129 while (cinfo->min_DCT_h_scaled_size * ssize <=
137 if (! cinfo->raw_data_out)
138 while (cinfo->min_DCT_v_scaled_size * ssize <=
159 (
long) (cinfo->max_h_samp_factor * cinfo->block_size));
163 (
long) (cinfo->max_v_samp_factor * cinfo->block_size));
170 switch (cinfo->out_color_space) {
172 cinfo->out_color_components = 1;
176#if RGB_PIXELSIZE != 3
177 cinfo->out_color_components = RGB_PIXELSIZE;
182 cinfo->out_color_components = 3;
186 cinfo->out_color_components = 4;
189 cinfo->out_color_components = cinfo->num_components;
191 cinfo->output_components = (cinfo->quantize_colors ? 1 :
192 cinfo->out_color_components);
196 cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
198 cinfo->rec_outbuf_height = 1;
247 cinfo->sample_range_limit =
table;
272 boolean use_c_buffer;
278 ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
285 if (cinfo->output_height <= 0 || cinfo->output_width <= 0 ||
286 cinfo->out_color_components <= 0)
287 ERREXIT(cinfo, JERR_EMPTY_IMAGE);
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);
300 master->quantizer_1pass =
NULL;
301 master->quantizer_2pass =
NULL;
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;
308 if (cinfo->quantize_colors) {
309 if (cinfo->raw_data_out)
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;
322 cinfo->enable_1pass_quant =
TRUE;
325 if (cinfo->enable_1pass_quant) {
326#ifdef QUANT_1PASS_SUPPORTED
327 jinit_1pass_quantizer(cinfo);
328 master->quantizer_1pass = cinfo->cquantize;
330 ERREXIT(cinfo, JERR_NOT_COMPILED);
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;
340 ERREXIT(cinfo, JERR_NOT_COMPILED);
349 if (! cinfo->raw_data_out) {
350 if (master->using_merged_upsample) {
351#ifdef UPSAMPLE_MERGING_SUPPORTED
352 jinit_merged_upsampler(cinfo);
354 ERREXIT(cinfo, JERR_NOT_COMPILED);
365 if (cinfo->arith_code)
372 use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image;
375 if (! cinfo->raw_data_out)
379 (*cinfo->mem->realize_virt_arrays) ((
j_common_ptr) cinfo);
382 (*cinfo->inputctl->start_input_pass) (cinfo);
384#ifdef D_MULTISCAN_FILES_SUPPORTED
389 if (cinfo->progress !=
NULL && ! cinfo->buffered_image &&
390 cinfo->inputctl->has_multiple_scans) {
393 if (cinfo->progressive_mode) {
395 nscans = 2 + 3 * cinfo->num_components;
398 nscans = cinfo->num_components;
400 cinfo->progress->pass_counter = 0
L;
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);
425 if (master->
pub.is_dummy_pass) {
426#ifdef QUANT_2PASS_SUPPORTED
429 (*cinfo->cquantize->start_pass) (cinfo,
FALSE);
433 ERREXIT(cinfo, JERR_NOT_COMPILED);
436 if (cinfo->quantize_colors && cinfo->colormap ==
NULL) {
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;
444 ERREXIT(cinfo, JERR_MODE_CHANGE);
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,
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);
469 if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) {
470 cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1);
485 if (cinfo->quantize_colors)
486 (*cinfo->cquantize->finish_pass) (cinfo);
491#ifdef D_MULTISCAN_FILES_SUPPORTED
504 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
509 cinfo->
cquantize = master->quantizer_2pass;
511 (*cinfo->
cquantize->new_color_map) (cinfo);
514 ERREXIT(cinfo, JERR_MODE_CHANGE);
532 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)
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)