Home | History | Annotate | Download | only in libtiff

Lines Matching defs:tif

47 int TIFFFillStrip(TIFF* tif, uint32 strip);
48 int TIFFFillTile(TIFF* tif, uint32 tile);
49 int TIFFReInitJPEG_12( TIFF *tif, int scheme, int is_encode );
163 TIFF* tif; /* back link needed by some code */
188 #define JState(tif) ((JPEGState*)(tif)->tif_data)
190 static int JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
191 static int JPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
192 static int JPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
193 static int JPEGEncodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
194 static int JPEGInitializeLibJPEG(TIFF * tif, int decode );
195 static int DecodeRowError(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
227 TIFFErrorExt(sp->tif->tif_clientdata, "JPEGLib", "%s", buffer); /* display the error message */
243 TIFFWarningExt(((JPEGState *) cinfo)->tif->tif_clientdata, "JPEGLib", "%s", buffer);
404 TIFF* tif = sp->tif;
406 sp->dest.next_output_byte = (JOCTET*) tif->tif_rawdata;
407 sp->dest.free_in_buffer = (size_t) tif->tif_rawdatasize;
414 TIFF* tif = sp->tif;
417 tif->tif_rawcc = tif->tif_rawdatasize;
427 tif->tif_rawcc = tif->tif_rawdatasize - sp->dest.free_in_buffer;
431 TIFFFlushData1(tif);
432 sp->dest.next_output_byte = (JOCTET*) tif->tif_rawdata;
433 sp->dest.free_in_buffer = (size_t) tif->tif_rawdatasize;
442 TIFF* tif = sp->tif;
444 tif->tif_rawcp = (uint8*) sp->dest.next_output_byte;
445 tif->tif_rawcc =
446 tif->tif_rawdatasize - (tmsize_t) sp->dest.free_in_buffer;
451 TIFFjpeg_data_dest(JPEGState* sp, TIFF* tif)
453 (void) tif;
502 TIFFjpeg_tables_dest(JPEGState* sp, TIFF* tif)
504 (void) tif;
515 TIFFErrorExt(sp->tif->tif_clientdata, "TIFFjpeg_tables_dest", "No space for JPEGTables");
534 tif = sp->tif;
536 sp->src.next_input_byte = (const JOCTET*) tif->tif_rawdata;
537 sp->src.bytes_in_buffer = (size_t) tif->tif_rawcc;
600 TIFFjpeg_data_src(JPEGState* sp, TIFF* tif)
602 (void) tif;
628 TIFFjpeg_tables_src(JPEGState* sp, TIFF* tif)
630 TIFFjpeg_data_src(sp, tif);
642 alloc_downsampled_buffers(TIFF* tif, jpeg_component_info* comp_info,
645 JPEGState* sp = JState(tif);
687 TIFF* tif;
696 static void JPEGFixupTagsSubsampling(TIFF* tif);
705 JPEGFixupTags(TIFF* tif)
708 JPEGState* sp = JState(tif);
709 if ((tif->tif_dir.td_photometric==PHOTOMETRIC_YCBCR)&&
710 (tif->tif_dir.td_planarconfig==PLANARCONFIG_CONTIG)&&
711 (tif->tif_dir.td_samplesperpixel==3) &&
713 JPEGFixupTagsSubsampling(tif);
722 JPEGFixupTagsSubsampling(TIFF* tif)
747 _TIFFFillStriles( tif );
749 if( tif->tif_dir.td_stripbytecount == NULL
750 || tif->tif_dir.td_stripoffset == NULL
751 || tif->tif_dir.td_stripbytecount[0] == 0 )
759 m.tif=tif;
764 TIFFWarningExt(tif->tif_clientdata,module,
770 m.fileoffset=tif->tif_dir.td_stripoffset[0];
772 m.filebytesleft=tif->tif_dir.td_stripbytecount[0];
774 TIFFWarningExt(tif->tif_clientdata,module,
851 if (n!=8+data->tif->tif_dir.td_samplesperpixel*3)
859 for (o=1; o<data->tif->tif_dir.td_samplesperpixel; o++)
866 TIFFWarningExt(data->tif->tif_clientdata,module,
874 TIFFWarningExt(data->tif->tif_clientdata,module,
878 if ((ph!=data->tif->tif_dir.td_ycbcrsubsampling[0])||(pv!=data->tif->tif_dir.td_ycbcrsubsampling[1]))
880 TIFFWarningExt(data->tif->tif_clientdata,module,
882 (int)data->tif->tif_dir.td_ycbcrsubsampling[0],
883 (int)data->tif->tif_dir.td_ycbcrsubsampling[1],
885 data->tif->tif_dir.td_ycbcrsubsampling[0]=ph;
886 data->tif->tif_dir.td_ycbcrsubsampling[1]=pv;
906 TIFFSeekFile(data->tif,data->fileoffset,SEEK_SET);
913 if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m)
970 JPEGSetupDecode(TIFF* tif)
972 JPEGState* sp = JState(tif);
973 TIFFDirectory *td = &tif->tif_dir;
976 if( tif->tif_dir.td_bitspersample == 12 )
977 return TIFFReInitJPEG_12( tif, COMPRESSION_JPEG, 0 );
980 JPEGInitializeLibJPEG( tif, TRUE );
986 if (TIFFFieldSet(tif,FIELD_JPEGTABLES)) {
987 TIFFjpeg_tables_src(sp, tif);
989 TIFFErrorExt(tif->tif_clientdata, "JPEGSetupDecode", "Bogus JPEGTables field");
1009 TIFFjpeg_data_src(sp, tif);
1010 tif->tif_postdecode = _TIFFNoPostDecode; /* override byte swapping */
1018 JPEGPreDecode(TIFF* tif, uint16 s)
1020 JPEGState *sp = JState(tif);
1021 TIFFDirectory *td = &tif->tif_dir;
1031 tif->tif_setupdecode( tif );
1048 tif->tif_rawcp = (uint8*) sp->src.next_input_byte;
1049 tif->tif_rawcc = sp->src.bytes_in_buffer;
1055 segment_height = td->td_imagelength - tif->tif_row;
1056 if (isTiled(tif)) {
1059 sp->bytesperline = TIFFTileRowSize(tif);
1063 sp->bytesperline = TIFFScanlineSize(tif);
1075 TIFFWarningExt(tif->tif_clientdata, module,
1090 TIFFErrorExt(tif->tif_clientdata, module,
1100 TIFFErrorExt(tif
1105 TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG data precision");
1112 TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG data precision");
1120 TIFFErrorExt(tif->tif_clientdata, module,
1132 TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG sampling factors");
1140 TIFFErrorExt(tif->tif_clientdata, module, "Improper JPEG sampling factors");
1166 tif->tif_decoderow = DecodeRowError;
1167 tif->tif_decodestrip = JPEGDecodeRaw;
1168 tif->tif_decodetile = JPEGDecodeRaw;
1172 tif->tif_decoderow = JPEGDecode;
1173 tif->tif_decodestrip = JPEGDecode;
1174 tif->tif_decodetile = JPEGDecode;
1181 if (!alloc_downsampled_buffers(tif, sp->cinfo.d.comp_info,
1195 JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
1197 JPEGState *sp = JState(tif);
1205 sp->src.next_input_byte = (const JOCTET*) tif->tif_rawcp;
1206 sp->src.bytes_in_buffer = (size_t) tif->tif_rawcc;
1213 TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
1233 ++tif->tif_row;
1240 tif->tif_rawcp = (uint8*) sp->src.next_input_byte;
1241 tif->tif_rawcc = sp->src.bytes_in_buffer;
1251 JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
1253 JPEGState *sp = JState(tif);
1261 sp->src.next_input_byte = (const JOCTET*) tif->tif_rawcp;
1262 sp->src.bytes_in_buffer = (size_t) tif->tif_rawcc;
1269 TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
1336 ++tif->tif_row;
1346 tif->tif_rawcp = (uint8*) sp->src.next_input_byte;
1347 tif->tif_rawcc = sp->src.bytes_in_buffer;
1356 DecodeRowError(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
1363 TIFFErrorExt(tif->tif_clientdata, "TIFFReadScanline",
1373 JPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
1375 JPEGState *sp = JState(tif);
1391 TIFFErrorExt(tif->tif_clientdata, "JPEGDecodeRaw",
1402 TIFFErrorExt(tif->tif_clientdata, "JPEGDecodeRaw",
1434 TIFFErrorExt(tif->tif_clientdata, "JPEGDecodeRaw",
1490 tif->tif_row += sp->v_sampling;
1555 prepare_JPEGTables(TIFF* tif)
1557 JPEGState* sp = JState(tif);
1577 if (!TIFFjpeg_tables_dest(sp, tif))
1587 JPEGSetupEncode(TIFF* tif)
1589 JPEGState* sp = JState(tif);
1590 TIFFDirectory *td = &tif->tif_dir;
1594 if( tif->tif_dir.td_bitspersample == 12 )
1595 return TIFFReInitJPEG_12( tif, COMPRESSION_JPEG, 1 );
1598 JPEGInitializeLibJPEG( tif, FALSE );
1641 TIFFErrorExt(tif->tif_clientdata, module,
1647 TIFFErrorExt(tif->tif_clientdata, module,
1660 if (!TIFFGetField(tif, TIFFTAG_REFERENCEBLACKWHITE,
1670 TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE,
1677 TIFFErrorExt(tif->tif_clientdata, module,
1702 TIFFErrorExt(tif->tif_clientdata, module, "BitsPerSample %d not allowed for JPEG",
1710 if (isTiled(tif)) {
1712 TIFFErrorExt(tif->tif_clientdata, module,
1718 TIFFErrorExt(tif->tif_clientdata, module,
1726 TIFFErrorExt(tif->tif_clientdata, module,
1738 if (!prepare_JPEGTables(tif))
1742 tif->tif_flags |= TIFF_DIRTYDIRECT;
1743 TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
1748 TIFFClrFieldBit(tif, FIELD_JPEGTABLES);
1752 TIFFjpeg_data_dest(sp, tif);
1761 JPEGPreEncode(TIFF* tif, uint16 s)
1763 JPEGState *sp = JState(tif);
1764 TIFFDirectory *td = &tif->tif_dir;
1773 tif->tif_setupencode( tif );
1780 if (isTiled(tif)) {
1783 sp->bytesperline = TIFFTileRowSize(tif);
1786 segment_height = td->td_imagelength - tif->tif_row;
1789 sp->bytesperline = TIFFScanlineSize(tif);
1799 TIFFErrorExt(tif->tif_clientdata, module, "Strip/tile too large for JPEG");
1869 tif->tif_encoderow = JPEGEncodeRaw;
1870 tif->tif_encodestrip = JPEGEncodeRaw;
1871 tif->tif_encodetile = JPEGEncodeRaw;
1875 tif->tif_encoderow = JPEGEncode;
1876 tif->tif_encodestrip = JPEGEncode;
1877 tif->tif_encodetile = JPEGEncode;
1884 if (!alloc_downsampled_buffers(tif, sp->cinfo.c.comp_info,
1898 JPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
1900 JPEGState *sp = JState(tif);
1911 TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
1915 if( !isTiled(tif) && tif->tif_row+nrows > tif->tif_dir.td_imagelength )
1916 nrows = tif->tif_dir.td_imagelength - tif->tif_row;
1924 TIFFErrorExt(tif->tif_clientdata,
1959 tif->tif_row++;
1976 JPEGEncodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
1978 JPEGState *sp = JState(tif);
1999 TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline discarded");
2049 tif->tif_row += sp->v_sampling;
2060 JPEGPostEncode(TIFF* tif)
2062 JPEGState *sp = JState(tif);
2091 return (TIFFjpeg_finish_compress(JState(tif)));
2095 JPEGCleanup(TIFF* tif)
2097 JPEGState *sp = JState(tif);
2101 tif->tif_tagmethods.vgetfield = sp->vgetparent;
2102 tif->tif_tagmethods.vsetfield = sp->vsetparent;
2103 tif->tif_tagmethods.printdir = sp->printdir;
2108 _TIFFfree(tif->tif_data); /* release local state */
2109 tif->tif_data = NULL;
2111 _TIFFSetDefaultCompressionState(tif);
2115 JPEGResetUpsampled( TIFF* tif )
2117 JPEGState* sp = JState(tif);
2118 TIFFDirectory* td = &tif->tif_dir;
2125 tif->tif_flags &= ~TIFF_UPSAMPLED;
2129 tif->tif_flags |= TIFF_UPSAMPLED;
2143 if( tif->tif_tilesize > 0 )
2144 tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)(-1);
2145 if( tif->tif_scanlinesize > 0 )
2146 tif->tif_scanlinesize = TIFFScanlineSize(tif);
2150 JPEGVSetField(TIFF* tif, uint32 tag, va_list ap)
2152 JPEGState* sp = JState(tif);
2167 TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
2174 JPEGResetUpsampled( tif );
2178 int ret_value = (*sp->vsetparent)(tif, tag, ap);
2179 JPEGResetUpsampled( tif );
2189 return (*sp->vsetparent)(tif, tag, ap);
2191 return (*sp->vsetparent)(tif, tag, ap);
2194 if ((fip = TIFFFieldWithTag(tif, tag)) != NULL) {
2195 TIFFSetFieldBit(tif, fip->field_bit);
2200 tif->tif_flags |= TIFF_DIRTYDIRECT;
2205 JPEGVGetField(TIFF* tif, uint32 tag, va_list ap)
2207 JPEGState* sp = JState(tif);
2226 return (*sp->vgetparent)(tif, tag, ap);
2232 JPEGPrintDir(TIFF* tif, FILE* fd, long flags)
2234 JPEGState* sp = JState(tif);
2240 if (TIFFFieldSet(tif,FIELD_JPEGTABLES))
2244 (*sp->printdir)(tif, fd, flags);
2249 JPEGDefaultStripSize(TIFF* tif, uint32 s)
2251 JPEGState* sp = JState(tif);
2252 TIFFDirectory *td = &tif->tif_dir;
2254 s = (*sp->defsparent)(tif, s);
2261 JPEGDefaultTileSize(TIFF* tif, uint32* tw, uint32* th)
2263 JPEGState* sp = JState(tif);
2264 TIFFDirectory *td = &tif->tif_dir;
2266 (*sp->deftparent)(tif, tw, th);
2275 * desired other than looking at tif->tif_mode. We accomplish this by
2293 static int JPEGInitializeLibJPEG( TIFF * tif, int decompress )
2295 JPEGState* sp = JState(tif);
2335 TIFFInitJPEG(TIFF* tif, int scheme)
2344 if (!_TIFFMergeFields(tif, jpegFields, TIFFArrayCount(jpegFields))) {
2345 TIFFErrorExt(tif->tif_clientdata,
2354 tif->tif_data = (uint8*) _TIFFmalloc(sizeof (JPEGState));
2356 if (tif->tif_data == NULL) {
2357 TIFFErrorExt(tif->tif_clientdata,
2361 _TIFFmemset(tif->tif_data, 0, sizeof(JPEGState));
2363 sp = JState(tif);
2364 sp->tif = tif; /* back link */
2369 sp->vgetparent = tif->tif_tagmethods.vgetfield;
2370 tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */
2371 sp->vsetparent = tif->tif_tagmethods.vsetfield;
2372 tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */
2373 sp->printdir = tif->tif_tagmethods.printdir;
2374 tif->tif_tagmethods.printdir = JPEGPrintDir; /* hook for codec tags */
2387 tif->tif_fixuptags = JPEGFixupTags;
2388 tif->tif_setupdecode = JPEGSetupDecode;
2389 tif->tif_predecode = JPEGPreDecode;
2390 tif->tif_decoderow = JPEGDecode;
2391 tif->tif_decodestrip = JPEGDecode;
2392 tif->tif_decodetile = JPEGDecode;
2393 tif->tif_setupencode = JPEGSetupEncode;
2394 tif->tif_preencode = JPEGPreEncode;
2395 tif->tif_postencode = JPEGPostEncode;
2396 tif->tif_encoderow = JPEGEncode;
2397 tif->tif_encodestrip = JPEGEncode;
2398 tif->tif_encodetile = JPEGEncode;
2399 tif->tif_cleanup = JPEGCleanup;
2400 sp->defsparent = tif->tif_defstripsize;
2401 tif->tif_defstripsize = JPEGDefaultStripSize;
2402 sp->deftparent = tif->tif_deftilesize;
2403 tif->tif_deftilesize = JPEGDefaultTileSize;
2404 tif->tif_flags |= TIFF_NOBITREV; /* no bit reversal, please */
2414 if( tif->tif_diroff == 0 )
2423 TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
2433 TIFFErrorExt(tif->tif_clientdata,