spandsp 3.0.0
t4_rx.h File Reference

Go to the source code of this file.

Classes

struct  t4_stats_t
 

Macros

#define T4_WIDTH_R4_A4   T4_WIDTH_100_A4
 
#define T4_WIDTH_R4_B4   T4_WIDTH_100_B4
 
#define T4_WIDTH_R4_A3   T4_WIDTH_100_A3
 
#define T4_WIDTH_R8_A4   T4_WIDTH_200_A4
 
#define T4_WIDTH_R8_B4   T4_WIDTH_200_B4
 
#define T4_WIDTH_R8_A3   T4_WIDTH_200_A3
 
#define T4_WIDTH_R16_A4   T4_WIDTH_400_A4
 
#define T4_WIDTH_R16_B4   T4_WIDTH_400_B4
 
#define T4_WIDTH_R16_A3   T4_WIDTH_400_A3
 

Typedefs

typedef int(* t4_row_write_handler_t) (void *user_data, const uint8_t buf[], size_t len)
 
typedef struct t4_rx_state_s t4_rx_state_t
 

Enumerations

enum  t4_image_compression_t {
  T4_COMPRESSION_NONE = 0x01 , T4_COMPRESSION_T4_1D = 0x02 , T4_COMPRESSION_T4_2D = 0x04 , T4_COMPRESSION_T6 = 0x08 ,
  T4_COMPRESSION_T85 = 0x10 , T4_COMPRESSION_T85_L0 = 0x20 , T4_COMPRESSION_T43 = 0x40 , T4_COMPRESSION_T45 = 0x80 ,
  T4_COMPRESSION_T42_T81 = 0x100 , T4_COMPRESSION_SYCC_T81 = 0x200 , T4_COMPRESSION_T88 = 0x400 , T4_COMPRESSION_UNCOMPRESSED = 0x1000 ,
  T4_COMPRESSION_JPEG = 0x2000 , T4_COMPRESSION_NO_SUBSAMPLING = 0x800000 , T4_COMPRESSION_GRAYSCALE = 0x1000000 , T4_COMPRESSION_COLOUR = 0x2000000 ,
  T4_COMPRESSION_12BIT = 0x4000000 , T4_COMPRESSION_COLOUR_TO_GRAY = 0x8000000 , T4_COMPRESSION_GRAY_TO_BILEVEL = 0x10000000 , T4_COMPRESSION_COLOUR_TO_BILEVEL = 0x20000000 ,
  T4_COMPRESSION_RESCALING = 0x40000000
}
 
enum  t4_image_types_t {
  T4_IMAGE_TYPE_BILEVEL = 0 , T4_IMAGE_TYPE_COLOUR_BILEVEL = 1 , T4_IMAGE_TYPE_4COLOUR_BILEVEL = 2 , T4_IMAGE_TYPE_GRAY_8BIT = 3 ,
  T4_IMAGE_TYPE_GRAY_12BIT = 4 , T4_IMAGE_TYPE_COLOUR_8BIT = 5 , T4_IMAGE_TYPE_4COLOUR_8BIT = 6 , T4_IMAGE_TYPE_COLOUR_12BIT = 7 ,
  T4_IMAGE_TYPE_4COLOUR_12BIT = 8
}
 
enum  t4_image_x_resolution_t {
  T4_X_RESOLUTION_100 = 3937 , T4_X_RESOLUTION_R4 = 4020 , T4_X_RESOLUTION_200 = 7874 , T4_X_RESOLUTION_R8 = 8040 ,
  T4_X_RESOLUTION_300 = 11811 , T4_X_RESOLUTION_400 = 15748 , T4_X_RESOLUTION_R16 = 16080 , T4_X_RESOLUTION_600 = 23622 ,
  T4_X_RESOLUTION_1200 = 47244
}
 
