47 int compression_level;
50#define LSTATE_INIT_DECODE 0x01
51#define LSTATE_INIT_ENCODE 0x02
57#define GetZSTDState(tif) ((ZSTDState *)(tif)->tif_data)
58#define ZSTDDecoderState(tif) GetZSTDState(tif)
59#define ZSTDEncoderState(tif) GetZSTDState(tif)
64static int ZSTDFixupTags(
TIFF *tif)
70static int ZSTDSetupDecode(
TIFF *tif)
72 ZSTDState *
sp = ZSTDDecoderState(tif);
77 if (
sp->state & LSTATE_INIT_ENCODE)
84 sp->state |= LSTATE_INIT_DECODE;
93 static const char module[] =
"ZSTDPreDecode";
94 ZSTDState *
sp = ZSTDDecoderState(tif);
100 if ((
sp->state & LSTATE_INIT_DECODE) == 0)
126 static const char module[] =
"ZSTDDecode";
127 ZSTDState *
sp = ZSTDDecoderState(tif);
134 assert(
sp->state == LSTATE_INIT_DECODE);
161 "Not enough data at scanline %lu (short %lu bytes)",
163 (
unsigned long)((
size_t)occ -
out_buffer.pos));
173static int ZSTDSetupEncode(
TIFF *tif)
175 ZSTDState *
sp = ZSTDEncoderState(tif);
178 if (
sp->state & LSTATE_INIT_DECODE)
185 sp->state |= LSTATE_INIT_ENCODE;
194 static const char module[] =
"ZSTDPreEncode";
195 ZSTDState *
sp = ZSTDEncoderState(tif);
200 if (
sp->state != LSTATE_INIT_ENCODE)
223 sp->out_buffer.pos = 0;
233 static const char module[] =
"ZSTDEncode";
234 ZSTDState *
sp = ZSTDEncoderState(tif);
239 assert(
sp->state == LSTATE_INIT_ENCODE);
257 if (
sp->out_buffer.pos ==
sp->out_buffer.size)
263 sp->out_buffer.pos = 0;
273static int ZSTDPostEncode(
TIFF *tif)
275 static const char module[] =
"ZSTDPostEncode";
276 ZSTDState *
sp = ZSTDEncoderState(tif);
288 if (
sp->out_buffer.pos > 0)
294 sp->out_buffer.pos = 0;
296 }
while (zstd_ret != 0);
300static void ZSTDCleanup(
TIFF *tif)
302 ZSTDState *
sp = GetZSTDState(tif);
329 static const char module[] =
"ZSTDVSetField";
330 ZSTDState *
sp = GetZSTDState(tif);
336 if (
sp->compression_level <= 0 ||
340 "ZSTD_LEVEL should be between 1 and %d",
345 return (*
sp->vsetparent)(tif,
tag,
ap);
352 ZSTDState *
sp = GetZSTDState(tif);
360 return (*
sp->vgetparent)(tif,
tag,
ap);
372 static const char module[] =
"TIFFInitZSTD";
393 sp = GetZSTDState(tif);
404 sp->compression_level = 9;
408 sp->out_buffer.dst =
NULL;
409 sp->out_buffer.size = 0;
410 sp->out_buffer.pos = 0;
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_t n)
void TIFFErrorExtR(TIFF *tif, const char *module, const char *fmt,...)
void _TIFFfreeExt(TIFF *tif, void *p)
void * _TIFFmallocExt(TIFF *tif, tmsize_t s)
int TIFFPredictorCleanup(TIFF *tif)
int TIFFPredictorInit(TIFF *tif)
void TIFFWarningExtR(TIFF *tif, const char *module, const char *fmt,...)
int TIFFFlushData1(TIFF *tif)
#define TIFFTAG_ZSTD_LEVEL
int(* TIFFVSetMethod)(TIFF *, uint32_t, va_list)
int(* TIFFVGetMethod)(TIFF *, uint32_t, 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)