Structured Fax File Format Description |
|
This article describe the format of a Structured Fax File.
An SFF-formatted document always starts with a header, which is valid for the complete document. Every page starts with a page header. This is followed by the pixel information, line by line.| Byte | 8-bit unsigned integer |
| Word | 16-bit unsigned integer, least significant octet first |
| DWord | 32-bit unsigned integer, least significant word first |
| Parameter | Type | Comment |
| SFF_Id | DWord | Magic number (identification) of SFF Format: coded as 0x66666653 ("Sfff"). |
| Version | Byte | Version number of SFF document: coded 0x01. |
| reserved | Byte | Reserved for future extensions; coded 0x00. |
| User Information | Word | Manufacturer-specific user information (not used by COMMON-ISDN-API, coded as 0x0000). |
| Page Count | Word | Number of pages in the document. Must be coded 0x0000 if not known (as in the case of receiving a document). |
| OffsetFirstPageHeader | Word | Byte offset of first page header from start of document header. This value is normally equal to the size of the document header (0x14), but there could be additional userspecific data between the document header and the first page header. COMMON-ISDN-API ignores and does not provide such additional data. |
| OffsetLastPageHeader | DWord | Byte offset of last page header from start of document header. Must be coded 0x00000000 if not known (as in the case of receiving a document). |
| OffsetDocumentEnd | DWord | Byte offset of document end from start of document header. Must be coded 0x00000000 if not known (as in the case of receiving a document). |
| Parameter | Type | Comment |
| PageHeaderID | Byte | 254 (Page data record type) |
| PageHeaderLen | Byte | 0: Document end 1...255: byte offset of first page data from the Resolution Vertical field of the page header. This value is normally equal to the size of the remainder of the header (0x10), but there may be additional user-specific data between page header and page data. COMMON-ISDN-API ignores and not provide such additional data. |
| Resolution Vertical | Byte | Definition of vertical resolution; different resolutions in one document may be ignored
by COMMON-ISDN-API 0: 98 lpi (standard) 1: 196 lpi (high resolution) 2...254: reserved 255: End of document (should not be used: PageHeaderLen should be coded 0 instead) |
| Resolution Horizontal | Byte | Definition of horizontal resolution 0: 203 dpi (standard) 1...255: reserved |
| Coding | Byte | Definition of pixel line coding 0: Modified Huffman coding 1...255: reserved |
| reserved | Byte | Coded as 0 |
| Line Length | Word | Number of pixels per line 1728: Standard G3 fax 2048: B4 (optional) 2432: A3 (optional) Support for additional values is optional for COMMON-ISDN-API. |
| Page Length | Word | Number of pixel lines per page. If not known, coded as 0x0000. |
| OffsetPreviousPage | DWord | Byte offset to previous page header or 0x00000000. Coded as 0x00000001 if first page. |
| OffsetNextPage | DWord | Byte offset to next page header or 0x00000000. Coded as 0x00000001 if last page. |
Page data is coded line by line: data describes each pixel row. Lines are coded as records of variable length; each line is coded according to the element coding in the page header. At present, only modified Huffman coding is supported.
MH coding is bitoriented: the pixel bits are stored in the bits of code words, least significant first. No EOL code words or fill bits are included. If the data includes EOL code words, COMMON-ISDN-API ignores these.
Each record is identified by the first byte:The bit stream start with bit 0 of the first data byte. The data coding the number of successive pixel with a specific color. The coding start with white color. Black and white are alternate, up to all pixels are decoded or the bit stream is ended. There are Make-up codes and Terminating codes. First is the Make-up code or not. Annotation: A application for decoding should handle more then one Make-up code in sequence. It exist exactly one Terminating code. After the Terminating code the color of pixel alter. The codes are differently for black and white. For line length more then 1728 pixel there are additional Make-up codes. This codes are equal for black and white.
Terminating codes| white | black | |||
| Value | Code | Length | Code | Length |
| 0 | 00110101 | 8 | 0000110111 | 10 |
| 1 | 000111 | 6 | 010 | 3 |
| 2 | 0111 | 4 | 11 | 2 |
| 3 | 1000 | 4 | 10 | 2 |
| 4 | 1011 | 4 | 011 | 3 |
| 5 | 1100 | 4 | 0011 | 4 |
| 6 | 1110 | 4 | 0010 | 4 |
| 7 | 1111 | 4 | 00011 | 5 |
| 8 | 10011 | 5 | 000101 | 6 |
| 9 | 10100 | 5 | 000100 | 6 |
| 10 | 00111 | 5 | 0000100 | 7 |
| 11 | 01000 | 5 | 0000101 | 7 |
| 12 | 001000 | 6 | 0000111 | 7 |
| 13 | 000011 | 6 | 00000100 | 8 |
| 14 | 110100 | 6 | 00000111 | 8 |
| 15 | 110101 | 6 | 000011000 | 9 |
| 16 | 101010 | 6 | 0000010111 | 10 |
| 17 | 101011 | 6 | 0000011000 | 10 |
| 18 | 0100111 | 7 | 0000001000 | 10 |
| 19 | 0001100 | 7 | 00001100111 | 11 |
| 20 | 0001000 | 7 | 00001101000 | 11 |
| 21 | 0010111 | 7 | 00001101100 | 11 |
| 22 | 0000011 | 7 | 00000110111 | 11 |
| 23 | 0000100 | 7 | 00000101000 | 11 |
| 24 | 0101000 | 7 | 00000010111 | 11 |
| 25 | 0101011 | 7 | 00000011000 | 11 |
| 26 | 0010011 | 7 | 000011001010 | 12 |
| 27 | 0100100 | 7 | 000011001011 | 12 |
| 28 | 0011000 | 7 | 000011001100 | 12 |
| 29 | 00000010 | 8 | 000011001101 | 12 |
| 30 | 00000011 | 8 | 000001101000 | 12 |
| 31 | 00011010 | 8 | 000001101001 | 12 |
| 32 | 00011011 | 8 | 000001101010 | 12 |
| 33 | 00010010 | 8 | 000001101011 | 12 |
| 34 | 00010011 | 8 | 000011010010 | 12 |
| 35 | 00010100 | 8 | 000011010011 | 12 |
| 36 | 00010101 | 8 | 000011010100 | 12 |
| 37 | 00010110 | 8 | 000011010101 | 12 |
| 38 | 00010111 | 8 | 000011010110 | 12 |
| 39 | 00101000 | 8 | 000011010111 | 12 |
| 40 | 00101001 | 8 | 000001101100 | 12 |
| 41 | 00101010 | 8 | 000001101101 | 12 |
| 42 | 00101011 | 8 | 000011011010 | 12 |
| 43 | 00101100 | 8 | 000011011011 | 12 |
| 44 | 00101101 | 8 | 000001010100 | 12 |
| 45 | 00000100 | 8 | 000001010101 | 12 |
| 46 | 00000101 | 8 | 000001010110 | 12 |
| 47 | 00001010 | 8 | 000001010111 | 12 |
| 48 | 00001011 | 8 | 000001100100 | 12 |
| 49 | 01010010 | 8 | 000001100101 | 12 |
| 50 | 01010011 | 8 | 000001010010 | 12 |
| 51 | 01010100 | 8 | 000001010011 | 12 |
| 52 | 01010101 | 8 | 000000100100 | 12 |
| 53 | 00100100 | 8 | 000000110111 | 12 |
| 54 | 00100101 | 8 | 000000111000 | 12 |
| 55 | 01011000 | 8 | 000000100111 | 12 |
| 56 | 01011001 | 8 | 000000101000 | 12 |
| 57 | 01011010 | 8 | 000001011000 | 12 |
| 58 | 01011011 | 8 | 000001011001 | 12 |
| 59 | 01001010 | 8 | 000000101011 | 12 |
| 60 | 01001011 | 8 | 000000101100 | 12 |
| 61 | 00110010 | 8 | 000001011010 | 12 |
| 62 | 00110011 | 8 | 000001100110 | 12 |
| 63 | 00110100 | 8 | 000001100111 | 12 |
| EOL | 000000000001 | 12 | 00000000000 | 11 |
| white | black | |||
| Value | Code | Length | Code | Length |
| 64 | 11011 | 5 | 0000001111 | 10 |
| 128 | 10010 | 5 | 000011001000 | 12 |
| 192 | 010111 | 6 | 000011001001 | 12 |
| 256 | 0110111 | 7 | 000001011011 | 12 |
| 320 | 00110110 | 8 | 000000110011 | 12 |
| 384 | 00110111 | 8 | 000000110100 | 12 |
| 448 | 01100100 | 8 | 000000110101 | 12 |
| 512 | 01100101 | 8 | 0000001101100 | 13 |
| 576 | 01101000 | 8 | 0000001101101 | 13 |
| 640 | 01100111 | 8 | 0000001001010 | 13 |
| 704 | 011001100 | 9 | 0000001001011 | 13 |
| 768 | 011001101 | 9 | 0000001001100 | 13 |
| 832 | 011010010 | 9 | 0000001001101 | 13 |
| 896 | 011010011 | 9 | 0000001110010 | 13 |
| 960 | 011010100 | 9 | 0000001110011 | 13 |
| 1024 | 011010101 | 9 | 0000001110100 | 13 |
| 1088 | 011010110 | 9 | 0000001110101 | 13 |
| 1152 | 011010111 | 9 | 0000001110110 | 13 |
| 1216 | 011011000 | 9 | 0000001110111 | 13 |
| 1280 | 011011001 | 9 | 0000001010010 | 13 |
| 1344 | 011011010 | 9 | 0000001010011 | 13 |
| 1408 | 011011011 | 9 | 0000001010100 | 13 |
| 1472 | 010011000 | 9 | 0000001010101 | 13 |
| 1536 | 010011001 | 9 | 0000001011010 | 13 |
| 1600 | 010011010 | 9 | 0000001011011 | 13 |
| 1664 | 011000 | 6 | 0000001100100 | 13 |
| 1728 | 010011011 | 9 | 0000001100101 | 13 |
| Value | Code | Length |
| 1792 | 00000001000 | 11 |
| 1856 | 00000001100 | 11 |
| 1920 | 00000001101 | 11 |
| 1984 | 000000010010 | 12 |
| 2048 | 000000010011 | 12 |
| 2112 | 000000010100 | 12 |
| 2176 | 000000010101 | 12 |
| 2240 | 000000010110 | 12 |
| 2304 | 000000010111 | 12 |
| 2368 | 000000011100 | 12 |
| 2432 | 000000011101 | 12 |
| 2496 | 000000011110 | 12 |
| 2560 | 000000011111 | 12 |
| Mail me at webmaster@pjh2.de. | Disclaimer |