LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
tif_fax3.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1990-1997 Sam Leffler
3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
4 *
5 * Permission to use, copy, modify, distribute, and sell this software and
6 * its documentation for any purpose is hereby granted without fee, provided
7 * that (i) the above copyright notices and this permission notice appear in
8 * all copies of the software and related documentation, and (ii) the names of
9 * Sam Leffler and Silicon Graphics may not be used in any advertising or
10 * publicity relating to the software without the specific, prior written
11 * permission of Sam Leffler and Silicon Graphics.
12 *
13 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
18 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22 * OF THIS SOFTWARE.
23 */
24
31#ifndef _FAX3_
32#define _FAX3_
33/*
34 * TIFF Library.
35 *
36 * CCITT Group 3 (T.4) and Group 4 (T.6) Decompression Support.
37 *
38 * Decoder support is derived, with permission, from the code
39 * in Frank Cringle's viewfax program;
40 * Copyright (C) 1990, 1995 Frank D. Cringle.
41 */
42#include "tiff.h"
43
44/*
45 * To override the default routine used to image decoded
46 * spans one can use the pseudo tag TIFFTAG_FAXFILLFUNC.
47 * The routine must have the type signature given below;
48 * for example:
49 *
50 * fillruns(unsigned char* buf, uint32_t* runs, uint32_t* erun, uint32_t lastx)
51 *
52 * where buf is place to set the bits, runs is the array of b&w run
53 * lengths (white then black), erun is the last run in the array, and
54 * lastx is the width of the row in pixels. Fill routines can assume
55 * the run array has room for at least lastx runs and can overwrite
56 * data in the run array as needed (e.g. to append zero runs to bring
57 * the count up to a nice multiple).
58 */
78typedef void (*TIFFFaxFillFunc)(unsigned char *buf, uint32_t *runs,
79 uint32_t *erun, uint32_t lastx);
80
81/*
82 * The default run filler; made external for other decoders.
83 */
84#if defined(__cplusplus)
85extern "C"
86{
87#endif
110 extern void _TIFFFax3fillruns(unsigned char *buf, uint32_t *runs,
111 uint32_t *erun, uint32_t lastx);
112#if defined(__cplusplus)
113}
114#endif
115
116/* finite state machine codes */
117#define S_Null 0
118#define S_Pass 1
119#define S_Horiz 2
120#define S_V0 3
121#define S_VR 4
122#define S_VL 5
123#define S_Ext 6
124#define S_TermW 7
125#define S_TermB 8
126#define S_MakeUpW 9
127#define S_MakeUpB 10
128#define S_MakeUp 11
129#define S_EOL 12
130
131/* WARNING: do not change the layout of this structure as the HylaFAX software
132 */
133/* really depends on it. See http://bugzilla.maptools.org/show_bug.cgi?id=2636
134 */
143typedef struct
144{
146 unsigned char State;
148 unsigned char Width;
153 uint32_t Param;
155
164extern const TIFFFaxTabEnt TIFFFaxMainTable[];
172extern const TIFFFaxTabEnt TIFFFaxWhiteTable[];
180extern const TIFFFaxTabEnt TIFFFaxBlackTable[];
181
182/*
183 * The following macros define the majority of the G3/G4 decoder
184 * algorithm using the state tables defined elsewhere. To build
185 * a decoder you need some setup code and some glue code. Note
186 * that you may also need/want to change the way the NeedBits*
187 * macros get input data if, for example, you know the data to be
188 * decoded is properly aligned and oriented (doing so before running
189 * the decoder can be a big performance win).
190 *
191 * Consult the decoder in the TIFF library for an idea of what you
192 * need to define and setup to make use of these definitions.
193 *
194 * NB: to enable a debugging version of these macros define FAX3_DEBUG
195 * before including this file. Trace output goes to stdout.
196 *
197 * When a run array would overflow, SETVALUE, CHECK_b1 and EXPAND2D (and so
198 * CLEANUP_RUNS and EXPAND1D, which use SETVALUE) report the error and then
199 * "goto RUN_OVERFLOW". A function that uses them must define a label of
200 * that name which clears the unwritten part of the caller buffer, releases
201 * the cached decoder state and returns -1, as its other error paths do.
202 */
203
204#ifndef EndOfData
205#define EndOfData() (cp >= ep)
206#endif
207/*
208 * Need <=8 or <=16 bits of input data. Unlike viewfax we
209 * cannot use/assume a word-aligned, properly bit swizzled
210 * input data set because data may come from an arbitrarily
211 * aligned, read-only source such as a memory-mapped file.
212 * Note also that the viewfax decoder does not check for
213 * running off the end of the input data buffer. This is
214 * possible for G3-encoded data because it prescans the input
215 * data to count EOL markers, but can cause problems for G4
216 * data. In any event, we don't prescan and must watch for
217 * running out of data since we can't permit the library to
218 * scan past the end of the input data buffer.
219 *
220 * Finally, note that we must handle remaindered data at the end
221 * of a strip specially. The coder asks for a fixed number of
222 * bits when scanning for the next code. This may be more bits
223 * than are actually present in the data stream. If we appear
224 * to run out of data but still have some number of valid bits
225 * remaining then we makeup the requested amount with zeros and
226 * return successfully. If the returned data is incorrect then
227 * we should be called again and get a premature EOF error;
228 * otherwise we should get the right answer.
229 */
230#ifndef NeedBits8
231#define NeedBits8(n, eoflab) \
232 do \
233 { \
234 if (BitsAvail < (n)) \
235 { \
236 if (EndOfData()) \
237 { \
238 if (BitsAvail == 0) /* no valid bits */ \
239 goto eoflab; \
240 BitsAvail = (n); /* pad with zeros */ \
241 } \
242 else \
243 { \
244 BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail; \
245 BitsAvail += 8; \
246 } \
247 } \
248 } while (0)
249#endif
250#ifndef NeedBits16
251#define NeedBits16(n, eoflab) \
252 do \
253 { \
254 if (BitsAvail < (n)) \
255 { \
256 if (EndOfData()) \
257 { \
258 if (BitsAvail == 0) /* no valid bits */ \
259 goto eoflab; \
260 BitsAvail = (n); /* pad with zeros */ \
261 } \
262 else \
263 { \
264 BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail; \
265 if ((BitsAvail += 8) < (n)) \
266 { \
267 if (EndOfData()) \
268 { \
269 /* NB: we know BitsAvail is non-zero here */ \
270 BitsAvail = (n); /* pad with zeros */ \
271 } \
272 else \
273 { \
274 BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail; \
275 BitsAvail += 8; \
276 } \
277 } \
278 } \
279 } \
280 } while (0)
281#endif
282#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
283#define ClrBits(n) \
284 do \
285 { \
286 BitsAvail -= (n); \
287 BitAcc >>= (n); \
288 } while (0)
289
290#ifdef FAX3_DEBUG
298static const char *StateNames[] = {
299 "Null ", "Pass ", "Horiz ", "V0 ", "VR ", "VL ", "Ext ",
300 "TermW ", "TermB ", "MakeUpW", "MakeUpB", "MakeUp ", "EOL ",
301};
310#define DEBUG_SHOW putchar(BitAcc & (1 << t) ? '1' : '0')
311#define LOOKUP8(wid, tab, eoflab) \
312 do \
313 { \
314 int t; \
315 NeedBits8(wid, eoflab); \
316 TabEnt = tab + GetBits(wid); \
317 printf("%08lX/%d: %s%5d\t", (long)BitAcc, BitsAvail, \
318 StateNames[TabEnt->State], TabEnt->Param); \
319 for (t = 0; t < TabEnt->Width; t++) \
320 DEBUG_SHOW; \
321 putchar('\n'); \
322 fflush(stdout); \
323 ClrBits(TabEnt->Width); \
324 } while (0)
325#define LOOKUP16(wid, tab, eoflab) \
326 do \
327 { \
328 int t; \
329 NeedBits16(wid, eoflab); \
330 TabEnt = tab + GetBits(wid); \
331 printf("%08lX/%d: %s%5d\t", (long)BitAcc, BitsAvail, \
332 StateNames[TabEnt->State], TabEnt->Param); \
333 for (t = 0; t < TabEnt->Width; t++) \
334 DEBUG_SHOW; \
335 putchar('\n'); \
336 fflush(stdout); \
337 ClrBits(TabEnt->Width); \
338 } while (0)
339
340#define SETVALUE(x) \
341 do \
342 { \
343 if (pa >= thisrun + sp->nruns) \
344 { \
345 TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u", \
346 sp->line, isTiled(tif) ? "tile" : "strip", \
347 isTiled(tif) ? tif->tif_dir.td_curtile \
348 : tif->tif_dir.td_curstrip); \
349 goto RUN_OVERFLOW; \
350 } \
351 *pa++ = RunLength + (x); \
352 printf("SETVALUE: %d\t%d\n", RunLength + (x), a0); \
353 a0 += x; \
354 RunLength = 0; \
355 } while (0)
356#else
357#define LOOKUP8(wid, tab, eoflab) \
358 do \
359 { \
360 NeedBits8(wid, eoflab); \
361 TabEnt = tab + GetBits(wid); \
362 ClrBits(TabEnt->Width); \
363 } while (0)
364#define LOOKUP16(wid, tab, eoflab) \
365 do \
366 { \
367 NeedBits16(wid, eoflab); \
368 TabEnt = tab + GetBits(wid); \
369 ClrBits(TabEnt->Width); \
370 } while (0)
371
372/*
373 * Append a run to the run length array for the
374 * current row and reset decoding state.
375 */
376#define SETVALUE(x) \
377 do \
378 { \
379 if (pa >= thisrun + sp->nruns) \
380 { \
381 TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u", \
382 sp->line, isTiled(tif) ? "tile" : "strip", \
383 isTiled(tif) ? tif->tif_dir.td_curtile \
384 : tif->tif_dir.td_curstrip); \
385 goto RUN_OVERFLOW; \
386 } \
387 *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x)); \
388 a0 += (int)(uint32_t)(x); \
389 RunLength = 0; \
390 } while (0)
391#endif
392
393/*
394 * Synchronize input decoding at the start of each
395 * row by scanning for an EOL (if appropriate) and
396 * skipping any trash data that might be present
397 * after a decoding error. Note that the decoding
398 * done elsewhere that recognizes an EOL only consumes
399 * 11 consecutive zero bits. This means that if EOLcnt
400 * is non-zero then we still need to scan for the final flag
401 * bit that is part of the EOL code.
402 */
403#define SYNC_EOL(eoflab, retrywithouteol) \
404 do \
405 { \
406 if (!(sp->b.mode & FAXMODE_NOEOL)) /* skip EOL, if not present */ \
407 { \
408 if (EOLcnt == 0) \
409 { \
410 for (;;) \
411 { \
412 NeedBits16(11, eoflab); \
413 if (GetBits(11) == 0) \
414 break; /* EOL found */ \
415 ClrBits(1); \
416 } \
417 } \
418 /* Now move after EOL or detect missing EOL. */ \
419 for (;;) \
420 { \
421 NeedBits8(8, noEOLFound); \
422 if (GetBits(8)) \
423 break; \
424 ClrBits(8); \
425 } \
426 while (GetBits(1) == 0) \
427 ClrBits(1); \
428 ClrBits(1); /* EOL bit */ \
429 EOLcnt = 0; /* reset EOL counter/flag */ \
430 break; /* existing EOL skipped, leave macro */ \
431 noEOLFound: \
432 sp->b.mode |= FAXMODE_NOEOL; \
433 tryG3WithoutEOL(a0); \
434 goto retrywithouteol; \
435 } \
436 } while (0)
437
438/*
439 * Cleanup the array of runs after decoding a row.
440 * We adjust final runs to insure the user buffer is not
441 * overwritten and/or undecoded area is white filled.
442 */
443#define CLEANUP_RUNS() \
444 do \
445 { \
446 if (RunLength) \
447 SETVALUE(0); \
448 if (a0 != (int)lastx) \
449 { \
450 badlength(a0, lastx); \
451 while (a0 > (int)lastx && pa > thisrun) \
452 a0 -= (int)*--pa; \
453 if (a0 < (int)lastx) \
454 { \
455 if (a0 < 0) \
456 a0 = 0; \
457 if ((pa - thisrun) & 1) \
458 SETVALUE(0); \
459 SETVALUE((uint32_t)((int)lastx - a0)); \
460 } \
461 else if (a0 > (int)lastx) \
462 { \
463 SETVALUE(lastx); \
464 SETVALUE(0); \
465 } \
466 } \
467 } while (0)
468
469/*
470 * Decode a line of 1D-encoded data.
471 *
472 * The line expanders are written as macros so that they can be reused
473 * but still have direct access to the local variables of the "calling"
474 * function.
475 *
476 * Note that unlike the original version we have to explicitly test for
477 * a0 >= lastx after each black/white run is decoded. This is because
478 * the original code depended on the input data being zero-padded to
479 * insure the decoder recognized an EOL before running out of data.
480 */
481#define EXPAND1D(eoflab) \
482 do \
483 { \
484 for (;;) \
485 { \
486 for (;;) \
487 { \
488 LOOKUP16(12, TIFFFaxWhiteTable, eof1d); \
489 switch (TabEnt->State) \
490 { \
491 case S_EOL: \
492 EOLcnt = 1; \
493 goto done1d; \
494 case S_TermW: \
495 SETVALUE(TabEnt->Param); \
496 goto doneWhite1d; \
497 case S_MakeUpW: \
498 case S_MakeUp: \
499 a0 = (int)((uint32_t)a0 + TabEnt->Param); \
500 RunLength = \
501 (int)((uint32_t)RunLength + TabEnt->Param); \
502 break; \
503 default: \
504 unexpected("WhiteTable", a0); \
505 goto done1d; \
506 } \
507 } \
508 doneWhite1d: \
509 if (a0 >= (int)lastx) \
510 goto done1d; \
511 for (;;) \
512 { \
513 LOOKUP16(13, TIFFFaxBlackTable, eof1d); \
514 switch (TabEnt->State) \
515 { \
516 case S_EOL: \
517 EOLcnt = 1; \
518 goto done1d; \
519 case S_TermB: \
520 SETVALUE(TabEnt->Param); \
521 goto doneBlack1d; \
522 case S_MakeUpB: \
523 case S_MakeUp: \
524 a0 += (int)TabEnt->Param; \
525 RunLength += (int)TabEnt->Param; \
526 break; \
527 default: \
528 unexpected("BlackTable", a0); \
529 goto done1d; \
530 } \
531 } \
532 doneBlack1d: \
533 if (a0 >= (int)lastx) \
534 goto done1d; \
535 if (*(pa - 1) == 0 && *(pa - 2) == 0) \
536 pa -= 2; \
537 } \
538 eof1d: \
539 prematureEOF(a0); \
540 CLEANUP_RUNS(); \
541 goto eoflab; \
542 done1d: \
543 CLEANUP_RUNS(); \
544 } while (0)
545
546/*
547 * Update the value of b1 using the array
548 * of runs for the reference line.
549 */
550#define CHECK_b1 \
551 do \
552 { \
553 if (pa != thisrun) \
554 while (b1 <= a0 && b1 < (int)lastx) \
555 { \
556 if (pb + 1 >= sp->refruns + sp->nruns) \
557 { \
558 TIFFErrorExtR(tif, module, \
559 "Buffer overflow at line %d of %s %u", \
560 sp->line, isTiled(tif) ? "tile" : "strip", \
561 isTiled(tif) ? tif->tif_dir.td_curtile \
562 : tif->tif_dir.td_curstrip); \
563 goto RUN_OVERFLOW; \
564 } \
565 b1 += (int)(pb[0] + pb[1]); \
566 pb += 2; \
567 } \
568 } while (0)
569
570/*
571 * Expand a row of 2D-encoded data.
572 */
573#define EXPAND2D(eoflab) \
574 do \
575 { \
576 while (a0 < (int)lastx) \
577 { \
578 if (pa >= thisrun + sp->nruns) \
579 { \
580 TIFFErrorExtR(tif, module, \
581 "Buffer overflow at line %d of %s %u", sp->line, \
582 isTiled(tif) ? "tile" : "strip", \
583 isTiled(tif) ? tif->tif_dir.td_curtile \
584 : tif->tif_dir.td_curstrip); \
585 goto RUN_OVERFLOW; \
586 } \
587 LOOKUP8(7, TIFFFaxMainTable, eof2d); \
588 switch (TabEnt->State) \
589 { \
590 case S_Pass: \
591 CHECK_b1; \
592 if (pb + 1 >= sp->refruns + sp->nruns) \
593 { \
594 TIFFErrorExtR( \
595 tif, module, \
596 "Buffer overflow at line %d of %s %u", sp->line, \
597 isTiled(tif) ? "tile" : "strip", \
598 isTiled(tif) ? tif->tif_dir.td_curtile \
599 : tif->tif_dir.td_curstrip); \
600 goto RUN_OVERFLOW; \
601 } \
602 b1 = b1 + (int)*pb++; \
603 RunLength = \
604 (int)((uint32_t)RunLength + (uint32_t)(b1 - a0)); \
605 a0 = b1; \
606 b1 = b1 + (int)*pb++; \
607 break; \
608 case S_Horiz: \
609 if ((pa - thisrun) & 1) \
610 { \
611 for (;;) \
612 { /* black first */ \
613 LOOKUP16(13, TIFFFaxBlackTable, eof2d); \
614 switch (TabEnt->State) \
615 { \
616 case S_TermB: \
617 SETVALUE(TabEnt->Param); \
618 goto doneWhite2da; \
619 case S_MakeUpB: \
620 case S_MakeUp: \
621 a0 = (int)((uint32_t)a0 + TabEnt->Param); \
622 RunLength = (int)((uint32_t)RunLength + \
623 TabEnt->Param); \
624 break; \
625 default: \
626 goto badBlack2d; \
627 } \
628 } \
629 doneWhite2da:; \
630 for (;;) \
631 { /* then white */ \
632 LOOKUP16(12, TIFFFaxWhiteTable, eof2d); \
633 switch (TabEnt->State) \
634 { \
635 case S_TermW: \
636 SETVALUE(TabEnt->Param); \
637 goto doneBlack2da; \
638 case S_MakeUpW: \
639 case S_MakeUp: \
640 a0 = (int)((uint32_t)a0 + TabEnt->Param); \
641 RunLength = (int)((uint32_t)RunLength + \
642 TabEnt->Param); \
643 break; \
644 default: \
645 goto badWhite2d; \
646 } \
647 } \
648 doneBlack2da:; \
649 } \
650 else \
651 { \
652 for (;;) \
653 { /* white first */ \
654 LOOKUP16(12, TIFFFaxWhiteTable, eof2d); \
655 switch (TabEnt->State) \
656 { \
657 case S_TermW: \
658 SETVALUE(TabEnt->Param); \
659 goto doneWhite2db; \
660 case S_MakeUpW: \
661 case S_MakeUp: \
662 a0 = (int)((uint32_t)a0 + TabEnt->Param); \
663 RunLength = (int)((uint32_t)RunLength + \
664 TabEnt->Param); \
665 break; \
666 default: \
667 goto badWhite2d; \
668 } \
669 } \
670 doneWhite2db:; \
671 for (;;) \
672 { /* then black */ \
673 LOOKUP16(13, TIFFFaxBlackTable, eof2d); \
674 switch (TabEnt->State) \
675 { \
676 case S_TermB: \
677 SETVALUE(TabEnt->Param); \
678 goto doneBlack2db; \
679 case S_MakeUpB: \
680 case S_MakeUp: \
681 a0 = (int)((uint32_t)a0 + TabEnt->Param); \
682 RunLength = (int)((uint32_t)RunLength + \
683 TabEnt->Param); \
684 break; \
685 default: \
686 goto badBlack2d; \
687 } \
688 } \
689 doneBlack2db:; \
690 } \
691 CHECK_b1; \
692 break; \
693 case S_V0: \
694 CHECK_b1; \
695 SETVALUE(b1 - a0); \
696 if (pb >= sp->refruns + sp->nruns) \
697 { \
698 TIFFErrorExtR( \
699 tif, module, \
700 "Buffer overflow at line %d of %s %u", sp->line, \
701 isTiled(tif) ? "tile" : "strip", \
702 isTiled(tif) ? tif->tif_dir.td_curtile \
703 : tif->tif_dir.td_curstrip); \
704 goto RUN_OVERFLOW; \
705 } \
706 b1 = b1 + (int)*pb++; \
707 break; \
708 case S_VR: \
709 CHECK_b1; \
710 SETVALUE((int)((uint32_t)(b1 - a0) + TabEnt->Param)); \
711 if (pb >= sp->refruns + sp->nruns) \
712 { \
713 TIFFErrorExtR( \
714 tif, module, \
715 "Buffer overflow at line %d of %s %u", sp->line, \
716 isTiled(tif) ? "tile" : "strip", \
717 isTiled(tif) ? tif->tif_dir.td_curtile \
718 : tif->tif_dir.td_curstrip); \
719 goto RUN_OVERFLOW; \
720 } \
721 b1 = b1 + (int)*pb++; \
722 break; \
723 case S_VL: \
724 CHECK_b1; \
725 if (b1 < (int)((uint32_t)a0 + TabEnt->Param)) \
726 { \
727 unexpected("VL", a0); \
728 goto eol2d; \
729 } \
730 SETVALUE((int)((uint32_t)(b1 - a0) - TabEnt->Param)); \
731 b1 = b1 - (int)*--pb; \
732 break; \
733 case S_Ext: \
734 *pa++ = (uint32_t)((int)lastx - a0); \
735 extension(a0); \
736 goto eol2d; \
737 case S_EOL: \
738 *pa++ = (uint32_t)((int)lastx - a0); \
739 NeedBits8(4, eof2d); \
740 if (GetBits(4)) \
741 unexpected("EOL", a0); \
742 ClrBits(4); \
743 EOLcnt = 1; \
744 goto eol2d; \
745 default: \
746 badMain2d: \
747 unexpected("MainTable", a0); \
748 goto eol2d; \
749 badBlack2d: \
750 unexpected("BlackTable", a0); \
751 goto eol2d; \
752 badWhite2d: \
753 unexpected("WhiteTable", a0); \
754 goto eol2d; \
755 eof2d: \
756 prematureEOF(a0); \
757 CLEANUP_RUNS(); \
758 goto eoflab; \
759 } \
760 } \
761 if (RunLength) \
762 { \
763 if (RunLength + a0 < lastx) \
764 { \
765 /* expect a final V0 */ \
766 NeedBits8(1, eof2d); \
767 if (!GetBits(1)) \
768 goto badMain2d; \
769 ClrBits(1); \
770 } \
771 SETVALUE(0); \
772 } \
773 eol2d: \
774 CLEANUP_RUNS(); \
775 } while (0)
776#endif /* _FAX3_ */
777
void(* TIFFFaxFillFunc)(unsigned char *buf, uint32_t *runs, uint32_t *erun, uint32_t lastx)
Render decoded fax runs through an installed callback.
Definition tif_fax3.h:78
const TIFFFaxTabEnt TIFFFaxMainTable[]
Decode seven-bit two-dimensional (Group3 2D and Group4) mode prefixes.
Definition tif_fax3sm.c:15
void _TIFFFax3fillruns(unsigned char *buf, uint32_t *runs, uint32_t *erun, uint32_t lastx)
Render alternating white/black fax runs into an MSB-first row.
Definition tif_fax3.c:731
const TIFFFaxTabEnt TIFFFaxBlackTable[]
Decode thirteen-bit black-run prefixes.
Definition tif_fax3sm.c:442
const TIFFFaxTabEnt TIFFFaxWhiteTable[]
Decode twelve-bit white-run prefixes.
Definition tif_fax3sm.c:30
Describe one generated fax decoding state transition.
Definition tif_fax3.h:144
uint32_t Param
Run length or vertical offset magnitude interpreted by State; fixed ABI layout.
Definition tif_fax3.h:153
unsigned char Width
Number of input code bits consumed by this entry.
Definition tif_fax3.h:148
unsigned char State
Finite-state operation code S_Null through S_EOL.
Definition tif_fax3.h:146
Define TIFF file-format types, tag identifiers, and constant values.