spandsp 3.0.0
t4_rx.h
Go to the documentation of this file.
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * t4_rx.h - definitions for T.4 FAX receive processing
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2003 Steve Underwood
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 2.1,
14 * as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26/*! \file */
27
28#if !defined(_SPANDSP_T4_RX_H_)
29#define _SPANDSP_T4_RX_H_
30
31/*! \page t4_page T.4 image compression and decompression
32
33\section t4_page_sec_1 What does it do?
34The T.4 image compression and decompression routines implement the 1D and 2D
35encoding methods defined in ITU specification T.4. They also implement the pure
362D encoding method defined in T.6. These are image compression algorithms used
37for FAX transmission.
38
39\section t4_page_sec_1 How does it work?
40*/
41
42/*! This function is a callback from the image decoders, to write the decoded bi-level image,
43 row by row. It is called for each row, with len set to the number of bytes per row. At the
44 end of the image it is called with len set to zero, to indicate the end of image condition.
45 \return 0 for OK, or non-zero for a problem that requires the image be interrupted. */
46typedef int (*t4_row_write_handler_t)(void *user_data, const uint8_t buf[], size_t len);
47
48/*! Supported compression modes. */
49typedef enum
50{
51 /*! No compression */
53 /*! T.4 1D compression */
55 /*! T.4 2D compression */
57 /*! T.6 2D compression */
59 /*! T.85 monochrome JBIG coding with L0 fixed. */
61 /*! T.85 monochrome JBIG coding with L0 variable. */
63 /*! T.43 gray-scale/colour JBIG coding */
65 /*! T.45 run length colour compression */
67 /*! T.42 + T.81 + T.30 Annex E colour JPEG coding */
69 /*! T.42 + T.81 + T.30 Annex K colour sYCC-JPEG coding */
71 /*! T.88 monochrome JBIG2 compression */
73 /*! Uncompressed image. This compression cannot be used for FAXes. It is provided for specifying
74 output formats for received images. */
76 /*! Conventional JPEG. This compression cannot be used for FAXes. It is provided for specifying
77 output formats for received images. */
79 /*! Support solour compression without sub-sampling */
81 /*! Gray-scale support by multi-level codecs */
83 /*! Colour support by multi-level codecs */
85 /*! 12 bit mode for gray-scale and colour */
87 /*! Convert a colour image to a gray-scale one */
89 /*! Dither a gray-scale image down a simple bilevel image, with rescaling to fit a FAX page */
91 /*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */
93 /*! Rescale an image (except a bi-level image) to fit a permitted FAX width when necessary */
96
97/*! Image type */
98typedef enum
99{
100 /* Traditional black and white FAX */
101 T4_IMAGE_TYPE_BILEVEL = 0,
102 /* RGB or CMY image */
103 T4_IMAGE_TYPE_COLOUR_BILEVEL = 1,
104 /* CMYK image */
105 T4_IMAGE_TYPE_4COLOUR_BILEVEL = 2,
106 /* 2 to 8 bits per pixel gray-scale image */
107 T4_IMAGE_TYPE_GRAY_8BIT = 3,
108 /* 9 to 12 bits per pixel gray-scale image */
109 T4_IMAGE_TYPE_GRAY_12BIT = 4,
110 /* 2 to 8 bits per pixel RGB or CMY colour image */
111 T4_IMAGE_TYPE_COLOUR_8BIT = 5,
112 /* 2 to 8 bits per pixel CMYK colour image */
113 T4_IMAGE_TYPE_4COLOUR_8BIT = 6,
114 /* 9 to 12 bits per pixel RGB or CMY colour image */
115 T4_IMAGE_TYPE_COLOUR_12BIT = 7,
116 /* 9 to 12 bits per pixel CMYK colour image */
117 T4_IMAGE_TYPE_4COLOUR_12BIT = 8
119
120/*! Supported X resolutions, in pixels per metre. */
121typedef enum
122{
123 T4_X_RESOLUTION_100 = 3937,
124 T4_X_RESOLUTION_R4 = 4020,
125 T4_X_RESOLUTION_200 = 7874,
126 T4_X_RESOLUTION_R8 = 8040,
127 T4_X_RESOLUTION_300 = 11811,
128 T4_X_RESOLUTION_400 = 15748,
129 T4_X_RESOLUTION_R16 = 16080,
130 T4_X_RESOLUTION_600 = 23622,
131 T4_X_RESOLUTION_1200 = 47244
133
134/*! Supported Y resolutions, in pixels per metre. */
135typedef enum
136{
137 T4_Y_RESOLUTION_STANDARD = 3850,
138 T4_Y_RESOLUTION_100 = 3937,
139 T4_Y_RESOLUTION_FINE = 7700,
140 T4_Y_RESOLUTION_200 = 7874,
141 T4_Y_RESOLUTION_300 = 11811,
142 T4_Y_RESOLUTION_SUPERFINE = 15400,
143 T4_Y_RESOLUTION_400 = 15748,
144 T4_Y_RESOLUTION_600 = 23622,
145 T4_Y_RESOLUTION_800 = 31496,
146 T4_Y_RESOLUTION_1200 = 47244
148
149/* Only the symmetric resolutions are valid for gray-scale and colour use. The asymmetric
150 ones are bi-level only. */
151enum
152{
153 /*! Standard FAX resolution 204dpi x 98dpi - bi-level only */
155 /*! Fine FAX resolution 204dpi x 196dpi - bi-level only */
157 /*! Super-fine FAX resolution 204dpi x 391dpi - bi-level only */
159 /*! Double FAX resolution 408dpi x 391dpi - bi-level only */
161
162 /*! 100dpi x 100dpi - gray-scale and colour only */
164 /*! 200dpi x 100dpi - bi-level only */
166 /*! 200dpi x 200dpi */
168 /*! 200dpi x 400dpi - bi-level only */
170 /*! 300dpi x 300dpi */
172 /*! 300dpi x 600dpi - bi-level only */
174 /*! 400dpi x 400dpi */
176 /*! 400dpi x 800dpi - bi-level only */
178 /*! 600dpi x 600dpi */
180 /*! 600dpi x 1200dpi - bi-level only */
182 /*! 1200dpi x 1200dpi */
184};
185
186/*!
187 Exact widths in PELs for the difference resolutions, and page widths.
188 Note:
189 The A4 widths also apply to North American letter and legal.
190 The R4 resolution widths are not supported in recent versions of T.30
191 Only images of exactly these widths are acceptable for FAX transmisson.
192
193 R4 864 pels/215mm for ISO A4, North American Letter and Legal
194 R4 1024 pels/255mm for ISO B4
195 R4 1216 pels/303mm for ISO A3
196 R8 1728 pels/215mm for ISO A4, North American Letter and Legal
197 R8 2048 pels/255mm for ISO B4
198 R8 2432 pels/303mm for ISO A3
199 R16 3456 pels/215mm for ISO A4, North American Letter and Legal
200 R16 4096 pels/255mm for ISO B4
201 R16 4864 pels/303mm for ISO A3
202
203 100 864 pels/219.46mm for ISO A4, North American Letter and Legal
204 100 1024 pels/260.10mm for ISO B4
205 100 1216 pels/308.86mm for ISO A3
206 200 1728 pels/219.46mm for ISO A4, North American Letter and Legal
207 200 2048 pels/260.10mm for ISO B4
208 200 2432 pels/308.86mm for ISO A3
209 300 2592 pels/219.46mm for ISO A4, North American Letter and Legal
210 300 3072 pels/260.10mm for ISO B4
211 300 3648 pels/308.86mm for ISO A3
212 400 3456 pels/219.46mm for ISO A4, North American Letter and Legal
213 400 4096 pels/260.10mm for ISO B4
214 400 4864 pels/308.86mm for ISO A3
215 600 5184 pels/219.46mm for ISO A4, North American Letter and Legal
216 600 6144 pels/260.10mm for ISO B4
217 600 7296 pels/308.86mm for ISO A3
218 1200 10368 pels/219.46mm for ISO A4, North American Letter and Legal
219 1200 12288 pels/260.10mm for ISO B4
220 1200 14592 pels/308.86mm for ISO A3
221
222 Note that R4, R8 and R16 widths are 5mm wider than the actual paper sizes.
223 The 100, 200, 300, 400, 600, and 1200 widths are 9.46mm, 10.1mm and 11.86mm
224 wider than the paper sizes.
225*/
226typedef enum
227{
228 T4_WIDTH_100_A4 = 864,
229 T4_WIDTH_100_B4 = 1024,
230 T4_WIDTH_100_A3 = 1216,
231 T4_WIDTH_200_A4 = 1728,
232 T4_WIDTH_200_B4 = 2048,
233 T4_WIDTH_200_A3 = 2432,
234 T4_WIDTH_300_A4 = 2592,
235 T4_WIDTH_300_B4 = 3072,
236 T4_WIDTH_300_A3 = 3648,
237 T4_WIDTH_400_A4 = 3456,
238 T4_WIDTH_400_B4 = 4096,
239 T4_WIDTH_400_A3 = 4864,
240 T4_WIDTH_600_A4 = 5184,
241 T4_WIDTH_600_B4 = 6144,
242 T4_WIDTH_600_A3 = 7296,
243 T4_WIDTH_1200_A4 = 10368,
244 T4_WIDTH_1200_B4 = 12288,
245 T4_WIDTH_1200_A3 = 14592
247
248#define T4_WIDTH_R4_A4 T4_WIDTH_100_A4
249#define T4_WIDTH_R4_B4 T4_WIDTH_100_B4
250#define T4_WIDTH_R4_A3 T4_WIDTH_100_A3
251
252#define T4_WIDTH_R8_A4 T4_WIDTH_200_A4
253#define T4_WIDTH_R8_B4 T4_WIDTH_200_B4
254#define T4_WIDTH_R8_A3 T4_WIDTH_200_A3
255
256#define T4_WIDTH_R16_A4 T4_WIDTH_400_A4
257#define T4_WIDTH_R16_B4 T4_WIDTH_400_B4
258#define T4_WIDTH_R16_A3 T4_WIDTH_400_A3
259
260/*!
261 Length of the various supported paper sizes, in pixels at the various Y resolutions.
262 Paper sizes are
263 A4 (210mm x 297mm)
264 B4 (250mm x 353mm)
265 A3 (297mm x 420mm)
266 North American Letter (215.9mm x 279.4mm or 8.5"x11")
267 North American Legal (215.9mm x 355.6mm or 8.4"x14")
268 Unlimited
269
270 T.4 does not accurately define the maximum number of scan lines in a page. A wide
271 variety of maximum row counts are used in the real world. It is important not to
272 set our sending limit too high, or a receiving machine might split pages. It is
273 important not to set it too low, or we might clip pages.
274
275 Values seen for standard resolution A4 pages include 1037, 1045, 1109, 1126 and 1143.
276 1109 seems the most-popular. At fine res 2150, 2196, 2200, 2237, 2252-2262, 2264,
277 2286, and 2394 are used. 2255 seems the most popular. We try to use balanced choices
278 here. 1143 pixels at 3.85/mm is 296.9mm, and an A4 page is 297mm long.
279*/
280typedef enum
281{
282 /* A4 is 297mm long */
283 T4_LENGTH_STANDARD_A4 = 1143,
284 T4_LENGTH_FINE_A4 = 2286,
285 T4_LENGTH_300_A4 = 4665,
286 T4_LENGTH_SUPERFINE_A4 = 4573,
287 T4_LENGTH_600_A4 = 6998,
288 T4_LENGTH_800_A4 = 9330,
289 T4_LENGTH_1200_A4 = 13996,
290 /* B4 is 353mm long */
291 T4_LENGTH_STANDARD_B4 = 1359,
292 T4_LENGTH_FINE_B4 = 2718,
293 T4_LENGTH_300_B4 = 4169,
294 T4_LENGTH_SUPERFINE_B4 = 5436,
295 T4_LENGTH_600_B4 = 8338,
296 T4_LENGTH_800_B4 = 11118,
297 T4_LENGTH_1200_B4 = 16677,
298 /* A3 is 420mm long */
299 T4_LENGTH_STANDARD_A3 = 1617,
300 T4_LENGTH_FINE_A3 = 3234,
301 T4_LENGTH_300_A3 = 4960,
302 T4_LENGTH_SUPERFINE_A3 = 6468,
303 T4_LENGTH_600_A3 = 9921,
304 T4_LENGTH_800_A3 = 13228,
305 T4_LENGTH_1200_A3 = 19842,
306 /* North American letter is 279.4mm long */
307 T4_LENGTH_STANDARD_US_LETTER = 1075,
308 T4_LENGTH_FINE_US_LETTER = 2151,
309 T4_LENGTH_300_US_LETTER = 3300,
310 T4_LENGTH_SUPERFINE_US_LETTER = 4302,
311 T4_LENGTH_600_US_LETTER = 6700,
312 T4_LENGTH_800_US_LETTER = 8800,
313 T4_LENGTH_1200_US_LETTER = 13200,
314 /* North American legal is 355.6mm long */
315 T4_LENGTH_STANDARD_US_LEGAL = 1369,
316 T4_LENGTH_FINE_US_LEGAL = 2738,
317 T4_LENGTH_300_US_LEGAL = 4200,
318 T4_LENGTH_SUPERFINE_US_LEGAL = 5476,
319 T4_LENGTH_600_US_LEGAL = 8400,
320 T4_LENGTH_800_US_LEGAL = 11200,
321 T4_LENGTH_1200_US_LEGAL = 16800
323
324enum
325{
326 T4_SUPPORT_WIDTH_215MM = 0x01,
327 T4_SUPPORT_WIDTH_255MM = 0x02,
328 T4_SUPPORT_WIDTH_303MM = 0x04,
329
330 T4_SUPPORT_LENGTH_UNLIMITED = 0x10000,
331 T4_SUPPORT_LENGTH_A4 = 0x20000,
332 T4_SUPPORT_LENGTH_B4 = 0x40000,
333 T4_SUPPORT_LENGTH_US_LETTER = 0x80000,
334 T4_SUPPORT_LENGTH_US_LEGAL = 0x100000
335};
336
337/*! Return values from the T.85 decoder */
338typedef enum
339{
340 /*! More image data is needed */
342 /*! Image completed successfully */
344 /*! The decoder has interrupted */
346 /*! An abort was found in the image data */
348 /*! A memory allocation error occurred */
350 /*! The image data is invalid. */
353
354/*!
355 T.4 FAX compression/decompression descriptor. This defines the working state
356 for a single instance of a T.4 FAX compression or decompression channel.
357*/
359
360/*!
361 T.4 FAX compression/decompression statistics.
362*/
363typedef struct
364{
365 /*! \brief The number of pages transferred so far. */
367 /*! \brief The number of pages in the file (<0 if unknown). */
369 /*! \brief The number of bad pixel rows in the most recent page. */
371 /*! \brief The largest number of bad pixel rows in a block in the most recent page. */
373 /*! \brief The type of image in the file page */
375 /*! \brief The horizontal resolution of the file page in pixels per metre */
377 /*! \brief The vertical resolution of the file page in pixels per metre */
379 /*! \brief The number of horizontal pixels in the file page. */
381 /*! \brief The number of vertical pixels in the file page. */
383 /*! \brief The type of image in the exchanged page */
384 int type;
385 /*! \brief The horizontal resolution of the exchanged page in pixels per metre */
387 /*! \brief The vertical resolution of the exchanged page in pixels per metre */
389 /*! \brief The number of horizontal pixels in the exchanged page. */
390 int width;
391 /*! \brief The number of vertical pixels in the exchanged page. */
393 /*! \brief The type of compression used between the FAX machines */
395 /*! \brief The size of the image on the line, in bytes */
397} t4_stats_t;
398
399#if defined(__cplusplus)
400extern "C" {
401#endif
402
403/*! \brief Prepare to receive the next page of the current document.
404 \param s The T.4 context.
405 \return zero for success, -1 for failure. */
406SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s);
407
408/*! \brief Put a bit of the current document page.
409 \param s The T.4 context.
410 \param bit The data bit.
411 \return Decode status. */
412SPAN_DECLARE(int) t4_rx_put_bit(t4_rx_state_t *s, int bit);
413
414/*! \brief Put a byte of the current document page.
415 \param s The T.4 context.
416 \param buf The buffer containing the chunk.
417 \param len The length of the chunk.
418 \return Decode status. */
419SPAN_DECLARE(int) t4_rx_put(t4_rx_state_t *s, const uint8_t buf[], size_t len);
420
421/*! \brief Complete the reception of a page.
422 \param s The T.4 receive context.
423 \return 0 for success, otherwise -1. */
424SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s);
425
426/*! \brief Set the row write handler for a T.4 receive context.
427 \param s The T.4 receive context.
428 \param handler A pointer to the handler routine.
429 \param user_data An opaque pointer passed to the handler routine.
430 \return 0 for success, otherwise -1. */
431SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_rx_state_t *s, t4_row_write_handler_t handler, void *user_data);
432
433/*! \brief Set the encoding for the received data.
434 \param s The T.4 context.
435 \param encoding The encoding.
436 \return 0 for success, otherwise -1. */
437SPAN_DECLARE(int) t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding);
438
439/*! \brief Set the expected width of the received image, in pixel columns.
440 \param s The T.4 context.
441 \param width The number of pixels across the image. */
442SPAN_DECLARE(void) t4_rx_set_image_width(t4_rx_state_t *s, int width);
443
444/*! \brief Set the row-to-row (y) resolution to expect for a received image.
445 \param s The T.4 context.
446 \param resolution The resolution, in pixels per metre. */
447SPAN_DECLARE(void) t4_rx_set_y_resolution(t4_rx_state_t *s, int resolution);
448
449/*! \brief Set the column-to-column (x) resolution to expect for a received image.
450 \param s The T.4 context.
451 \param resolution The resolution, in pixels per metre. */
452SPAN_DECLARE(void) t4_rx_set_x_resolution(t4_rx_state_t *s, int resolution);
453
454/*! \brief Set the DCS information of the fax, for inclusion in the file.
455 \param s The T.4 context.
456 \param dcs The DCS information, formatted as an ASCII string. */
457SPAN_DECLARE(void) t4_rx_set_dcs(t4_rx_state_t *s, const char *dcs);
458
459/*! \brief Set the sub-address of the fax, for inclusion in the file.
460 \param s The T.4 context.
461 \param sub_address The sub-address string. */
462SPAN_DECLARE(void) t4_rx_set_sub_address(t4_rx_state_t *s, const char *sub_address);
463
464/*! \brief Set the identity of the remote machine, for inclusion in the file.
465 \param s The T.4 context.
466 \param ident The identity string. */
467SPAN_DECLARE(void) t4_rx_set_far_ident(t4_rx_state_t *s, const char *ident);
468
469/*! \brief Set the vendor of the remote machine, for inclusion in the file.
470 \param s The T.4 context.
471 \param vendor The vendor string, or NULL. */
472SPAN_DECLARE(void) t4_rx_set_vendor(t4_rx_state_t *s, const char *vendor);
473
474/*! \brief Set the model of the remote machine, for inclusion in the file.
475 \param s The T.4 context.
476 \param model The model string, or NULL. */
477SPAN_DECLARE(void) t4_rx_set_model(t4_rx_state_t *s, const char *model);
478
479/*! Get the current image transfer statistics.
480 \brief Get the current transfer statistics.
481 \param s The T.4 context.
482 \param t A pointer to a statistics structure. */
484
485/*! Get the short text name of a compression format.
486 \brief Get the short text name of an encoding format.
487 \param compression The compression type.
488 \return A pointer to the string. */
489SPAN_DECLARE(const char *) t4_compression_to_str(int compression);
490
491/*! Get the short text name of an image format.
492 \brief Get the short text name of an image format.
493 \param type The image format.
494 \return A pointer to the string. */
495SPAN_DECLARE(const char *) t4_image_type_to_str(int type);
496
497/*! Get the short text name of an image resolution.
498 \brief Get the short text name of an image resolution.
499 \param resolution_code The image resolution code.
500 \return A pointer to the string. */
501SPAN_DECLARE(const char *) t4_image_resolution_to_str(int resolution_code);
502
503/*! Get the logging context associated with a T.4 receive context.
504 \brief Get the logging context associated with a T.4 receive context.
505 \param s The T.4 receive context.
506 \return A pointer to the logging context */
508
509/*! \brief Prepare for reception of a document.
510 \param s The T.4 context.
511 \param file The name of the file to be received.
512 \param supported_output_compressions The compression schemes supported for output to a TIFF file.
513 \return A pointer to the context, or NULL if there was a problem. */
514SPAN_DECLARE(t4_rx_state_t *) t4_rx_init(t4_rx_state_t *s, const char *file, int supported_output_compressions);
515
516/*! \brief End reception of a document. Tidy up and close the file.
517 This should be used to end T.4 reception started with t4_rx_init.
518 \param s The T.4 receive context.
519 \return 0 for success, otherwise -1. */
520SPAN_DECLARE(int) t4_rx_release(t4_rx_state_t *s);
521
522/*! \brief End reception of a document. Tidy up, close the file and
523 free the context. This should be used to end T.4 reception
524 started with t4_rx_init.
525 \param s The T.4 receive context.
526 \return 0 for success, otherwise -1. */
527SPAN_DECLARE(int) t4_rx_free(t4_rx_state_t *s);
528
529#if defined(__cplusplus)
530}
531#endif
532
533#endif
534/*- End of file ------------------------------------------------------------*/
struct logging_state_s logging_state_t
Definition logging.h:72
Definition private/t4_rx.h:106
Definition t4_rx.h:364
int pages_transferred
The number of pages transferred so far.
Definition t4_rx.h:366
int type
The type of image in the exchanged page.
Definition t4_rx.h:384
int compression
The type of compression used between the FAX machines.
Definition t4_rx.h:394
int image_y_resolution
The vertical resolution of the file page in pixels per metre.
Definition t4_rx.h:378
int length
The number of vertical pixels in the exchanged page.
Definition t4_rx.h:392
int pages_in_file
The number of pages in the file (<0 if unknown).
Definition t4_rx.h:368
int y_resolution
The vertical resolution of the exchanged page in pixels per metre.
Definition t4_rx.h:388
int bad_rows
The number of bad pixel rows in the most recent page.
Definition t4_rx.h:370
int image_type
The type of image in the file page.
Definition t4_rx.h:374
int image_width
The number of horizontal pixels in the file page.
Definition t4_rx.h:380
int image_x_resolution
The horizontal resolution of the file page in pixels per metre.
Definition t4_rx.h:376
int x_resolution
The horizontal resolution of the exchanged page in pixels per metre.
Definition t4_rx.h:386
int image_length
The number of vertical pixels in the file page.
Definition t4_rx.h:382
int longest_bad_row_run
The largest number of bad pixel rows in a block in the most recent page.
Definition t4_rx.h:372
int line_image_size
The size of the image on the line, in bytes.
Definition t4_rx.h:396
int width
The number of horizontal pixels in the exchanged page.
Definition t4_rx.h:390
void t4_rx_set_sub_address(t4_rx_state_t *s, const char *sub_address)
Set the sub-address of the fax, for inclusion in the file.
Definition t4_rx.c:906
t4_image_compression_t
Definition t4_rx.h:50
@ T4_COMPRESSION_T4_1D
Definition t4_rx.h:54
@ T4_COMPRESSION_GRAY_TO_BILEVEL
Definition t4_rx.h:90
@ T4_COMPRESSION_T85
Definition t4_rx.h:60
@ T4_COMPRESSION_T42_T81
Definition t4_rx.h:68
@ T4_COMPRESSION_COLOUR
Definition t4_rx.h:84
@ T4_COMPRESSION_GRAYSCALE
Definition t4_rx.h:82
@ T4_COMPRESSION_NONE
Definition t4_rx.h:52
@ T4_COMPRESSION_JPEG
Definition t4_rx.h:78
@ T4_COMPRESSION_12BIT
Definition t4_rx.h:86
@ T4_COMPRESSION_NO_SUBSAMPLING
Definition t4_rx.h:80
@ T4_COMPRESSION_T85_L0
Definition t4_rx.h:62
@ T4_COMPRESSION_T88
Definition t4_rx.h:72
@ T4_COMPRESSION_SYCC_T81
Definition t4_rx.h:70
@ T4_COMPRESSION_COLOUR_TO_BILEVEL
Definition t4_rx.h:92
@ T4_COMPRESSION_RESCALING
Definition t4_rx.h:94
@ T4_COMPRESSION_T45
Definition t4_rx.h:66
@ T4_COMPRESSION_COLOUR_TO_GRAY
Definition t4_rx.h:88
@ T4_COMPRESSION_T6
Definition t4_rx.h:58
@ T4_COMPRESSION_T4_2D
Definition t4_rx.h:56
@ T4_COMPRESSION_T43
Definition t4_rx.h:64
@ T4_COMPRESSION_UNCOMPRESSED
Definition t4_rx.h:75
t4_rx_state_t * t4_rx_init(t4_rx_state_t *s, const char *file, int supported_output_compressions)
Prepare for reception of a document.
Definition t4_rx.c:1421
int t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding)
Set the encoding for the received data.
Definition t4_rx.c:1007
int t4_rx_start_page(t4_rx_state_t *s)
Prepare to receive the next page of the current document.
Definition t4_rx.c:1276
int t4_rx_set_row_write_handler(t4_rx_state_t *s, t4_row_write_handler_t handler, void *user_data)
Set the row write handler for a T.4 receive context.
Definition t4_rx.c:1174
void t4_rx_set_far_ident(t4_rx_state_t *s, const char *ident)
Set the identity of the remote machine, for inclusion in the file.
Definition t4_rx.c:912
t4_image_x_resolution_t
Definition t4_rx.h:122
t4_image_width_t
Definition t4_rx.h:227
t4_image_types_t
Definition t4_rx.h:99
int t4_rx_put(t4_rx_state_t *s, const uint8_t buf[], size_t len)
Put a byte of the current document page.
Definition t4_rx.c:876
t4_decoder_status_t
Definition t4_rx.h:339
@ T4_DECODE_NOMEM
Definition t4_rx.h:349
@ T4_DECODE_MORE_DATA
Definition t4_rx.h:341
@ T4_DECODE_OK
Definition t4_rx.h:343
@ T4_DECODE_INVALID_DATA
Definition t4_rx.h:351
@ T4_DECODE_ABORTED
Definition t4_rx.h:347
@ T4_DECODE_INTERRUPT
Definition t4_rx.h:345
void t4_rx_set_x_resolution(t4_rx_state_t *s, int resolution)
Set the column-to-column (x) resolution to expect for a received image.
Definition t4_rx.c:894
logging_state_t * t4_rx_get_logging_state(t4_rx_state_t *s)
Get the logging context associated with a T.4 receive context.
Definition t4_rx.c:1415
const char * t4_compression_to_str(int compression)
Get the short text name of an encoding format.
Definition t4_rx.c:98
struct t4_rx_state_s t4_rx_state_t
Definition t4_rx.h:358
const char * t4_image_resolution_to_str(int resolution_code)
Get the short text name of an image resolution.
Definition t4_rx.c:163
void t4_rx_set_model(t4_rx_state_t *s, const char *model)
Set the model of the remote machine, for inclusion in the file.
Definition t4_rx.c:924
const char * t4_image_type_to_str(int type)
Get the short text name of an image format.
Definition t4_rx.c:135
@ T4_RESOLUTION_R8_FINE
Definition t4_rx.h:156
@ T4_RESOLUTION_400_400
Definition t4_rx.h:175
@ T4_RESOLUTION_300_600
Definition t4_rx.h:173
@ T4_RESOLUTION_200_400
Definition t4_rx.h:169
@ T4_RESOLUTION_1200_1200
Definition t4_rx.h:183
@ T4_RESOLUTION_100_100
Definition t4_rx.h:163
@ T4_RESOLUTION_R16_SUPERFINE
Definition t4_rx.h:160
@ T4_RESOLUTION_200_200
Definition t4_rx.h:167
@ T4_RESOLUTION_600_1200
Definition t4_rx.h:181
@ T4_RESOLUTION_R8_SUPERFINE
Definition t4_rx.h:158
@ T4_RESOLUTION_600_600
Definition t4_rx.h:179
@ T4_RESOLUTION_R8_STANDARD
Definition t4_rx.h:154
@ T4_RESOLUTION_200_100
Definition t4_rx.h:165
@ T4_RESOLUTION_400_800
Definition t4_rx.h:177
@ T4_RESOLUTION_300_300
Definition t4_rx.h:171
int t4_rx_free(t4_rx_state_t *s)
End reception of a document. Tidy up, close the file and free the context. This should be used to end...
Definition t4_rx.c:1494
t4_image_length_t
Definition t4_rx.h:281
void t4_rx_set_image_width(t4_rx_state_t *s, int width)
Set the expected width of the received image, in pixel columns.
Definition t4_rx.c:1168
void t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t)
Get the current transfer statistics.
Definition t4_rx.c:1202
t4_image_y_resolution_t
Definition t4_rx.h:136
int t4_rx_put_bit(t4_rx_state_t *s, int bit)
Put a bit of the current document page.
Definition t4_rx.c:817
int t4_rx_release(t4_rx_state_t *s)
End reception of a document. Tidy up and close the file. This should be used to end T....
Definition t4_rx.c:1484
int(* t4_row_write_handler_t)(void *user_data, const uint8_t buf[], size_t len)
Definition t4_rx.h:46
void t4_rx_set_vendor(t4_rx_state_t *s, const char *vendor)
Set the vendor of the remote machine, for inclusion in the file.
Definition t4_rx.c:918
void t4_rx_set_dcs(t4_rx_state_t *s, const char *dcs)
Set the DCS information of the fax, for inclusion in the file.
Definition t4_rx.c:900
void t4_rx_set_y_resolution(t4_rx_state_t *s, int resolution)
Set the row-to-row (y) resolution to expect for a received image.
Definition t4_rx.c:888
int t4_rx_end_page(t4_rx_state_t *s)
Complete the reception of a page.
Definition t4_rx.c:1350