ReactOS 0.4.15-dev-7918-g2a2556c
tif_compress.c File Reference
#include <precomp.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 *pp, tmsize_t cc, uint16 s)
 
int _TIFFNoStripEncode (TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
 
int _TIFFNoTileEncode (TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
 
static int TIFFNoDecode (TIFF *tif, const char *method)
 
static int _TIFFNoFixupTags (TIFF *tif)
 
int _TIFFNoRowDecode (TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
 
int _TIFFNoStripDecode (TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
 
int _TIFFNoTileDecode (TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
 
int _TIFFNoSeek (TIFF *tif, uint32 off)
 
int _TIFFNoPreCode (TIFF *tif, uint16 s)
 
static int _TIFFtrue (TIFF *tif)
 
static void _TIFFvoid (TIFF *tif)
 
void _TIFFSetDefaultCompressionState (TIFF *tif)
 
int TIFFSetCompressionScheme (TIFF *tif, int scheme)
 
const TIFFCodecTIFFFindCODEC (uint16 scheme)
 
TIFFCodecTIFFRegisterCODEC (uint16 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 88 of file tif_compress.c.

89{
90 (void) tif;
91 return (1);
92}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoPreCode()

int _TIFFNoPreCode ( TIFF tif,
uint16  s 
)

Definition at line 125 of file tif_compress.c.

126{
127 (void) tif; (void) s;
128 return (1);
129}
GLdouble s
Definition: gl.h:2039

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoRowDecode()

int _TIFFNoRowDecode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 95 of file tif_compress.c.

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

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoRowEncode()

int _TIFFNoRowEncode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 51 of file tif_compress.c.

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

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoSeek()

int _TIFFNoSeek ( TIFF tif,
uint32  off 
)

Definition at line 116 of file tif_compress.c.

117{
118 (void) off;
120 "Compression algorithm does not support random access");
121 return (0);
122}
thandle_t tif_clientdata
Definition: tiffiop.h:207
char * tif_name
Definition: tiffiop.h:116
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoStripDecode()

int _TIFFNoStripDecode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 102 of file tif_compress.c.

103{
104 (void) pp; (void) cc; (void) s;
105 return (TIFFNoDecode(tif, "strip"));
106}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoStripEncode()

int _TIFFNoStripEncode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 58 of file tif_compress.c.

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

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoTileDecode()

int _TIFFNoTileDecode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 109 of file tif_compress.c.

110{
111 (void) pp; (void) cc; (void) s;
112 return (TIFFNoDecode(tif, "tile"));
113}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoTileEncode()

int _TIFFNoTileEncode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 65 of file tif_compress.c.

66{
67 (void) pp; (void) cc; (void) s;
68 return (TIFFNoEncode(tif, "tile"));
69}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFSetDefaultCompressionState()

void _TIFFSetDefaultCompressionState ( TIFF tif)

Definition at line 135 of file tif_compress.c.

136{
138 tif->tif_decodestatus = TRUE;
144 tif->tif_encodestatus = TRUE;
151 tif->tif_close = _TIFFvoid;
152 tif->tif_seek = _TIFFNoSeek;
153 tif->tif_cleanup = _TIFFvoid;
157}
#define TRUE
Definition: types.h:120
TIFFTileMethod tif_deftilesize
Definition: tiffiop.h:190
TIFFCodeMethod tif_encodestrip
Definition: tiffiop.h:183
TIFFSeekMethod tif_seek
Definition: tiffiop.h:187
TIFFCodeMethod tif_encodetile
Definition: tiffiop.h:185
TIFFPreMethod tif_preencode
Definition: tiffiop.h:178
TIFFBoolMethod tif_fixuptags
Definition: tiffiop.h:173
TIFFPreMethod tif_predecode
Definition: tiffiop.h:175
TIFFCodeMethod tif_decodestrip
Definition: tiffiop.h:182
TIFFStripMethod tif_defstripsize
Definition: tiffiop.h:189
uint32 tif_flags
Definition: tiffiop.h:119
TIFFCodeMethod tif_decoderow
Definition: tiffiop.h:180
TIFFBoolMethod tif_setupencode
Definition: tiffiop.h:176
TIFFBoolMethod tif_postencode
Definition: tiffiop.h:179
TIFFCodeMethod tif_encoderow
Definition: tiffiop.h:181
TIFFVoidMethod tif_close
Definition: tiffiop.h:186
int tif_decodestatus
Definition: tiffiop.h:172
int tif_encodestatus
Definition: tiffiop.h:177
TIFFVoidMethod tif_cleanup
Definition: tiffiop.h:188
TIFFBoolMethod tif_setupdecode
Definition: tiffiop.h:174
TIFFCodeMethod tif_decodetile
Definition: tiffiop.h:184
int _TIFFNoPreCode(TIFF *tif, uint16 s)
Definition: tif_compress.c:125
int _TIFFNoSeek(TIFF *tif, uint32 off)
Definition: tif_compress.c:116
static void _TIFFvoid(TIFF *tif)
Definition: tif_compress.c:132
int _TIFFNoStripDecode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:102
int _TIFFNoTileEncode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:65
static int _TIFFtrue(TIFF *tif)
Definition: tif_compress.c:131
static int _TIFFNoFixupTags(TIFF *tif)
Definition: tif_compress.c:88
int _TIFFNoRowEncode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:51
int _TIFFNoStripEncode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:58
int _TIFFNoTileDecode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:109
int _TIFFNoRowDecode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:95
uint32 _TIFFDefaultStripSize(TIFF *tif, uint32 s)
Definition: tif_strip.c:223
void _TIFFDefaultTileSize(TIFF *tif, uint32 *tw, uint32 *th)
Definition: tif_tile.c:278
#define TIFF_NOREADRAW
Definition: tiffiop.h:136
#define TIFF_NOBITREV
Definition: tiffiop.h:127

Referenced by TIFFClientOpen(), and TIFFSetCompressionScheme().

◆ _TIFFtrue()

static int _TIFFtrue ( TIFF tif)
static

Definition at line 131 of file tif_compress.c.

131{ (void) tif; return (1); }

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFvoid()

static void _TIFFvoid ( TIFF tif)
static

Definition at line 132 of file tif_compress.c.

132{ (void) tif; }

Referenced by _TIFFSetDefaultCompressionState().

◆ TIFFFindCODEC()

const TIFFCodec * TIFFFindCODEC ( uint16  scheme)

Definition at line 186 of file tif_compress.c.

187{
188 const TIFFCodec* c;
189 codec_t* cd;
190
191 for (cd = registeredCODECS; cd; cd = cd->next)
192 if (cd->info->scheme == scheme)
193 return ((const TIFFCodec*) cd->info);
194 for (c = _TIFFBuiltinCODECS; c->name; c++)
195 if (c->scheme == scheme)
196 return (c);
197 return ((const TIFFCodec*) 0);
198}
InitDirComponents & cd
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
DWORD scheme
char * name
Definition: tiffio.h:251
TIFFCodec _TIFFBuiltinCODECS[]
Definition: tif_codec.c:87
static codec_t * registeredCODECS
Definition: tif_compress.c:183

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 252 of file tif_compress.c.

253{
254 int i = 1;
255 codec_t *cd;
256 const TIFFCodec* c;
258 TIFFCodec* new_codecs;
259
260 for (cd = registeredCODECS; cd; cd = cd->next) {
261 new_codecs = (TIFFCodec *)
262 _TIFFrealloc(codecs, i * sizeof(TIFFCodec));
263 if (!new_codecs) {
265 return NULL;
266 }
267 codecs = new_codecs;
268 _TIFFmemcpy(codecs + i - 1, cd, sizeof(TIFFCodec));
269 i++;
270 }
271 for (c = _TIFFBuiltinCODECS; c->name; c++) {
272 if (TIFFIsCODECConfigured(c->scheme)) {
273 new_codecs = (TIFFCodec *)
274 _TIFFrealloc(codecs, i * sizeof(TIFFCodec));
275 if (!new_codecs) {
277 return NULL;
278 }
279 codecs = new_codecs;
280 _TIFFmemcpy(codecs + i - 1, (const void*)c, sizeof(TIFFCodec));
281 i++;
282 }
283 }
284
285 new_codecs = (TIFFCodec *) _TIFFrealloc(codecs, i * sizeof(TIFFCodec));
286 if (!new_codecs) {
288 return NULL;
289 }
290 codecs = new_codecs;
291 _TIFFmemset(codecs + i - 1, 0, sizeof(TIFFCodec));
292
293 return codecs;
294}
#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 scheme)
Definition: tif_codec.c:150
void _TIFFfree(void *p)
Definition: tif_unix.c:326
void _TIFFmemset(void *p, int v, tmsize_t c)
Definition: tif_unix.c:338
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
Definition: tif_unix.c:344
void * _TIFFrealloc(void *p, tmsize_t s)
Definition: tif_unix.c:332

◆ TIFFNoDecode()

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

Definition at line 72 of file tif_compress.c.

73{
75
76 if (c)
78 "%s %s decoding is not implemented",
79 c->name, method);
80 else
82 "Compression scheme %u %s decoding is not implemented",
84 return (0);
85}
method
Definition: dragdrop.c:54
uint16 td_compression
Definition: tif_dir.h:77
TIFFDirectory tif_dir
Definition: tiffiop.h:151
const TIFFCodec * TIFFFindCODEC(uint16 scheme)
Definition: tif_compress.c:186

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

◆ TIFFNoEncode()

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

Definition at line 34 of file tif_compress.c.

35{
37
38 if (c) {
40 "%s %s encoding is not implemented",
41 c->name, method);
42 } else {
44 "Compression scheme %u %s encoding is not implemented",
46 }
47 return (-1);
48}

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

◆ TIFFRegisterCODEC()

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

Definition at line 201 of file tif_compress.c.

202{
203 codec_t* cd = (codec_t*)
204 _TIFFmalloc((tmsize_t)(sizeof (codec_t) + sizeof (TIFFCodec) + strlen(name)+1));
205
206 if (cd != NULL) {
207 cd->info = (TIFFCodec*) ((uint8*) cd + sizeof (codec_t));
208 cd->info->name = (char*)
209 ((uint8*) cd->info + sizeof (TIFFCodec));
210 strcpy(cd->info->name, name);
211 cd->info->scheme = scheme;
212 cd->info->init = init;
213 cd->next = registeredCODECS;
215 } else {
216 TIFFErrorExt(0, "TIFFRegisterCODEC",
217 "No space to register compression scheme %s", name);
218 return NULL;
219 }
220 return (cd->info);
221}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned char uint8
Definition: types.h:28
Definition: name.c:39
struct _codec codec_t
void * _TIFFmalloc(tmsize_t s)
Definition: tif_unix.c:309
TIFF_SSIZE_T tmsize_t
Definition: tiffio.h:65
static int init
Definition: wintirpc.c:33

◆ TIFFSetCompressionScheme()

int TIFFSetCompressionScheme ( TIFF tif,
int  scheme 
)

Definition at line 160 of file tif_compress.c.

161{
163
165 /*
166 * Don't treat an unknown compression scheme as an error.
167 * This permits applications to open files with data that
168 * the library does not have builtin support for, but which
169 * may still be meaningful.
170 */
171 return (c ? (*c->init)(tif, scheme) : 1);
172}
unsigned short uint16
Definition: types.h:30
void _TIFFSetDefaultCompressionState(TIFF *tif)
Definition: tif_compress.c:135

Referenced by _TIFFVSetField().

◆ TIFFUnRegisterCODEC()

void TIFFUnRegisterCODEC ( TIFFCodec c)

Definition at line 224 of file tif_compress.c.

225{
226 codec_t* cd;
227 codec_t** pcd;
228
229 for (pcd = &registeredCODECS; (cd = *pcd) != NULL; pcd = &cd->next)
230 if (cd->info == c) {
231 *pcd = cd->next;
232 _TIFFfree(cd);
233 return;
234 }
235 TIFFErrorExt(0, "TIFFUnRegisterCODEC",
236 "Cannot remove compression scheme %s; not registered", c->name);
237}

Variable Documentation

◆ registeredCODECS

codec_t* registeredCODECS = NULL
static