1 /* $Header: /home/vp/work/opencv-cvsbackup/opencv/3rdparty/libtiff/tif_codec.c,v 1.1 2005-06-17 13:54:52 vp153 Exp $ */
4 * Copyright (c) 1988-1997 Sam Leffler
5 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
7 * Permission to use, copy, modify, distribute, and sell this software and
8 * its documentation for any purpose is hereby granted without fee, provided
9 * that (i) the above copyright notices and this permission notice appear in
10 * all copies of the software and related documentation, and (ii) the names of
11 * Sam Leffler and Silicon Graphics may not be used in any advertising or
12 * publicity relating to the software without the specific, prior written
13 * permission of Sam Leffler and Silicon Graphics.
15 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
20 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
21 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
22 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
30 * Builtin Compression Scheme Configuration Support.
34 static int NotConfigured(TIFF*, int);
37 #define TIFFInitLZW NotConfigured
39 #ifndef PACKBITS_SUPPORT
40 #define TIFFInitPackBits NotConfigured
42 #ifndef THUNDER_SUPPORT
43 #define TIFFInitThunderScan NotConfigured
46 #define TIFFInitNeXT NotConfigured
49 #define TIFFInitJPEG NotConfigured
52 #define TIFFInitOJPEG NotConfigured
55 #define TIFFInitCCITTRLE NotConfigured
56 #define TIFFInitCCITTRLEW NotConfigured
57 #define TIFFInitCCITTFax3 NotConfigured
58 #define TIFFInitCCITTFax4 NotConfigured
61 #define TIFFInitJBIG NotConfigured
64 #define TIFFInitZIP NotConfigured
66 #ifndef PIXARLOG_SUPPORT
67 #define TIFFInitPixarLog NotConfigured
69 #ifndef LOGLUV_SUPPORT
70 #define TIFFInitSGILog NotConfigured
74 * Compression schemes statically built into the library.
77 const TIFFCodec _TIFFBuiltinCODECS[] = {
79 TIFFCodec _TIFFBuiltinCODECS[] = {
81 { "None", COMPRESSION_NONE, TIFFInitDumpMode },
82 { "LZW", COMPRESSION_LZW, TIFFInitLZW },
83 { "PackBits", COMPRESSION_PACKBITS, TIFFInitPackBits },
84 { "ThunderScan", COMPRESSION_THUNDERSCAN,TIFFInitThunderScan },
85 { "NeXT", COMPRESSION_NEXT, TIFFInitNeXT },
86 { "JPEG", COMPRESSION_JPEG, TIFFInitJPEG },
87 { "Old-style JPEG", COMPRESSION_OJPEG, TIFFInitOJPEG },
88 { "CCITT RLE", COMPRESSION_CCITTRLE, TIFFInitCCITTRLE },
89 { "CCITT RLE/W", COMPRESSION_CCITTRLEW, TIFFInitCCITTRLEW },
90 { "CCITT Group 3", COMPRESSION_CCITTFAX3, TIFFInitCCITTFax3 },
91 { "CCITT Group 4", COMPRESSION_CCITTFAX4, TIFFInitCCITTFax4 },
92 { "ISO JBIG", COMPRESSION_JBIG, TIFFInitJBIG },
93 { "Deflate", COMPRESSION_DEFLATE, TIFFInitZIP },
94 { "AdobeDeflate", COMPRESSION_ADOBE_DEFLATE , TIFFInitZIP },
95 { "PixarLog", COMPRESSION_PIXARLOG, TIFFInitPixarLog },
96 { "SGILog", COMPRESSION_SGILOG, TIFFInitSGILog },
97 { "SGILog24", COMPRESSION_SGILOG24, TIFFInitSGILog },
102 _notConfigured(TIFF* tif)
104 const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
106 TIFFError(tif->tif_name,
107 "%s compression support is not configured", c->name);
112 NotConfigured(TIFF* tif, int scheme)
116 tif->tif_decodestatus = FALSE;
117 tif->tif_setupdecode = _notConfigured;
118 tif->tif_encodestatus = FALSE;
119 tif->tif_setupencode = _notConfigured;
123 /************************************************************************/
124 /* TIFFIsCODECConfigured() */
125 /************************************************************************/
128 * Check whether we have working codec for the specific coding scheme.
130 * @return returns 1 if the codec is configured and working. Otherwise
131 * 0 will be returned.
135 TIFFIsCODECConfigured(uint16 scheme)
137 const TIFFCodec* codec = TIFFFindCODEC(scheme);
142 if(codec->init == NULL) {
145 if(codec->init != NotConfigured){