Appendix III: Utility Routines and Data Formats (3)
T4(FAX)
NAME
t4 - the data format defined in CCITT recommendation T4
DESCRIPTION
Dimension and Resolution: In vertical direction the resolu-tion is defined below.
Standard resolution: 3.85 line/mm
Optional higher resolution: 7.70 line/mm
In horizontal direction, the standard resolution is defined as 1728 black and white picture elements along the standard line length of 215 mm. Optionally, there can be 2048 or 2432 picture elements along a scan line length of 255 or 303 mm, respectively. The input documents up to a minimum of ISO A4 size should be accepted.
One-Dimensional Coding: The one-dimensional run length data compression is accomplished by the popular modified Huffman coding scheme. In this scheme, black and white runs are re-placed by a base 64 codes representation. Compression is achieved since the code word lengths are invertly related to the probability of the occurrence of a particular run. A special code (000000000001), known as EOL (End of Line), follows each line of data. This code starts the facsimile message phase, while the control phase is restored by a com-bination of six contiguous EOLs (RTC). The data format of a facsimile message is shown below.
start of the facsimile data
|
v
+---+------+---+------+-/
!EOL! DATA !EOL! DATA !
+---+------+---+------+-/
end of the facsimile data
|
v
/-+---+------+---+---+---+---+---+---+
!EOL! DATA !EOL!EOL!EOL!EOL!EOL!EOL!
/-+---+------+---+---+---+---+---+---+
|<------ RTC ------->|
Two-Dimensional Coding: The two-dimensional coding scheme is labeled as the Modified READ Code. It codes one line with reference to the line above,correlation between adja-cent lines allowing for more efficient compression. In order to limit the disturbed area in the event of transmission er-rors, a one-dimensionally coded line is transmitted after one or more two-dimensionally coded lines. A bit, following the EOL, indicates whether one- or two-dimensional coding is used for the next line:
EOL1: one-dimensional coding;
EOL0: two-dimensional coding.
start of the facsimile data
|
v
+----+--------+----+--------+-/
!EOL1!DATA(1D)!EOL0!DATA(2D)!
+----+--------+----+--------+-/
end of the facsimile data
|
v
/-+----+--------+----+----+----+----+----+----+
!EOL0!DATA(2D)!EOL1!EOL1!EOL1!EOL1!EOL1!EOL1!
/-+----+--------+----+----+----+----+----+----+
|<--------- RTC --------->|
TEXT(FAX)
NAME
text - the text format for use in the facsimile system
DESCRIPTION
This is the representation structure for coded character text. It is used in the facsimile system.
The text structure consists of a series of character strings, each of which represents a text line. However no control characters, e.g. <CR> and <LF>, are used in the structure. Each text line is proeeded by a count byte, indi-cating the number of characters on the line. The character sting follows after the the count byte. A zero count indi-cates the end of file.
EXAMPLES
Here is an example text shown below:
This is a text.
This is a picture.
It can be represented as:
<017> T h i s <040> i s <040> a <040> t e x t .
<022> T h i s <040> i s <040> a <040> p i c t u
r e . <0>
TS(FAX)
NAME
ts - translate an ASCII string into vector format
SYNOPSIS
ts(ar_in, left, right, tid)
char *ar_in;
int left, right, tid;
DESCRIPTION
This routine will convert a zero-ended ASCII string pointed to by ar_in into the corresponding vecter format. As the character font being used is a set of 12x20 matrices, there will be 20 line vectors created. These vectors are written to the Cleans and Simple interface by calling cswrite. The callers task identifier tid has to be provided.
At the two ends of the text line, blanks can be padded that are specified as left and right. Note that they are meas-ured in pels.
Consequently, the result should be a image, whose dimension is:
width = left + 12*length + right;
height = 20;
where length is the number of characters in the input string.
As an intermediate result the bitmap is first created which is then converted into the vector format, by calling tovec.
BUGS
The input string must be ended with a zero field.
SEE ALSO
vector(fax), tovec(fax), csinit(fax), cswrite(fax), fitter(fax)
VECTOR(FAX)
NAME
vector - the internal data structure for a facsimile image
DESCRIPTION
This is the representation structure for binary images, a simple run length compression algorithm being used. Most of the image files are kept in vector format for ease of pro-cessing.
The vector format consists of a series of integer vectors, one vector for each row of pels in the image. Each vector is proceeded by a count word which indicates the number of in-teger words in the vector. The next element of the vector after the count field is the number of white pels in the first run of the line. The second word then gives the number of pels that follow the initial white run, and so on t the end of the vector. Note the first run length element must refer to a white run. It should be set to 0 if the first run is black.
EXAMPLES
A line consists of 20 pels as follows:
00011111111011100000
It can be represented as:
5, 3, 8, 1, 3, 5
The inverse of the line:
11100000000100011111
should be represented as:
6, 0, 3, 8, 1, 3, 5