enum  t4_image_y_resolution_t {
  T4_Y_RESOLUTION_STANDARD = 3850 , T4_Y_RESOLUTION_100 = 3937 , T4_Y_RESOLUTION_FINE = 7700 , T4_Y_RESOLUTION_200 = 7874 ,
  T4_Y_RESOLUTION_300 = 11811 , T4_Y_RESOLUTION_SUPERFINE = 15400 , T4_Y_RESOLUTION_400 = 15748 , T4_Y_RESOLUTION_600 = 23622 ,
  T4_Y_RESOLUTION_800 = 31496 , T4_Y_RESOLUTION_1200 = 47244
}
 
enum  {
  T4_RESOLUTION_R8_STANDARD = 0x1 , T4_RESOLUTION_R8_FINE = 0x2 , T4_RESOLUTION_R8_SUPERFINE = 0x4 , T4_RESOLUTION_R16_SUPERFINE = 0x8 ,
  T4_RESOLUTION_100_100 = 0x10 , T4_RESOLUTION_200_100 = 0x20 , T4_RESOLUTION_200_200 = 0x40 , T4_RESOLUTION_200_400 = 0x80 ,
  T4_RESOLUTION_300_300 = 0x100 , T4_RESOLUTION_300_600 = 0x200 , T4_RESOLUTION_400_400 = 0x400 , T4_RESOLUTION_400_800 = 0x800 ,
  T4_RESOLUTION_600_600 = 0x1000 , T4_RESOLUTION_600_1200 = 0x2000 , T4_RESOLUTION_1200_1200 = 0x4000
}
 
enum  t4_image_width_t {
  T4_WIDTH_100_A4 = 864 , T4_WIDTH_100_B4 = 1024 , T4_WIDTH_100_A3 = 1216 , T4_WIDTH_200_A4 = 1728 ,
  T4_WIDTH_200_B4 = 2048 , T4_WIDTH_200_A3 = 2432 , T4_WIDTH_300_A4 = 2592 , T4_WIDTH_300_B4 = 3072 ,
  T4_WIDTH_300_A3 = 3648 , T4_WIDTH_400_A4 = 3456 , T4_WIDTH_400_B4 = 4096 , T4_WIDTH_400_A3 = 4864 ,
  T4_WIDTH_600_A4 = 5184 , T4_WIDTH_600_B4 = 6144 , T4_WIDTH_600_A3 = 7296 , T4_WIDTH_1200_A4 = 10368 ,
  T4_WIDTH_1200_B4 = 12288 , T4_WIDTH_1200_A3 = 14592
}
 
enum  t4_image_length_t {
  T4_LENGTH_STANDARD_A4 = 1143 , T4_LENGTH_FINE_A4 = 2286 , T4_LENGTH_300_A4 = 4665 , T4_LENGTH_SUPERFINE_A4 = 4573 ,
  T4_LENGTH_600_A4 = 6998 , T4_LENGTH_800_A4 = 9330 , T4_LENGTH_1200_A4 = 13996 , T4_LENGTH_STANDARD_B4 = 1359 ,
  T4_LENGTH_FINE_B4 = 2718 , T4_LENGTH_300_B4 = 4169 , T4_LENGTH_SUPERFINE_B4 = 5436 , T4_LENGTH_600_B4 = 8338 ,
  T4_LENGTH_800_B4 = 11118 , T4_LENGTH_1200_B4 = 16677 , T4_LENGTH_STANDARD_A3 = 1617 , T4_LENGTH_FINE_A3 = 3234 ,
  T4_LENGTH_300_A3 = 4960 , T4_LENGTH_SUPERFINE_A3 = 6468 , T4_LENGTH_600_A3 = 9921 , T4_LENGTH_800_A3 = 13228 ,
  T4_LENGTH_1200_A3 = 19842 , T4_LENGTH_STANDARD_US_LETTER = 1075 , T4_LENGTH_FINE_US_LETTER = 2151 , T4_LENGTH_300_US_LETTER = 3300 ,
  T4_LENGTH_SUPERFINE_US_LETTER = 4302 , T4_LENGTH_600_US_LETTER = 6700 , T4_LENGTH_800_US_LETTER = 8800 , T4_LENGTH_1200_US_LETTER = 13200 ,
  T4_LENGTH_STANDARD_US_LEGAL = 1369 , T4_LENGTH_FINE_US_LEGAL = 2738 , T4_LENGTH_300_US_LEGAL = 4200 , T4_LENGTH_SUPERFINE_US_LEGAL = 5476 ,
  T4_LENGTH_600_US_LEGAL = 8400 , T4_LENGTH_800_US_LEGAL = 11200 , T4_LENGTH_1200_US_LEGAL = 16800
}
 
