27 #define WIN32_LEAN_AND_MEAN 62 #if defined(__BORLANDC__) || defined(__MINGW32__) 80 #if defined(WIN32) && !defined(__MINGW32__) 97 #if defined(D_MAX_DATA_UNITS_IN_MCU) 98 #define width_in_blocks width_in_data_units 105 #define SETJMP(jbuf) setjmp(jbuf) 106 #define LONGJMP(jbuf,code) longjmp(jbuf,code) 107 #define JMP_BUF jmp_buf 132 int cinfo_initialized;
164 int ycbcrsampling_fetched;
171 #define JState(tif) ((JPEGState*)(tif)->tif_data) 177 static int JPEGInitializeLibJPEG(
TIFF * tif,
178 int force_encode,
int force_decode );
180 #define FIELD_JPEGTABLES (FIELD_CODEC+0) 181 #define FIELD_RECVPARAMS (FIELD_CODEC+1) 182 #define FIELD_SUBADDRESS (FIELD_CODEC+2) 183 #define FIELD_RECVTIME (FIELD_CODEC+3) 184 #define FIELD_FAXDCS (FIELD_CODEC+4) 205 #define N(a) (sizeof (a) / sizeof (a[0])) 224 JPEGState *sp = (JPEGState *) cinfo;
227 (*cinfo->err->format_message) (cinfo, buffer);
228 TIFFErrorExt(sp->tif->tif_clientdata,
"JPEGLib", buffer);
243 (*cinfo->err->format_message) (cinfo, buffer);
244 TIFFWarningExt(((JPEGState *) cinfo)->tif->tif_clientdata,
"JPEGLib", buffer);
253 #define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op)) 254 #define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op),1)) 257 TIFFjpeg_create_compress(JPEGState* sp)
261 sp->err.error_exit = TIFFjpeg_error_exit;
262 sp->err.output_message = TIFFjpeg_output_message;
268 TIFFjpeg_create_decompress(JPEGState* sp)
272 sp->err.error_exit = TIFFjpeg_error_exit;
273 sp->err.output_message = TIFFjpeg_output_message;
279 TIFFjpeg_set_defaults(JPEGState* sp)
298 TIFFjpeg_suppress_tables(JPEGState* sp,
boolean suppress)
325 TIFFjpeg_finish_compress(JPEGState* sp)
331 TIFFjpeg_write_tables(JPEGState* sp)
343 TIFFjpeg_start_decompress(JPEGState* sp)
345 return CALLVJPEG(sp, jpeg_start_decompress(&sp->cinfo.d));
363 TIFFjpeg_finish_decompress(JPEGState* sp)
369 TIFFjpeg_abort(JPEGState* sp)
375 TIFFjpeg_destroy(JPEGState* sp)
381 TIFFjpeg_alloc_sarray(JPEGState* sp,
int pool_id,
385 (*sp->cinfo.comm.mem->alloc_sarray)
386 (&sp->cinfo.comm, pool_id, samplesperrow, numrows));
398 JPEGState* sp = (JPEGState*) cinfo;
408 JPEGState* sp = (JPEGState*) cinfo;
423 JPEGState* sp = (JPEGState*) cinfo;
433 TIFFjpeg_data_dest(JPEGState* sp,
TIFF* tif)
436 sp->cinfo.c.dest = &sp->dest;
437 sp->dest.init_destination = std_init_destination;
438 sp->dest.empty_output_buffer = std_empty_output_buffer;
439 sp->dest.term_destination = std_term_destination;
449 JPEGState* sp = (JPEGState*) cinfo;
453 sp->dest.free_in_buffer = (
size_t) sp->jpegtables_length;
459 JPEGState* sp = (JPEGState*) cinfo;
464 (
tsize_t) (sp->jpegtables_length + 1000));
466 ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 100);
467 sp->dest.next_output_byte = (
JOCTET*) newbuf + sp->jpegtables_length;
468 sp->dest.free_in_buffer = (
size_t) 1000;
469 sp->jpegtables = newbuf;
470 sp->jpegtables_length += 1000;
477 JPEGState* sp = (JPEGState*) cinfo;
484 TIFFjpeg_tables_dest(JPEGState* sp,
TIFF* tif)
493 sp->jpegtables_length = 1000;
495 if (sp->jpegtables ==
NULL) {
496 sp->jpegtables_length = 0;
497 TIFFErrorExt(sp->tif->tif_clientdata,
"TIFFjpeg_tables_dest",
"No space for JPEGTables");
500 sp->cinfo.c.dest = &sp->dest;
501 sp->dest.init_destination = tables_init_destination;
502 sp->dest.empty_output_buffer = tables_empty_output_buffer;
503 sp->dest.term_destination = tables_term_destination;
515 JPEGState* sp = (JPEGState*) cinfo;
519 sp->src.bytes_in_buffer = (
size_t) tif->
tif_rawcc;
525 JPEGState* sp = (JPEGState* ) cinfo;
533 WARNMS(cinfo, JWRN_JPEG_EOF);
535 sp->src.next_input_byte = dummy_EOI;
536 sp->src.bytes_in_buffer = 2;
543 JPEGState* sp = (JPEGState*) cinfo;
546 if (num_bytes > (
long) sp->src.bytes_in_buffer) {
548 (
void) std_fill_input_buffer(cinfo);
550 sp->src.next_input_byte += (size_t) num_bytes;
551 sp->src.bytes_in_buffer -= (size_t) num_bytes;
566 TIFFjpeg_data_src(JPEGState* sp,
TIFF* tif)
569 sp->cinfo.d.src = &sp->src;
570 sp->src.init_source = std_init_source;
571 sp->src.fill_input_buffer = std_fill_input_buffer;
572 sp->src.skip_input_data = std_skip_input_data;
574 sp->src.term_source = std_term_source;
575 sp->src.bytes_in_buffer = 0;
576 sp->src.next_input_byte =
NULL;
587 JPEGState* sp = (JPEGState*) cinfo;
590 sp->src.bytes_in_buffer = (
size_t) sp->jpegtables_length;
594 TIFFjpeg_tables_src(JPEGState* sp,
TIFF* tif)
596 TIFFjpeg_data_src(sp, tif);
597 sp->src.init_source = tables_init_source;
611 JPEGState* sp =
JState(tif);
615 int samples_per_clump = 0;
617 for (ci = 0, compptr = comp_info; ci < num_components;
626 sp->ds_buffer[ci] =
buf;
628 sp->samplesperclump = samples_per_clump;
638 JPEGSetupDecode(
TIFF* tif)
640 JPEGState* sp =
JState(tif);
643 JPEGInitializeLibJPEG( tif, 0, 1 );
646 assert(sp->cinfo.comm.is_decompressor);
650 TIFFjpeg_tables_src(sp, tif);
659 switch (sp->photometric) {
672 TIFFjpeg_data_src(sp, tif);
683 JPEGState *sp =
JState(tif);
685 static const char module[] =
"JPEGPreDecode";
686 uint32 segment_width, segment_height;
687 int downsampled_output;
691 assert(sp->cinfo.comm.is_decompressor);
696 if (!TIFFjpeg_abort(sp))
722 segment_width =
TIFFhowmany(segment_width, sp->h_sampling);
723 segment_height =
TIFFhowmany(segment_height, sp->v_sampling);
725 if (sp->cinfo.d.image_width != segment_width ||
726 sp->cinfo.d.image_height != segment_height) {
728 "Improper JPEG strip/tile size, expected %dx%d, got %dx%d",
731 sp->cinfo.d.image_width,
732 sp->cinfo.d.image_height);
734 if (sp->cinfo.d.num_components !=
755 if (sp->cinfo.d.comp_info[0].h_samp_factor != sp->h_sampling ||
756 sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling) {
758 "Improper JPEG sampling factors %d,%d\n" 759 "Apparently should be %d,%d.",
760 sp->cinfo.d.comp_info[0].h_samp_factor,
761 sp->cinfo.d.comp_info[0].v_samp_factor,
762 sp->h_sampling, sp->v_sampling);
773 "Decompressor will try reading with " 775 sp->cinfo.d.comp_info[0].h_samp_factor,
776 sp->cinfo.d.comp_info[0].v_samp_factor);
779 sp->cinfo.d.comp_info[0].h_samp_factor;
781 sp->cinfo.d.comp_info[0].v_samp_factor;
785 for (ci = 1; ci < sp->cinfo.d.num_components; ci++) {
786 if (sp->cinfo.d.comp_info[ci].h_samp_factor != 1 ||
787 sp->cinfo.d.comp_info[ci].v_samp_factor != 1) {
794 if (sp->cinfo.d.comp_info[0].h_samp_factor != 1 ||
795 sp->cinfo.d.comp_info[0].v_samp_factor != 1) {
800 downsampled_output =
FALSE;
805 sp->cinfo.d.jpeg_color_space =
JCS_YCbCr;
806 sp->cinfo.d.out_color_space =
JCS_RGB;
812 (sp->h_sampling != 1 || sp->v_sampling != 1))
813 downsampled_output =
TRUE;
816 if (downsampled_output) {
818 sp->cinfo.d.raw_data_out =
TRUE;
824 sp->cinfo.d.raw_data_out =
FALSE;
830 if (!TIFFjpeg_start_decompress(sp))
833 if (downsampled_output) {
834 if (!alloc_downsampled_buffers(tif, sp->cinfo.d.comp_info,
835 sp->cinfo.d.num_components))
849 JPEGState *sp =
JState(tif);
853 nrows = cc / sp->bytesperline;
854 if (cc % sp->bytesperline)
857 if( nrows > (
int) sp->cinfo.d.image_height )
858 nrows = sp->cinfo.d.image_height;
869 #if !defined(JPEG_LIB_MK1) 870 if( sp->cinfo.d.data_precision == 12 )
874 _TIFFmalloc(
sizeof(
short) * sp->cinfo.d.output_width
875 * sp->cinfo.d.num_components );
879 if( line_work_buf !=
NULL )
886 if (TIFFjpeg_read_scanlines(sp, &line_work_buf, 1) != 1)
889 if( sp->cinfo.d.data_precision == 12 )
891 int value_pairs = (sp->cinfo.d.output_width
892 * sp->cinfo.d.num_components) / 2;
895 for( iPair = 0; iPair < value_pairs; iPair++ )
897 unsigned char *out_ptr =
898 ((
unsigned char *)
buf) + iPair * 3;
899 JSAMPLE *in_ptr = line_work_buf + iPair * 2;
901 out_ptr[0] = (in_ptr[0] & 0xff0) >> 4;
902 out_ptr[1] = ((in_ptr[0] & 0xf) << 4)
903 | ((in_ptr[1] & 0xf00) >> 8);
904 out_ptr[2] = ((in_ptr[1] & 0xff) >> 0);
907 else if( sp->cinfo.d.data_precision == 8 )
909 int value_count = (sp->cinfo.d.output_width
910 * sp->cinfo.d.num_components);
913 for( iValue = 0; iValue < value_count; iValue++ )
915 ((
unsigned char *)
buf)[iValue] =
916 line_work_buf[iValue] & 0xff;
928 if (TIFFjpeg_read_scanlines(sp, &bufptr, 1) != 1)
933 buf += sp->bytesperline;
934 cc -= sp->bytesperline;
935 }
while (--nrows > 0);
937 if( line_work_buf !=
NULL )
942 return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height
943 || TIFFjpeg_finish_decompress(sp);
953 JPEGState *sp =
JState(tif);
958 if ( (nrows = sp->cinfo.d.image_height) ) {
960 JDIMENSION clumps_per_line = sp->cinfo.d.comp_info[1].downsampled_width;
961 int samples_per_clump = sp->samplesperclump;
964 unsigned short* tmpbuf =
_TIFFmalloc(
sizeof(
unsigned short) *
965 sp->cinfo.d.output_width *
966 sp->cinfo.d.num_components);
974 if (sp->scancount >=
DCTSIZE) {
975 int n = sp->cinfo.d.max_v_samp_factor *
DCTSIZE;
976 if (TIFFjpeg_read_raw_data(sp, sp->ds_buffer, n)
986 for (ci = 0, compptr = sp->cinfo.d.comp_info;
993 for (ypos = 0; ypos < vsamp; ypos++) {
994 JSAMPLE *inptr = sp->ds_buffer[ci][sp->scancount*vsamp + ypos];
1004 for (nclump = clumps_per_line; nclump-- > 0; ) {
1005 outptr[0] = *inptr++;
1006 outptr += samples_per_clump;
1012 for (nclump = clumps_per_line; nclump-- > 0; ) {
1013 for (xpos = 0; xpos < hsamp; xpos++)
1014 outptr[xpos] = *inptr++;
1015 outptr += samples_per_clump;
1018 clumpoffset += hsamp;
1024 if (sp->cinfo.d.data_precision == 8)
1027 int len = sp->cinfo.d.output_width * sp->cinfo.d.num_components;
1028 for (i=0; i<
len; i++)
1030 ((
unsigned char*)
buf)[
i] = tmpbuf[
i] & 0xff;
1035 int value_pairs = (sp->cinfo.d.output_width
1036 * sp->cinfo.d.num_components) / 2;
1038 for( iPair = 0; iPair < value_pairs; iPair++ )
1040 unsigned char *out_ptr = ((
unsigned char *)
buf) + iPair * 3;
1041 JSAMPLE *in_ptr = tmpbuf + iPair * 2;
1042 out_ptr[0] = (in_ptr[0] & 0xff0) >> 4;
1043 out_ptr[1] = ((in_ptr[0] & 0xf) << 4)
1044 | ((in_ptr[1] & 0xf00) >> 8);
1045 out_ptr[2] = ((in_ptr[1] & 0xff) >> 0);
1053 buf += sp->bytesperline;
1054 cc -= sp->bytesperline;
1055 }
while (--nrows > 0);
1064 return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height
1065 || TIFFjpeg_finish_decompress(sp);
1074 unsuppress_quant_table (JPEGState* sp,
int tblno)
1078 if ((qtbl = sp->cinfo.c.quant_tbl_ptrs[tblno]) !=
NULL)
1083 unsuppress_huff_table (JPEGState* sp,
int tblno)
1087 if ((htbl = sp->cinfo.c.dc_huff_tbl_ptrs[tblno]) !=
NULL)
1089 if ((htbl = sp->cinfo.c.ac_huff_tbl_ptrs[tblno]) !=
NULL)
1094 prepare_JPEGTables(
TIFF* tif)
1096 JPEGState* sp =
JState(tif);
1098 JPEGInitializeLibJPEG( tif, 0, 0 );
1101 if (!TIFFjpeg_set_quality(sp, sp->jpegquality,
FALSE))
1105 if (!TIFFjpeg_suppress_tables(sp,
TRUE))
1108 unsuppress_quant_table(sp, 0);
1110 unsuppress_quant_table(sp, 1);
1113 unsuppress_huff_table(sp, 0);
1115 unsuppress_huff_table(sp, 1);
1118 if (!TIFFjpeg_tables_dest(sp, tif))
1121 if (!TIFFjpeg_write_tables(sp))
1128 JPEGSetupEncode(
TIFF* tif)
1130 JPEGState* sp =
JState(tif);
1132 static const char module[] =
"JPEGSetupEncode";
1134 JPEGInitializeLibJPEG( tif, 1, 0 );
1137 assert(!sp->cinfo.comm.is_decompressor);
1145 sp->cinfo.c.input_components = 1;
1146 if (!TIFFjpeg_set_defaults(sp))
1150 switch (sp->photometric) {
1166 refbw[1] = (float)(top-1L);
1167 refbw[2] = (float)(top>>1);
1168 refbw[3] = refbw[1];
1169 refbw[4] = refbw[2];
1170 refbw[5] = refbw[1];
1179 "PhotometricInterpretation %d not allowed for JPEG",
1180 (
int) sp->photometric);
1214 "JPEG tile height must be multiple of %d",
1220 "JPEG tile width must be multiple of %d",
1228 "RowsPerStrip must be multiple of %d for JPEG",
1236 if (!prepare_JPEGTables(tif))
1249 TIFFjpeg_data_dest(sp, tif);
1260 JPEGState *sp =
JState(tif);
1262 static const char module[] =
"JPEGPreEncode";
1263 uint32 segment_width, segment_height;
1264 int downsampled_input;
1267 assert(!sp->cinfo.comm.is_decompressor);
1286 segment_width =
TIFFhowmany(segment_width, sp->h_sampling);
1287 segment_height =
TIFFhowmany(segment_height, sp->v_sampling);
1289 if (segment_width > 65535 || segment_height > 65535) {
1293 sp->cinfo.c.image_width = segment_width;
1294 sp->cinfo.c.image_height = segment_height;
1295 downsampled_input =
FALSE;
1300 sp->cinfo.c.in_color_space =
JCS_RGB;
1303 if (sp->h_sampling != 1 || sp->v_sampling != 1)
1304 downsampled_input =
TRUE;
1306 if (!TIFFjpeg_set_colorspace(sp,
JCS_YCbCr))
1312 sp->cinfo.c.comp_info[0].h_samp_factor = sp->h_sampling;
1313 sp->cinfo.c.comp_info[0].v_samp_factor = sp->v_sampling;
1321 sp->cinfo.c.input_components = 1;
1325 sp->cinfo.c.comp_info[0].component_id =
s;
1328 sp->cinfo.c.comp_info[0].quant_tbl_no = 1;
1329 sp->cinfo.c.comp_info[0].dc_tbl_no = 1;
1330 sp->cinfo.c.comp_info[0].ac_tbl_no = 1;
1334 sp->cinfo.c.write_JFIF_header =
FALSE;
1335 sp->cinfo.c.write_Adobe_marker =
FALSE;
1338 if (!TIFFjpeg_set_quality(sp, sp->jpegquality,
FALSE))
1340 unsuppress_quant_table(sp, 0);
1341 unsuppress_quant_table(sp, 1);
1344 sp->cinfo.c.optimize_coding =
FALSE;
1346 sp->cinfo.c.optimize_coding =
TRUE;
1347 if (downsampled_input) {
1349 sp->cinfo.c.raw_data_in =
TRUE;
1355 sp->cinfo.c.raw_data_in =
FALSE;
1361 if (!TIFFjpeg_start_compress(sp,
FALSE))
1364 if (downsampled_input) {
1365 if (!alloc_downsampled_buffers(tif, sp->cinfo.c.comp_info,
1366 sp->cinfo.c.num_components))
1381 JPEGState *sp =
JState(tif);
1388 nrows = cc / sp->bytesperline;
1389 if (cc % sp->bytesperline)
1392 while (nrows-- > 0) {
1394 if (TIFFjpeg_write_scanlines(sp, bufptr, 1) != 1)
1398 buf += sp->bytesperline;
1410 JPEGState *sp =
JState(tif);
1415 int clumpoffset, ci, xpos, ypos;
1417 int samples_per_clump = sp->samplesperclump;
1422 nrows = cc / sp->bytesperline;
1423 if (cc % sp->bytesperline)
1427 clumps_per_line = sp->cinfo.c.comp_info[1].downsampled_width;
1429 while (nrows-- > 0) {
1435 for (ci = 0, compptr = sp->cinfo.c.comp_info;
1441 clumps_per_line * hsamp);
1442 for (ypos = 0; ypos < vsamp; ypos++) {
1444 outptr = sp->ds_buffer[ci][sp->scancount*vsamp + ypos];
1447 for (nclump = clumps_per_line; nclump-- > 0; ) {
1448 *outptr++ = inptr[0];
1449 inptr += samples_per_clump;
1453 for (nclump = clumps_per_line; nclump-- > 0; ) {
1454 for (xpos = 0; xpos < hsamp; xpos++)
1455 *outptr++ = inptr[xpos];
1456 inptr += samples_per_clump;
1460 for (xpos = 0; xpos < padding; xpos++) {
1461 *outptr = outptr[-1];
1464 clumpoffset += hsamp;
1468 if (sp->scancount >=
DCTSIZE) {
1469 int n = sp->cinfo.c.max_v_samp_factor *
DCTSIZE;
1470 if (TIFFjpeg_write_raw_data(sp, sp->ds_buffer, n) !=
n)
1476 buf += sp->bytesperline;
1485 JPEGPostEncode(
TIFF* tif)
1487 JPEGState *sp =
JState(tif);
1489 if (sp->scancount > 0) {
1497 for (ci = 0, compptr = sp->cinfo.c.comp_info;
1503 for (ypos = sp->scancount * vsamp;
1504 ypos <
DCTSIZE * vsamp; ypos++) {
1506 (
tdata_t)sp->ds_buffer[ci][ypos-1],
1511 n = sp->cinfo.c.max_v_samp_factor *
DCTSIZE;
1512 if (TIFFjpeg_write_raw_data(sp, sp->ds_buffer, n) != n)
1516 return (TIFFjpeg_finish_compress(
JState(tif)));
1520 JPEGCleanup(
TIFF* tif)
1522 JPEGState *sp =
JState(tif);
1529 if( sp->cinfo_initialized )
1530 TIFFjpeg_destroy(sp);
1540 JPEGVSetField(
TIFF* tif,
ttag_t tag, va_list ap)
1542 JPEGState* sp =
JState(tif);
1550 v32 = va_arg(ap,
uint32);
1557 sp->jpegtables_length = v32;
1561 sp->jpegquality = va_arg(ap,
int);
1564 sp->jpegcolormode = va_arg(ap,
int);
1588 sp->jpegtablesmode = va_arg(ap,
int);
1592 sp->ycbcrsampling_fetched = 1;
1593 return (*sp->vsetparent)(tif, tag, ap);
1595 sp->recvparams = va_arg(ap,
uint32);
1601 sp->recvtime = va_arg(ap,
uint32);
1607 return (*sp->vsetparent)(tif, tag, ap);
1645 JPEGFixupTestSubsampling(
TIFF * tif )
1647 #ifdef CHECK_JPEG_YCBCR_SUBSAMPLING 1648 JPEGState *sp =
JState(tif);
1651 JPEGInitializeLibJPEG( tif, 0, 0 );
1659 if( !sp->cinfo.comm.is_decompressor
1660 || sp->ycbcrsampling_fetched
1664 sp->ycbcrsampling_fetched = 1;
1682 JPEGVGetField(
TIFF* tif,
ttag_t tag, va_list ap)
1684 JPEGState* sp =
JState(tif);
1690 *va_arg(ap,
uint32*) = sp->jpegtables_length;
1691 *va_arg(ap,
void**) = sp->jpegtables;
1694 *va_arg(ap,
int*) = sp->jpegquality;
1697 *va_arg(ap,
int*) = sp->jpegcolormode;
1700 *va_arg(ap,
int*) = sp->jpegtablesmode;
1703 JPEGFixupTestSubsampling( tif );
1704 return (*sp->vgetparent)(tif, tag, ap);
1707 *va_arg(ap,
uint32*) = sp->recvparams;
1710 *va_arg(ap,
char**) = sp->subaddress;
1713 *va_arg(ap,
uint32*) = sp->recvtime;
1716 *va_arg(ap,
char**) = sp->faxdcs;
1719 return (*sp->vgetparent)(tif, tag, ap);
1725 JPEGPrintDir(
TIFF* tif, FILE* fd,
long flags)
1727 JPEGState* sp =
JState(tif);
1733 fprintf(fd,
" JPEG Tables: (%lu bytes)\n",
1734 (
unsigned long) sp->jpegtables_length);
1736 fprintf(fd,
" Fax Receive Parameters: %08lx\n",
1737 (
unsigned long) sp->recvparams);
1739 fprintf(fd,
" Fax SubAddress: %s\n", sp->subaddress);
1741 fprintf(fd,
" Fax Receive Time: %lu secs\n",
1742 (
unsigned long) sp->recvtime);
1744 fprintf(fd,
" Fax DCS: %s\n", sp->faxdcs);
1750 JPEGState* sp =
JState(tif);
1753 s = (*sp->defsparent)(tif, s);
1762 JPEGState* sp =
JState(tif);
1765 (*sp->deftparent)(tif, tw, th);
1792 static int JPEGInitializeLibJPEG(
TIFF * tif,
int force_encode,
int force_decode )
1794 JPEGState* sp =
JState(tif);
1796 int data_is_empty =
TRUE;
1799 if( sp->cinfo_initialized )
1809 && byte_counts !=
NULL )
1811 data_is_empty = byte_counts[0] == 0;
1815 && byte_counts !=
NULL )
1817 data_is_empty = byte_counts[0] == 0;
1822 else if( force_encode )
1824 else if( tif->
tif_mode == O_RDONLY )
1826 else if( data_is_empty )
1835 if (!TIFFjpeg_create_decompress(sp))
1839 if (!TIFFjpeg_create_compress(sp))
1843 sp->cinfo_initialized =
TRUE;
1881 sp->jpegtables =
NULL;
1882 sp->jpegtables_length = 0;
1883 sp->jpegquality = 75;
1888 sp->subaddress =
NULL;
1891 sp->ycbcrsampling_fetched = 0;
1914 sp->cinfo_initialized =
FALSE;
1924 #define SIZE_OF_JPEGTABLES 2000 1927 sp->jpegtables = (
void *)
_TIFFmalloc(sp->jpegtables_length);
1929 #undef SIZE_OF_JPEGTABLES
TIFFCodeMethod tif_decoderow
#define JPEGTABLESMODE_HUFF
TIFFTagMethods tif_tagmethods
#define TIFFTAG_JPEGTABLES
char int boolean force_baseline
void _TIFFsetString(char **cpp, char *cp)
bool decompress(const void *cdata, size_t csize, void *data_out)
jpeg_read_header(j_decompress_ptr cinfo, boolean require_image)
#define TIFFTAG_JPEGTABLESMODE
tsize_t TIFFTileRowSize(TIFF *tif)
jpeg_write_raw_data(j_compress_ptr cinfo, JSAMPIMAGE data, JDIMENSION num_lines)
#define PHOTOMETRIC_YCBCR
TIFFPreMethod tif_predecode
#define TIFFClrFieldBit(tif, field)
jpeg_finish_compress(j_compress_ptr cinfo)
void TIFFWarningExt(thandle_t fd, const char *module, const char *fmt,...)
#define TIFFTAG_STRIPBYTECOUNTS
TIFFCodeMethod tif_encodestrip
uint32(* TIFFStripMethod)(TIFF *, uint32)
#define TIFFhowmany(x, y)
JSAMPARRAY JDIMENSION max_lines
char s[JMSG_STR_PARM_MAX]
TIFFCodeMethod tif_encoderow
int TIFFFillStrip(TIFF *, tstrip_t)
tsize_t TIFFScanlineSize(TIFF *tif)
JSAMPARRAY JDIMENSION num_lines
#define LONGJMP(jbuf, code)
#define TIFFTAG_YCBCRSUBSAMPLING
#define TIFFTAG_REFERENCEBLACKWHITE
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
#define FIELD_YCBCRSUBSAMPLING
#define TIFFTAG_JPEGCOLORMODE
jpeg_start_compress(j_compress_ptr cinfo, boolean write_all_tables)
#define TIFFTAG_TILEBYTECOUNTS
jpeg_component_info * compptr
jpeg_suppress_tables(j_compress_ptr cinfo, boolean suppress)
void _TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)
JDIMENSION width_in_blocks
GLenum GLuint GLenum GLsizei const GLchar * buf
#define JPEGCOLORMODE_RGB
#define jpeg_create_decompress(cinfo)
#define TIFFSetFieldBit(tif, field)
uint16 td_ycbcrsubsampling[2]
jpeg_read_raw_data(j_decompress_ptr cinfo, JSAMPIMAGE data, JDIMENSION max_lines)
TIFFCodeMethod tif_decodestrip
#define JPEG_HEADER_TABLES_ONLY
TIFFCodeMethod tif_encodetile
jpeg_abort(j_common_ptr cinfo)
#define PHOTOMETRIC_PALETTE
TIFFTileMethod tif_deftilesize
TIFFPreMethod tif_preencode
GLsizei GLsizei GLenum GLenum const GLvoid * data
#define TIFFTAG_FAXRECVTIME
TIFFBoolMethod tif_postencode
struct jpeg_destination_mgr * dest
TIFFPostMethod tif_postdecode
#define JPEGCOLORMODE_RAW
jpeg_write_scanlines(j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines)
void _TIFFMergeFieldInfo(TIFF *tif, const TIFFFieldInfo info[], int n)
#define TIFFTAG_JPEGQUALITY
#define JPEGTABLESMODE_QUANT
void * _TIFFrealloc(tdata_t p, tsize_t s)
#define WARNMS(cinfo, code)
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
#define TIFFFieldSet(tif, field)
#define TIFFroundup(x, y)
#define CALLJPEG(sp, fail, op)
void _TIFFsetByteArray(void **vpp, void *vp, uint32 n)
jpeg_finish_decompress(j_decompress_ptr cinfo)
TIFFCodeMethod tif_decodetile
#define ERREXIT1(cinfo, code, p1)
jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired)
#define PLANARCONFIG_SEPARATE
#define CALLVJPEG(sp, op)
TIFFVoidMethod tif_cleanup
void _TIFFmemset(tdata_t p, int v, tsize_t c)
void _TIFFSetDefaultCompressionState(TIFF *tif)
struct jpeg_source_mgr * src
void _TIFFNoPostDecode(TIFF *tif, tidata_t buf, tsize_t cc)
uint16 td_samplesperpixel
jpeg_read_scanlines(j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines)
const TIFFFieldInfo * _TIFFFieldWithTag(TIFF *tif, ttag_t tag)
GLdouble GLdouble GLdouble GLdouble top
jpeg_set_colorspace(j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
tsize_t TIFFTileSize(TIFF *tif)
void(* TIFFTileMethod)(TIFF *, uint32 *, uint32 *)
int(* TIFFVGetMethod)(TIFF *, ttag_t, va_list)
#define jpeg_create_compress(cinfo)
int TIFFInitJPEG(TIFF *tif, int scheme)
int TIFFSetField(TIFF *tif, ttag_t tag,...)
const TIFFFieldInfo * _TIFFFindFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType dt)
void * _TIFFmalloc(tsize_t s)
jpeg_set_defaults(j_compress_ptr cinfo)
jpeg_std_error(struct jpeg_error_mgr *err)
int TIFFIsTiled(TIFF *tif)
int TIFFGetField(TIFF *tif, ttag_t tag,...)
#define TIFFTAG_FAXSUBADDRESS
void _TIFFfree(tdata_t p)
jpeg_write_tables(j_compress_ptr cinfo)
jpeg_destroy(j_common_ptr cinfo)
const JOCTET * next_input_byte
int(* TIFFVSetMethod)(TIFF *, ttag_t, va_list)
#define SIZE_OF_JPEGTABLES
JOCTET * next_output_byte
TIFFBoolMethod tif_setupencode
jpeg_set_quality(j_compress_ptr cinfo, int quality, boolean force_baseline)
TIFFStripMethod tif_defstripsize
int TIFFFlushData1(TIFF *tif)
int TIFFFillTile(TIFF *, ttile_t)
#define PLANARCONFIG_CONTIG
#define TIFFTAG_FAXRECVPARAMS
TIFFBoolMethod tif_setupdecode