Visualization Library 2.0.0-b5

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
tif_codec.c
Go to the documentation of this file.
1 /* $Id: tif_codec.c,v 1.10 2005/12/21 12:23:13 joris Exp $ */
2 
3 /*
4  * Copyright (c) 1988-1997 Sam Leffler
5  * Copyright (c) 1991-1997 Silicon Graphics, Inc.
6  *
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.
14  *
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.
18  *
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
24  * OF THIS SOFTWARE.
25  */
26 
27 /*
28  * TIFF Library
29  *
30  * Builtin Compression Scheme Configuration Support.
31  */
32 #include "tiffiop.h"
33 
34 static int NotConfigured(TIFF*, int);
35 
36 #ifndef LZW_SUPPORT
37 #define TIFFInitLZW NotConfigured
38 #endif
39 #ifndef PACKBITS_SUPPORT
40 #define TIFFInitPackBits NotConfigured
41 #endif
42 #ifndef THUNDER_SUPPORT
43 #define TIFFInitThunderScan NotConfigured
44 #endif
45 #ifndef NEXT_SUPPORT
46 #define TIFFInitNeXT NotConfigured
47 #endif
48 #ifndef JPEG_SUPPORT
49 #define TIFFInitJPEG NotConfigured
50 #endif
51 #ifndef OJPEG_SUPPORT
52 #define TIFFInitOJPEG NotConfigured
53 #endif
54 #ifndef CCITT_SUPPORT
55 #define TIFFInitCCITTRLE NotConfigured
56 #define TIFFInitCCITTRLEW NotConfigured
57 #define TIFFInitCCITTFax3 NotConfigured
58 #define TIFFInitCCITTFax4 NotConfigured
59 #endif
60 #ifndef JBIG_SUPPORT
61 #define TIFFInitJBIG NotConfigured
62 #endif
63 #ifndef ZIP_SUPPORT
64 #define TIFFInitZIP NotConfigured
65 #endif
66 #ifndef PIXARLOG_SUPPORT
67 #define TIFFInitPixarLog NotConfigured
68 #endif
69 #ifndef LOGLUV_SUPPORT
70 #define TIFFInitSGILog NotConfigured
71 #endif
72 
73 /*
74  * Compression schemes statically built into the library.
75  */
76 #ifdef VMS
77 const TIFFCodec _TIFFBuiltinCODECS[] = {
78 #else
79 TIFFCodec _TIFFBuiltinCODECS[] = {
80 #endif
82  { "LZW", COMPRESSION_LZW, TIFFInitLZW },
83  { "PackBits", COMPRESSION_PACKBITS, TIFFInitPackBits },
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 },
98  { NULL, 0, NULL }
99 };
100 
101 static int
102 _notConfigured(TIFF* tif)
103 {
105 
107  "%s compression support is not configured", c->name);
108  return (0);
109 }
110 
111 static int
112 NotConfigured(TIFF* tif, int scheme)
113 {
114  (void) scheme;
115 
116  tif->tif_decodestatus = FALSE;
117  tif->tif_setupdecode = _notConfigured;
118  tif->tif_encodestatus = FALSE;
119  tif->tif_setupencode = _notConfigured;
120  return (1);
121 }
122 
123 /************************************************************************/
124 /* TIFFIsCODECConfigured() */
125 /************************************************************************/
126 
134 int
136 {
137  const TIFFCodec* codec = TIFFFindCODEC(scheme);
138 
139  if(codec == NULL) {
140  return 0;
141  }
142  if(codec->init == NULL) {
143  return 0;
144  }
145  if(codec->init != NotConfigured){
146  return 1;
147  }
148  return 0;
149 }
150 
int TIFFInitCCITTFax3(TIFF *tif, int scheme)
Definition: tif_fax3.c:1354
int TIFFInitThunderScan(TIFF *tif, int scheme)
Definition: tif_thunder.c:149
#define COMPRESSION_PACKBITS
Definition: tiff.h:180
int TIFFInitZIP(TIFF *tif, int scheme)
Definition: tif_zip.c:318
#define NULL
Definition: ftobjs.h:61
TIFFInitMethod init
Definition: tiffio.h:245
#define COMPRESSION_CCITTFAX3
Definition: tiff.h:171
#define COMPRESSION_SGILOG24
Definition: tiff.h:197
#define COMPRESSION_CCITTRLE
Definition: tiff.h:170
#define COMPRESSION_OJPEG
Definition: tiff.h:176
thandle_t tif_clientdata
Definition: tiffiop.h:171
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
char * tif_name
Definition: tiffiop.h:96
Definition: tiffiop.h:95
int TIFFInitNeXT(TIFF *tif, int scheme)
Definition: tif_next.c:134
#define TIFFInitOJPEG
Definition: tif_codec.c:52
char * name
Definition: tiffio.h:243
#define COMPRESSION_DEFLATE
Definition: tiff.h:190
#define COMPRESSION_CCITTFAX4
Definition: tiff.h:173
int tif_encodestatus
Definition: tiffiop.h:143
#define TIFFInitJBIG
Definition: tif_codec.c:61
int TIFFInitLZW(TIFF *tif, int scheme)
Definition: tif_lzw.c:1022
#define COMPRESSION_CCITTRLEW
Definition: tiff.h:179
unsigned short uint16
Definition: tiff.h:71
#define COMPRESSION_PIXARLOG
Definition: tiff.h:189
#define COMPRESSION_JBIG
Definition: tiff.h:195
const GLubyte * c
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:63
int TIFFInitCCITTRLEW(TIFF *tif, int scheme)
Definition: tif_fax3.c:1549
#define FALSE
Definition: ftobjs.h:57
const TIFFCodec * TIFFFindCODEC(uint16 scheme)
Definition: tif_compress.c:177
#define COMPRESSION_NONE
Definition: tiff.h:169
#define COMPRESSION_SGILOG
Definition: tiff.h:196
#define COMPRESSION_JPEG
Definition: tiff.h:177
TIFFCodec _TIFFBuiltinCODECS[]
Definition: tif_codec.c:79
int TIFFInitPixarLog(TIFF *tif, int scheme)
int TIFFInitPackBits(TIFF *tif, int scheme)
Definition: tif_packbits.c:278
int tif_decodestatus
Definition: tiffiop.h:139
#define COMPRESSION_THUNDERSCAN
Definition: tiff.h:181
int TIFFInitDumpMode(TIFF *tif, int scheme)
Definition: tif_dumpmode.c:106
#define COMPRESSION_ADOBE_DEFLATE
Definition: tiff.h:191
TIFFDirectory tif_dir
Definition: tiffiop.h:122
int TIFFInitSGILog(TIFF *tif, int scheme)
Definition: tif_luv.c:1556
int TIFFInitCCITTFax4(TIFF *tif, int scheme)
Definition: tif_fax3.c:1456
int TIFFInitJPEG(TIFF *tif, int scheme)
Definition: tif_jpeg.c:1849
uint16 td_compression
Definition: tif_dir.h:46
int TIFFIsCODECConfigured(uint16 scheme)
Check whether we have working codec for the specific coding scheme.
Definition: tif_codec.c:135
int TIFFInitCCITTRLE(TIFF *tif, int scheme)
Definition: tif_fax3.c:1532
#define COMPRESSION_LZW
Definition: tiff.h:175
TIFFBoolMethod tif_setupencode
Definition: tiffiop.h:142
#define COMPRESSION_NEXT
Definition: tiff.h:178
TIFFBoolMethod tif_setupdecode
Definition: tiffiop.h:140