enum  {
  T4_SUPPORT_WIDTH_215MM = 0x01 , T4_SUPPORT_WIDTH_255MM = 0x02 , T4_SUPPORT_WIDTH_303MM = 0x04 , T4_SUPPORT_LENGTH_UNLIMITED = 0x10000 ,
  T4_SUPPORT_LENGTH_A4 = 0x20000 , T4_SUPPORT_LENGTH_B4 = 0x40000 , T4_SUPPORT_LENGTH_US_LETTER = 0x80000 , T4_SUPPORT_LENGTH_US_LEGAL = 0x100000
}
 
enum  t4_decoder_status_t {
  T4_DECODE_MORE_DATA = 0 , T4_DECODE_OK = -1 , T4_DECODE_INTERRUPT = -2 , T4_DECODE_ABORTED = -3 ,
  T4_DECODE_NOMEM = -4 , T4_DECODE_INVALID_DATA = -5
}
 

Functions

int t4_rx_start_page (t4_rx_state_t *s)
 Prepare to receive the next page of the current document.
 
int t4_rx_put_bit (t4_rx_state_t *s, int bit)
 Put a bit of the current document page.
 
int t4_rx_put (t4_rx_state_t *s, const uint8_t buf[], size_t len)
 Put a byte of the current document page.
 
int t4_rx_end_page (t4_rx_state_t *s)
 Complete the reception of a page.
 
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.
 
int t4_rx_set_rx_encoding (t4_rx_state_t *s, int encoding)
 Set the encoding for the received data.
 
void t4_rx_set_image_width (t4_rx_state_t *s, int width)
 Set the expected width of the received image, in pixel columns.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
void t4_rx_get_transfer_statistics (t4_rx_state_t *s, t4_stats_t *t)
 Get the current transfer statistics.
 
const char * t4_compression_to_str (int compression)
 Get the short text name of an encoding format.
 
const char * t4_image_type_to_str (int type)
 Get the short text name of an image format.
 
const char * t4_image_resolution_to_str (int resolution_code)
 Get the short text name of an image resolution.
 
logging_state_tt4_rx_get_logging_state (t4_rx_state_t *s)
 Get the logging context associated with a T.4 receive context.
 
t4_rx_state_tt4_rx_init (t4_rx_state_t *s, const char *file, int supported_output_compressions)
 Prepare for reception of a document.
 
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.4 reception started with t4_rx_init.
 
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 T.4 reception started with t4_rx_init.
 

Typedef Documentation

◆ t4_row_write_handler_t

typedef int(* t4_row_write_handler_t) (void *user_data, const uint8_t buf[], size_t len)

This function is a callback from the image decoders, to write the decoded bi-level image, row by row. It is called for each row, with len set to the number of bytes per row. At the end of the image it is called with len set to zero, to indicate the end of image condition.

Returns
0 for OK, or non-zero for a problem that requires the image be interrupted.

◆ t4_rx_state_t

typedef struct t4_rx_state_s t4_rx_state_t

T.4 FAX compression/decompression descriptor. This defines the working state for a single instance of a T.4 FAX compression or decompression channel.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
T4_RESOLUTION_R8_STANDARD 

Standard FAX resolution 204dpi x 98dpi - bi-level only

T4_RESOLUTION_R8_FINE 

Fine FAX resolution 204dpi x 196dpi - bi-level only

