本文整理汇总了C++中TIFFPredictorInit函数的典型用法代码示例。如果您正苦于以下问题:C++ TIFFPredictorInit函数的具体用法?C++ TIFFPredictorInit怎么用?C++ TIFFPredictorInit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TIFFPredictorInit函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TIFFInitZIP
int
TIFFInitZIP(TIFF* tif, int scheme)
{
ZIPState* sp;
assert( (scheme == COMPRESSION_DEFLATE)
|| (scheme == COMPRESSION_ADOBE_DEFLATE));
/*
* Allocate state block so tag methods have storage to record values.
*/
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (ZIPState));
if (tif->tif_data == NULL)
goto bad;
sp = ZState(tif);
sp->stream.zalloc = NULL;
sp->stream.zfree = NULL;
sp->stream.opaque = NULL;
sp->stream.data_type = Z_BINARY;
/*
* Merge codec-specific tag information and
* override parent get/set field methods.
*/
TIFFMergeFieldInfo(tif, zipFieldInfo, N(zipFieldInfo));
sp->vgetparent = tif->tif_tagmethods.vgetfield;
tif->tif_tagmethods.vgetfield = ZIPVGetField;/* hook for codec tags */
sp->vsetparent = tif->tif_tagmethods.vsetfield;
tif->tif_tagmethods.vsetfield = ZIPVSetField;/* hook for codec tags */
/* Default values for codec-specific fields */
sp->zipquality = Z_DEFAULT_COMPRESSION; /* default comp. level */
sp->state = 0;
/*
* Install codec methods.
*/
tif->tif_setupdecode = ZIPSetupDecode;
tif->tif_predecode = ZIPPreDecode;
tif->tif_decoderow = ZIPDecode;
tif->tif_decodestrip = ZIPDecode;
tif->tif_decodetile = ZIPDecode;
#ifdef PDFLIB_TIFFWRITE_SUPPORT
tif->tif_setupencode = ZIPSetupEncode;
tif->tif_preencode = ZIPPreEncode;
tif->tif_postencode = ZIPPostEncode;
tif->tif_encoderow = ZIPEncode;
tif->tif_encodestrip = ZIPEncode;
tif->tif_encodetile = ZIPEncode;
#endif /* PDFLIB_TIFFWRITE_SUPPORT */
tif->tif_cleanup = ZIPCleanup;
/*
* Setup predictor setup.
*/
(void) TIFFPredictorInit(tif);
return (1);
bad:
_TIFFError(tif, "TIFFInitZIP", "No space for ZIP state block");
return (0);
}
示例2: TIFFInitLZW
int
TIFFInitLZW(TIFF* tif, int scheme)
{
assert(scheme == COMPRESSION_LZW);
/*
* Allocate state block so tag methods have storage to record values.
*/
if (tif->tif_mode == O_RDONLY) {
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (LZWDecodeState));
if (tif->tif_data == NULL)
goto bad;
DecoderState(tif)->dec_codetab = NULL;
DecoderState(tif)->dec_decode = NULL;
}
/*
* Install codec methods.
*/
tif->tif_setupdecode = LZWSetupDecode;
tif->tif_predecode = LZWPreDecode;
tif->tif_decoderow = LZWDecode;
tif->tif_decodestrip = LZWDecode;
tif->tif_decodetile = LZWDecode;
tif->tif_cleanup = LZWCleanup;
/*
* Setup predictor setup.
*/
(void) TIFFPredictorInit(tif);
return (1);
bad:
TIFFError("TIFFInitLZW", GetString(IDS_LZW_NO_SPACE));//"No space for LZW state block");
return (0);
}
示例3: LZWSetupDecode
static int
LZWSetupDecode(TIFF* tif)
{
static const char module[] = "LZWSetupDecode";
LZWCodecState* sp = DecoderState(tif);
int code;
if( sp == NULL )
{
/*
* Allocate state block so tag methods have storage to record
* values.
*/
tif->tif_data = (uint8*) _TIFFmalloc(sizeof(LZWCodecState));
if (tif->tif_data == NULL)
{
TIFFErrorExt(tif->tif_clientdata, module, "No space for LZW state block");
return (0);
}
DecoderState(tif)->dec_codetab = NULL;
DecoderState(tif)->dec_decode = NULL;
/*
* Setup predictor setup.
*/
(void) TIFFPredictorInit(tif);
sp = DecoderState(tif);
}
assert(sp != NULL);
if (sp->dec_codetab == NULL) {
sp->dec_codetab = (code_t*)_TIFFmalloc(CSIZE*sizeof (code_t));
if (sp->dec_codetab == NULL) {
TIFFErrorExt(tif->tif_clientdata, module,
"No space for LZW code table");
return (0);
}
/*
* Pre-load the table.
*/
code = 255;
do {
sp->dec_codetab[code].value = (unsigned char)code;
sp->dec_codetab[code].firstchar = (unsigned char)code;
sp->dec_codetab[code].length = 1;
sp->dec_codetab[code].next = NULL;
} while (code--);
/*
* Zero-out the unused entries
*/
_TIFFmemset(&sp->dec_codetab[CODE_CLEAR], 0,
(CODE_FIRST - CODE_CLEAR) * sizeof (code_t));
}
return (1);
}
示例4: LZWSetupDecode
static int
LZWSetupDecode(TIFF* tif)
{
LZWCodecState* sp = DecoderState(tif);
static const char module[] = " LZWSetupDecode";
int code;
if( sp == NULL )
{
/*
* Allocate state block so tag methods have storage to record
* values.
*/
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof(LZWCodecState));
if (tif->tif_data == NULL)
{
TIFFErrorExt(tif->tif_clientdata, "LZWPreDecode", "No space for LZW state block");
return (0);
}
DecoderState(tif)->dec_codetab = NULL;
DecoderState(tif)->dec_decode = NULL;
/*
* Setup predictor setup.
*/
(void) TIFFPredictorInit(tif);
sp = DecoderState(tif);
}
assert(sp != NULL);
if (sp->dec_codetab == NULL) {
sp->dec_codetab = (code_t*)_TIFFmalloc(CSIZE*sizeof (code_t));
if (sp->dec_codetab == NULL) {
TIFFErrorExt(tif->tif_clientdata, module, "No space for LZW code table");
return (0);
}
/*
* Pre-load the table.
*/
code = 255;
do {
sp->dec_codetab[code].value = code;
sp->dec_codetab[code].firstchar = code;
sp->dec_codetab[code].length = 1;
sp->dec_codetab[code].next = NULL;
} while (code--);
}
return (1);
}
示例5: TIFFInitZIP
int
TIFFInitZIP(TIFF* tif, int scheme)
{
ZIPState* sp;
assert(scheme == COMPRESSION_DEFLATE);
/*
* Allocate state block so tag methods have storage to record values.
*/
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (ZIPState));
if (tif->tif_data == NULL)
goto bad;
sp = (ZIPState*) tif->tif_data;
sp->stream.zalloc = NULL;
sp->stream.zfree = NULL;
sp->stream.opaque = NULL;
sp->stream.data_type = Z_BINARY;
/*
* Install codec methods.
*/
tif->tif_setupdecode = ZIPSetupDecode;
tif->tif_predecode = ZIPPreDecode;
tif->tif_decoderow = ZIPDecode;
tif->tif_decodestrip = ZIPDecode;
tif->tif_decodetile = ZIPDecode;
tif->tif_setupencode = ZIPSetupEncode;
tif->tif_preencode = ZIPPreEncode;
tif->tif_postencode = ZIPPostEncode;
tif->tif_encoderow = ZIPEncode;
tif->tif_encodestrip = ZIPEncode;
tif->tif_encodetile = ZIPEncode;
tif->tif_cleanup = ZIPCleanup;
/*
* Setup predictor setup.
*/
(void) TIFFPredictorInit(tif);
return (1);
bad:
TIFFError("TIFFInitZIP", "No space for ZIP state block");
return (0);
}
示例6: TIFFInitLZW
int
TIFFInitLZW(TIFF* tif, int scheme)
{
static const char module[] = "TIFFInitLZW";
assert(scheme == COMPRESSION_LZW);
/*
* Allocate state block so tag methods have storage to record values.
*/
tif->tif_data = (uint8*) _TIFFmalloc(sizeof (LZWCodecState));
if (tif->tif_data == NULL)
goto bad;
DecoderState(tif)->dec_codetab = NULL;
DecoderState(tif)->dec_decode = NULL;
EncoderState(tif)->enc_hashtab = NULL;
LZWState(tif)->rw_mode = tif->tif_mode;
/*
* Install codec methods.
*/
tif->tif_fixuptags = LZWFixupTags;
tif->tif_setupdecode = LZWSetupDecode;
tif->tif_predecode = LZWPreDecode;
tif->tif_decoderow = LZWDecode;
tif->tif_decodestrip = LZWDecode;
tif->tif_decodetile = LZWDecode;
tif->tif_setupencode = LZWSetupEncode;
tif->tif_preencode = LZWPreEncode;
tif->tif_postencode = LZWPostEncode;
tif->tif_encoderow = LZWEncode;
tif->tif_encodestrip = LZWEncode;
tif->tif_encodetile = LZWEncode;
tif->tif_cleanup = LZWCleanup;
/*
* Setup predictor setup.
*/
(void) TIFFPredictorInit(tif);
return (1);
bad:
TIFFErrorExt(tif->tif_clientdata, module,
"No space for LZW state block");
return (0);
}
示例7: TIFFInitLZMA
int
TIFFInitLZMA(TIFF* tif, int scheme)
{
static const char module[] = "TIFFInitLZMA";
LZMAState* sp;
lzma_stream tmp_stream = LZMA_STREAM_INIT;
assert( scheme == COMPRESSION_LZMA );
/*
* Merge codec-specific tag information.
*/
if (!_TIFFMergeFields(tif, lzmaFields, TIFFArrayCount(lzmaFields))) {
TIFFErrorExt(tif->tif_clientdata, module,
"Merging LZMA2 codec-specific tags failed");
return 0;
}
/*
* Allocate state block so tag methods have storage to record values.
*/
tif->tif_data = (uint8*) _TIFFmalloc(sizeof(LZMAState));
if (tif->tif_data == NULL)
goto bad;
sp = LState(tif);
memcpy(&sp->stream, &tmp_stream, sizeof(lzma_stream));
/*
* Override parent get/set field methods.
*/
sp->vgetparent = tif->tif_tagmethods.vgetfield;
tif->tif_tagmethods.vgetfield = LZMAVGetField; /* hook for codec tags */
sp->vsetparent = tif->tif_tagmethods.vsetfield;
tif->tif_tagmethods.vsetfield = LZMAVSetField; /* hook for codec tags */
/* Default values for codec-specific fields */
sp->preset = LZMA_PRESET_DEFAULT; /* default comp. level */
sp->check = LZMA_CHECK_NONE;
sp->state = 0;
/* Data filters. So far we are using delta and LZMA2 filters only. */
sp->opt_delta.type = LZMA_DELTA_TYPE_BYTE;
/*
* The sample size in bytes seems to be reasonable distance for delta
* filter.
*/
sp->opt_delta.dist = (tif->tif_dir.td_bitspersample % 8) ?
1 : tif->tif_dir.td_bitspersample / 8;
sp->filters[0].id = LZMA_FILTER_DELTA;
sp->filters[0].options = &sp->opt_delta;
lzma_lzma_preset(&sp->opt_lzma, sp->preset);
sp->filters[1].id = LZMA_FILTER_LZMA2;
sp->filters[1].options = &sp->opt_lzma;
sp->filters[2].id = LZMA_VLI_UNKNOWN;
sp->filters[2].options = NULL;
/*
* Install codec methods.
*/
tif->tif_fixuptags = LZMAFixupTags;
tif->tif_setupdecode = LZMASetupDecode;
tif->tif_predecode = LZMAPreDecode;
tif->tif_decoderow = LZMADecode;
tif->tif_decodestrip = LZMADecode;
tif->tif_decodetile = LZMADecode;
tif->tif_setupencode = LZMASetupEncode;
tif->tif_preencode = LZMAPreEncode;
tif->tif_postencode = LZMAPostEncode;
tif->tif_encoderow = LZMAEncode;
tif->tif_encodestrip = LZMAEncode;
tif->tif_encodetile = LZMAEncode;
tif->tif_cleanup = LZMACleanup;
/*
* Setup predictor setup.
*/
(void) TIFFPredictorInit(tif);
return 1;
bad:
TIFFErrorExt(tif->tif_clientdata, module,
"No space for LZMA2 state block");
return 0;
}
示例8: TIFFInitZIP
int
TIFFInitZIP(TIFF* tif, int scheme)
{
static const char module[] = "TIFFInitZIP";
ZIPState* sp;
assert( (scheme == COMPRESSION_DEFLATE)
|| (scheme == COMPRESSION_ADOBE_DEFLATE));
/*
* Merge codec-specific tag information.
*/
if (!_TIFFMergeFieldInfo(tif, zipFieldInfo,
TIFFArrayCount(zipFieldInfo))) {
TIFFErrorExt(tif->tif_clientdata, module,
"Merging Deflate codec-specific tags failed");
return 0;
}
/*
* Allocate state block so tag methods have storage to record values.
*/
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (ZIPState));
if (tif->tif_data == NULL)
goto bad;
sp = ZState(tif);
sp->stream.zalloc = NULL;
sp->stream.zfree = NULL;
sp->stream.opaque = NULL;
sp->stream.data_type = Z_BINARY;
/*
* Override parent get/set field methods.
*/
sp->vgetparent = tif->tif_tagmethods.vgetfield;
tif->tif_tagmethods.vgetfield = ZIPVGetField; /* hook for codec tags */
sp->vsetparent = tif->tif_tagmethods.vsetfield;
tif->tif_tagmethods.vsetfield = ZIPVSetField; /* hook for codec tags */
/* Default values for codec-specific fields */
sp->zipquality = Z_DEFAULT_COMPRESSION; /* default comp. level */
sp->state = 0;
/*
* Install codec methods.
*/
tif->tif_setupdecode = ZIPSetupDecode;
tif->tif_predecode = ZIPPreDecode;
tif->tif_decoderow = ZIPDecode;
tif->tif_decodestrip = ZIPDecode;
tif->tif_decodetile = ZIPDecode;
tif->tif_setupencode = ZIPSetupEncode;
tif->tif_preencode = ZIPPreEncode;
tif->tif_postencode = ZIPPostEncode;
tif->tif_encoderow = ZIPEncode;
tif->tif_encodestrip = ZIPEncode;
tif->tif_encodetile = ZIPEncode;
tif->tif_cleanup = ZIPCleanup;
/*
* Setup predictor setup.
*/
(void) TIFFPredictorInit(tif);
return (1);
bad:
TIFFErrorExt(tif->tif_clientdata, module,
"No space for ZIP state block");
return (0);
}