Lines Matching refs:cinfo

85 static void fatal_jpeg_error (j_common_ptr cinfo)  in fatal_jpeg_error()  argument
90 (*cinfo->err->output_message) (cinfo); in fatal_jpeg_error()
92 jmpbufw = (jmpbuf_wrapper *) cinfo->client_data; in fatal_jpeg_error()
93 jpeg_destroy (cinfo); in fatal_jpeg_error()
158 void jpeg_gdIOCtx_dest (j_compress_ptr cinfo, gdIOCtx * outfile);
162 struct jpeg_compress_struct cinfo; in gdImageJpegCtx() local
172 memset (&cinfo, 0, sizeof (cinfo)); in gdImageJpegCtx()
175 cinfo.err = jpeg_std_error (&jerr); in gdImageJpegCtx()
176 cinfo.client_data = &jmpbufw; in gdImageJpegCtx()
185 cinfo.err->error_exit = fatal_jpeg_error; in gdImageJpegCtx()
187 jpeg_create_compress (&cinfo); in gdImageJpegCtx()
189 cinfo.image_width = im->sx; in gdImageJpegCtx()
190 cinfo.image_height = im->sy; in gdImageJpegCtx()
191 cinfo.input_components = 3; /* # of color components per pixel */ in gdImageJpegCtx()
192 cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ in gdImageJpegCtx()
193 jpeg_set_defaults (&cinfo); in gdImageJpegCtx()
195 jpeg_set_quality (&cinfo, quality, TRUE); in gdImageJpegCtx()
200 jpeg_simple_progression (&cinfo); in gdImageJpegCtx()
203 jpeg_gdIOCtx_dest (&cinfo, outfile); in gdImageJpegCtx()
205 row = (JSAMPROW) safe_emalloc(cinfo.image_width * cinfo.input_components, sizeof(JSAMPLE), 0); in gdImageJpegCtx()
206 memset(row, 0, cinfo.image_width * cinfo.input_components * sizeof(JSAMPLE)); in gdImageJpegCtx()
209 jpeg_start_compress (&cinfo, TRUE); in gdImageJpegCtx()
216 jpeg_write_marker (&cinfo, JPEG_COM, (unsigned char *) comment, (unsigned int) strlen (comment)); in gdImageJpegCtx()
233 nlines = jpeg_write_scanlines (&cinfo, rowptr, 1); in gdImageJpegCtx()
260 nlines = jpeg_write_scanlines (&cinfo, rowptr, 1); in gdImageJpegCtx()
267 jpeg_finish_compress (&cinfo); in gdImageJpegCtx()
268 jpeg_destroy_compress (&cinfo); in gdImageJpegCtx()
292 void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile);
303 struct jpeg_decompress_struct cinfo; in gdImageCreateFromJpegCtx() local
316 memset (&cinfo, 0, sizeof (cinfo)); in gdImageCreateFromJpegCtx()
321 cinfo.err = jpeg_std_error (&jerr); in gdImageCreateFromJpegCtx()
322 cinfo.client_data = &jmpbufw; in gdImageCreateFromJpegCtx()
324 cinfo.err->emit_message = (void (*)(j_common_ptr,int)) php_jpeg_emit_message; in gdImageCreateFromJpegCtx()
337 cinfo.err->error_exit = fatal_jpeg_error; in gdImageCreateFromJpegCtx()
339 jpeg_create_decompress (&cinfo); in gdImageCreateFromJpegCtx()
341 jpeg_gdIOCtx_src (&cinfo, infile); in gdImageCreateFromJpegCtx()
344 jpeg_save_markers(&cinfo, JPEG_APP0 + 14, 256); in gdImageCreateFromJpegCtx()
346 retval = jpeg_read_header (&cinfo, TRUE); in gdImageCreateFromJpegCtx()
351 if (cinfo.image_height > INT_MAX) { in gdImageCreateFromJpegCtx()
352 …(%u) is greater than INT_MAX (%d) (and thus greater than gd can handle)", cinfo.image_height, INT_… in gdImageCreateFromJpegCtx()
355 if (cinfo.image_width > INT_MAX) { in gdImageCreateFromJpegCtx()
356 …(%u) is greater than INT_MAX (%d) (and thus greater than gd can handle)", cinfo.image_width, INT_M… in gdImageCreateFromJpegCtx()
359 im = gdImageCreateTrueColor ((int) cinfo.image_width, (int) cinfo.image_height); in gdImageCreateFromJpegCtx()
368 if ((cinfo.jpeg_color_space == JCS_CMYK) || (cinfo.jpeg_color_space == JCS_YCCK)) { in gdImageCreateFromJpegCtx()
369 cinfo.out_color_space = JCS_CMYK; in gdImageCreateFromJpegCtx()
371 cinfo.out_color_space = JCS_RGB; in gdImageCreateFromJpegCtx()
374 if (jpeg_start_decompress (&cinfo) != TRUE) { in gdImageCreateFromJpegCtx()
388 gdImageInterlace (im, cinfo.progressive_mode != 0); in gdImageCreateFromJpegCtx()
391 if (cinfo.out_color_space == JCS_RGB) { in gdImageCreateFromJpegCtx()
392 if (cinfo.output_components != 3) { in gdImageCreateFromJpegCtx()
393 …zation request resulted in output_components == %d (expected 3 for RGB)", cinfo.output_components); in gdImageCreateFromJpegCtx()
397 } else if (cinfo.out_color_space == JCS_CMYK) { in gdImageCreateFromJpegCtx()
399 if (cinfo.output_components != 4) { in gdImageCreateFromJpegCtx()
400 …ation request resulted in output_components == %d (expected 4 for CMYK)", cinfo.output_components); in gdImageCreateFromJpegCtx()
404 marker = cinfo.marker_list; in gdImageCreateFromJpegCtx()
422 row = safe_emalloc(cinfo.output_width * channels, sizeof(JSAMPLE), 0); in gdImageCreateFromJpegCtx()
423 memset(row, 0, cinfo.output_width * channels * sizeof(JSAMPLE)); in gdImageCreateFromJpegCtx()
426 if (cinfo.out_color_space == JCS_CMYK) { in gdImageCreateFromJpegCtx()
427 for (i = 0; i < cinfo.output_height; i++) { in gdImageCreateFromJpegCtx()
430 nrows = jpeg_read_scanlines (&cinfo, rowptr, 1); in gdImageCreateFromJpegCtx()
435 for (j = 0; j < cinfo.output_width; j++, currow += 4, tpix++) { in gdImageCreateFromJpegCtx()
440 for (i = 0; i < cinfo.output_height; i++) { in gdImageCreateFromJpegCtx()
443 nrows = jpeg_read_scanlines (&cinfo, rowptr, 1); in gdImageCreateFromJpegCtx()
448 for (j = 0; j < cinfo.output_width; j++, currow += 3, tpix++) { in gdImageCreateFromJpegCtx()
454 if (jpeg_finish_decompress (&cinfo) != TRUE) { in gdImageCreateFromJpegCtx()
458 if (cinfo.err->num_warnings > 0) { in gdImageCreateFromJpegCtx()
463 jpeg_destroy_decompress (&cinfo); in gdImageCreateFromJpegCtx()
469 jpeg_destroy_decompress (&cinfo); in gdImageCreateFromJpegCtx()
530 void init_source (j_decompress_ptr cinfo) in init_source() argument
532 my_src_ptr src = (my_src_ptr) cinfo->src; in init_source()
577 safeboolean fill_input_buffer (j_decompress_ptr cinfo) in fill_input_buffer() argument
579 my_src_ptr src = (my_src_ptr) cinfo->src; in fill_input_buffer()
602 ERREXIT (cinfo, JERR_INPUT_EMPTY); in fill_input_buffer()
604 WARNMS (cinfo, JWRN_JPEG_EOF); in fill_input_buffer()
631 void skip_input_data (j_decompress_ptr cinfo, long num_bytes) in skip_input_data() argument
633 my_src_ptr src = (my_src_ptr) cinfo->src; in skip_input_data()
641 (void) fill_input_buffer (cinfo); in skip_input_data()
670 void term_source (j_decompress_ptr cinfo) in term_source() argument
674 my_src_ptr src = (my_src_ptr) cinfo->src; in term_source()
685 void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile) in jpeg_gdIOCtx_src() argument
696 if (cinfo->src == NULL) { /* first time for this JPEG object? */ in jpeg_gdIOCtx_src()
697 cinfo->src = (struct jpeg_source_mgr *) in jpeg_gdIOCtx_src()
698 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (my_source_mgr)); in jpeg_gdIOCtx_src()
699 src = (my_src_ptr) cinfo->src; in jpeg_gdIOCtx_src()
700 …src->buffer = (unsigned char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,… in jpeg_gdIOCtx_src()
704 src = (my_src_ptr) cinfo->src; in jpeg_gdIOCtx_src()
733 void init_destination (j_compress_ptr cinfo) in init_destination() argument
735 my_dest_ptr dest = (my_dest_ptr) cinfo->dest; in init_destination()
738 …dest->buffer = (unsigned char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, OU… in init_destination()
768 safeboolean empty_output_buffer (j_compress_ptr cinfo) in empty_output_buffer() argument
770 my_dest_ptr dest = (my_dest_ptr) cinfo->dest; in empty_output_buffer()
773 ERREXIT (cinfo, JERR_FILE_WRITE); in empty_output_buffer()
792 void term_destination (j_compress_ptr cinfo) in term_destination() argument
794 my_dest_ptr dest = (my_dest_ptr) cinfo->dest; in term_destination()
799 ERREXIT (cinfo, JERR_FILE_WRITE); in term_destination()
810 void jpeg_gdIOCtx_dest (j_compress_ptr cinfo, gdIOCtx * outfile) in jpeg_gdIOCtx_dest() argument
820 if (cinfo->dest == NULL) { /* first time for this JPEG object? */ in jpeg_gdIOCtx_dest()
821cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JP… in jpeg_gdIOCtx_dest()
824 dest = (my_dest_ptr) cinfo->dest; in jpeg_gdIOCtx_dest()