46 int compression_level;
49#define LSTATE_INIT_DECODE 0x01
50#define LSTATE_INIT_ENCODE 0x02
56#define LState(tif) ((ZSTDState*) (tif)->tif_data)
57#define DecoderState(tif) LState(tif)
58#define EncoderState(tif) LState(tif)
64ZSTDFixupTags(
TIFF* tif)
71ZSTDSetupDecode(
TIFF* tif)
73 ZSTDState*
sp = DecoderState(tif);
78 if (
sp->state & LSTATE_INIT_ENCODE) {
84 sp->state |= LSTATE_INIT_DECODE;
94 static const char module[] =
"ZSTDPreDecode";
95 ZSTDState*
sp = DecoderState(tif);
101 if( (
sp->state & LSTATE_INIT_DECODE) == 0 )
111 if(
sp->dstream ==
NULL ) {
113 "Cannot allocate decompression stream");
119 "Error in ZSTD_initDStream(): %s",
130 static const char module[] =
"ZSTDDecode";
131 ZSTDState*
sp = DecoderState(tif);
138 assert(
sp->state == LSTATE_INIT_DECODE);
153 "Error in ZSTD_decompressStream(): %s",
157 }
while( zstd_ret != 0 &&
163 "Not enough data at scanline %lu (short %lu bytes)",
165 (
unsigned long) (
size_t)occ -
out_buffer.pos);
176ZSTDSetupEncode(
TIFF* tif)
178 ZSTDState*
sp = EncoderState(tif);
181 if (
sp->state & LSTATE_INIT_DECODE) {
187 sp->state |= LSTATE_INIT_ENCODE;
197 static const char module[] =
"ZSTDPreEncode";
198 ZSTDState *
sp = EncoderState(tif);
203 if(
sp->state != LSTATE_INIT_ENCODE )
211 if(
sp->cstream ==
NULL ) {
213 "Cannot allocate compression stream");
220 "Error in ZSTD_initCStream(): %s",
227 sp->out_buffer.pos = 0;
238 static const char module[] =
"ZSTDEncode";
239 ZSTDState *
sp = EncoderState(tif);
244 assert(
sp->state == LSTATE_INIT_ENCODE);
257 "Error in ZSTD_compressStream(): %s",
261 if(
sp->out_buffer.pos ==
sp->out_buffer.size ) {
265 sp->out_buffer.pos = 0;
276ZSTDPostEncode(
TIFF* tif)
278 static const char module[] =
"ZSTDPostEncode";
279 ZSTDState *
sp = EncoderState(tif);
286 "Error in ZSTD_endStream(): %s",
290 if(
sp->out_buffer.pos > 0 ) {
294 sp->out_buffer.pos = 0;
296 }
while (zstd_ret != 0);
301ZSTDCleanup(
TIFF* tif)
303 ZSTDState*
sp = LState(tif);
329 static const char module[] =
"ZSTDVSetField";
330 ZSTDState*
sp = LState(tif);
335 if(
sp->compression_level <= 0 ||
339 "ZSTD_LEVEL should be between 1 and %d",
344 return (*
sp->vsetparent)(tif,
tag,
ap);
352 ZSTDState*
sp = LState(tif);
359 return (*
sp->vgetparent)(tif,
tag,
ap);
373 static const char module[] =
"TIFFInitZSTD";
383 "Merging ZSTD codec-specific tags failed");
404 sp->compression_level = 9;
408 sp->out_buffer.dst =
NULL;
409 sp->out_buffer.size = 0;
410 sp->out_buffer.pos = 0;
435 "No space for ZSTD state block");
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
static unsigned char * in_buffer
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID out_buffer
TIFFCodeMethod tif_encodestrip
TIFFCodeMethod tif_encodetile
TIFFTagMethods tif_tagmethods
TIFFPreMethod tif_preencode
TIFFBoolMethod tif_fixuptags
TIFFPreMethod tif_predecode
TIFFCodeMethod tif_decodestrip
TIFFCodeMethod tif_decoderow
TIFFBoolMethod tif_setupencode
TIFFBoolMethod tif_postencode
TIFFCodeMethod tif_encoderow
TIFFVoidMethod tif_cleanup
TIFFBoolMethod tif_setupdecode
TIFFCodeMethod tif_decodetile
void _TIFFSetDefaultCompressionState(TIFF *tif)
int _TIFFMergeFields(TIFF *tif, const TIFFField info[], uint32 n)
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
int TIFFPredictorCleanup(TIFF *tif)
int TIFFPredictorInit(TIFF *tif)
void * _TIFFmalloc(tmsize_t s)
void TIFFWarningExt(thandle_t fd, const char *module, const char *fmt,...)
int TIFFFlushData1(TIFF *tif)
#define TIFFTAG_ZSTD_LEVEL
int(* TIFFVGetMethod)(TIFF *, uint32, va_list)
int(* TIFFVSetMethod)(TIFF *, uint32, va_list)
#define TIFFArrayCount(a)
void int int ULONGLONG int va_list * ap
ZSTDLIB_API size_t ZSTD_initCStream(ZSTD_CStream *zcs, int compressionLevel)
ZSTDLIB_API size_t ZSTD_initDStream(ZSTD_DStream *zds)
ZSTDLIB_API size_t ZSTD_compressStream(ZSTD_CStream *zcs, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
ZSTDLIB_API size_t ZSTD_freeCStream(ZSTD_CStream *zcs)
ZSTDLIB_API size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
ZSTDLIB_API const char * ZSTD_getErrorName(size_t code)
ZSTDLIB_API ZSTD_DStream * ZSTD_createDStream(void)
ZSTDLIB_API ZSTD_CStream * ZSTD_createCStream(void)
ZSTDLIB_API size_t ZSTD_endStream(ZSTD_CStream *zcs, ZSTD_outBuffer *output)
ZSTDLIB_API size_t ZSTD_freeDStream(ZSTD_DStream *zds)
ZSTDLIB_API int ZSTD_maxCLevel(void)