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()
162 void jpeg_gdIOCtx_dest (j_compress_ptr cinfo, gdIOCtx * outfile);
166 struct jpeg_compress_struct cinfo; in gdImageJpegCtx() local
176 memset (&cinfo, 0, sizeof (cinfo)); in gdImageJpegCtx()
179 cinfo.err = jpeg_std_error (&jerr); in gdImageJpegCtx()
180 cinfo.client_data = &jmpbufw; in gdImageJpegCtx()
189 cinfo.err->error_exit = fatal_jpeg_error; in gdImageJpegCtx()
191 jpeg_create_compress (&cinfo); in gdImageJpegCtx()
193 cinfo.image_width = im->sx; in gdImageJpegCtx()
194 cinfo.image_height = im->sy; in gdImageJpegCtx()
195 cinfo.input_components = 3; /* # of color components per pixel */ in gdImageJpegCtx()
196 cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ in gdImageJpegCtx()
197 jpeg_set_defaults (&cinfo); in gdImageJpegCtx()
199 jpeg_set_quality (&cinfo, quality, TRUE); in gdImageJpegCtx()
204 jpeg_simple_progression (&cinfo); in gdImageJpegCtx()
207 jpeg_gdIOCtx_dest (&cinfo, outfile); in gdImageJpegCtx()
209 row = (JSAMPROW) safe_emalloc(cinfo.image_width * cinfo.input_components, sizeof(JSAMPLE), 0); in gdImageJpegCtx()
210 memset(row, 0, cinfo.image_width * cinfo.input_components * sizeof(JSAMPLE)); in gdImageJpegCtx()
213 jpeg_start_compress (&cinfo, TRUE); in gdImageJpegCtx()
220 jpeg_write_marker (&cinfo, JPEG_COM, (unsigned char *) comment, (unsigned int) strlen (comment)); in gdImageJpegCtx()
237 nlines = jpeg_write_scanlines (&cinfo, rowptr, 1); in gdImageJpegCtx()
264 nlines = jpeg_write_scanlines (&cinfo, rowptr, 1); in gdImageJpegCtx()
271 jpeg_finish_compress (&cinfo); in gdImageJpegCtx()
272 jpeg_destroy_compress (&cinfo); in gdImageJpegCtx()
306 void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile);
322 struct jpeg_decompress_struct cinfo; in gdImageCreateFromJpegCtxEx() local
335 memset (&cinfo, 0, sizeof (cinfo)); in gdImageCreateFromJpegCtxEx()
340 cinfo.err = jpeg_std_error (&jerr); in gdImageCreateFromJpegCtxEx()
341 cinfo.client_data = &jmpbufw; in gdImageCreateFromJpegCtxEx()
343 cinfo.err->emit_message = (void (*)(j_common_ptr,int)) php_jpeg_emit_message; in gdImageCreateFromJpegCtxEx()
356 cinfo.err->error_exit = fatal_jpeg_error; in gdImageCreateFromJpegCtxEx()
358 jpeg_create_decompress (&cinfo); in gdImageCreateFromJpegCtxEx()
360 jpeg_gdIOCtx_src (&cinfo, infile); in gdImageCreateFromJpegCtxEx()
363 jpeg_save_markers(&cinfo, JPEG_APP0 + 14, 256); in gdImageCreateFromJpegCtxEx()
365 retval = jpeg_read_header (&cinfo, TRUE); in gdImageCreateFromJpegCtxEx()
370 if (cinfo.image_height > INT_MAX) { in gdImageCreateFromJpegCtxEx()
371 …(%u) is greater than INT_MAX (%d) (and thus greater than gd can handle)", cinfo.image_height, INT_… in gdImageCreateFromJpegCtxEx()
374 if (cinfo.image_width > INT_MAX) { in gdImageCreateFromJpegCtxEx()
375 …(%u) is greater than INT_MAX (%d) (and thus greater than gd can handle)", cinfo.image_width, INT_M… in gdImageCreateFromJpegCtxEx()
378 im = gdImageCreateTrueColor ((int) cinfo.image_width, (int) cinfo.image_height); in gdImageCreateFromJpegCtxEx()
387 if ((cinfo.jpeg_color_space == JCS_CMYK) || (cinfo.jpeg_color_space == JCS_YCCK)) { in gdImageCreateFromJpegCtxEx()
388 cinfo.out_color_space = JCS_CMYK; in gdImageCreateFromJpegCtxEx()
390 cinfo.out_color_space = JCS_RGB; in gdImageCreateFromJpegCtxEx()
393 if (jpeg_start_decompress (&cinfo) != TRUE) { in gdImageCreateFromJpegCtxEx()
407 gdImageInterlace (im, cinfo.progressive_mode != 0); in gdImageCreateFromJpegCtxEx()
410 if (cinfo.out_color_space == JCS_RGB) { in gdImageCreateFromJpegCtxEx()
411 if (cinfo.output_components != 3) { in gdImageCreateFromJpegCtxEx()
412 …zation request resulted in output_components == %d (expected 3 for RGB)", cinfo.output_components); in gdImageCreateFromJpegCtxEx()
416 } else if (cinfo.out_color_space == JCS_CMYK) { in gdImageCreateFromJpegCtxEx()
418 if (cinfo.output_components != 4) { in gdImageCreateFromJpegCtxEx()
419 …ation request resulted in output_components == %d (expected 4 for CMYK)", cinfo.output_components); in gdImageCreateFromJpegCtxEx()
423 marker = cinfo.marker_list; in gdImageCreateFromJpegCtxEx()
441 row = safe_emalloc(cinfo.output_width * channels, sizeof(JSAMPLE), 0); in gdImageCreateFromJpegCtxEx()
442 memset(row, 0, cinfo.output_width * channels * sizeof(JSAMPLE)); in gdImageCreateFromJpegCtxEx()
445 if (cinfo.out_color_space == JCS_CMYK) { in gdImageCreateFromJpegCtxEx()
446 for (i = 0; i < cinfo.output_height; i++) { in gdImageCreateFromJpegCtxEx()
449 nrows = jpeg_read_scanlines (&cinfo, rowptr, 1); in gdImageCreateFromJpegCtxEx()
454 for (j = 0; j < cinfo.output_width; j++, currow += 4, tpix++) { in gdImageCreateFromJpegCtxEx()
459 for (i = 0; i < cinfo.output_height; i++) { in gdImageCreateFromJpegCtxEx()
462 nrows = jpeg_read_scanlines (&cinfo, rowptr, 1); in gdImageCreateFromJpegCtxEx()
467 for (j = 0; j < cinfo.output_width; j++, currow += 3, tpix++) { in gdImageCreateFromJpegCtxEx()
473 if (jpeg_finish_decompress (&cinfo) != TRUE) { in gdImageCreateFromJpegCtxEx()
477 if (cinfo.err->num_warnings > 0) { in gdImageCreateFromJpegCtxEx()
482 jpeg_destroy_decompress (&cinfo); in gdImageCreateFromJpegCtxEx()
488 jpeg_destroy_decompress (&cinfo); in gdImageCreateFromJpegCtxEx()
549 void init_source (j_decompress_ptr cinfo) in init_source() argument
551 my_src_ptr src = (my_src_ptr) cinfo->src; in init_source()
596 safeboolean fill_input_buffer (j_decompress_ptr cinfo) in fill_input_buffer() argument
598 my_src_ptr src = (my_src_ptr) cinfo->src; in fill_input_buffer()
621 ERREXIT (cinfo, JERR_INPUT_EMPTY); in fill_input_buffer()
623 WARNMS (cinfo, JWRN_JPEG_EOF); in fill_input_buffer()
650 void skip_input_data (j_decompress_ptr cinfo, long num_bytes) in skip_input_data() argument
652 my_src_ptr src = (my_src_ptr) cinfo->src; in skip_input_data()
660 (void) fill_input_buffer (cinfo); in skip_input_data()
689 void term_source (j_decompress_ptr cinfo) in term_source() argument
693 my_src_ptr src = (my_src_ptr) cinfo->src; in term_source()
704 void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile) in jpeg_gdIOCtx_src() argument
715 if (cinfo->src == NULL) { /* first time for this JPEG object? */ in jpeg_gdIOCtx_src()
716 cinfo->src = (struct jpeg_source_mgr *) in jpeg_gdIOCtx_src()
717 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (my_source_mgr)); in jpeg_gdIOCtx_src()
718 src = (my_src_ptr) cinfo->src; in jpeg_gdIOCtx_src()
719 …src->buffer = (unsigned char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,… in jpeg_gdIOCtx_src()
723 src = (my_src_ptr) cinfo->src; in jpeg_gdIOCtx_src()
752 void init_destination (j_compress_ptr cinfo) in init_destination() argument
754 my_dest_ptr dest = (my_dest_ptr) cinfo->dest; in init_destination()
757 …dest->buffer = (unsigned char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, OU… in init_destination()
787 safeboolean empty_output_buffer (j_compress_ptr cinfo) in empty_output_buffer() argument
789 my_dest_ptr dest = (my_dest_ptr) cinfo->dest; in empty_output_buffer()
792 ERREXIT (cinfo, JERR_FILE_WRITE); in empty_output_buffer()
811 void term_destination (j_compress_ptr cinfo) in term_destination() argument
813 my_dest_ptr dest = (my_dest_ptr) cinfo->dest; in term_destination()
818 ERREXIT (cinfo, JERR_FILE_WRITE); in term_destination()
829 void jpeg_gdIOCtx_dest (j_compress_ptr cinfo, gdIOCtx * outfile) in jpeg_gdIOCtx_dest() argument
839 if (cinfo->dest == NULL) { /* first time for this JPEG object? */ in jpeg_gdIOCtx_dest()
840 …cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JP… in jpeg_gdIOCtx_dest()
843 dest = (my_dest_ptr) cinfo->dest; in jpeg_gdIOCtx_dest()