Lines Matching refs:cinfo
57 jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo) in jpeg_calc_jpeg_dimensions() argument
61 cinfo->jpeg_width = cinfo->image_width; in jpeg_calc_jpeg_dimensions()
62 cinfo->jpeg_height = cinfo->image_height; in jpeg_calc_jpeg_dimensions()
63 cinfo->min_DCT_h_scaled_size = DCTSIZE; in jpeg_calc_jpeg_dimensions()
64 cinfo->min_DCT_v_scaled_size = DCTSIZE; in jpeg_calc_jpeg_dimensions()
70 initial_setup (j_compress_ptr cinfo, boolean transcode_only) in initial_setup() argument
82 jpeg_calc_jpeg_dimensions(cinfo); in initial_setup()
86 if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 in initial_setup()
87 || cinfo->num_components <= 0 || cinfo->input_components <= 0) in initial_setup()
88 ERREXIT(cinfo, JERR_EMPTY_IMAGE); in initial_setup()
91 if ((long) cinfo->_jpeg_height > (long) JPEG_MAX_DIMENSION || in initial_setup()
92 (long) cinfo->_jpeg_width > (long) JPEG_MAX_DIMENSION) in initial_setup()
93 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); in initial_setup()
96 samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components; in initial_setup()
99 ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); in initial_setup()
102 if (cinfo->data_precision != BITS_IN_JSAMPLE) in initial_setup()
103 ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); in initial_setup()
106 if (cinfo->num_components > MAX_COMPONENTS) in initial_setup()
107 ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, in initial_setup()
111 cinfo->max_h_samp_factor = 1; in initial_setup()
112 cinfo->max_v_samp_factor = 1; in initial_setup()
113 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in initial_setup()
117 ERREXIT(cinfo, JERR_BAD_SAMPLING); in initial_setup()
118 cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, in initial_setup()
120 cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, in initial_setup()
125 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in initial_setup()
137 jdiv_round_up((long) cinfo->_jpeg_width * (long) compptr->h_samp_factor, in initial_setup()
138 (long) (cinfo->max_h_samp_factor * DCTSIZE)); in initial_setup()
140 jdiv_round_up((long) cinfo->_jpeg_height * (long) compptr->v_samp_factor, in initial_setup()
141 (long) (cinfo->max_v_samp_factor * DCTSIZE)); in initial_setup()
144 jdiv_round_up((long) cinfo->_jpeg_width * (long) compptr->h_samp_factor, in initial_setup()
145 (long) cinfo->max_h_samp_factor); in initial_setup()
147 jdiv_round_up((long) cinfo->_jpeg_height * (long) compptr->v_samp_factor, in initial_setup()
148 (long) cinfo->max_v_samp_factor); in initial_setup()
156 cinfo->total_iMCU_rows = (JDIMENSION) in initial_setup()
157 jdiv_round_up((long) cinfo->_jpeg_height, in initial_setup()
158 (long) (cinfo->max_v_samp_factor*DCTSIZE)); in initial_setup()
165 validate_script (j_compress_ptr cinfo) in validate_script() argument
180 if (cinfo->num_scans <= 0) in validate_script()
181 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0); in validate_script()
186 scanptr = cinfo->scan_info; in validate_script()
189 cinfo->progressive_mode = TRUE; in validate_script()
191 for (ci = 0; ci < cinfo->num_components; ci++) in validate_script()
195 ERREXIT(cinfo, JERR_NOT_COMPILED); in validate_script()
198 cinfo->progressive_mode = FALSE; in validate_script()
199 for (ci = 0; ci < cinfo->num_components; ci++) in validate_script()
203 for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) { in validate_script()
207 ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN); in validate_script()
210 if (thisi < 0 || thisi >= cinfo->num_components) in validate_script()
211 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); in validate_script()
214 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); in validate_script()
221 if (cinfo->progressive_mode) { in validate_script()
237 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
240 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
243 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
248 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
253 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
257 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
266 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
271 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); in validate_script()
278 if (cinfo->progressive_mode) { in validate_script()
285 for (ci = 0; ci < cinfo->num_components; ci++) { in validate_script()
287 ERREXIT(cinfo, JERR_MISSING_DATA); in validate_script()
291 for (ci = 0; ci < cinfo->num_components; ci++) { in validate_script()
293 ERREXIT(cinfo, JERR_MISSING_DATA); in validate_script()
302 select_scan_parameters (j_compress_ptr cinfo) in select_scan_parameters() argument
308 if (cinfo->scan_info != NULL) { in select_scan_parameters()
310 my_master_ptr master = (my_master_ptr) cinfo->master; in select_scan_parameters()
311 const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number; in select_scan_parameters()
313 cinfo->comps_in_scan = scanptr->comps_in_scan; in select_scan_parameters()
315 cinfo->cur_comp_info[ci] = in select_scan_parameters()
316 &cinfo->comp_info[scanptr->component_index[ci]]; in select_scan_parameters()
318 cinfo->Ss = scanptr->Ss; in select_scan_parameters()
319 cinfo->Se = scanptr->Se; in select_scan_parameters()
320 cinfo->Ah = scanptr->Ah; in select_scan_parameters()
321 cinfo->Al = scanptr->Al; in select_scan_parameters()
327 if (cinfo->num_components > MAX_COMPS_IN_SCAN) in select_scan_parameters()
328 ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, in select_scan_parameters()
330 cinfo->comps_in_scan = cinfo->num_components; in select_scan_parameters()
331 for (ci = 0; ci < cinfo->num_components; ci++) { in select_scan_parameters()
332 cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci]; in select_scan_parameters()
334 cinfo->Ss = 0; in select_scan_parameters()
335 cinfo->Se = DCTSIZE2-1; in select_scan_parameters()
336 cinfo->Ah = 0; in select_scan_parameters()
337 cinfo->Al = 0; in select_scan_parameters()
343 per_scan_setup (j_compress_ptr cinfo) in per_scan_setup() argument
350 if (cinfo->comps_in_scan == 1) { in per_scan_setup()
353 compptr = cinfo->cur_comp_info[0]; in per_scan_setup()
356 cinfo->MCUs_per_row = compptr->width_in_blocks; in per_scan_setup()
357 cinfo->MCU_rows_in_scan = compptr->height_in_blocks; in per_scan_setup()
373 cinfo->blocks_in_MCU = 1; in per_scan_setup()
374 cinfo->MCU_membership[0] = 0; in per_scan_setup()
379 if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) in per_scan_setup()
380 ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, in per_scan_setup()
384 cinfo->MCUs_per_row = (JDIMENSION) in per_scan_setup()
385 jdiv_round_up((long) cinfo->_jpeg_width, in per_scan_setup()
386 (long) (cinfo->max_h_samp_factor*DCTSIZE)); in per_scan_setup()
387 cinfo->MCU_rows_in_scan = (JDIMENSION) in per_scan_setup()
388 jdiv_round_up((long) cinfo->_jpeg_height, in per_scan_setup()
389 (long) (cinfo->max_v_samp_factor*DCTSIZE)); in per_scan_setup()
391 cinfo->blocks_in_MCU = 0; in per_scan_setup()
393 for (ci = 0; ci < cinfo->comps_in_scan; ci++) { in per_scan_setup()
394 compptr = cinfo->cur_comp_info[ci]; in per_scan_setup()
409 if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU) in per_scan_setup()
410 ERREXIT(cinfo, JERR_BAD_MCU_SIZE); in per_scan_setup()
412 cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; in per_scan_setup()
420 if (cinfo->restart_in_rows > 0) { in per_scan_setup()
421 long nominal = (long) cinfo->restart_in_rows * (long) cinfo->MCUs_per_row; in per_scan_setup()
422 cinfo->restart_interval = (unsigned int) MIN(nominal, 65535L); in per_scan_setup()
436 prepare_for_pass (j_compress_ptr cinfo) in prepare_for_pass() argument
438 my_master_ptr master = (my_master_ptr) cinfo->master; in prepare_for_pass()
445 select_scan_parameters(cinfo); in prepare_for_pass()
446 per_scan_setup(cinfo); in prepare_for_pass()
447 if (! cinfo->raw_data_in) { in prepare_for_pass()
448 (*cinfo->cconvert->start_pass) (cinfo); in prepare_for_pass()
449 (*cinfo->downsample->start_pass) (cinfo); in prepare_for_pass()
450 (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU); in prepare_for_pass()
452 (*cinfo->fdct->start_pass) (cinfo); in prepare_for_pass()
453 (*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding); in prepare_for_pass()
454 (*cinfo->coef->start_pass) (cinfo, in prepare_for_pass()
457 (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); in prepare_for_pass()
458 if (cinfo->optimize_coding) { in prepare_for_pass()
469 select_scan_parameters(cinfo); in prepare_for_pass()
470 per_scan_setup(cinfo); in prepare_for_pass()
471 if (cinfo->Ss != 0 || cinfo->Ah == 0 || cinfo->arith_code) { in prepare_for_pass()
472 (*cinfo->entropy->start_pass) (cinfo, TRUE); in prepare_for_pass()
473 (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST); in prepare_for_pass()
487 if (! cinfo->optimize_coding) { in prepare_for_pass()
488 select_scan_parameters(cinfo); in prepare_for_pass()
489 per_scan_setup(cinfo); in prepare_for_pass()
491 (*cinfo->entropy->start_pass) (cinfo, FALSE); in prepare_for_pass()
492 (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST); in prepare_for_pass()
495 (*cinfo->marker->write_frame_header) (cinfo); in prepare_for_pass()
496 (*cinfo->marker->write_scan_header) (cinfo); in prepare_for_pass()
500 ERREXIT(cinfo, JERR_NOT_COMPILED); in prepare_for_pass()
506 if (cinfo->progress != NULL) { in prepare_for_pass()
507 cinfo->progress->completed_passes = master->pass_number; in prepare_for_pass()
508 cinfo->progress->total_passes = master->total_passes; in prepare_for_pass()
524 pass_startup (j_compress_ptr cinfo) in pass_startup() argument
526 cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */ in pass_startup()
528 (*cinfo->marker->write_frame_header) (cinfo); in pass_startup()
529 (*cinfo->marker->write_scan_header) (cinfo); in pass_startup()
538 finish_pass_master (j_compress_ptr cinfo) in finish_pass_master() argument
540 my_master_ptr master = (my_master_ptr) cinfo->master; in finish_pass_master()
545 (*cinfo->entropy->finish_pass) (cinfo); in finish_pass_master()
554 if (! cinfo->optimize_coding) in finish_pass_master()
563 if (cinfo->optimize_coding) in finish_pass_master()
578 jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only) in jinit_c_master_control() argument
583 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, in jinit_c_master_control()
585 cinfo->master = (struct jpeg_comp_master *) master; in jinit_c_master_control()
592 initial_setup(cinfo, transcode_only); in jinit_c_master_control()
594 if (cinfo->scan_info != NULL) { in jinit_c_master_control()
596 validate_script(cinfo); in jinit_c_master_control()
598 ERREXIT(cinfo, JERR_NOT_COMPILED); in jinit_c_master_control()
601 cinfo->progressive_mode = FALSE; in jinit_c_master_control()
602 cinfo->num_scans = 1; in jinit_c_master_control()
605 if (cinfo->progressive_mode && !cinfo->arith_code) /* TEMPORARY HACK ??? */ in jinit_c_master_control()
606 cinfo->optimize_coding = TRUE; /* assume default tables no good for progressive mode */ in jinit_c_master_control()
611 if (cinfo->optimize_coding) in jinit_c_master_control()
621 if (cinfo->optimize_coding) in jinit_c_master_control()
622 master->total_passes = cinfo->num_scans * 2; in jinit_c_master_control()
624 master->total_passes = cinfo->num_scans; in jinit_c_master_control()