T4_RESOLUTION_R8_SUPERFINE 

Super-fine FAX resolution 204dpi x 391dpi - bi-level only

T4_RESOLUTION_R16_SUPERFINE 

Double FAX resolution 408dpi x 391dpi - bi-level only

T4_RESOLUTION_100_100 

100dpi x 100dpi - gray-scale and colour only

T4_RESOLUTION_200_100 

200dpi x 100dpi - bi-level only

T4_RESOLUTION_200_200 

200dpi x 200dpi

T4_RESOLUTION_200_400 

200dpi x 400dpi - bi-level only

T4_RESOLUTION_300_300 

300dpi x 300dpi

T4_RESOLUTION_300_600 

300dpi x 600dpi - bi-level only

T4_RESOLUTION_400_400 

400dpi x 400dpi

T4_RESOLUTION_400_800 

400dpi x 800dpi - bi-level only

T4_RESOLUTION_600_600 

600dpi x 600dpi

T4_RESOLUTION_600_1200 

600dpi x 1200dpi - bi-level only

T4_RESOLUTION_1200_1200 

1200dpi x 1200dpi

◆ t4_decoder_status_t

Return values from the T.85 decoder

Enumerator
T4_DECODE_MORE_DATA 

More image data is needed

T4_DECODE_OK 

Image completed successfully

T4_DECODE_INTERRUPT 

The decoder has interrupted

T4_DECODE_ABORTED 

An abort was found in the image data

T4_DECODE_NOMEM 

A memory allocation error occurred

T4_DECODE_INVALID_DATA 

The image data is invalid.

◆ t4_image_compression_t

Supported compression modes.

Enumerator
T4_COMPRESSION_NONE 

No compression

T4_COMPRESSION_T4_1D 

T.4 1D compression

T4_COMPRESSION_T4_2D 

T.4 2D compression

T4_COMPRESSION_T6 

T.6 2D compression

T4_COMPRESSION_T85 

T.85 monochrome JBIG coding with L0 fixed.

T4_COMPRESSION_T85_L0 

T.85 monochrome JBIG coding with L0 variable.

T4_COMPRESSION_T43 

T.43 gray-scale/colour JBIG coding

T4_COMPRESSION_T45 

T.45 run length colour compression

T4_COMPRESSION_T42_T81 

T.42 + T.81 + T.30 Annex E colour JPEG coding

T4_COMPRESSION_SYCC_T81 

T.42 + T.81 + T.30 Annex K colour sYCC-JPEG coding

T4_COMPRESSION_T88 

T.88 monochrome JBIG2 compression

T4_COMPRESSION_UNCOMPRESSED 

Uncompressed image. This compression cannot be used for FAXes. It is provided for specifying output formats for received images.

T4_COMPRESSION_JPEG 

Conventional JPEG. This compression cannot be used for FAXes. It is provided for specifying output formats for received images.

T4_COMPRESSION_NO_SUBSAMPLING 

Support solour compression without sub-sampling

T4_COMPRESSION_GRAYSCALE 

Gray-scale support by multi-level codecs

T4_COMPRESSION_COLOUR 

Colour support by multi-level codecs

T4_COMPRESSION_12BIT 

12 bit mode for gray-scale and colour

T4_COMPRESSION_COLOUR_TO_GRAY 

Convert a colour image to a gray-scale one

T4_COMPRESSION_GRAY_TO_BILEVEL 

Dither a gray-scale image down a simple bilevel image, with rescaling to fit a FAX page

T4_COMPRESSION_COLOUR_TO_BILEVEL 

Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page

T4_COMPRESSION_RESCALING 

Rescale an image (except a bi-level image) to fit a permitted FAX width when necessary

◆ t4_image_length_t

Length of the various supported paper sizes, in pixels at the various Y resolutions. Paper sizes are A4 (210mm x 297mm) B4 (250mm x 353mm) A3 (297mm x 420mm) North American Letter (215.9mm x 279.4mm or 8.5"x11") North American Legal (215.9mm x 355.6mm or 8.4"x14") Unlimited

