Lines Matching refs:cinfo
44 use_merged_upsample (j_decompress_ptr cinfo) in use_merged_upsample() argument
48 if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling) in use_merged_upsample()
53 if (cinfo->jpeg_color_space != JCS_YCbCr || in use_merged_upsample()
54 cinfo->num_components != 3 || in use_merged_upsample()
55 cinfo->out_color_components != 3 || in use_merged_upsample()
56 (cinfo->out_color_space != JCS_RGB_565 && in use_merged_upsample()
57 cinfo->out_color_space != JCS_RGB)) { in use_merged_upsample()
62 if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 || in use_merged_upsample()
63 cinfo->out_color_space != JCS_RGB || in use_merged_upsample()
64 cinfo->out_color_components != RGB_PIXELSIZE) in use_merged_upsample()
69 if (cinfo->comp_info[0].h_samp_factor != 2 || in use_merged_upsample()
70 cinfo->comp_info[1].h_samp_factor != 1 || in use_merged_upsample()
71 cinfo->comp_info[2].h_samp_factor != 1 || in use_merged_upsample()
72 cinfo->comp_info[0].v_samp_factor > 2 || in use_merged_upsample()
73 cinfo->comp_info[1].v_samp_factor != 1 || in use_merged_upsample()
74 cinfo->comp_info[2].v_samp_factor != 1) in use_merged_upsample()
77 if (cinfo->comp_info[0].DCT_scaled_size != cinfo->min_DCT_scaled_size || in use_merged_upsample()
78 cinfo->comp_info[1].DCT_scaled_size != cinfo->min_DCT_scaled_size || in use_merged_upsample()
79 cinfo->comp_info[2].DCT_scaled_size != cinfo->min_DCT_scaled_size) in use_merged_upsample()
97 jpeg_calc_output_dimensions (j_decompress_ptr cinfo) in jpeg_calc_output_dimensions() argument
108 if (!cinfo->tile_decode) in jpeg_calc_output_dimensions()
110 if (cinfo->global_state != DSTATE_READY) in jpeg_calc_output_dimensions()
111 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); in jpeg_calc_output_dimensions()
116 if (cinfo->scale_num * 8 <= cinfo->scale_denom) { in jpeg_calc_output_dimensions()
118 cinfo->output_width = (JDIMENSION) in jpeg_calc_output_dimensions()
119 jdiv_round_up((long) cinfo->image_width, 8L); in jpeg_calc_output_dimensions()
120 cinfo->output_height = (JDIMENSION) in jpeg_calc_output_dimensions()
121 jdiv_round_up((long) cinfo->image_height, 8L); in jpeg_calc_output_dimensions()
122 cinfo->min_DCT_scaled_size = 1; in jpeg_calc_output_dimensions()
123 } else if (cinfo->scale_num * 4 <= cinfo->scale_denom) { in jpeg_calc_output_dimensions()
125 cinfo->output_width = (JDIMENSION) in jpeg_calc_output_dimensions()
126 jdiv_round_up((long) cinfo->image_width, 4L); in jpeg_calc_output_dimensions()
127 cinfo->output_height = (JDIMENSION) in jpeg_calc_output_dimensions()
128 jdiv_round_up((long) cinfo->image_height, 4L); in jpeg_calc_output_dimensions()
129 cinfo->min_DCT_scaled_size = 2; in jpeg_calc_output_dimensions()
130 } else if (cinfo->scale_num * 2 <= cinfo->scale_denom) { in jpeg_calc_output_dimensions()
132 cinfo->output_width = (JDIMENSION) in jpeg_calc_output_dimensions()
133 jdiv_round_up((long) cinfo->image_width, 2L); in jpeg_calc_output_dimensions()
134 cinfo->output_height = (JDIMENSION) in jpeg_calc_output_dimensions()
135 jdiv_round_up((long) cinfo->image_height, 2L); in jpeg_calc_output_dimensions()
136 cinfo->min_DCT_scaled_size = 4; in jpeg_calc_output_dimensions()
139 cinfo->output_width = cinfo->image_width; in jpeg_calc_output_dimensions()
140 cinfo->output_height = cinfo->image_height; in jpeg_calc_output_dimensions()
141 cinfo->min_DCT_scaled_size = DCTSIZE; in jpeg_calc_output_dimensions()
148 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in jpeg_calc_output_dimensions()
150 int ssize = cinfo->min_DCT_scaled_size; in jpeg_calc_output_dimensions()
153 cinfo->max_h_samp_factor * cinfo->min_DCT_scaled_size) && in jpeg_calc_output_dimensions()
155 cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size)) { in jpeg_calc_output_dimensions()
164 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in jpeg_calc_output_dimensions()
168 jdiv_round_up((long) cinfo->image_width * in jpeg_calc_output_dimensions()
170 (long) (cinfo->max_h_samp_factor * DCTSIZE)); in jpeg_calc_output_dimensions()
172 jdiv_round_up((long) cinfo->image_height * in jpeg_calc_output_dimensions()
174 (long) (cinfo->max_v_samp_factor * DCTSIZE)); in jpeg_calc_output_dimensions()
180 cinfo->output_width = cinfo->image_width; in jpeg_calc_output_dimensions()
181 cinfo->output_height = cinfo->image_height; in jpeg_calc_output_dimensions()
190 switch (cinfo->out_color_space) { in jpeg_calc_output_dimensions()
192 cinfo->out_color_components = 1; in jpeg_calc_output_dimensions()
196 cinfo->out_color_components = RGB_PIXELSIZE; in jpeg_calc_output_dimensions()
203 cinfo->out_color_components = 3; in jpeg_calc_output_dimensions()
210 cinfo->out_color_components = 4; in jpeg_calc_output_dimensions()
213 cinfo->out_color_components = cinfo->num_components; in jpeg_calc_output_dimensions()
216 cinfo->output_components = (cinfo->quantize_colors ? 1 : in jpeg_calc_output_dimensions()
217 cinfo->out_color_components); in jpeg_calc_output_dimensions()
220 if (use_merged_upsample(cinfo)) in jpeg_calc_output_dimensions()
221 cinfo->rec_outbuf_height = cinfo->max_v_samp_factor; in jpeg_calc_output_dimensions()
223 cinfo->rec_outbuf_height = 1; in jpeg_calc_output_dimensions()
271 prepare_range_limit_table (j_decompress_ptr cinfo) in prepare_range_limit_table() argument
278 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, in prepare_range_limit_table()
281 cinfo->sample_range_limit = table; in prepare_range_limit_table()
295 cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE)); in prepare_range_limit_table()
311 master_selection (j_decompress_ptr cinfo) in master_selection() argument
313 my_master_ptr master = (my_master_ptr) cinfo->master; in master_selection()
319 jpeg_calc_output_dimensions(cinfo); in master_selection()
320 prepare_range_limit_table(cinfo); in master_selection()
323 samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components; in master_selection()
326 ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); in master_selection()
330 master->using_merged_upsample = use_merged_upsample(cinfo); in master_selection()
336 if (! cinfo->quantize_colors || ! cinfo->buffered_image) { in master_selection()
337 cinfo->enable_1pass_quant = FALSE; in master_selection()
338 cinfo->enable_external_quant = FALSE; in master_selection()
339 cinfo->enable_2pass_quant = FALSE; in master_selection()
341 if (cinfo->quantize_colors) { in master_selection()
342 if (cinfo->raw_data_out) in master_selection()
343 ERREXIT(cinfo, JERR_NOTIMPL); in master_selection()
345 if (cinfo->out_color_components != 3) { in master_selection()
346 cinfo->enable_1pass_quant = TRUE; in master_selection()
347 cinfo->enable_external_quant = FALSE; in master_selection()
348 cinfo->enable_2pass_quant = FALSE; in master_selection()
349 cinfo->colormap = NULL; in master_selection()
350 } else if (cinfo->colormap != NULL) { in master_selection()
351 cinfo->enable_external_quant = TRUE; in master_selection()
352 } else if (cinfo->two_pass_quantize) { in master_selection()
353 cinfo->enable_2pass_quant = TRUE; in master_selection()
355 cinfo->enable_1pass_quant = TRUE; in master_selection()
358 if (cinfo->enable_1pass_quant) { in master_selection()
360 jinit_1pass_quantizer(cinfo); in master_selection()
361 master->quantizer_1pass = cinfo->cquantize; in master_selection()
363 ERREXIT(cinfo, JERR_NOT_COMPILED); in master_selection()
368 if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) { in master_selection()
370 jinit_2pass_quantizer(cinfo); in master_selection()
371 master->quantizer_2pass = cinfo->cquantize; in master_selection()
373 ERREXIT(cinfo, JERR_NOT_COMPILED); in master_selection()
382 if (! cinfo->raw_data_out) { in master_selection()
385 jinit_merged_upsampler(cinfo); /* does color conversion too */ in master_selection()
387 ERREXIT(cinfo, JERR_NOT_COMPILED); in master_selection()
390 jinit_color_deconverter(cinfo); in master_selection()
391 jinit_upsampler(cinfo); in master_selection()
393 jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant); in master_selection()
396 jinit_inverse_dct(cinfo); in master_selection()
398 if (cinfo->arith_code) { in master_selection()
399 ERREXIT(cinfo, JERR_ARITH_NOTIMPL); in master_selection()
401 if (cinfo->progressive_mode) { in master_selection()
403 jinit_phuff_decoder(cinfo); in master_selection()
405 ERREXIT(cinfo, JERR_NOT_COMPILED); in master_selection()
408 jinit_huff_decoder(cinfo); in master_selection()
412 use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image; in master_selection()
413 jinit_d_coef_controller(cinfo, use_c_buffer); in master_selection()
415 if (! cinfo->raw_data_out) in master_selection()
416 jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */); in master_selection()
419 (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); in master_selection()
422 (*cinfo->inputctl->start_input_pass) (cinfo); in master_selection()
429 if (cinfo->progress != NULL && ! cinfo->buffered_image && in master_selection()
430 cinfo->inputctl->has_multiple_scans) { in master_selection()
433 if (cinfo->progressive_mode) { in master_selection()
435 nscans = 2 + 3 * cinfo->num_components; in master_selection()
438 nscans = cinfo->num_components; in master_selection()
440 cinfo->progress->pass_counter = 0L; in master_selection()
441 cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; in master_selection()
442 cinfo->progress->completed_passes = 0; in master_selection()
443 cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2); in master_selection()
461 prepare_for_output_pass (j_decompress_ptr cinfo) in prepare_for_output_pass() argument
463 my_master_ptr master = (my_master_ptr) cinfo->master; in prepare_for_output_pass()
469 (*cinfo->cquantize->start_pass) (cinfo, FALSE); in prepare_for_output_pass()
470 (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST); in prepare_for_output_pass()
471 (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST); in prepare_for_output_pass()
473 ERREXIT(cinfo, JERR_NOT_COMPILED); in prepare_for_output_pass()
476 if (cinfo->quantize_colors && cinfo->colormap == NULL) { in prepare_for_output_pass()
478 if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) { in prepare_for_output_pass()
479 cinfo->cquantize = master->quantizer_2pass; in prepare_for_output_pass()
481 } else if (cinfo->enable_1pass_quant) { in prepare_for_output_pass()
482 cinfo->cquantize = master->quantizer_1pass; in prepare_for_output_pass()
484 ERREXIT(cinfo, JERR_MODE_CHANGE); in prepare_for_output_pass()
487 (*cinfo->idct->start_pass) (cinfo); in prepare_for_output_pass()
488 (*cinfo->coef->start_output_pass) (cinfo); in prepare_for_output_pass()
489 if (! cinfo->raw_data_out) { in prepare_for_output_pass()
491 (*cinfo->cconvert->start_pass) (cinfo); in prepare_for_output_pass()
492 (*cinfo->upsample->start_pass) (cinfo); in prepare_for_output_pass()
493 if (cinfo->quantize_colors) in prepare_for_output_pass()
494 (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass); in prepare_for_output_pass()
495 (*cinfo->post->start_pass) (cinfo, in prepare_for_output_pass()
497 (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); in prepare_for_output_pass()
502 if (cinfo->progress != NULL) { in prepare_for_output_pass()
503 cinfo->progress->completed_passes = master->pass_number; in prepare_for_output_pass()
504 cinfo->progress->total_passes = master->pass_number + in prepare_for_output_pass()
509 if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) { in prepare_for_output_pass()
510 cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1); in prepare_for_output_pass()
521 finish_output_pass (j_decompress_ptr cinfo) in finish_output_pass() argument
523 my_master_ptr master = (my_master_ptr) cinfo->master; in finish_output_pass()
525 if (cinfo->quantize_colors) in finish_output_pass()
526 (*cinfo->cquantize->finish_pass) (cinfo); in finish_output_pass()
538 jpeg_new_colormap (j_decompress_ptr cinfo) in jpeg_new_colormap() argument
540 my_master_ptr master = (my_master_ptr) cinfo->master; in jpeg_new_colormap()
543 if (cinfo->global_state != DSTATE_BUFIMAGE) in jpeg_new_colormap()
544 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); in jpeg_new_colormap()
546 if (cinfo->quantize_colors && cinfo->enable_external_quant && in jpeg_new_colormap()
547 cinfo->colormap != NULL) { in jpeg_new_colormap()
549 cinfo->cquantize = master->quantizer_2pass; in jpeg_new_colormap()
551 (*cinfo->cquantize->new_color_map) (cinfo); in jpeg_new_colormap()
554 ERREXIT(cinfo, JERR_MODE_CHANGE); in jpeg_new_colormap()
566 jinit_master_decompress (j_decompress_ptr cinfo) in jinit_master_decompress() argument
571 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, in jinit_master_decompress()
573 cinfo->master = (struct jpeg_decomp_master *) master; in jinit_master_decompress()
579 master_selection(cinfo); in jinit_master_decompress()