• Home
  • Raw
  • Download

Lines Matching refs:sp

92 #define is2DEncoding(sp) (sp->b.groupoptions & GROUP3OPT_2DENCODING)  argument
103 #define DECLARE_STATE(tif, sp, mod) \ argument
105 Fax3CodecState* sp = DecoderState(tif); \
107 int lastx = sp->b.rowpixels; /* last element in row */ \
116 const unsigned char* bitmap = sp->bitmap; /* input data bit reverser */ \
118 #define DECLARE_STATE_2D(tif, sp, mod) \ argument
119 DECLARE_STATE(tif, sp, mod); \
125 #define CACHE_STATE(tif, sp) do { \ argument
126 BitAcc = sp->data; \
127 BitsAvail = sp->bit; \
128 EOLcnt = sp->EOLcnt; \
135 #define UNCACHE_STATE(tif, sp) do { \ argument
136 sp->bit = BitsAvail; \
137 sp->data = BitAcc; \
138 sp->EOLcnt = EOLcnt; \
149 Fax3CodecState* sp = DecoderState(tif); in Fax3PreDecode() local
152 assert(sp != NULL); in Fax3PreDecode()
153 sp->bit = 0; /* force initial read */ in Fax3PreDecode()
154 sp->data = 0; in Fax3PreDecode()
155 sp->EOLcnt = 0; /* force initial scan for EOL */ in Fax3PreDecode()
163 sp->bitmap = in Fax3PreDecode()
165 if (sp->refruns) { /* init reference line to white */ in Fax3PreDecode()
166 sp->refruns[0] = (uint32) sp->b.rowpixels; in Fax3PreDecode()
167 sp->refruns[1] = 0; in Fax3PreDecode()
169 sp->line = 0; in Fax3PreDecode()
187 #define unexpected(table, a0) Fax3Unexpected(module, tif, sp->line, a0)
198 #define extension(a0) Fax3Extension(module, tif, sp->line, a0)
209 #define badlength(a0,lastx) Fax3BadLength(module, tif, sp->line, a0, lastx)
219 #define prematureEOF(a0) Fax3PrematureEOF(module, tif, sp->line, a0)
229 DECLARE_STATE(tif, sp, "Fax3Decode1D"); in Fax3Decode1D()
231 if (occ % sp->b.rowbytes) in Fax3Decode1D()
236 CACHE_STATE(tif, sp); in Fax3Decode1D()
237 thisrun = sp->curruns; in Fax3Decode1D()
249 (*sp->fill)(buf, thisrun, pa, lastx); in Fax3Decode1D()
250 buf += sp->b.rowbytes; in Fax3Decode1D()
251 occ -= sp->b.rowbytes; in Fax3Decode1D()
252 sp->line++; in Fax3Decode1D()
257 (*sp->fill)(buf, thisrun, pa, lastx); in Fax3Decode1D()
258 UNCACHE_STATE(tif, sp); in Fax3Decode1D()
261 UNCACHE_STATE(tif, sp); in Fax3Decode1D()
272 DECLARE_STATE_2D(tif, sp, "Fax3Decode2D"); in Fax3Decode2D()
275 if (occ % sp->b.rowbytes) in Fax3Decode2D()
280 CACHE_STATE(tif, sp); in Fax3Decode2D()
284 pa = thisrun = sp->curruns; in Fax3Decode2D()
298 pb = sp->refruns; in Fax3Decode2D()
304 (*sp->fill)(buf, thisrun, pa, lastx); in Fax3Decode2D()
306 SWAP(uint32*, sp->curruns, sp->refruns); in Fax3Decode2D()
307 buf += sp->b.rowbytes; in Fax3Decode2D()
308 occ -= sp->b.rowbytes; in Fax3Decode2D()
309 sp->line++; in Fax3Decode2D()
314 (*sp->fill)(buf, thisrun, pa, lastx); in Fax3Decode2D()
315 UNCACHE_STATE(tif, sp); in Fax3Decode2D()
318 UNCACHE_STATE(tif, sp); in Fax3Decode2D()
477 Fax3BaseState* sp = Fax3State(tif); in Fax3SetupState() local
498 sp->rowbytes = rowbytes; in Fax3SetupState()
499 sp->rowpixels = rowpixels; in Fax3SetupState()
504 (sp->groupoptions & GROUP3OPT_2DENCODING) || in Fax3SetupState()
568 #define Fax3FlushBits(tif, sp) { \ argument
571 *(tif)->tif_rawcp++ = (uint8) (sp)->data; \
573 (sp)->data = 0, (sp)->bit = 8; \
605 Fax3CodecState* sp = EncoderState(tif); in Fax3PutBits() local
606 unsigned int bit = sp->bit; in Fax3PutBits()
607 int data = sp->data; in Fax3PutBits()
611 sp->data = data; in Fax3PutBits()
612 sp->bit = bit; in Fax3PutBits()
640 Fax3CodecState* sp = EncoderState(tif); in putspan() local
641 unsigned int bit = sp->bit; in putspan()
642 int data = sp->data; in putspan()
670 sp->data = data; in putspan()
671 sp->bit = bit; in putspan()
683 Fax3CodecState* sp = EncoderState(tif); in Fax3PutEOL() local
684 unsigned int bit = sp->bit; in Fax3PutEOL()
685 int data = sp->data; in Fax3PutEOL()
688 if (sp->b.groupoptions & GROUP3OPT_FILLBITS) { in Fax3PutEOL()
695 if (align != sp->bit) { in Fax3PutEOL()
696 if (align > sp->bit) in Fax3PutEOL()
697 align = sp->bit + (8 - align); in Fax3PutEOL()
699 align = sp->bit - align; in Fax3PutEOL()
706 if (is2DEncoding(sp)) in Fax3PutEOL()
707 code = (code<<1) | (sp->tag == G3_1D), length++; in Fax3PutEOL()
710 sp->data = data; in Fax3PutEOL()
711 sp->bit = bit; in Fax3PutEOL()
720 Fax3CodecState* sp = EncoderState(tif); in Fax3PreEncode() local
723 assert(sp != NULL); in Fax3PreEncode()
724 sp->bit = 8; in Fax3PreEncode()
725 sp->data = 0; in Fax3PreEncode()
726 sp->tag = G3_1D; in Fax3PreEncode()
732 if (sp->refline) in Fax3PreEncode()
733 _TIFFmemset(sp->refline, 0x00, sp->b.rowbytes); in Fax3PreEncode()
734 if (is2DEncoding(sp)) { in Fax3PreEncode()
748 sp->maxk = (res > 150 ? 4 : 2); in Fax3PreEncode()
749 sp->k = sp->maxk-1; in Fax3PreEncode()
751 sp->k = sp->maxk = 0; in Fax3PreEncode()
752 sp->line = 0; in Fax3PreEncode()
949 Fax3CodecState* sp = EncoderState(tif); in Fax3Encode1DRow() local
965 if (sp->b.mode & (FAXMODE_BYTEALIGN|FAXMODE_WORDALIGN)) { in Fax3Encode1DRow()
966 if (sp->bit != 8) /* byte-align */ in Fax3Encode1DRow()
967 Fax3FlushBits(tif, sp); in Fax3Encode1DRow()
968 if ((sp->b.mode&FAXMODE_WORDALIGN) && in Fax3Encode1DRow()
970 Fax3FlushBits(tif, sp); in Fax3Encode1DRow()
1042 Fax3CodecState* sp = EncoderState(tif); in Fax3Encode() local
1044 if (cc % sp->b.rowbytes) in Fax3Encode()
1050 if ((sp->b.mode & FAXMODE_NOEOL) == 0) in Fax3Encode()
1052 if (is2DEncoding(sp)) { in Fax3Encode()
1053 if (sp->tag == G3_1D) { in Fax3Encode()
1054 if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels)) in Fax3Encode()
1056 sp->tag = G3_2D; in Fax3Encode()
1058 if (!Fax3Encode2DRow(tif, bp, sp->refline, in Fax3Encode()
1059 sp->b.rowpixels)) in Fax3Encode()
1061 sp->k--; in Fax3Encode()
1063 if (sp->k == 0) { in Fax3Encode()
1064 sp->tag = G3_1D; in Fax3Encode()
1065 sp->k = sp->maxk-1; in Fax3Encode()
1067 _TIFFmemcpy(sp->refline, bp, sp->b.rowbytes); in Fax3Encode()
1069 if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels)) in Fax3Encode()
1072 bp += sp->b.rowbytes; in Fax3Encode()
1073 cc -= sp->b.rowbytes; in Fax3Encode()
1081 Fax3CodecState* sp = EncoderState(tif); in Fax3PostEncode() local
1083 if (sp->bit != 8) in Fax3PostEncode()
1084 Fax3FlushBits(tif, sp); in Fax3PostEncode()
1092 Fax3CodecState* sp = EncoderState(tif); in Fax3Close() local
1097 if (is2DEncoding(sp)) in Fax3Close()
1098 code = (code<<1) | (sp->tag == G3_1D), length++; in Fax3Close()
1101 Fax3FlushBits(tif, sp); in Fax3Close()
1108 Fax3CodecState* sp = DecoderState(tif); in Fax3Cleanup() local
1110 assert(sp != 0); in Fax3Cleanup()
1112 tif->tif_tagmethods.vgetfield = sp->b.vgetparent; in Fax3Cleanup()
1113 tif->tif_tagmethods.vsetfield = sp->b.vsetparent; in Fax3Cleanup()
1114 tif->tif_tagmethods.printdir = sp->b.printdir; in Fax3Cleanup()
1116 if (sp->runs) in Fax3Cleanup()
1117 _TIFFfree(sp->runs); in Fax3Cleanup()
1118 if (sp->refline) in Fax3Cleanup()
1119 _TIFFfree(sp->refline); in Fax3Cleanup()
1149 Fax3BaseState* sp = Fax3State(tif); in Fax3VSetField() local
1152 assert(sp != 0); in Fax3VSetField()
1153 assert(sp->vsetparent != 0); in Fax3VSetField()
1157 sp->mode = (int) va_arg(ap, int); in Fax3VSetField()
1165 sp->groupoptions = (uint32) va_arg(ap, uint32); in Fax3VSetField()
1170 sp->groupoptions = (uint32) va_arg(ap, uint32); in Fax3VSetField()
1173 sp->badfaxlines = (uint32) va_arg(ap, uint32); in Fax3VSetField()
1176 sp->cleanfaxdata = (uint16) va_arg(ap, uint16_vap); in Fax3VSetField()
1179 sp->badfaxrun = (uint32) va_arg(ap, uint32); in Fax3VSetField()
1182 return (*sp->vsetparent)(tif, tag, ap); in Fax3VSetField()
1197 Fax3BaseState* sp = Fax3State(tif); in Fax3VGetField() local
1199 assert(sp != 0); in Fax3VGetField()
1203 *va_arg(ap, int*) = sp->mode; in Fax3VGetField()
1210 *va_arg(ap, uint32*) = sp->groupoptions; in Fax3VGetField()
1213 *va_arg(ap, uint32*) = sp->badfaxlines; in Fax3VGetField()
1216 *va_arg(ap, uint16*) = sp->cleanfaxdata; in Fax3VGetField()
1219 *va_arg(ap, uint32*) = sp->badfaxrun; in Fax3VGetField()
1222 return (*sp->vgetparent)(tif, tag, ap); in Fax3VGetField()
1230 Fax3BaseState* sp = Fax3State(tif); in Fax3PrintDir() local
1232 assert(sp != 0); in Fax3PrintDir()
1239 if (sp->groupoptions & GROUP4OPT_UNCOMPRESSED) in Fax3PrintDir()
1244 if (sp->groupoptions & GROUP3OPT_2DENCODING) in Fax3PrintDir()
1246 if (sp->groupoptions & GROUP3OPT_FILLBITS) in Fax3PrintDir()
1248 if (sp->groupoptions & GROUP3OPT_UNCOMPRESSED) in Fax3PrintDir()
1252 (unsigned long) sp->groupoptions, in Fax3PrintDir()
1253 (unsigned long) sp->groupoptions); in Fax3PrintDir()
1257 switch (sp->cleanfaxdata) { in Fax3PrintDir()
1269 sp->cleanfaxdata, sp->cleanfaxdata); in Fax3PrintDir()
1273 (unsigned long) sp->badfaxlines); in Fax3PrintDir()
1276 (unsigned long) sp->badfaxrun); in Fax3PrintDir()
1277 if (sp->printdir) in Fax3PrintDir()
1278 (*sp->printdir)(tif, fd, flags); in Fax3PrintDir()
1285 Fax3BaseState* sp; in InitCCITTFax3() local
1308 sp = Fax3State(tif); in InitCCITTFax3()
1309 sp->rw_mode = tif->tif_mode; in InitCCITTFax3()
1314 sp->vgetparent = tif->tif_tagmethods.vgetfield; in InitCCITTFax3()
1316 sp->vsetparent = tif->tif_tagmethods.vsetfield; in InitCCITTFax3()
1318 sp->printdir = tif->tif_tagmethods.printdir; in InitCCITTFax3()
1320 sp->groupoptions = 0; in InitCCITTFax3()
1322 if (sp->rw_mode == O_RDONLY) /* FIXME: improve for in place update */ in InitCCITTFax3()
1384 DECLARE_STATE_2D(tif, sp, "Fax4Decode"); in Fax4Decode()
1386 if (occ % sp->b.rowbytes) in Fax4Decode()
1391 CACHE_STATE(tif, sp); in Fax4Decode()
1395 pa = thisrun = sp->curruns; in Fax4Decode()
1396 pb = sp->refruns; in Fax4Decode()
1406 (*sp->fill)(buf, thisrun, pa, lastx); in Fax4Decode()
1408 SWAP(uint32*, sp->curruns, sp->refruns); in Fax4Decode()
1409 buf += sp->b.rowbytes; in Fax4Decode()
1410 occ -= sp->b.rowbytes; in Fax4Decode()
1411 sp->line++; in Fax4Decode()
1421 (*sp->fill)(buf, thisrun, pa, lastx); in Fax4Decode()
1422 UNCACHE_STATE(tif, sp); in Fax4Decode()
1423 return ( sp->line ? 1 : -1); /* don't error on badly-terminated strips */ in Fax4Decode()
1425 UNCACHE_STATE(tif, sp); in Fax4Decode()
1437 Fax3CodecState *sp = EncoderState(tif); in Fax4Encode() local
1439 if (cc % sp->b.rowbytes) in Fax4Encode()
1445 if (!Fax3Encode2DRow(tif, bp, sp->refline, sp->b.rowpixels)) in Fax4Encode()
1447 _TIFFmemcpy(sp->refline, bp, sp->b.rowbytes); in Fax4Encode()
1448 bp += sp->b.rowbytes; in Fax4Encode()
1449 cc -= sp->b.rowbytes; in Fax4Encode()
1457 Fax3CodecState *sp = EncoderState(tif); in Fax4PostEncode() local
1462 if (sp->bit != 8) in Fax4PostEncode()
1463 Fax3FlushBits(tif, sp); in Fax4PostEncode()
1508 DECLARE_STATE(tif, sp, "Fax3DecodeRLE"); in Fax3DecodeRLE()
1509 int mode = sp->b.mode; in Fax3DecodeRLE()
1511 if (occ % sp->b.rowbytes) in Fax3DecodeRLE()
1516 CACHE_STATE(tif, sp); in Fax3DecodeRLE()
1517 thisrun = sp->curruns; in Fax3DecodeRLE()
1528 (*sp->fill)(buf, thisrun, pa, lastx); in Fax3DecodeRLE()
1541 buf += sp->b.rowbytes; in Fax3DecodeRLE()
1542 occ -= sp->b.rowbytes; in Fax3DecodeRLE()
1543 sp->line++; in Fax3DecodeRLE()
1546 (*sp->fill)(buf, thisrun, pa, lastx); in Fax3DecodeRLE()
1547 UNCACHE_STATE(tif, sp); in Fax3DecodeRLE()
1550 UNCACHE_STATE(tif, sp); in Fax3DecodeRLE()