Lines Matching refs:cinfo

46 initial_setup (j_compress_ptr cinfo)  in initial_setup()  argument
55 if (cinfo->image_height <= 0 || cinfo->image_width <= 0 in initial_setup()
56 || cinfo->num_components <= 0 || cinfo->input_components <= 0) in initial_setup()
57 ERREXIT(cinfo, JERR_EMPTY_IMAGE); in initial_setup()
60 if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION || in initial_setup()
61 (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION) in initial_setup()
62 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); in initial_setup()
65 samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components; in initial_setup()
68 ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); in initial_setup()
71 if (cinfo->data_precision != BITS_IN_JSAMPLE) in initial_setup()
72 ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); in initial_setup()
75 if (cinfo->num_components > MAX_COMPONENTS) in initial_setup()
76 ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, in initial_setup()
80 cinfo->max_h_samp_factor = 1; in initial_setup()
81 cinfo->max_v_samp_factor = 1; in initial_setup()
82 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in initial_setup()
86 ERREXIT(cinfo, JERR_BAD_SAMPLING); in initial_setup()
87 cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, in initial_setup()
89 cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, in initial_setup()
94 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in initial_setup()
102 jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, in initial_setup()
103 (long) (cinfo->max_h_samp_factor * DCTSIZE)); in initial_setup()
105 jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, in initial_setup()
106 (long) (cinfo->max_v_samp_factor * DCTSIZE)); in initial_setup()
109 jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, in initial_setup()
110 (long) cinfo->max_h_samp_factor); in initial_setup()
112 jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, in initial_setup()
113 (long) cinfo->max_v_samp_factor); in initial_setup()
121 cinfo->total_iMCU_rows = (JDIMENSION) in initial_setup()
122 jdiv_round_up((long) cinfo->image_height, in initial_setup()
123 (long) (cinfo->max_v_samp_factor*DCTSIZE)); in initial_setup()
130 validate_script (j_compress_ptr cinfo) in validate_script() argument
145 if (cinfo->num_scans <= 0) in validate_script()
146 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0); in validate_script()
151 scanptr = cinfo->scan_info; in validate_script()
154 cinfo->progressive_mode = TRUE; in validate_script()
156 for (ci = 0; ci < cinfo->num_components; ci++) in validate_script()
160 ERREXIT(cinfo, JERR_NOT_COMPILED); in validate_script()
163 cinfo->progressive_mode = FALSE; in validate_script()
164 for (ci = 0; ci < cinfo->num_components; ci++) in validate_script()
168 for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) { in validate_script()
172 ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN); in validate_script()
175 if (thisi < 0 || thisi >= cinfo->num_components) in validate_script()
176 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); in validate_script()
179 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); in validate_script()
186 if (cinfo->progressive_mode) { in validate_script()
202 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
205 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
208 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
213 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
218 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
222 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
231 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); in validate_script()
236 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); in validate_script()
243 if (cinfo->progressive_mode) { in validate_script()
250 for (ci = 0; ci < cinfo->num_components; ci++) { in validate_script()
252 ERREXIT(cinfo, JERR_MISSING_DATA); in validate_script()
256 for (ci = 0; ci < cinfo->num_components; ci++) { in validate_script()
258 ERREXIT(cinfo, JERR_MISSING_DATA); in validate_script()
267 select_scan_parameters (j_compress_ptr cinfo) in select_scan_parameters() argument
273 if (cinfo->scan_info != NULL) { in select_scan_parameters()
275 my_master_ptr master = (my_master_ptr) cinfo->master; in select_scan_parameters()
276 const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number; in select_scan_parameters()
278 cinfo->comps_in_scan = scanptr->comps_in_scan; in select_scan_parameters()
280 cinfo->cur_comp_info[ci] = in select_scan_parameters()
281 &cinfo->comp_info[scanptr->component_index[ci]]; in select_scan_parameters()
283 cinfo->Ss = scanptr->Ss; in select_scan_parameters()
284 cinfo->Se = scanptr->Se; in select_scan_parameters()
285 cinfo->Ah = scanptr->Ah; in select_scan_parameters()
286 cinfo->Al = scanptr->Al; in select_scan_parameters()
292 if (cinfo->num_components > MAX_COMPS_IN_SCAN) in select_scan_parameters()
293 ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, in select_scan_parameters()
295 cinfo->comps_in_scan = cinfo->num_components; in select_scan_parameters()
296 for (ci = 0; ci < cinfo->num_components; ci++) { in select_scan_parameters()
297 cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci]; in select_scan_parameters()
299 cinfo->Ss = 0; in select_scan_parameters()
300 cinfo->Se = DCTSIZE2-1; in select_scan_parameters()
301 cinfo->Ah = 0; in select_scan_parameters()
302 cinfo->Al = 0; in select_scan_parameters()
308 per_scan_setup (j_compress_ptr cinfo) in per_scan_setup() argument
315 if (cinfo->comps_in_scan == 1) { in per_scan_setup()
318 compptr = cinfo->cur_comp_info[0]; in per_scan_setup()
321 cinfo->MCUs_per_row = compptr->width_in_blocks; in per_scan_setup()
322 cinfo->MCU_rows_in_scan = compptr->height_in_blocks; in per_scan_setup()
338 cinfo->blocks_in_MCU = 1; in per_scan_setup()
339 cinfo->MCU_membership[0] = 0; in per_scan_setup()
344 if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) in per_scan_setup()
345 ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, in per_scan_setup()
349 cinfo->MCUs_per_row = (JDIMENSION) in per_scan_setup()
350 jdiv_round_up((long) cinfo->image_width, in per_scan_setup()
351 (long) (cinfo->max_h_samp_factor*DCTSIZE)); in per_scan_setup()
352 cinfo->MCU_rows_in_scan = (JDIMENSION) in per_scan_setup()
353 jdiv_round_up((long) cinfo->image_height, in per_scan_setup()
354 (long) (cinfo->max_v_samp_factor*DCTSIZE)); in per_scan_setup()
356 cinfo->blocks_in_MCU = 0; in per_scan_setup()
358 for (ci = 0; ci < cinfo->comps_in_scan; ci++) { in per_scan_setup()
359 compptr = cinfo->cur_comp_info[ci]; in per_scan_setup()
374 if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU) in per_scan_setup()
375 ERREXIT(cinfo, JERR_BAD_MCU_SIZE); in per_scan_setup()
377 cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; in per_scan_setup()
385 if (cinfo->restart_in_rows > 0) { in per_scan_setup()
386 long nominal = (long) cinfo->restart_in_rows * (long) cinfo->MCUs_per_row; in per_scan_setup()
387 cinfo->restart_interval = (unsigned int) MIN(nominal, 65535L); in per_scan_setup()
401 prepare_for_pass (j_compress_ptr cinfo) in prepare_for_pass() argument
403 my_master_ptr master = (my_master_ptr) cinfo->master; in prepare_for_pass()
410 select_scan_parameters(cinfo); in prepare_for_pass()
411 per_scan_setup(cinfo); in prepare_for_pass()
412 if (! cinfo->raw_data_in) { in prepare_for_pass()
413 (*cinfo->cconvert->start_pass) (cinfo); in prepare_for_pass()
414 (*cinfo->downsample->start_pass) (cinfo); in prepare_for_pass()
415 (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU); in prepare_for_pass()
417 (*cinfo->fdct->start_pass) (cinfo); in prepare_for_pass()
418 (*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding); in prepare_for_pass()
419 (*cinfo->coef->start_pass) (cinfo, in prepare_for_pass()
422 (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); in prepare_for_pass()
423 if (cinfo->optimize_coding) { in prepare_for_pass()
434 select_scan_parameters(cinfo); in prepare_for_pass()
435 per_scan_setup(cinfo); in prepare_for_pass()
436 if (cinfo->Ss != 0 || cinfo->Ah == 0 || cinfo->arith_code) { in prepare_for_pass()
437 (*cinfo->entropy->start_pass) (cinfo, TRUE); in prepare_for_pass()
438 (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST); in prepare_for_pass()
452 if (! cinfo->optimize_coding) { in prepare_for_pass()
453 select_scan_parameters(cinfo); in prepare_for_pass()
454 per_scan_setup(cinfo); in prepare_for_pass()
456 (*cinfo->entropy->start_pass) (cinfo, FALSE); in prepare_for_pass()
457 (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST); in prepare_for_pass()
460 (*cinfo->marker->write_frame_header) (cinfo); in prepare_for_pass()
461 (*cinfo->marker->write_scan_header) (cinfo); in prepare_for_pass()
465 ERREXIT(cinfo, JERR_NOT_COMPILED); in prepare_for_pass()
471 if (cinfo->progress != NULL) { in prepare_for_pass()
472 cinfo->progress->completed_passes = master->pass_number; in prepare_for_pass()
473 cinfo->progress->total_passes = master->total_passes; in prepare_for_pass()
489 pass_startup (j_compress_ptr cinfo) in pass_startup() argument
491 cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */ in pass_startup()
493 (*cinfo->marker->write_frame_header) (cinfo); in pass_startup()
494 (*cinfo->marker->write_scan_header) (cinfo); in pass_startup()
503 finish_pass_master (j_compress_ptr cinfo) in finish_pass_master() argument
505 my_master_ptr master = (my_master_ptr) cinfo->master; in finish_pass_master()
510 (*cinfo->entropy->finish_pass) (cinfo); in finish_pass_master()
519 if (! cinfo->optimize_coding) in finish_pass_master()
528 if (cinfo->optimize_coding) in finish_pass_master()
543 jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only) in jinit_c_master_control() argument
548 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, in jinit_c_master_control()
550 cinfo->master = (struct jpeg_comp_master *) master; in jinit_c_master_control()
557 initial_setup(cinfo); in jinit_c_master_control()
559 if (cinfo->scan_info != NULL) { in jinit_c_master_control()
561 validate_script(cinfo); in jinit_c_master_control()
563 ERREXIT(cinfo, JERR_NOT_COMPILED); in jinit_c_master_control()
566 cinfo->progressive_mode = FALSE; in jinit_c_master_control()
567 cinfo->num_scans = 1; in jinit_c_master_control()
570 if (cinfo->progressive_mode) /* TEMPORARY HACK ??? */ in jinit_c_master_control()
571 cinfo->optimize_coding = TRUE; /* assume default tables no good for progressive mode */ in jinit_c_master_control()
576 if (cinfo->optimize_coding) in jinit_c_master_control()
586 if (cinfo->optimize_coding) in jinit_c_master_control()
587 master->total_passes = cinfo->num_scans * 2; in jinit_c_master_control()
589 master->total_passes = cinfo->num_scans; in jinit_c_master_control()