T.4 does not accurately define the maximum number of scan lines in a page. A wide variety of maximum row counts are used in the real world. It is important not to set our sending limit too high, or a receiving machine might split pages. It is important not to set it too low, or we might clip pages.

Values seen for standard resolution A4 pages include 1037, 1045, 1109, 1126 and 1143. 1109 seems the most-popular. At fine res 2150, 2196, 2200, 2237, 2252-2262, 2264, 2286, and 2394 are used. 2255 seems the most popular. We try to use balanced choices here. 1143 pixels at 3.85/mm is 296.9mm, and an A4 page is 297mm long.

◆ t4_image_types_t

Image type

◆ t4_image_width_t

Exact widths in PELs for the difference resolutions, and page widths. Note: The A4 widths also apply to North American letter and legal. The R4 resolution widths are not supported in recent versions of T.30 Only images of exactly these widths are acceptable for FAX transmisson.

R4 864 pels/215mm for ISO A4, North American Letter and Legal R4 1024 pels/255mm for ISO B4 R4 1216 pels/303mm for ISO A3 R8 1728 pels/215mm for ISO A4, North American Letter and Legal R8 2048 pels/255mm for ISO B4 R8 2432 pels/303mm for ISO A3 R16 3456 pels/215mm for ISO A4, North American Letter and Legal R16 4096 pels/255mm for ISO B4 R16 4864 pels/303mm for ISO A3

100 864 pels/219.46mm for ISO A4, North American Letter and Legal 100 1024 pels/260.10mm for ISO B4 100 1216 pels/308.86mm for ISO A3 200 1728 pels/219.46mm for ISO A4, North American Letter and Legal 200 2048 pels/260.10mm for ISO B4 200 2432 pels/308.86mm for ISO A3 300 2592 pels/219.46mm for ISO A4, North American Letter and Legal 300 3072 pels/260.10mm for ISO B4 300 3648 pels/308.86mm for ISO A3 400 3456 pels/219.46mm for ISO A4, North American Letter and Legal 400 4096 pels/260.10mm for ISO B4 400 4864 pels/308.86mm for ISO A3 600 5184 pels/219.46mm for ISO A4, North American Letter and Legal 600 6144 pels/260.10mm for ISO B4 600 7296 pels/308.86mm for ISO A3 1200 10368 pels/219.46mm for ISO A4, North American Letter and Legal 1200 12288 pels/260.10mm for ISO B4 1200 14592 pels/308.86mm for ISO A3

Note that R4, R8 and R16 widths are 5mm wider than the actual paper sizes. The 100, 200, 300, 400, 600, and 1200 widths are 9.46mm, 10.1mm and 11.86mm wider than the paper sizes.

◆ t4_image_x_resolution_t

Supported X resolutions, in pixels per metre.

◆ t4_image_y_resolution_t

Supported Y resolutions, in pixels per metre.

Function Documentation

◆ t4_compression_to_str()

const char * t4_compression_to_str ( int compression)

Get the short text name of an encoding format.

Get the short text name of a compression format.

Parameters
compressionThe compression type.
Returns
A pointer to the string.

References T4_COMPRESSION_JPEG, T4_COMPRESSION_NONE, T4_COMPRESSION_SYCC_T81, T4_COMPRESSION_T42_T81, T4_COMPRESSION_T43, T4_COMPRESSION_T45, T4_COMPRESSION_T4_1D, T4_COMPRESSION_T4_2D, T4_COMPRESSION_T6, T4_COMPRESSION_T85, T4_COMPRESSION_T85_L0, T4_COMPRESSION_T88, and T4_COMPRESSION_UNCOMPRESSED.

Referenced by t4_rx_start_page(), and t4_tx_start_page().

◆ t4_image_resolution_to_str()

const char * t4_image_resolution_to_str ( int resolution_code)

Get the short text name of an image resolution.

Get the short text name of an image resolution.

