26 #if !defined(_SPANDSP_PRIVATE_T4_RX_H_)
27 #define _SPANDSP_PRIVATE_T4_RX_H_
29 #define t4_rx_state_s t4_state_s
void t30_set_rx_file(t30_state_t *s, const char *file, int stop_page)
Set next receive file name.
Definition: t30_api.c:614
@ T4_COMPRESSION_NONE
Definition: t4_rx.h:52
int t30_set_tx_nsf(t30_state_t *s, const uint8_t *nsf, int len)
Set the transmitted NSF frame to be associated with a T.30 context.
Definition: t30_api.c:271
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:1246
int min_row_bits
The minimum bits in any row of the current page. For monitoring only.
Definition: private/t4_tx.h:99
@ T30_SUPPORT_T6_COMPRESSION
Definition: t30.h:362
int run_length
The length of the in-progress run of black or white.
Definition: private/t4_t6_decode.h:63
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 tx_bits
The number of bits currently in tx_bitstream.
Definition: private/t4_tx.h:94
int b_cursor
The current step into the reference row run-lengths buffer.
Definition: private/t4_t6_decode.h:72
void t38_gateway_set_ecm_capability(t38_gateway_state_t *s, int ecm_allowed)
Control whether error correcting mode (ECM) is allowed.
Definition: t38_gateway.c:2392
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 b1
The first changing element on the reference line to the right of a0 and of opposite colour to a0.
Definition: private/t4_t6_decode.h:61
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
const char * t30_completion_code_to_str(int result)
Convert a phase E completion code to a short text description.
Definition: t30_logging.c:108
@ T4_COMPRESSION_ITU_T85_L0
Definition: t4_rx.h:62
int32_t output_compression
The compression type for output to the TIFF file.
Definition: private/t4_rx.h:65
void fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle)
Select whether silent audio will be sent when FAX transmit is idle.
Definition: fax.c:579
int image_size
The size of the image in the image buffer, in bytes.
Definition: private/t4_tx.h:59
int bad_rows
The number of bad pixel rows in the most recent page.
Definition: t4_rx.h:223
Definition: private/t38_gateway.h:194
int t4_rx_end_page(t4_rx_state_t *s)
Complete the reception of a page.
Definition: t4_rx.c:581
void * row_write_user_data
Opaque pointer passed to row_write_handler.
Definition: private/t4_t6_decode.h:42
fax_state_t * fax_init(fax_state_t *s, int calling_party)
Initialise a FAX context.
Definition: fax.c:664
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:1115
int t30_set_supported_compressions(t30_state_t *s, int supported_compressions)
Specify supported compression types.
Definition: t30_api.c:688
int image_width
Width of the current page, in pixels.
Definition: private/t4_tx.h:72
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
t4_row_write_handler_t row_write_handler
The type of compression used between the FAX machines.
Definition: private/t4_t6_decode.h:40
int row_len
The current length of the current row.
Definition: private/t4_tx.h:82
int consecutive_eols
This variable is used to count the consecutive EOLS we have seen. If it reaches six,...
Definition: private/t4_t6_decode.h:51
Definition: private/t38_core.h:32
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_rx_start_page(t4_rx_state_t *s)
Prepare to receive the next page of the current document.
Definition: t4_rx.c:1010
@ T4_COMPRESSION_ITU_T85
Definition: t4_rx.h:60
@ T4_COMPRESSION_ITU_T4_2D
Definition: t4_rx.h:56
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
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
const char * t30_frametype(uint8_t x)
Return a text name for a T.30 frame type.
Definition: t30_logging.c:241
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
const char * file
The current file name.
Definition: private/t4_rx.h:57
uint8_t * row_buf
Pointer to the buffer for the current pixel row.
Definition: private/t4_tx.h:89
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:1103
logging_state_t * t38_gateway_get_logging_state(t38_gateway_state_t *s)
Get a pointer to the logging context associated with a T.38 context.
Definition: t38_gateway.c:2386
TIFF * tiff_file
The libtiff context for the current TIFF file.
Definition: private/t4_rx.h:59
logging_state_t logging
Error and flow logging control.
Definition: private/t38_terminal.h:119
t38_core_state_t * t38_gateway_get_t38_core_state(t38_gateway_state_t *s)
Get a pointer to the T.38 core IFP packet engine associated with a T.38 context.
Definition: t38_gateway.c:2380
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 last_row_starts_at
A pointer into the image buffer indicating where the last row begins.
Definition: private/t4_t6_decode.h:45
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
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
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
int row_bits
The current number of bits in the current encoded row.
Definition: private/t4_tx.h:97
void t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep)
Select whether TEP time will be allowed for.
Definition: t38_terminal.c:1405
int width
The number of horizontal pixels in the most recent page.
Definition: t4_rx.h:219
int its_black
TRUE if the current run is black.
Definition: private/t4_t6_decode.h:67
t38_core_state_t * t38_terminal_get_t38_core_state(t38_terminal_state_t *s)
Get a pointer to the T.38 core IFP packet engine associated with a T.38 context.
Definition: t38_terminal.c:1433
void fax_set_tep_mode(fax_state_t *s, int use_tep)
Select whether TEP will be sent for the image modems.
Definition: fax.c:585
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:1109
@ T4_COMPRESSION_ITU_T43
Definition: t4_rx.h:64
#define CM_PER_INCH
Definition: t4_rx.c:107
#define EOLS_TO_END_ANY_RX_PAGE
Definition: t4_rx.c:110
Definition: private/t4_tx.h:35
int a0
The reference or starting changing element on the coding line. At the start of the coding line,...
Definition: private/t4_t6_decode.h:58
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:1127
int current_page
The number of pages transferred to date.
Definition: private/t4_tx.h:66
logging_state_t * t38_core_get_logging_state(t38_core_state_t *s)
Get a pointer to the logging context associated with a T.38 context.
Definition: t38_core.c:1076
int start_page
The first page to transfer. -1 to start at the beginning of the file.
Definition: private/t4_rx.h:77
@ T30_SUPPORT_T4_2D_COMPRESSION
Definition: t30.h:360
#define EOLS_TO_END_T4_RX_PAGE
Definition: t4_rx.c:112
@ T30_SUPPORT_V29
Definition: t30.h:344
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 rx_skip_bits
The number of bits to be skipped before trying to match the next code word.
Definition: private/t4_t6_decode.h:79
int bad_rows
The total number of bad rows in the current page.
Definition: private/t4_t6_decode.h:94
Definition: private/t38_terminal.h:110
logging_state_t * t30_get_logging_state(t30_state_t *s)
Get a pointer to the logging context associated with a T.30 context.
Definition: t30_api.c:784
@ T30_SUPPORT_V27TER
Definition: t30.h:342
@ T4_COMPRESSION_ITU_T42
Definition: t4_rx.h:68
Definition: private/fax.h:35
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
t38_gateway_state_t * t38_gateway_init(t38_gateway_state_t *s, t38_tx_packet_handler_t *tx_packet_handler, void *tx_packet_user_data)
Initialise a gateway mode T.38 context.
Definition: t38_gateway.c:2494
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
t38_terminal_state_t * t38_terminal_init(t38_terminal_state_t *s, int calling_party, t38_tx_packet_handler_t *tx_packet_handler, void *tx_packet_user_data)
Initialise a termination mode T.38 context.
Definition: t38_terminal.c:1509
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 span_log(logging_state_t *s, int level, const char *format,...)
Generate a log entry.
Definition: logging.c:84
uint32_t * ref_runs
Black and white run-lengths for the reference row.
Definition: private/t4_tx.h:87
const char * t4_encoding_to_str(int encoding)
Get the short text name of an encoding format.
Definition: t4_rx.c:1148
@ T4_COMPRESSION_ITU_T6
Definition: t4_rx.h:58
void t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t)
Get the current transfer statistics.
Definition: t30.c:6229
logging_state_t logging
Error and flow logging control.
Definition: private/t38_core.h:132
void t30_set_phase_d_handler(t30_state_t *s, t30_phase_d_handler_t *handler, void *user_data)
Set a callback function for T.30 phase D handling.
Definition: t30_api.c:756
uint32_t tx_bitstream
Encoded data bits buffer.
Definition: private/t4_tx.h:92
int pages_in_file
The number of pages in the current image file.
Definition: private/t4_rx.h:74
void t30_set_tx_file(t30_state_t *s, const char *file, int start_page, int stop_page)
Set next transmit file name.
Definition: t30_api.c:622
@ T4_COMPRESSION_ITU_SYCC_T42
Definition: t4_rx.h:70
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 x_resolution
Column-to-column (X) resolution in pixels per metre.
Definition: private/t4_tx.h:68
int t38_terminal_release(t38_terminal_state_t *s)
Release a T.38 context.
Definition: t38_terminal.c:1549
Definition: private/t30.h:35
void t30_set_phase_b_handler(t30_state_t *s, t30_phase_b_handler_t *handler, void *user_data)
Set a callback function for T.30 phase B handling.
Definition: t30_api.c:749
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 t38_terminal_set_config(t38_terminal_state_t *s, int config)
Set configuration options.
Definition: t38_terminal.c:1354
logging_state_t logging
Error and flow logging control.
Definition: private/t4_tx.h:104
t30_state_t * fax_get_t30_state(fax_state_t *s)
Get a pointer to the T.30 engine associated with a FAX context.
Definition: fax.c:591
void t30_set_phase_e_handler(t30_state_t *s, t30_phase_e_handler_t *handler, void *user_data)
Set a callback function for T.30 phase E handling.
Definition: t30_api.c:763
int tx_seq_no
The sequence number for the next packet to be transmitted.
Definition: private/t38_core.h:112
int a_cursor
The current step into the current row run-lengths buffer.
Definition: private/t4_t6_decode.h:70
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 line_image_size
The size of the compressed image on the line side, in bits.
Definition: private/t4_tx.h:54
int fax_release(fax_state_t *s)
Release a FAX context.
Definition: fax.c:719
int pages_rx
The number of pages received so far.
Definition: t30.h:527
t30_state_t t30
The T.30 back-end.
Definition: private/t38_terminal.h:113
uint32_t rx_bitstream
Incoming bit buffer for decompression.
Definition: private/t4_t6_decode.h:75
Definition: private/t4_rx.h:54
t30_state_t * t38_terminal_get_t30_state(t38_terminal_state_t *s)
Get a pointer to the T.30 engine associated with a T.38 context.
Definition: t38_terminal.c:1427
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
int32_t output_t4_options
The TIFF G3 FAX options.
Definition: private/t4_rx.h:71
@ T30_SUPPORT_T4_1D_COMPRESSION
Definition: t30.h:358
int pages_tx
The number of pages sent so far.
Definition: t30.h:525
int(* t4_row_write_handler_t)(void *user_data, const uint8_t buf[], size_t len)
Definition: t4_rx.h:46
int t30_set_supported_modems(t30_state_t *s, int supported_modems)
Specify supported modems.
Definition: t30_api.c:680
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:1121
void t38_gateway_set_transmit_on_idle(t38_gateway_state_t *s, int transmit_on_idle)
Select whether silent audio will be sent when transmit is idle.
Definition: t38_gateway.c:2398
logging_state_t * fax_get_logging_state(fax_state_t *s)
Get a pointer to the logging context associated with a FAX context.
Definition: fax.c:597
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
int black_white
2D horizontal mode control.
Definition: private/t4_t6_decode.h:65
@ T30_SUPPORT_V17
Definition: t30.h:346
int y_resolution
The vertical resolution of the page in pixels per metre.
Definition: t4_rx.h:229
@ T4_COMPRESSION_ITU_T4_1D
Definition: t4_rx.h:54
@ T4_COMPRESSION_ITU_T45
Definition: t4_rx.h:66
int t30_set_tx_ident(t30_state_t *s, const char *id)
Set the transmitted identifier associated with a T.30 context.
Definition: t30_api.c:90
Definition: private/logging.h:33
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
@ T30_SUPPORT_T85_COMPRESSION
Definition: t30.h:364
int curr_bad_row_run
Decoded pixel buffer.
Definition: private/t4_t6_decode.h:90
int t30_set_ecm_capability(t30_state_t *s, int enabled)
Select ECM capability.
Definition: t30_api.c:637
void t38_set_t38_version(t38_core_state_t *s, int t38_version)
Definition: t38_core.c:1034
#define EOLS_TO_END_T6_RX_PAGE
Definition: t4_rx.c:114
int rx_bits
The number of bits currently in rx_bitstream.
Definition: private/t4_t6_decode.h:77
logging_state_t * t38_terminal_get_logging_state(t38_terminal_state_t *s)
Get a pointer to the logging context associated with a T.38 context.
Definition: t38_terminal.c:1494
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