26 #if !defined(_SPANDSP_PRIVATE_T4_TX_H_)
27 #define _SPANDSP_PRIVATE_T4_TX_H_
29 #define t4_tx_state_s t4_state_s
void t4_tx_set_min_bits_per_row(t4_tx_state_t *s, int bits)
Set the minimum number of encoded bits per row. This allows the makes the encoding process to be set ...
Definition: t4_tx.c:1417
int t4_tx_start_page(t4_tx_state_t *s)
Prepare to send the next page of the current document.
Definition: t4_tx.c:1221
int t4_tx_get_chunk(t4_tx_state_t *s, uint8_t buf[], int max_len)
Get the next chunk of the current document page. The document will be padded for the current minimum ...
Definition: t4_tx.c:1386
int t4_tx_get_byte(t4_tx_state_t *s)
Get the next byte of the current document page. The document will be padded for the current minimum s...
Definition: t4_tx.c:1378
int min_row_bits
The minimum bits in any row of the current page. For monitoring only.
Definition: private/t4_tx.h:99
uint32_t * cur_runs
Black and white run-lengths for the current row.
Definition: private/t4_tx.h:85
int y_resolution
Row-to-row (Y) resolution in pixels per metre.
Definition: private/t4_tx.h:70
int min_bits_per_row
The minimum number of encoded bits per row. This is a timing thing for hardware FAX machines.
Definition: private/t4_t6_encode.h:36
int tx_bits
The number of bits currently in tx_bitstream.
Definition: private/t4_tx.h:94
#define EOLS_TO_END_T6_TX_PAGE
Definition: t4_tx.c:108
int t4_tx_get_chunk(t4_tx_state_t *s, uint8_t buf[], int max_len)
Get the next chunk of the current document page. The document will be padded for the current minimum ...
Definition: t4_tx.c:1386
int longest_bad_row_run
The longest run of consecutive bad rows seen in the current page.
Definition: private/t4_t6_decode.h:92
int t4_tx_restart_page(t4_tx_state_t *s)
Prepare the current page for a resend.
Definition: t4_tx.c:1347
@ T4_COMPRESSION_ITU_T85_L0
Definition: t4_rx.h:62
void t4_tx_set_local_ident(t4_tx_state_t *s, const char *ident)
Set the identity of the local machine, for inclusion in page headers.
Definition: t4_tx.c:1423
int max_rows_to_next_1d_row
The current maximum contiguous rows that may be 2D encoded.
Definition: private/t4_t6_encode.h:38
int image_size
The size of the image in the image buffer, in bytes.
Definition: private/t4_tx.h:59
const char * header_info
The text which will be used in FAX page header. No text results in no header line.
Definition: private/t4_tx.h:49
int bad_rows
The number of bad pixel rows in the most recent page.
Definition: t4_rx.h:223
void t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t)
Get the current transfer statistics.
Definition: t4_rx.c:1133
int t4_tx_restart_page(t4_tx_state_t *s)
Prepare the current page for a resend.
Definition: t4_tx.c:1347
int image_width
Width of the current page, in pixels.
Definition: private/t4_tx.h:72
struct tz_s * tz
Optional per instance time zone for the FAX page header timestamp.
Definition: private/t4_tx.h:51
int row_len
The current length of the current row.
Definition: private/t4_tx.h:82
int(* t4_row_read_handler_t)(void *user_data, uint8_t buf[], size_t len)
Definition: t4_tx.h:36
@ T4_COMPRESSION_ITU_T85
Definition: t4_rx.h:60
t4_tx_state_t * t4_tx_init(t4_tx_state_t *s, const char *file, int start_page, int stop_page)
Prepare for transmission of a document.
Definition: t4_tx.c:1493
@ T4_COMPRESSION_ITU_T4_2D
Definition: t4_rx.h:56
int row
Current pixel row number.
Definition: private/t4_tx.h:76
const char * file
The current file name.
Definition: private/t4_rx.h:57
void t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding)
Set the encoding for the encoded data.
Definition: t4_tx.c:1409
uint8_t * row_buf
Pointer to the buffer for the current pixel row.
Definition: private/t4_tx.h:89
int t4_rx_start_page(t4_rx_state_t *s)
Prepare to receive the next page of the current document.
Definition: t4_rx.c:1010
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:1097
void t4_tx_set_header_tz(t4_tx_state_t *s, struct tz_s *tz)
Set the header timezone.
Definition: t4_tx.c:1435
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:1002
TIFF * tiff_file
The libtiff context for the current TIFF file.
Definition: private/t4_rx.h:59
int t4_tx_get_current_page_in_file(t4_tx_state_t *s)
Get the currnet page number in the file.
Definition: t4_tx.c:1472
uint16_t photo_metric
The TIFF photometric setting for the current page.
Definition: private/t4_rx.h:67
int stop_page
The last page to transfer. -1 to continue to the end of the file.
Definition: private/t4_rx.h:79
int line_encoding
The type of compression used between the FAX machines.
Definition: private/t4_tx.h:42
int bytes_per_row
The current number of bytes per row of uncompressed image data.
Definition: private/t4_tx.h:57
int16_t run_length
Definition: t4_tx.c:132
int pages_transferred
The number of pages transferred so far.
Definition: t4_rx.h:215
int image_length
Length of the current page, in pixels.
Definition: private/t4_tx.h:74
void t4_tx_set_local_ident(t4_tx_state_t *s, const char *ident)
Set the identity of the local machine, for inclusion in page headers.
Definition: t4_tx.c:1423
int length
The number of vertical pixels in the most recent page.
Definition: t4_rx.h:221
uint16_t fill_order
The TIFF fill order setting for the current page.
Definition: private/t4_rx.h:69
uint16_t code
Definition: t4_tx.c:130
t4_tx_state_t * t4_tx_init(t4_tx_state_t *s, const char *file, int start_page, int stop_page)
Prepare for transmission of a document.
Definition: t4_tx.c:1493
int t4_rx_put_byte(t4_rx_state_t *s, uint8_t byte)
Put a byte of the current document page.
Definition: t4_rx.c:981
int t4_tx_get_x_resolution(t4_tx_state_t *s)
Get the column-to-column (x) resolution of the current page.
Definition: t4_tx.c:1447
int row_bits
The current number of bits in the current encoded row.
Definition: private/t4_tx.h:97
int width
The number of horizontal pixels in the most recent page.
Definition: t4_rx.h:219
@ T4_COMPRESSION_ITU_T43
Definition: t4_rx.h:64
#define CM_PER_INCH
Definition: t4_tx.c:103
Definition: private/t4_t6_encode.h:33
Definition: private/t4_tx.h:36
int t4_tx_get_pages_in_file(t4_tx_state_t *s)
Get the number of pages in the file.
Definition: t4_tx.c:1459
int bit_pos
Pointer to the byte containing the next image bit to transmit.
Definition: private/t4_t6_encode.h:48
int t4_tx_get_x_resolution(t4_tx_state_t *s)
Get the column-to-column (x) resolution of the current page.
Definition: t4_tx.c:1447
int current_page
The number of pages transferred to date.
Definition: private/t4_tx.h:66
int start_page
The first page to transfer. -1 to start at the beginning of the file.
Definition: private/t4_rx.h:77
int t4_tx_check_bit(t4_tx_state_t *s)
Return the next bit of the current document page, without actually moving forward in the buffer....
Definition: t4_tx.c:1398
int t4_tx_get_byte(t4_tx_state_t *s)
Get the next byte of the current document page. The document will be padded for the current minimum s...
Definition: t4_tx.c:1378
Definition: private/timezone.h:82
int pages_in_file
The number of pages in the file (<0 if unknown).
Definition: t4_rx.h:217
int max_row_bits
The maximum bits in any row of the current page. For monitoring only.
Definition: private/t4_tx.h:101
int ref_steps
The number of runs currently in the reference row.
Definition: private/t4_t6_encode.h:45
int bad_rows
The total number of bad rows in the current page.
Definition: private/t4_t6_decode.h:94
int t4_tx_release(t4_tx_state_t *s)
End the transmission of a document. Tidy up and close the file. This should be used to end T....
Definition: t4_tx.c:1574
int t4_rx_put_bit(t4_rx_state_t *s, int bit)
Put a bit of the current document page.
Definition: t4_rx.c:975
@ T4_COMPRESSION_ITU_T42
Definition: t4_rx.h:68
int t4_tx_end_page(t4_tx_state_t *s)
Complete the sending of a page.
Definition: t4_tx.c:1355
void t4_tx_set_header_tz(t4_tx_state_t *s, tz_t *tz)
Set the header timezone.
Definition: t4_tx.c:1435
int t4_rx_end_page(t4_rx_state_t *s)
Complete the reception of a page.
Definition: t4_rx.c:581
Definition: private/t4_t6_decode.h:33
#define EOLS_TO_END_T4_TX_PAGE
Definition: t4_tx.c:106
int row_is_2d
This variable is set if we are treating the current row as a 2D encoded one.
Definition: private/t4_tx.h:80
int rx
The same structure is used for T.4 transmit and receive. This variable records which mode is in progr...
Definition: private/t4_tx.h:39
int t4_tx_get_bit(t4_tx_state_t *s)
Get the next bit of the current document page. The document will be padded for the current minimum sc...
Definition: t4_tx.c:1362
int span_log(logging_state_t *s, int level, const char *format,...)
Generate a log entry.
Definition: logging.c:84
int t4_tx_end_page(t4_tx_state_t *s)
Complete the sending of a page.
Definition: t4_tx.c:1355
uint32_t * ref_runs
Black and white run-lengths for the reference row.
Definition: private/t4_tx.h:87
int rows_to_next_1d_row
Number of rows left that can be 2D encoded, before a 1D encoded row must be used.
Definition: private/t4_t6_encode.h:42
@ T4_COMPRESSION_ITU_T6
Definition: t4_rx.h:58
int t4_tx_start_page(t4_tx_state_t *s)
Prepare to send the next page of the current document.
Definition: t4_tx.c:1221
int t4_tx_get_y_resolution(t4_tx_state_t *s)
Get the row-to-row (y) resolution of the current page.
Definition: t4_tx.c:1441
void t4_tx_set_header_info(t4_tx_state_t *s, const char *info)
Set the header info.
Definition: t4_tx.c:1429
uint32_t tx_bitstream
Encoded data bits buffer.
Definition: private/t4_tx.h:92
t4_rx_state_t * t4_rx_init(t4_rx_state_t *s, const char *file, int output_encoding)
Prepare for reception of a document.
Definition: t4_rx.c:1177
int t4_tx_get_bit(t4_tx_state_t *s)
Get the next bit of the current document page. The document will be padded for the current minimum sc...
Definition: t4_tx.c:1362
int pages_in_file
The number of pages in the current image file.
Definition: private/t4_rx.h:74
@ T4_COMPRESSION_ITU_SYCC_T42
Definition: t4_rx.h:70
int x_resolution
Column-to-column (X) resolution in pixels per metre.
Definition: private/t4_tx.h:68
int image_buffer_size
The current size of the image buffer.
Definition: private/t4_tx.h:61
int longest_bad_row_run
The largest number of bad pixel rows in a block in the most recent page.
Definition: t4_rx.h:225
void t4_tx_get_transfer_statistics(t4_tx_state_t *s, t4_stats_t *t)
Get the current transfer statistics.
Definition: t4_tx.c:1478
logging_state_t logging
Error and flow logging control.
Definition: private/t4_tx.h:104
const char * t4_encoding_to_str(int encoding)
Get the short text name of an encoding format.
Definition: t4_rx.c:1148
int encoding
The type of compression used between the FAX machines.
Definition: t4_rx.h:231
int x_resolution
The horizontal resolution of the page in pixels per metre.
Definition: t4_rx.h:227
int t4_tx_release(t4_tx_state_t *s)
End the transmission of a document. Tidy up and close the file. This should be used to end T....
Definition: t4_tx.c:1574
int line_image_size
The size of the compressed image on the line side, in bits.
Definition: private/t4_tx.h:54
int t4_tx_get_y_resolution(t4_tx_state_t *s)
Get the row-to-row (y) resolution of the current page.
Definition: t4_tx.c:1441
void t4_tx_set_header_info(t4_tx_state_t *s, const char *info)
Set the header info.
Definition: t4_tx.c:1429
Definition: private/t4_rx.h:55
t4_tiff_state_t tiff
All TIFF file specific state information for the T.4 context.
Definition: private/t4_tx.h:107
uint8_t * image_buffer
A point to the image buffer.
Definition: private/t4_tx.h:63
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:1091
int t4_tx_next_page_has_different_format(t4_tx_state_t *s)
Check for the existance of the next page, and whether its format is like the current one....
Definition: t4_tx.c:1328
int t4_tx_set_row_read_handler(t4_tx_state_t *s, t4_row_read_handler_t handler, void *user_data)
Set the row read handler for a T.4 transmit context.
Definition: t4_tx.c:1213
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:1085
int t4_tx_get_image_width(t4_tx_state_t *s)
Get the width of the current page, in pixel columns.
Definition: t4_tx.c:1453
void bit_reverse(uint8_t to[], const uint8_t from[], int len)
Bit reverse each byte in a buffer.
Definition: bit_operations.c:79
int t4_rx_put_chunk(t4_rx_state_t *s, const uint8_t buf[], int len)
Put a byte of the current document page.
Definition: t4_rx.c:987
int t4_tx_set_row_read_handler(t4_tx_state_t *s, t4_row_read_handler_t handler, void *user_data)
Set the row read handler for a T.4 transmit context.
Definition: t4_tx.c:1213
void t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding)
Set the encoding for the received data.
Definition: t4_rx.c:1079
int t4_tx_get_image_width(t4_tx_state_t *s)
Get the width of the current page, in pixel columns.
Definition: t4_tx.c:1453
void * row_read_user_data
Opaque pointer passed to row_read_handler.
Definition: private/t4_t6_encode.h:55
void t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding)
Set the encoding for the encoded data.
Definition: t4_tx.c:1409
void t4_tx_set_min_bits_per_row(t4_tx_state_t *s, int bits)
Set the minimum number of encoded bits per row. This allows the makes the encoding process to be set ...
Definition: t4_tx.c:1417
int y_resolution
The vertical resolution of the page in pixels per metre.
Definition: t4_rx.h:229
uint16_t length
Definition: t4_tx.c:128
@ T4_COMPRESSION_ITU_T4_1D
Definition: t4_rx.h:54
int t4_tx_free(t4_tx_state_t *s)
End the transmission of a document. Tidy up, close the file and free the context. This should be used...
Definition: t4_tx.c:1585
Definition: private/logging.h:34
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:1235
t4_row_read_handler_t row_read_handler
Callback function to read a row of pixels from the image source.
Definition: private/t4_t6_encode.h:53
int bit_ptr
Pointer to the bit within the byte containing the next image bit to transmit.
Definition: private/t4_t6_encode.h:50
@ SIG_STATUS_END_OF_DATA
The data stream has ended.
Definition: async.h:71
int line_image_size
The size of the image on the line, in bytes.
Definition: t4_rx.h:233
time_t page_start_time
The time at which handling of the current page began.
Definition: private/t4_tx.h:45