ReactOS 0.4.16-dev-2617-g01a0906
tif_compress.c File Reference
#include "tiffiop.h"
Include dependency graph for tif_compress.c:

Go to the source code of this file.

Classes

struct  _codec
 

Typedefs

typedef struct _codec codec_t
 

Functions

static int TIFFNoEncode (TIFF *tif, const char *method)
 
int _TIFFNoRowEncode (TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
 
int _TIFFNoStripEncode (TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
 
int _TIFFNoTileEncode (TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
 
static int TIFFNoDecode (TIFF *tif, const char *method)
 
static int _TIFFNoFixupTags (TIFF *tif)
 
int _TIFFNoRowDecode (TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
 
int _TIFFNoStripDecode (TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
 
int _TIFFNoTileDecode (TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
 
int _TIFFNoSeek (TIFF *tif, uint32_t off)
 
int _TIFFNoPreCode (TIFF *tif, uint16_t s)
 
static int _TIFFtrue (TIFF *tif)
 
static void _TIFFvoid (TIFF *tif)
 
void _TIFFSetDefaultCompressionState (TIFF *tif)
 
int TIFFSetCompressionScheme (TIFF *tif, int scheme)
 
const TIFFCodecTIFFFindCODEC (uint16_t scheme)
 
TIFFCodecTIFFRegisterCODEC (uint16_t scheme, const char *name, TIFFInitMethod init)
 
void TIFFUnRegisterCODEC (TIFFCodec *c)
 
TIFFCodecTIFFGetConfiguredCODECs ()
 

Variables

static codec_tregisteredCODECS = NULL
 

Typedef Documentation

◆ codec_t

Function Documentation

◆ _TIFFNoFixupTags()

static int _TIFFNoFixupTags ( TIFF tif)
static

Definition at line 90 of file tif_compress.c.

91{
92 (void)tif;
93 return (1);
94}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoPreCode()

int _TIFFNoPreCode ( TIFF tif,
uint16_t  s 
)

Definition at line 128 of file tif_compress.c.

129{
130 (void)tif;
131 (void)s;
132 return (1);
133}
GLdouble s
Definition: gl.h:2039

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoRowDecode()

int _TIFFNoRowDecode ( TIFF tif,
uint8_t pp,
tmsize_t  cc,
uint16_t  s 
)

Definition at line 96 of file tif_compress.c.

97{
98 (void)pp;
99 (void)cc;
100 (void)s;
101 return (TIFFNoDecode(tif, "scanline"));
102}
uint32_t cc
Definition: isohybrid.c:75
static int TIFFNoDecode(TIFF *tif, const char *method)
Definition: tif_compress.c:75

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoRowEncode()

int _TIFFNoRowEncode ( TIFF tif,
uint8_t pp,
tmsize_t  cc,
uint16_t  s 
)

Definition at line 51 of file tif_compress.c.

52{
53 (void)pp;
54 (void)cc;
55 (void)s;
56 return (TIFFNoEncode(tif, "scanline"));
57}
static int TIFFNoEncode(TIFF *tif, const char *method)
Definition: tif_compress.c:32

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoSeek()

int _TIFFNoSeek ( TIFF tif,
uint32_t  off 
)

Definition at line 120 of file tif_compress.c.

121{
122 (void)off;
123 TIFFErrorExtR(tif, tif->tif_name,
124 "Compression algorithm does not support random access");
125 return (0);
126}
char * tif_name
Definition: tiffiop.h:114
void TIFFErrorExtR(TIFF *tif, const char *module, const char *fmt,...)
Definition: tif_error.c:107

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoStripDecode()

int _TIFFNoStripDecode ( TIFF tif,
uint8_t pp,
tmsize_t  cc,
uint16_t  s 
)

Definition at line 104 of file tif_compress.c.

105{
106 (void)pp;
107 (void)cc;
108 (void)s;
109 return (TIFFNoDecode(tif, "strip"));
110}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoStripEncode()

int _TIFFNoStripEncode ( TIFF tif,
uint8_t pp,
tmsize_t  cc,
uint16_t  s 
)

Definition at line 59 of file tif_compress.c.

60{
61 (void)pp;
62 (void)cc;
63 (void)s;
64 return (TIFFNoEncode(tif, "strip"));
65}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoTileDecode()

int _TIFFNoTileDecode ( TIFF tif,
uint8_t pp,
tmsize_t  cc,
uint16_t  s 
)

Definition at line 112 of file tif_compress.c.

113{
114 (void)pp;
115 (void)cc;
116 (void)s;
117 return (TIFFNoDecode(tif, "tile"));
118}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoTileEncode()

int _TIFFNoTileEncode ( TIFF tif,
uint8_t pp,
tmsize_t  cc,
uint16_t  s 
)

Definition at line 67 of file tif_compress.c.

68{
69 (void)pp;
70 (void)cc;
71 (void)s;
72 return (TIFFNoEncode(tif, "tile"));
73}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFSetDefaultCompressionState()

void _TIFFSetDefaultCompressionState ( TIFF tif)

Definition at line 142 of file tif_compress.c.

143{
145 tif->tif_decodestatus = TRUE;
151 tif->tif_encodestatus = TRUE;
158 tif->tif_close = _TIFFvoid;
159 tif->tif_seek = _TIFFNoSeek;
160 tif->tif_cleanup = _TIFFvoid;
164}
#define TRUE
Definition: types.h:120
TIFFTileMethod tif_deftilesize
Definition: tiffiop.h:215
TIFFCodeMethod tif_encodestrip
Definition: tiffiop.h:208
TIFFSeekMethod tif_seek
Definition: tiffiop.h:212
TIFFCodeMethod tif_encodetile
Definition: tiffiop.h:210
TIFFPreMethod tif_preencode
Definition: tiffiop.h:203
TIFFBoolMethod tif_fixuptags
Definition: tiffiop.h:198
TIFFPreMethod tif_predecode
Definition: tiffiop.h:200
TIFFCodeMethod tif_decodestrip
Definition: tiffiop.h:207
TIFFStripMethod tif_defstripsize
Definition: tiffiop.h:214
TIFFCodeMethod tif_decoderow
Definition: tiffiop.h:205
TIFFBoolMethod tif_setupencode
Definition: tiffiop.h:201
TIFFBoolMethod tif_postencode
Definition: tiffiop.h:204
TIFFCodeMethod tif_encoderow
Definition: tiffiop.h:206
TIFFVoidMethod tif_close
Definition: tiffiop.h:211
int tif_decodestatus
Definition: tiffiop.h:197
int tif_encodestatus
Definition: tiffiop.h:202
TIFFVoidMethod tif_cleanup
Definition: tiffiop.h:213
TIFFBoolMethod tif_setupdecode
Definition: tiffiop.h:199
uint32_t tif_flags
Definition: tiffiop.h:117
TIFFCodeMethod tif_decodetile
Definition: tiffiop.h:209
static void _TIFFvoid(TIFF *tif)
Definition: tif_compress.c:140
int _TIFFNoTileEncode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Definition: tif_compress.c:67
static int _TIFFtrue(TIFF *tif)
Definition: tif_compress.c:135
int _TIFFNoTileDecode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Definition: tif_compress.c:112
static int _TIFFNoFixupTags(TIFF *tif)
Definition: tif_compress.c:90
int _TIFFNoRowDecode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Definition: tif_compress.c:96
int _TIFFNoRowEncode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Definition: tif_compress.c:51
int _TIFFNoStripEncode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Definition: tif_compress.c:59
int _TIFFNoStripDecode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Definition: tif_compress.c:104
int _TIFFNoPreCode(TIFF *tif, uint16_t s)
Definition: tif_compress.c:128
int _TIFFNoSeek(TIFF *tif, uint32_t off)
Definition: tif_compress.c:120
uint32_t _TIFFDefaultStripSize(TIFF *tif, uint32_t s)
Definition: tif_strip.c:223
void _TIFFDefaultTileSize(TIFF *tif, uint32_t *tw, uint32_t *th)
Definition: tif_tile.c:272
#define TIFF_NOREADRAW
Definition: tiffiop.h:135
#define TIFF_NOBITREV
Definition: tiffiop.h:125

Referenced by TIFFClientOpenExt(), and TIFFSetCompressionScheme().

◆ _TIFFtrue()

static int _TIFFtrue ( TIFF tif)
static

Definition at line 135 of file tif_compress.c.

136{
137 (void)tif;
138 return (1);
139}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFvoid()

static void _TIFFvoid ( TIFF tif)
static

Definition at line 140 of file tif_compress.c.

140{ (void)tif; }

Referenced by _TIFFSetDefaultCompressionState().

◆ TIFFFindCODEC()

const TIFFCodec * TIFFFindCODEC ( uint16_t  scheme)

Definition at line 192 of file tif_compress.c.

193{
194 const TIFFCodec *c;
195 codec_t *cd;
196
197 for (cd = registeredCODECS; cd; cd = cd->next)
198 if (cd->info->scheme == scheme)
199 return ((const TIFFCodec *)cd->info);
200 for (c = _TIFFBuiltinCODECS; c->name; c++)
201 if (c->scheme == scheme)
202 return (c);
203 return ((const TIFFCodec *)0);
204}
InitDirComponents & cd
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
DWORD scheme
char * name
Definition: tiffio.h:272
const TIFFCodec _TIFFBuiltinCODECS[]
Definition: tif_codec.c:86
static codec_t * registeredCODECS
Definition: tif_compress.c:190

Referenced by _notConfigured(), TIFFIsCODECConfigured(), TIFFNoDecode(), TIFFNoEncode(), TIFFPrintDirectory(), and TIFFSetCompressionScheme().

◆ TIFFGetConfiguredCODECs()

TIFFCodec * TIFFGetConfiguredCODECs ( void  )

Get list of configured codecs, both built-in and registered by user. Caller is responsible to free this structure.

Returns
returns array of TIFFCodec records (the last record should be NULL) or NULL if function failed.

Definition at line 261 of file tif_compress.c.

262{
263 int i = 1;
264 codec_t *cd;
265 const TIFFCodec *c;
267 TIFFCodec *new_codecs;
268
269 for (cd = registeredCODECS; cd; cd = cd->next)
270 {
271 new_codecs =
273 if (!new_codecs)
274 {
276 return NULL;
277 }
278 codecs = new_codecs;
279 _TIFFmemcpy(codecs + i - 1, cd->info, sizeof(TIFFCodec));
280 i++;
281 }
282 for (c = _TIFFBuiltinCODECS; c->name; c++)
283 {
284 if (TIFFIsCODECConfigured(c->scheme))
285 {
286 new_codecs = (TIFFCodec *)_TIFFreallocExt(NULL, codecs,
287 i * sizeof(TIFFCodec));
288 if (!new_codecs)
289 {
291 return NULL;
292 }
293 codecs = new_codecs;
294 _TIFFmemcpy(codecs + i - 1, (const void *)c, sizeof(TIFFCodec));
295 i++;
296 }
297 }
298
299 new_codecs =
301 if (!new_codecs)
302 {
304 return NULL;
305 }
306 codecs = new_codecs;
307 _TIFFmemset(codecs + i - 1, 0, sizeof(TIFFCodec));
308
309 return codecs;
310}
#define NULL
Definition: types.h:112
static const struct image_codec codecs[NUM_CODECS]
Definition: image.c:4283
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int TIFFIsCODECConfigured(uint16_t scheme)
Definition: tif_codec.c:146
void _TIFFfreeExt(TIFF *tif, void *p)
Definition: tif_open.c:275
void * _TIFFreallocExt(TIFF *tif, void *p, tmsize_t s)
Definition: tif_open.c:235
void _TIFFmemset(void *p, int v, tmsize_t c)
Definition: tif_unix.c:353
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
Definition: tif_unix.c:355

◆ TIFFNoDecode()

static int TIFFNoDecode ( TIFF tif,
const char method 
)
static

Definition at line 75 of file tif_compress.c.

76{
78
79 if (c)
80 TIFFErrorExtR(tif, tif->tif_name, "%s %s decoding is not implemented",
81 c->name, method);
82 else
83 TIFFErrorExtR(tif, tif->tif_name,
84 "Compression scheme %" PRIu16
85 " %s decoding is not implemented",
87 return (0);
88}
#define PRIu16
Definition: inttypes.h:83
method
Definition: dragdrop.c:54
uint16_t td_compression
Definition: tif_dir.h:88
TIFFDirectory tif_dir
Definition: tiffiop.h:157
const TIFFCodec * TIFFFindCODEC(uint16_t scheme)
Definition: tif_compress.c:192

Referenced by _TIFFNoRowDecode(), _TIFFNoStripDecode(), and _TIFFNoTileDecode().

◆ TIFFNoEncode()

static int TIFFNoEncode ( TIFF tif,
const char method 
)
static

Definition at line 32 of file tif_compress.c.

33{
35
36 if (c)
37 {
38 TIFFErrorExtR(tif, tif->tif_name, "%s %s encoding is not implemented",
39 c->name, method);
40 }
41 else
42 {
43 TIFFErrorExtR(tif, tif->tif_name,
44 "Compression scheme %" PRIu16
45 " %s encoding is not implemented",
47 }
48 return (-1);
49}

Referenced by _TIFFNoRowEncode(), _TIFFNoStripEncode(), and _TIFFNoTileEncode().

◆ TIFFRegisterCODEC()

TIFFCodec * TIFFRegisterCODEC ( uint16_t  scheme,
const char name,
TIFFInitMethod  init 
)

Definition at line 206 of file tif_compress.c.

208{
210 NULL,
211 (tmsize_t)(sizeof(codec_t) + sizeof(TIFFCodec) + strlen(name) + 1));
212
213 if (cd != NULL)
214 {
215 cd->info = (TIFFCodec *)((uint8_t *)cd + sizeof(codec_t));
216 cd->info->name = (char *)((uint8_t *)cd->info + sizeof(TIFFCodec));
217 strcpy(cd->info->name, name);
218 cd->info->scheme = scheme;
219 cd->info->init = init;
220 cd->next = registeredCODECS;
222 }
223 else
224 {
225 TIFFErrorExt(0, "TIFFRegisterCODEC",
226 "No space to register compression scheme %s", name);
227 return NULL;
228 }
229 return (cd->info);
230}
unsigned char uint8_t
Definition: stdint.h:33
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
strcpy
Definition: string.h:131
Definition: name.c:39
struct _codec codec_t
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:63
void * _TIFFmallocExt(TIFF *tif, tmsize_t s)
Definition: tif_open.c:173
TIFF_SSIZE_T tmsize_t
Definition: tiffio.h:67
static int init
Definition: wintirpc.c:33

◆ TIFFSetCompressionScheme()

int TIFFSetCompressionScheme ( TIFF tif,
int  scheme 
)

Definition at line 166 of file tif_compress.c.

167{
169
171 /*
172 * Don't treat an unknown compression scheme as an error.
173 * This permits applications to open files with data that
174 * the library does not have builtin support for, but which
175 * may still be meaningful.
176 */
177 return (c ? (*c->init)(tif, scheme) : 1);
178}
unsigned short uint16_t
Definition: stdint.h:35
void _TIFFSetDefaultCompressionState(TIFF *tif)
Definition: tif_compress.c:142

Referenced by _TIFFVSetField().

◆ TIFFUnRegisterCODEC()

void TIFFUnRegisterCODEC ( TIFFCodec c)

Definition at line 232 of file tif_compress.c.

233{
234 codec_t *cd;
235 codec_t **pcd;
236
237 for (pcd = &registeredCODECS; (cd = *pcd) != NULL; pcd = &cd->next)
238 if (cd->info == c)
239 {
240 *pcd = cd->next;
242 return;
243 }
244 TIFFErrorExt(0, "TIFFUnRegisterCODEC",
245 "Cannot remove compression scheme %s; not registered",
246 c->name);
247}

Variable Documentation

◆ registeredCODECS

codec_t* registeredCODECS = NULL
static