spandsp 3.0.0
t4_t6_decode.h File Reference

Go to the source code of this file.

Typedefs

typedef struct t4_t6_decode_state_s t4_t6_decode_state_t
 

Functions

int t4_t6_decode_put_bit (t4_t6_decode_state_t *s, int bit)
 Put a bit of the current document page. More...
 
int t4_t6_decode_put (t4_t6_decode_state_t *s, const uint8_t buf[], size_t len)
 Put a byte of the current document page. More...
 
int t4_t6_decode_set_row_write_handler (t4_t6_decode_state_t *s, t4_row_write_handler_t handler, void *user_data)
 Set the row write handler for a T.4/T.6 decode context. More...
 
int t4_t6_decode_set_encoding (t4_t6_decode_state_t *s, int encoding)
 Set the encoding for the encoded data. More...
 
uint32_t t4_t6_decode_get_image_width (t4_t6_decode_state_t *s)
 Get the width of the image. More...
 
uint32_t t4_t6_decode_get_image_length (t4_t6_decode_state_t *s)
 Get the length of the image. More...
 
int t4_t6_decode_get_compressed_image_size (t4_t6_decode_state_t *s)
 Get the size of the compressed image, in bits. More...
 
logging_state_tt4_t6_decode_get_logging_state (t4_t6_decode_state_t *s)
 Get the logging context associated with a T.4 or T.6 decode context. More...
 
int t4_t6_decode_restart (t4_t6_decode_state_t *s, int image_width)
 
t4_t6_decode_state_tt4_t6_decode_init (t4_t6_decode_state_t *s, int encoding, int image_width, t4_row_write_handler_t handler, void *user_data)
 Prepare to decode an image in T.4 or T.6 format. More...
 
int t4_t6_decode_release (t4_t6_decode_state_t *s)
 
int t4_t6_decode_free (t4_t6_decode_state_t *s)
 

Function Documentation

◆ t4_t6_decode_get_compressed_image_size()

int t4_t6_decode_get_compressed_image_size ( t4_t6_decode_state_t s)

Get the size of the compressed image, in bits.

Parameters
sThe T.4/T.6 context.
Returns
The size of the compressed image, in bits.

References t4_t6_decode_state_s::compressed_image_size.

◆ t4_t6_decode_get_image_length()

uint32_t t4_t6_decode_get_image_length ( t4_t6_decode_state_t s)

Get the length of the image.

Parameters
sThe T.4/T.6 context.
Returns
The length of the image, in pixels.

References t4_t6_decode_state_s::image_length.

◆ t4_t6_decode_get_image_width()

uint32_t t4_t6_decode_get_image_width ( t4_t6_decode_state_t s)

Get the width of the image.

Parameters
sThe T.4/T.6 context.
Returns
The width of the image, in pixels.

References t4_t6_decode_state_s::image_width.

◆ t4_t6_decode_get_logging_state()

logging_state_t * t4_t6_decode_get_logging_state ( t4_t6_decode_state_t s)

Get the logging context associated with a T.4 or T.6 decode context.

Get the logging context associated with a T.4 or T.6 decode context.

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

References t4_t6_decode_state_s::logging.

◆ t4_t6_decode_init()

t4_t6_decode_state_t * t4_t6_decode_init ( t4_t6_decode_state_t s,
int  encoding,
int  image_width,
t4_row_write_handler_t  handler,
void *  user_data 
)

Prepare to decode an image in T.4 or T.6 format.

Parameters
sThe T.4/T.6 context.
encodingThe encoding mode.
imagewidth The image width, in pixels.
handlerA callback routine to handle decoded image rows.
user_dataAn opaque pointer passed to handler.
Returns
A pointer to the context, or NULL if there was a problem.

◆ t4_t6_decode_put()

int t4_t6_decode_put ( t4_t6_decode_state_t s,
const uint8_t  buf[],
size_t  len 
)

Put a byte of the current document page.

Parameters
sThe T.4/T.6 context.
bufThe buffer containing the chunk.
lenThe length of the chunk.
Returns
T4_DECODE_MORE_DATA when the image is still in progress. T4_DECODE_OK when the image is complete.

◆ t4_t6_decode_put_bit()

int t4_t6_decode_put_bit ( t4_t6_decode_state_t s,
int  bit 
)

Put a bit of the current document page.

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

Referenced by t4_rx_put_bit().

◆ t4_t6_decode_set_encoding()

int t4_t6_decode_set_encoding ( t4_t6_decode_state_t s,
int  encoding 
)

Set the encoding for the encoded data.

Parameters
sThe T.4/T.6 context.
encodingThe encoding.
Returns
0 for success, otherwise -1.

References t4_t6_decode_state_s::encoding, T4_COMPRESSION_T4_1D, T4_COMPRESSION_T4_2D, and T4_COMPRESSION_T6.

◆ t4_t6_decode_set_row_write_handler()

int t4_t6_decode_set_row_write_handler ( t4_t6_decode_state_t s,
t4_row_write_handler_t  handler,
void *  user_data 
)

Set the row write handler for a T.4/T.6 decode context.

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

References t4_t6_decode_state_s::row_write_handler, and t4_t6_decode_state_s::row_write_user_data.

Referenced by t4_rx_set_row_write_handler().