spandsp  3.0.0
t43.c File Reference
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <tiffio.h>
#include "spandsp/stdbool.h"
#include <time.h>
#include "floating_fudge.h"
#include <setjmp.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/unaligned.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/timezone.h"
#include "spandsp/t4_rx.h"
#include "spandsp/t4_tx.h"
#include "spandsp/t81_t82_arith_coding.h"
#include "spandsp/t85.h"
#include "spandsp/t42.h"
#include "spandsp/t43.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/t81_t82_arith_coding.h"
#include "spandsp/private/t85.h"
#include "spandsp/private/t42.h"
#include "spandsp/private/t43.h"
#include "t43_gray_code_tables.h"
#include "t42_t43_local.h"

Functions

const char * t43_image_type_to_str (int type)
 
void t43_encode_set_options (t43_encode_state_t *s, uint32_t l0, int mx, int options)
 
int t43_encode_set_image_width (t43_encode_state_t *s, uint32_t image_width)
 
int t43_encode_set_image_length (t43_encode_state_t *s, uint32_t image_length)
 
int t43_encode_set_image_type (t43_encode_state_t *s, int image_type)
 
void t43_encode_abort (t43_encode_state_t *s)
 
void t43_encode_comment (t43_encode_state_t *s, const uint8_t comment[], size_t len)
 
int t43_encode_image_complete (t43_encode_state_t *s)
 Check if we are at the end of the current document page. More...
 
int t43_encode_get (t43_encode_state_t *s, uint8_t buf[], size_t max_len)
 
uint32_t t43_encode_get_image_width (t43_encode_state_t *s)
 
uint32_t t43_encode_get_image_length (t43_encode_state_t *s)
 
int t43_encode_get_compressed_image_size (t43_encode_state_t *s)
 
int t43_encode_set_row_read_handler (t43_encode_state_t *s, t4_row_read_handler_t handler, void *user_data)
 
logging_state_tt43_encode_get_logging_state (t43_encode_state_t *s)
 Get the logging context associated with a T.43 encode context. More...
 
int t43_encode_restart (t43_encode_state_t *s, uint32_t image_width, uint32_t image_length)
 Restart a T.43 encode context. More...
 
t43_encode_state_tt43_encode_init (t43_encode_state_t *s, uint32_t image_width, uint32_t image_length, t4_row_read_handler_t handler, void *user_data)
 Prepare to encode an image in T.43 format. More...
 
int t43_encode_release (t43_encode_state_t *s)
 Release a T.43 encode context. More...
 
int t43_encode_free (t43_encode_state_t *s)
 Free a T.43 encode context. More...
 
void t43_decode_rx_status (t43_decode_state_t *s, int status)
 
int t43_decode_put (t43_decode_state_t *s, const uint8_t data[], size_t len)
 Decode a chunk of T.43 data. More...
 
int t43_decode_set_row_write_handler (t43_decode_state_t *s, t4_row_write_handler_t handler, void *user_data)
 Set the row handler routine. More...
 
int t43_decode_set_comment_handler (t43_decode_state_t *s, uint32_t max_comment_len, t4_row_write_handler_t handler, void *user_data)
 Set the comment handler routine. More...
 
int t43_decode_set_image_size_constraints (t43_decode_state_t *s, uint32_t max_xd, uint32_t max_yd)
 
uint32_t t43_decode_get_image_width (t43_decode_state_t *s)
 Get the width of the image. More...
 
uint32_t t43_decode_get_image_length (t43_decode_state_t *s)
 Get the length of the image. More...
 
int t43_decode_get_compressed_image_size (t43_decode_state_t *s)
 
logging_state_tt43_decode_get_logging_state (t43_decode_state_t *s)
 Get the logging context associated with a T.43 decode context. More...
 
int t43_decode_restart (t43_decode_state_t *s)
 
t43_decode_state_tt43_decode_init (t43_decode_state_t *s, t4_row_write_handler_t handler, void *user_data)
 Prepare to decode an image in T.43 format. More...
 
int t43_decode_release (t43_decode_state_t *s)
 Release a T.43 decode context. More...
 
int t43_decode_free (t43_decode_state_t *s)
 Free a T.43 decode context. More...
 

Function Documentation

◆ t43_decode_free()

int t43_decode_free ( t43_decode_state_t s)

Free a T.43 decode context.

Parameters
sThe T.43 decode context.
Returns
0 for OK, else -1.

References t43_decode_release(), and t85_decode_free().

◆ t43_decode_get_image_length()

uint32_t t43_decode_get_image_length ( t43_decode_state_t s)

Get the length of the image.

Parameters
sThe T.43 context.
Returns
The length of the image, in pixels.