Parameters
resolution_codeThe image resolution code.
Returns
A pointer to the string.

References T4_RESOLUTION_100_100, T4_RESOLUTION_1200_1200, T4_RESOLUTION_200_100, T4_RESOLUTION_200_200, T4_RESOLUTION_200_400, T4_RESOLUTION_300_300, T4_RESOLUTION_300_600, T4_RESOLUTION_400_400, T4_RESOLUTION_400_800, T4_RESOLUTION_600_1200, T4_RESOLUTION_600_600, T4_RESOLUTION_R16_SUPERFINE, T4_RESOLUTION_R8_FINE, T4_RESOLUTION_R8_STANDARD, and T4_RESOLUTION_R8_SUPERFINE.

Referenced by t4_tx_set_tx_image_format().

◆ t4_image_type_to_str()

const char * t4_image_type_to_str ( int type)

Get the short text name of an image format.

Get the short text name of an image format.

Parameters
typeThe image format.
Returns
A pointer to the string.

Referenced by t4_tx_set_tx_image_format().

◆ t4_rx_end_page()

◆ t4_rx_free()

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 T.4 reception started with t4_rx_init.

Parameters
sThe T.4 receive context.
Returns
0 for success, otherwise -1.

References t4_rx_release().

◆ t4_rx_get_logging_state()

logging_state_t * t4_rx_get_logging_state ( t4_rx_state_t * s)

Get the logging context associated with a T.4 receive context.

Get the logging context associated with a T.4 receive context.

Parameters
sThe T.4 receive context.
Returns
A pointer to the logging context

References t4_rx_state_s::logging.

◆ t4_rx_get_transfer_statistics()

void t4_rx_get_transfer_statistics ( t4_rx_state_t * s,
t4_stats_t * t )

Get the current transfer statistics.

Get the current image transfer statistics.

Parameters
sThe T.4 context.
tA pointer to a statistics structure.

References t4_t6_decode_state_s::bad_rows, t4_stats_t::bad_rows, t4_rx_metadata_t::compression, t4_stats_t::compression, t4_rx_state_s::current_page, t4_rx_metadata_t::image_length, t4_stats_t::image_length, t4_stats_t::image_type, t4_rx_metadata_t::image_width, t4_stats_t::image_width, t4_stats_t::image_x_resolution, t4_stats_t::image_y_resolution, t4_stats_t::length, t4_rx_state_s::line_image_size, t4_stats_t::line_image_size, t4_t6_decode_state_s::longest_bad_row_run, t4_stats_t::longest_bad_row_run, t4_rx_tiff_state_t::pages_in_file, t4_stats_t::pages_in_file, t4_stats_t::pages_transferred, t42_decode_get_compressed_image_size(), t42_decode_get_image_length(), t42_decode_get_image_width(), t43_decode_get_image_length(), t43_decode_get_image_width(), T4_COMPRESSION_T42_T81, T4_COMPRESSION_T43, T4_COMPRESSION_T45, T4_COMPRESSION_T4_1D, T4_COMPRESSION_T4_2D, T4_COMPRESSION_T6, T4_COMPRESSION_T85, T4_COMPRESSION_T85_L0, T4_COMPRESSION_T88, t4_t6_decode_get_compressed_image_size(), t4_t6_decode_get_image_length(), t4_t6_decode_get_image_width(), t85_decode_get_compressed_image_size(), t85_decode_get_image_length(), t85_decode_get_image_width(), t4_rx_state_s::tiff, t4_stats_t::type, t4_stats_t::width, t4_rx_metadata_t::x_resolution, t4_stats_t::x_resolution, t4_rx_metadata_t::y_resolution, and t4_stats_t::y_resolution.

Referenced by t30_get_transfer_statistics().

◆ t4_rx_init()

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.

Parameters
sThe T.4 context.
fileThe name of the file to be received.
supported_output_compressionsThe compression schemes supported for output to a TIFF file.
Returns
A pointer to the context, or NULL if there was a problem.

