| Bsoft 1.9 Bernard's software package

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

Classes | Macros | Enumerations | Functions
tif_fax3.c File Reference
`#include "tiffiop.h"`
`#include "tif_fax3.h"`
`#include "t4.h"`
`#include <stdio.h>`

Go to the source code of this file.

## Classes
struct | Fax3BaseState
struct | Fax3CodecState

## Macros
#define | G3CODES
#define | Fax3State(tif) ((Fax3BaseState*) (tif)->tif_data)
#define | DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
#define | EncoderState(tif) ((Fax3CodecState*) Fax3State(tif))
#define | is2DEncoding(sp) (sp->b.groupoptions & GROUP3OPT_2DENCODING)
#define | isAligned(p, t) ((((unsigned long)(p)) & (sizeof (t)-1)) == 0)
#define | DECLARE_STATE(tif, sp, mod)
#define | DECLARE_STATE_2D(tif, sp, mod)
#define | CACHE_STATE(tif, sp)
#define | UNCACHE_STATE(tif, sp)
#define | unexpected(table, a0) Fax3Unexpected(module, tif, sp->line, a0)
#define | extension(a0) Fax3Extension(module, tif, sp->line, a0)
#define | badlength(a0, lastx) Fax3BadLength(module, tif, sp->line, a0, lastx)
#define | prematureEOF(a0) Fax3PrematureEOF(module, tif, sp->line, a0)
#define | Nop
#define | SWAP(t, a, b) { t x; x = (a); (a) = (b); (b) = x; }
#define | FILL(n, cp)
#define | ZERO(n, cp)
#define | Fax3FlushBits(tif, sp)
#define | _FlushBits(tif)
#define | _PutBits(tif, bits, length)
#define | putcode(tif, te) Fax3PutBits(tif, (te)->code, (te)->length)
#define | finddiff(_cp, _bs, _be, _color) (_bs + (_color ? find1span(_cp,_bs,_be) : find0span(_cp,_bs,_be)))
#define | finddiff2(_cp, _bs, _be, _color) (_bs < _be ? finddiff(_cp,_bs,_be,_color) : _be)
#define | PIXEL(buf, ix) ((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1)
#define | FIELD_BADFAXLINES (FIELD_CODEC+0)
#define | FIELD_CLEANFAXDATA (FIELD_CODEC+1)
#define | FIELD_BADFAXRUN (FIELD_CODEC+2)
#define | FIELD_RECVPARAMS (FIELD_CODEC+3)
#define | FIELD_SUBADDRESS (FIELD_CODEC+4)
#define | FIELD_RECVTIME (FIELD_CODEC+5)
#define | FIELD_FAXDCS (FIELD_CODEC+6)
#define | FIELD_OPTIONS (FIELD_CODEC+7)
#define | N(a) (sizeof (a) / sizeof (a[0]))
#define | SWAP(t, a, b) { t x; x = (a); (a) = (b); (b) = x; }

## Enumerations
enum | Ttag { G3_1D, G3_2D }

## Functions
void | _TIFFFax3fillruns (unsigned char *buf, uint32 *runs, uint32 *erun, uint32 lastx)
int | TIFFInitCCITTFax3 (TIFF *tif, int scheme)
int | TIFFInitCCITTFax4 (TIFF *tif, int scheme)
int | TIFFInitCCITTRLE (TIFF *tif, int scheme)
int | TIFFInitCCITTRLEW (TIFF *tif, int scheme)

## Macro Definition Documentation

#define _FlushBits | ( |  | tif | ) |

Value:
{ \
if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \
(void) TIFFFlushData1(tif); \
*(tif)->tif_rawcp++ = (tidataval_t) data; \
(tif)->tif_rawcc++; \
data = 0, bit = 8; \
}
tidataval_t
unsigned char tidataval_t
Definition: tiffiop.h:90
data
JSAMPIMAGE data
Definition: jpeglib.h:945
TIFFFlushData1
int TIFFFlushData1(TIFF *tif)
Definition: tif_write.c:682

Definition at line 563 of file tif_fax3.c.

#define _PutBits | ( |  | tif,
|  |  | bits,
|  |  | length
| ) |  |

Value:
{ \
while (length > bit) { \
data |= bits >> (length - bit); \
length -= bit; \
_FlushBits(tif); \
} \
data |= (bits & _msbmask[length]) << (bit - length); \
bit -= length; \
if (bit == 0) \
_FlushBits(tif); \
}
bits
unsigned int bits
Definition: tif_acorn.c:68
data
JSAMPIMAGE data
Definition: jpeglib.h:945
_FlushBits
#define _FlushBits(tif)
Definition: tif_fax3.c:563

