35 #define PredictorState(tif) ((TIFFPredictorState*) (tif)->tif_data) 50 PredictorSetup(
TIFF* tif)
52 static const char module[] =
"PredictorSetup";
65 "Horizontal differencing \"Predictor\" not supported with %d-bit samples",
73 "Floating point \"Predictor\" not supported with %d data format",
80 "\"Predictor\" value %d not supported",
98 PredictorSetupDecode(
TIFF* tif)
103 if (!(*sp->
setupdecode)(tif) || !PredictorSetup(tif))
108 case 8: sp->
pfunc = horAcc8;
break;
109 case 16: sp->
pfunc = horAcc16;
break;
129 if (sp->
pfunc == horAcc16) {
130 sp->
pfunc = swabHorAcc16;
166 PredictorSetupEncode(
TIFF* tif)
171 if (!(*sp->
setupencode)(tif) || !PredictorSetup(tif))
176 case 8: sp->
pfunc = horDiff8;
break;
177 case 16: sp->
pfunc = horDiff16;
break;
208 #define REPEAT4(n, op) \ 210 default: { int i; for (i = n-4; i > 0; i--) { op; } } \ 223 char* cp = (
char*) cp0;
230 unsigned int cr = cp[0];
231 unsigned int cg = cp[1];
232 unsigned int cb = cp[2];
235 cp[0] = (char) (cr += cp[0]);
236 cp[1] = (char) (cg += cp[1]);
237 cp[2] = (char) (cb += cp[2]);
238 }
while ((int32) cc > 0);
239 }
else if (stride == 4) {
240 unsigned int cr = cp[0];
241 unsigned int cg = cp[1];
242 unsigned int cb = cp[2];
243 unsigned int ca = cp[3];
246 cp[0] = (char) (cr += cp[0]);
247 cp[1] = (char) (cg += cp[1]);
248 cp[2] = (char) (cb += cp[2]);
249 cp[3] = (char) (ca += cp[3]);
250 }
while ((int32) cc > 0);
254 (
char) (cp[stride] + *cp); cp++)
256 }
while ((int32) cc > 0);
272 REPEAT4(stride, wp[stride] += wp[0]; wp++)
274 }
while ((int32) wc > 0);
288 REPEAT4(stride, wp[stride] += wp[0]; wp++)
290 }
while ((int32) wc > 0);
310 while (count > stride) {
311 REPEAT4(stride, cp[stride] += cp[0]; cp++)
317 for (count = 0; count < wc; count++) {
319 for (byte = 0; byte < bps; byte++) {
321 cp[bps * count +
byte] = tmp[byte * wc +
count];
323 cp[bps * count +
byte] =
324 tmp[(bps - byte - 1) * wc + count];
343 if ((*sp->
coderow)(tif, op0, occ0, s)) {
344 (*sp->
pfunc)(tif, op0, occ0);
365 if ((*sp->
codetile)(tif, op0, occ0, s)) {
369 while ((
long)occ0 > 0) {
384 char* cp = (
char*) cp0;
397 r1 = cp[3]; cp[3] = r1-r2; r2 = r1;
398 g1 = cp[4]; cp[4] = g1-g2; g2 = g1;
399 b1 = cp[5]; cp[5] = b1-b2; b2 = b1;
401 }
while ((int32)(cc -= 3) > 0);
402 }
else if (stride == 4) {
409 r1 = cp[4]; cp[4] = r1-r2; r2 = r1;
410 g1 = cp[5]; cp[5] = g1-g2; g2 = g1;
411 b1 = cp[6]; cp[6] = b1-b2; b2 = b1;
412 a1 = cp[7]; cp[7] = a1-a2; a2 = a1;
414 }
while ((int32)(cc -= 4) > 0);
418 REPEAT4(stride, cp[stride] -= cp[0]; cp--)
419 }
while ((int32)(cc -= stride) > 0);
436 REPEAT4(stride, wp[stride] -= wp[0]; wp--)
438 }
while ((int32) wc > 0);
459 for (count = 0; count < wc; count++) {
461 for (byte = 0; byte < bps; byte++) {
463 cp[byte * wc +
count] = tmp[bps * count +
byte];
465 cp[(bps - byte - 1) * wc + count] =
466 tmp[bps * count + byte];
473 cp += cc - stride - 1;
475 REPEAT4(stride, cp[stride] -= cp[0]; cp--)
488 (*sp->
pfunc)(tif, bp, cc);
489 return (*sp->
coderow)(tif, bp, cc,
s);
497 unsigned char* bp = bp0;
505 while ((
long)cc > 0) {
510 return (*sp->
codetile)(tif, bp0, cc0,
s);
513 #define FIELD_PREDICTOR (FIELD_CODEC+0) 519 #define N(a) (sizeof (a) / sizeof (a[0])) 522 PredictorVSetField(
TIFF* tif,
ttag_t tag, va_list ap)
542 PredictorVGetField(
TIFF* tif,
ttag_t tag, va_list ap)
560 PredictorPrintDir(
TIFF* tif, FILE* fd,
long flags)
566 fprintf(fd,
" Predictor: ");
568 case 1: fprintf(fd,
"none ");
break;
569 case 2: fprintf(fd,
"horizontal differencing ");
break;
570 case 3: fprintf(fd,
"floating point predictor ");
break;
#define PredictorState(tif)
TIFFCodeMethod tif_decoderow
TIFFTagMethods tif_tagmethods
tsize_t TIFFTileRowSize(TIFF *tif)
TIFFVGetMethod vgetparent
TIFFCodeMethod tif_encodestrip
TIFFCodeMethod tif_encoderow
tsize_t TIFFScanlineSize(TIFF *tif)
#define PREDICTOR_HORIZONTAL
void TIFFSwabArrayOfShort(uint16 *wp, register unsigned long n)
TIFFVSetMethod vsetparent
int TIFFPredictorCleanup(TIFF *tif)
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
void _TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)
#define TIFFSetFieldBit(tif, field)
TIFFCodeMethod tif_decodestrip
TIFFCodeMethod tif_encodetile
TIFFBoolMethod setupdecode
#define SAMPLEFORMAT_IEEEFP
TIFFPostMethod tif_postdecode
void _TIFFMergeFieldInfo(TIFF *tif, const TIFFFieldInfo info[], int n)
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
#define TIFFFieldSet(tif, field)
TIFFCodeMethod tif_decodetile
TIFFBoolMethod setupencode
void _TIFFNoPostDecode(TIFF *tif, tidata_t buf, tsize_t cc)
uint16 td_samplesperpixel
int TIFFPredictorInit(TIFF *tif)
#define TIFFTAG_PREDICTOR
void * _TIFFmalloc(tsize_t s)
GLuint GLuint GLsizei count
void _TIFFfree(tdata_t p)
#define PREDICTOR_FLOATINGPOINT
TIFFBoolMethod tif_setupencode
#define PLANARCONFIG_CONTIG
TIFFBoolMethod tif_setupdecode