References t4_rx_state_s::current_page, t4_rx_tiff_state_t::file, t4_rx_state_s::logging, t4_rx_tiff_state_t::pages_in_file, t4_rx_state_s::row_handler, t4_rx_state_s::row_handler_user_data, span_log(), t4_rx_state_s::supported_tiff_compressions, t4_rx_state_s::tiff, t4_rx_metadata_t::x_resolution, and t4_rx_metadata_t::y_resolution.

◆ t4_rx_put()

int t4_rx_put ( t4_rx_state_t * s,
const uint8_t buf[],
size_t len )

Put a byte of the current document page.

Parameters
sThe T.4 context.
bufThe buffer containing the chunk.
lenThe length of the chunk.
Returns
Decode status.

References t4_rx_state_s::line_image_size, and T4_DECODE_OK.

Referenced by t30_non_ecm_put().

◆ t4_rx_put_bit()

int t4_rx_put_bit ( t4_rx_state_t * s,
int bit )

Put a bit of the current document page.

Parameters
sThe T.4 context.
bitThe data bit.
Returns
Decode status.

References t4_rx_state_s::line_image_size, and t4_t6_decode_put_bit().

Referenced by t30_non_ecm_put_bit().

◆ t4_rx_release()

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.4 reception started with t4_rx_init.

Parameters
sThe T.4 receive context.
Returns
0 for success, otherwise -1.

References t4_rx_tiff_state_t::file, and t4_rx_state_s::tiff.

Referenced by t4_rx_free().

◆ t4_rx_set_dcs()

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.

Parameters
sThe T.4 context.
dcsThe DCS information, formatted as an ASCII string.

References t4_rx_metadata_t::dcs.

◆ t4_rx_set_far_ident()

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.

Parameters
sThe T.4 context.
identThe identity string.

References t4_rx_metadata_t::far_ident.

◆ t4_rx_set_image_width()

void t4_rx_set_image_width ( t4_rx_state_t * s,
int width )

Set the expected width of the received image, in pixel columns.

Parameters
sThe T.4 context.
widthThe number of pixels across the image.

References t4_rx_metadata_t::image_width.

◆ t4_rx_set_model()

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.

Parameters
sThe T.4 context.
modelThe model string, or NULL.

References t4_rx_metadata_t::model.

◆ t4_rx_set_row_write_handler()

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.

Parameters
sThe T.4 receive context.
handlerA pointer to the handler routine.
user_dataAn opaque pointer passed to the handler routine.
Returns
0 for success, otherwise -1.

References t4_rx_state_s::row_handler, t4_rx_state_s::row_handler_user_data, t42_decode_set_row_write_handler(), t43_decode_set_row_write_handler(), T4_COMPRESSION_T42_T81, T4_COMPRESSION_T43, T4_COMPRESSION_T45, T4_COMPRESSION_T4_1D, T4_COMPRESSION_T4_2D, T4_COMPRESSION_T6, T4_COMPRESSION_T85, T4_COMPRESSION_T85_L0, T4_COMPRESSION_T88, t4_t6_decode_set_row_write_handler(), and t85_decode_set_row_write_handler().

◆ t4_rx_set_rx_encoding()

◆ t4_rx_set_sub_address()

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.

Parameters
sThe T.4 context.
sub_addressThe sub-address string.

References t4_rx_metadata_t::sub_address.

◆ t4_rx_set_vendor()

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.

Parameters
sThe T.4 context.
vendorThe vendor string, or NULL.

References t4_rx_metadata_t::vendor.

◆ t4_rx_set_x_resolution()

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.

Parameters
sThe T.4 context.
resolutionThe resolution, in pixels per metre.

References t4_rx_metadata_t::x_resolution.

◆ t4_rx_set_y_resolution()

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.

Parameters
sThe T.4 context.
resolutionThe resolution, in pixels per metre.

References t4_rx_metadata_t::y_resolution.

◆ t4_rx_start_page()