Definition at line 572 of file tif_fax3.c.

#define badlength | ( |  | a0,
|  |  | lastx
| ) |  | Fax3BadLength(module, tif, sp->line, a0, lastx)

Definition at line 214 of file tif_fax3.c.

#define CACHE_STATE | ( |  | tif,
|  |  | sp
| ) |  |

Value:
do { \
BitAcc = sp->data; \
BitsAvail = sp->bit; \
EOLcnt = sp->EOLcnt; \
cp = (unsigned char*) tif->tif_rawcp; \
ep = cp + tif->tif_rawcc; \
} while (0)

Definition at line 129 of file tif_fax3.c.

#define DECLARE_STATE | ( |  | tif,
|  |  | sp,
|  |  | mod
| ) |  |

Value:
static const char module[] = mod; \
Fax3CodecState* sp = DecoderState(tif); \
int a0; /* reference element */ \
int lastx = sp->b.rowpixels; /* last element in row */ \
uint32 BitAcc; /* bit accumulator */ \
int BitsAvail; /* # valid bits in BitAcc */ \
int RunLength; /* length of current run */ \
unsigned char* cp; /* next byte of input data */ \
unsigned char* ep; /* end of input data */ \
uint32* pa; /* place to stuff next run */ \
uint32* thisrun; /* current row's run array */ \
int EOLcnt; /* # EOL codes recognized */ \
const unsigned char* bitmap = sp->bitmap; /* input data bit reverser */ \
const TIFFFaxTabEnt* TabEnt
DecoderState
#define DecoderState(tif)
Definition: tif_fax3.c:92
TIFFFaxTabEnt
Definition: tif_fax3.h:84

Definition at line 107 of file tif_fax3.c.

#define DECLARE_STATE_2D | ( |  | tif,
|  |  | sp,
|  |  | mod
| ) |  |

Value:
DECLARE_STATE(tif, sp, mod); \
int b1; /* next change on prev line */ \
uint32* pb /* next run in reference line */\
/*
* Load any state that may be changed during decoding.
*/
DECLARE_STATE
#define DECLARE_STATE(tif, sp, mod)
Definition: tif_fax3.c:107

Definition at line 122 of file tif_fax3.c.

#define DecoderState | ( |  | tif | ) | ((Fax3CodecState*) Fax3State(tif))

Definition at line 92 of file tif_fax3.c.

#define EncoderState | ( |  | tif | ) | ((Fax3CodecState*) Fax3State(tif))

Definition at line 93 of file tif_fax3.c.

#define extension | ( |  | a0 | ) | Fax3Extension(module, tif, sp->line, a0)

Definition at line 202 of file tif_fax3.c.

#define Fax3FlushBits | ( |  | tif,
|  |  | sp
| ) |  |

Value:
{ \
if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \
(void) TIFFFlushData1(tif); \
*(tif)->tif_rawcp++ = (tidataval_t) (sp)->data; \
(tif)->tif_rawcc++; \
(sp)->data = 0, (sp)->bit = 8; \
}
tidataval_t
unsigned char tidataval_t
Definition: tiffiop.h:90
data
JSAMPIMAGE data
Definition: jpeglib.h:945
TIFFFlushData1
int TIFFFlushData1(TIFF *tif)
Definition: tif_write.c:682

Definition at line 556 of file tif_fax3.c.

#define Fax3State | ( |  | tif | ) | ((Fax3BaseState*) (tif)->tif_data)

Definition at line 68 of file tif_fax3.c.

#define FIELD_BADFAXLINES (FIELD_CODEC+0)

Definition at line 1114 of file tif_fax3.c.

#define FIELD_BADFAXRUN (FIELD_CODEC+2)

Definition at line 1116 of file tif_fax3.c.

#define FIELD_CLEANFAXDATA (FIELD_CODEC+1)

Definition at line 1115 of file tif_fax3.c.

#define FIELD_FAXDCS (FIELD_CODEC+6)

Definition at line 1120 of file tif_fax3.c.

#define FIELD_OPTIONS (FIELD_CODEC+7)

Definition at line 1122 of file tif_fax3.c.

#define FIELD_RECVPARAMS (FIELD_CODEC+3)

Definition at line 1117 of file tif_fax3.c.

#define FIELD_RECVTIME (FIELD_CODEC+5)

Definition at line 1119 of file tif_fax3.c.

#define FIELD_SUBADDRESS (FIELD_CODEC+4)

Definition at line 1118 of file tif_fax3.c.

#define FILL | ( |  | n,
|  |  | cp
| ) |  |