References t85_decode_get_image_length().

◆ t43_decode_get_image_width()

uint32_t t43_decode_get_image_width ( t43_decode_state_t s)

Get the width of the image.

Parameters
sThe T.43 context.
Returns
The width of the image, in pixels.

References t85_decode_get_image_width().

◆ t43_decode_get_logging_state()

logging_state_t* t43_decode_get_logging_state ( t43_decode_state_t s)

Get the logging context associated with a T.43 decode context.

Get the logging context associated with a T.43 decode context.

Parameters
sThe T.43 decode context.
Returns
A pointer to the logging context

References t43_decode_state_s::logging.

◆ t43_decode_init()

t43_decode_state_t* t43_decode_init ( t43_decode_state_t s,
t4_row_write_handler_t  handler,
void *  user_data 
)

Prepare to decode an image in T.43 format.

Parameters
sThe T.43 context.
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.

◆ t43_decode_put()

int t43_decode_put ( t43_decode_state_t s,
const uint8_t  data[],
size_t  len 
)

Decode a chunk of T.43 data.

Parameters
sThe T.43 context.
dataThe data to be decoded.
lenThe length of the data to be decoded.
Returns
0 for OK.

◆ t43_decode_release()

int t43_decode_release ( t43_decode_state_t s)

Release a T.43 decode context.

Parameters
sThe T.43 decode context.
Returns
0 for OK, else -1.

References t85_decode_release().

Referenced by t43_decode_free().

◆ t43_decode_set_comment_handler()

int t43_decode_set_comment_handler ( t43_decode_state_t s,
uint32_t  max_comment_len,
t4_row_write_handler_t  handler,
void *  user_data 
)

Set the comment handler routine.

Parameters
sThe T.43 context.
max_comment_lenThe maximum length of comment to be passed to the handler.
handlerA callback routine to handle decoded comment.
user_dataAn opaque pointer passed to handler.
Returns
0 for OK.

References t85_decode_set_comment_handler().

◆ t43_decode_set_row_write_handler()

int t43_decode_set_row_write_handler ( t43_decode_state_t s,
t4_row_write_handler_t  handler,
void *  user_data 
)

Set the row handler routine.

Parameters
sThe T.43 context.
handlerA callback routine to handle decoded image rows.
user_dataAn opaque pointer passed to handler.
Returns
0 for OK.

References t43_decode_state_s::row_write_handler, t85_decode_state_s::row_write_handler, t43_decode_state_s::row_write_user_data, and t85_decode_state_s::row_write_user_data.

Referenced by t4_rx_set_row_write_handler().

◆ t43_encode_free()

int t43_encode_free ( t43_encode_state_t s)

Free a T.43 encode context.

Parameters
sThe T.43 encode context.
Returns
0 for OK, else -1.

References t43_encode_release(), and t85_encode_release().

◆ t43_encode_get_logging_state()

logging_state_t* t43_encode_get_logging_state ( t43_encode_state_t s)

Get the logging context associated with a T.43 encode context.

Get the logging context associated with a T.43 encode context.

Parameters
sThe T.43 encode context.
Returns
A pointer to the logging context

References t43_encode_state_s::logging.

◆ t43_encode_image_complete()

int t43_encode_image_complete ( t43_encode_state_t s)

Check if we are at the end of the current document page.

Parameters
sThe T.43 context.
Returns
0 for more data to come. SIG_STATUS_END_OF_DATA for no more data.

Referenced by t4_tx_image_complete().

◆ t43_encode_init()

t43_encode_state_t* t43_encode_init ( t43_encode_state_t s,
uint32_t  image_width,
uint32_t  image_length,
t4_row_read_handler_t  handler,
void *  user_data 
)

Prepare to encode an image in T.43 format.

Parameters
sThe T.43 context.
image_widthImage width, in pixels.
image_lengthImage length, in pixels.
handlerA callback routine to handle encoded image rows.
user_dataAn opaque pointer passed to handler.
Returns
A pointer to the context, or NULL if there was a problem.

◆ t43_encode_release()

int t43_encode_release ( t43_encode_state_t s)

Release a T.43 encode context.

Parameters
sThe T.43 encode context.
Returns
0 for OK, else -1.

References t85_encode_release().

Referenced by t43_encode_free().

◆ t43_encode_restart()

int t43_encode_restart ( t43_encode_state_t s,
uint32_t  image_width,
uint32_t  image_length 
)

Restart a T.43 encode context.

Parameters
sThe T.43 context.
imageimage_width The image width, in pixels.
imageimage_width The image length, in pixels.
Returns
0 for success, otherwise -1.