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()
51 if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 || in use_merged_upsample()
52 cinfo->out_color_space != JCS_RGB || in use_merged_upsample()
53 cinfo->out_color_components != RGB_PIXELSIZE) in use_merged_upsample()
56 if (cinfo->comp_info[0].h_samp_factor != 2 || in use_merged_upsample()
57 cinfo->comp_info[1].h_samp_factor != 1 || in use_merged_upsample()
58 cinfo->comp_info[2].h_samp_factor != 1 || in use_merged_upsample()
59 cinfo->comp_info[0].v_samp_factor > 2 || in use_merged_upsample()
60 cinfo->comp_info[1].v_samp_factor != 1 || in use_merged_upsample()
61 cinfo->comp_info[2].v_samp_factor != 1) in use_merged_upsample()
64 if (cinfo->comp_info[0].DCT_scaled_size != cinfo->min_DCT_scaled_size || in use_merged_upsample()
65 cinfo->comp_info[1].DCT_scaled_size != cinfo->min_DCT_scaled_size || in use_merged_upsample()
66 cinfo->comp_info[2].DCT_scaled_size != cinfo->min_DCT_scaled_size) in use_merged_upsample()
84 jpeg_calc_output_dimensions (j_decompress_ptr cinfo) in jpeg_calc_output_dimensions() argument
93 if (cinfo->global_state != DSTATE_READY) in jpeg_calc_output_dimensions()
94 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); in jpeg_calc_output_dimensions()
99 if (cinfo->scale_num * 8 <= cinfo->scale_denom) { in jpeg_calc_output_dimensions()
101 cinfo->output_width = (JDIMENSION) in jpeg_calc_output_dimensions()
102 jdiv_round_up((long) cinfo->image_width, 8L); in jpeg_calc_output_dimensions()
103 cinfo->output_height = (JDIMENSION) in jpeg_calc_output_dimensions()
104 jdiv_round_up((long) cinfo->image_height, 8L); in jpeg_calc_output_dimensions()
105 cinfo->min_DCT_scaled_size = 1; in jpeg_calc_output_dimensions()
106 } else if (cinfo->scale_num * 4 <= cinfo->scale_denom) { in jpeg_calc_output_dimensions()
108 cinfo->output_width = (JDIMENSION) in jpeg_calc_output_dimensions()
109 jdiv_round_up((long) cinfo->image_width, 4L); in jpeg_calc_output_dimensions()
110 cinfo->output_height = (JDIMENSION) in jpeg_calc_output_dimensions()
111 jdiv_round_up((long) cinfo->image_height, 4L); in jpeg_calc_output_dimensions()
112 cinfo->min_DCT_scaled_size = 2; in jpeg_calc_output_dimensions()
113 } else if (cinfo->scale_num * 2 <= cinfo->scale_denom) { in jpeg_calc_output_dimensions()
115 cinfo->output_width = (JDIMENSION) in jpeg_calc_output_dimensions()
116 jdiv_round_up((long) cinfo->image_width, 2L); in jpeg_calc_output_dimensions()
117 cinfo->output_height = (JDIMENSION) in jpeg_calc_output_dimensions()
118 jdiv_round_up((long) cinfo->image_height, 2L); in jpeg_calc_output_dimensions()
119 cinfo->min_DCT_scaled_size = 4; in jpeg_calc_output_dimensions()
122 cinfo->output_width = cinfo->image_width; in jpeg_calc_output_dimensions()
123 cinfo->output_height = cinfo->image_height; in jpeg_calc_output_dimensions()
124 cinfo->min_DCT_scaled_size = DCTSIZE; in jpeg_calc_output_dimensions()
131 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in jpeg_calc_output_dimensions()
133 int ssize = cinfo->min_DCT_scaled_size; in jpeg_calc_output_dimensions()
136 cinfo->max_h_samp_factor * cinfo->min_DCT_scaled_size) && in jpeg_calc_output_dimensions()
138 cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size)) { in jpeg_calc_output_dimensions()
147 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in jpeg_calc_output_dimensions()
151 jdiv_round_up((long) cinfo->image_width * in jpeg_calc_output_dimensions()
153 (long) (cinfo->max_h_samp_factor * DCTSIZE)); in jpeg_calc_output_dimensions()
155 jdiv_round_up((long) cinfo->image_height * in jpeg_calc_output_dimensions()
157 (long) (cinfo->max_v_samp_factor * DCTSIZE)); in jpeg_calc_output_dimensions()
163 cinfo->output_width = cinfo->image_width; in jpeg_calc_output_dimensions()
164 cinfo->output_height = cinfo->image_height; in jpeg_calc_output_dimensions()
173 switch (cinfo->out_color_space) { in jpeg_calc_output_dimensions()
175 cinfo->out_color_components = 1; in jpeg_calc_output_dimensions()
179 cinfo->out_color_components = RGB_PIXELSIZE; in jpeg_calc_output_dimensions()
183 cinfo->out_color_components = 3; in jpeg_calc_output_dimensions()
187 cinfo->out_color_components = 4; in jpeg_calc_output_dimensions()
190 cinfo->out_color_components = cinfo->num_components; in jpeg_calc_output_dimensions()
193 cinfo->output_components = (cinfo->quantize_colors ? 1 : in jpeg_calc_output_dimensions()
194 cinfo->out_color_components); in jpeg_calc_output_dimensions()
197 if (use_merged_upsample(cinfo)) in jpeg_calc_output_dimensions()
198 cinfo->rec_outbuf_height = cinfo->max_v_samp_factor; in jpeg_calc_output_dimensions()
200 cinfo->rec_outbuf_height = 1; in jpeg_calc_output_dimensions()
248 prepare_range_limit_table (j_decompress_ptr cinfo) in prepare_range_limit_table() argument
255 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, in prepare_range_limit_table()
258 cinfo->sample_range_limit = table; in prepare_range_limit_table()
272 cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE)); in prepare_range_limit_table()
288 master_selection (j_decompress_ptr cinfo) in master_selection() argument
290 my_master_ptr master = (my_master_ptr) cinfo->master; in master_selection()
296 jpeg_calc_output_dimensions(cinfo); in master_selection()
297 prepare_range_limit_table(cinfo); in master_selection()
300 samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components; in master_selection()
303 ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); in master_selection()
307 master->using_merged_upsample = use_merged_upsample(cinfo); in master_selection()
313 if (! cinfo->quantize_colors || ! cinfo->buffered_image) { in master_selection()
314 cinfo->enable_1pass_quant = FALSE; in master_selection()
315 cinfo->enable_external_quant = FALSE; in master_selection()
316 cinfo->enable_2pass_quant = FALSE; in master_selection()
318 if (cinfo->quantize_colors) { in master_selection()
319 if (cinfo->raw_data_out) in master_selection()
320 ERREXIT(cinfo, JERR_NOTIMPL); in master_selection()
322 if (cinfo->out_color_components != 3) { in master_selection()
323 cinfo->enable_1pass_quant = TRUE; in master_selection()
324 cinfo->enable_external_quant = FALSE; in master_selection()
325 cinfo->enable_2pass_quant = FALSE; in master_selection()
326 cinfo->colormap = NULL; in master_selection()
327 } else if (cinfo->colormap != NULL) { in master_selection()
328 cinfo->enable_external_quant = TRUE; in master_selection()
329 } else if (cinfo->two_pass_quantize) { in master_selection()
330 cinfo->enable_2pass_quant = TRUE; in master_selection()
332 cinfo->enable_1pass_quant = TRUE; in master_selection()
335 if (cinfo->enable_1pass_quant) { in master_selection()
337 jinit_1pass_quantizer(cinfo); in master_selection()
338 master->quantizer_1pass = cinfo->cquantize; in master_selection()
340 ERREXIT(cinfo, JERR_NOT_COMPILED); in master_selection()
345 if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) { in master_selection()
347 jinit_2pass_quantizer(cinfo); in master_selection()
348 master->quantizer_2pass = cinfo->cquantize; in master_selection()
350 ERREXIT(cinfo, JERR_NOT_COMPILED); in master_selection()
359 if (! cinfo->raw_data_out) { in master_selection()
362 jinit_merged_upsampler(cinfo); /* does color conversion too */ in master_selection()
364 ERREXIT(cinfo, JERR_NOT_COMPILED); in master_selection()
367 jinit_color_deconverter(cinfo); in master_selection()
368 jinit_upsampler(cinfo); in master_selection()
370 jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant); in master_selection()
373 jinit_inverse_dct(cinfo); in master_selection()
375 if (cinfo->arith_code) { in master_selection()
376 ERREXIT(cinfo, JERR_ARITH_NOTIMPL); in master_selection()
378 if (cinfo->progressive_mode) { in master_selection()
380 jinit_phuff_decoder(cinfo); in master_selection()
382 ERREXIT(cinfo, JERR_NOT_COMPILED); in master_selection()
385 jinit_huff_decoder(cinfo); in master_selection()
389 use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image; in master_selection()
390 jinit_d_coef_controller(cinfo, use_c_buffer); in master_selection()
392 if (! cinfo->raw_data_out) in master_selection()
393 jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */); in master_selection()
396 (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); in master_selection()
399 (*cinfo->inputctl->start_input_pass) (cinfo); in master_selection()
406 if (cinfo->progress != NULL && ! cinfo->buffered_image && in master_selection()
407 cinfo->inputctl->has_multiple_scans) { in master_selection()
410 if (cinfo->progressive_mode) { in master_selection()
412 nscans = 2 + 3 * cinfo->num_components; in master_selection()
415 nscans = cinfo->num_components; in master_selection()
417 cinfo->progress->pass_counter = 0L; in master_selection()
418 cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; in master_selection()
419 cinfo->progress->completed_passes = 0; in master_selection()
420 cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2); in master_selection()
438 prepare_for_output_pass (j_decompress_ptr cinfo) in prepare_for_output_pass() argument
440 my_master_ptr master = (my_master_ptr) cinfo->master; in prepare_for_output_pass()
446 (*cinfo->cquantize->start_pass) (cinfo, FALSE); in prepare_for_output_pass()
447 (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST); in prepare_for_output_pass()
448 (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST); in prepare_for_output_pass()
450 ERREXIT(cinfo, JERR_NOT_COMPILED); in prepare_for_output_pass()
453 if (cinfo->quantize_colors && cinfo->colormap == NULL) { in prepare_for_output_pass()
455 if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) { in prepare_for_output_pass()
456 cinfo->cquantize = master->quantizer_2pass; in prepare_for_output_pass()
458 } else if (cinfo->enable_1pass_quant) { in prepare_for_output_pass()
459 cinfo->cquantize = master->quantizer_1pass; in prepare_for_output_pass()
461 ERREXIT(cinfo, JERR_MODE_CHANGE); in prepare_for_output_pass()
464 (*cinfo->idct->start_pass) (cinfo); in prepare_for_output_pass()
465 (*cinfo->coef->start_output_pass) (cinfo); in prepare_for_output_pass()
466 if (! cinfo->raw_data_out) { in prepare_for_output_pass()
468 (*cinfo->cconvert->start_pass) (cinfo); in prepare_for_output_pass()
469 (*cinfo->upsample->start_pass) (cinfo); in prepare_for_output_pass()
470 if (cinfo->quantize_colors) in prepare_for_output_pass()
471 (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass); in prepare_for_output_pass()
472 (*cinfo->post->start_pass) (cinfo, in prepare_for_output_pass()
474 (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); in prepare_for_output_pass()
479 if (cinfo->progress != NULL) { in prepare_for_output_pass()
480 cinfo->progress->completed_passes = master->pass_number; in prepare_for_output_pass()
481 cinfo->progress->total_passes = master->pass_number + in prepare_for_output_pass()
486 if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) { in prepare_for_output_pass()
487 cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1); in prepare_for_output_pass()
498 finish_output_pass (j_decompress_ptr cinfo) in finish_output_pass() argument
500 my_master_ptr master = (my_master_ptr) cinfo->master; in finish_output_pass()
502 if (cinfo->quantize_colors) in finish_output_pass()
503 (*cinfo->cquantize->finish_pass) (cinfo); in finish_output_pass()
515 jpeg_new_colormap (j_decompress_ptr cinfo) in jpeg_new_colormap() argument
517 my_master_ptr master = (my_master_ptr) cinfo->master; in jpeg_new_colormap()
520 if (cinfo->global_state != DSTATE_BUFIMAGE) in jpeg_new_colormap()
521 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); in jpeg_new_colormap()
523 if (cinfo->quantize_colors && cinfo->enable_external_quant && in jpeg_new_colormap()
524 cinfo->colormap != NULL) { in jpeg_new_colormap()
526 cinfo->cquantize = master->quantizer_2pass; in jpeg_new_colormap()
528 (*cinfo->cquantize->new_color_map) (cinfo); in jpeg_new_colormap()
531 ERREXIT(cinfo, JERR_MODE_CHANGE); in jpeg_new_colormap()
543 jinit_master_decompress (j_decompress_ptr cinfo) in jinit_master_decompress() argument
548 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, in jinit_master_decompress()
550 cinfo->master = (struct jpeg_decomp_master *) master; in jinit_master_decompress()
556 master_selection(cinfo); in jinit_master_decompress()