Value:
switch (n) { \
case 7: (cp)[6] = 0xff; case 6: (cp)[5] = 0xff; case 5: (cp)[4] = 0xff; \
case 4: (cp)[3] = 0xff; case 3: (cp)[2] = 0xff; case 2: (cp)[1] = 0xff; \
case 1: (cp)[0] = 0xff; (cp) += (n); case 0: ; \
}

Definition at line 347 of file tif_fax3.c.

#define finddiff | ( |  | _cp,
|  |  | _bs,
|  |  | _be,
|  |  | _color
| ) |  | (_bs + (_color ? find1span(_cp,_bs,_be) : find0span(_cp,_bs,_be)))

Definition at line 919 of file tif_fax3.c.

#define finddiff2 | ( |  | _cp,
|  |  | _bs,
|  |  | _be,
|  |  | _color
| ) |  | (_bs < _be ? finddiff(_cp,_bs,_be,_color) : _be)

Definition at line 925 of file tif_fax3.c.

#define G3CODES

Definition at line 42 of file tif_fax3.c.

#define is2DEncoding | ( |  | sp | ) | (sp->b.groupoptions & GROUP3OPT_2DENCODING)

Definition at line 95 of file tif_fax3.c.

#define isAligned | ( |  | p,
|  |  | t
| ) |  | ((((unsigned long)(p)) & (sizeof (t)-1)) == 0)

Definition at line 97 of file tif_fax3.c.

#define N | ( |  | a | ) | (sizeof (a) / sizeof (a[0]))

Definition at line 1156 of file tif_fax3.c.

#define Nop

Definition at line 227 of file tif_fax3.c.

#define PIXEL | ( |  | buf,
|  |  | ix
| ) |  | ((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1)

#define prematureEOF | ( |  | a0 | ) | Fax3PrematureEOF(module, tif, sp->line, a0)

Definition at line 225 of file tif_fax3.c.

#define putcode | ( |  | tif,
|  |  | te
| ) |  | Fax3PutBits(tif, (te)->code, (te)->length)

Definition at line 605 of file tif_fax3.c.

#define SWAP | ( |  | t,
|  |  | a,
|  |  | b
| ) |  | { t x; x = (a); (a) = (b); (b) = x; }

Definition at line 1421 of file tif_fax3.c.

#define SWAP | ( |  | t,
|  |  | a,
|  |  | b
| ) |  | { t x; x = (a); (a) = (b); (b) = x; }

Definition at line 1421 of file tif_fax3.c.

#define UNCACHE_STATE | ( |  | tif,
|  |  | sp
| ) |  |

Value:
do { \
sp->bit = BitsAvail; \
sp->data = BitAcc; \
sp->EOLcnt = EOLcnt; \
tif->tif_rawcc -= (tidata_t) cp - tif->tif_rawcp; \
tif->tif_rawcp = (tidata_t) cp; \
} while (0)
tidata_t
tidataval_t * tidata_t
Definition: tiffiop.h:91

Definition at line 139 of file tif_fax3.c.

#define unexpected | ( |  | table,
|  |  | a0
| ) |  | Fax3Unexpected(module, tif, sp->line, a0)

Definition at line 191 of file tif_fax3.c.

#define ZERO | ( |  | n,
|  |  | cp
| ) |  |

Value:
switch (n) { \
case 7: (cp)[6] = 0; case 6: (cp)[5] = 0; case 5: (cp)[4] = 0; \
case 4: (cp)[3] = 0; case 3: (cp)[2] = 0; case 2: (cp)[1] = 0; \
case 1: (cp)[0] = 0; (cp) += (n); case 0: ; \
}

Definition at line 353 of file tif_fax3.c.

## Enumeration Type Documentation

enum Ttag

Enumerator
G3_1D |
G3_2D |

Definition at line 70 of file tif_fax3.c.

## Function Documentation

void _TIFFFax3fillruns | ( | unsigned char * | buf,
|  | uint32 * | runs,
|  | uint32 * | erun,
|  | uint32 | lastx
| ) |  |

Definition at line 366 of file tif_fax3.c.

int TIFFInitCCITTFax3 | ( | TIFF * | tif,
|  | int | scheme
| ) |  |

Definition at line 1395 of file tif_fax3.c.

int TIFFInitCCITTFax4 | ( | TIFF * | tif,
|  | int | scheme
| ) |  |

Definition at line 1503 of file tif_fax3.c.

int TIFFInitCCITTRLE | ( | TIFF * | tif,
|  | int | scheme
| ) |  |

Definition at line 1585 of file tif_fax3.c.

int TIFFInitCCITTRLEW | ( | TIFF * | tif,
|  | int | scheme
| ) |  |

Definition at line 1602 of file tif_fax3.c.