spandsp
1.99.0
|
#include <inttypes.h>
#include <stdlib.h>
#include <limits.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#include <memory.h>
#include <string.h>
#include "spandsp/stdbool.h"
#include "floating_fudge.h"
#include <tiffio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/async.h"
#include "spandsp/timezone.h"
#include "spandsp/t4_rx.h"
#include "spandsp/t4_tx.h"
#include "spandsp/image_translate.h"
#include "spandsp/t81_t82_arith_coding.h"
#include "spandsp/t85.h"
#include "spandsp/t42.h"
#include "spandsp/t43.h"
#include "spandsp/t4_t6_decode.h"
#include "spandsp/t4_t6_encode.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 "spandsp/private/t4_t6_decode.h"
#include "spandsp/private/t4_t6_encode.h"
#include "spandsp/private/image_translate.h"
#include "spandsp/private/t4_rx.h"
#include "spandsp/private/t4_tx.h"
Classes | |
struct | t4_run_table_entry_t |
Macros | |
#define | EOLS_TO_END_T4_TX_PAGE 6 |
#define | EOLS_TO_END_T6_TX_PAGE 2 |
#define | STATE_TRACE(...) |
#define | pixel_is_black(x, bit) (((x)[(bit) >> 3] << ((bit) & 7)) & 0x80) |
Functions | |
int | t4_t6_encode_image_complete (t4_t6_encode_state_t *s) |
Return the next bit of the current document page, without actually moving forward in the buffer. The document will be padded for the current minimum scan line time. More... | |
int | t4_t6_encode_get_bit (t4_t6_encode_state_t *s) |
Get the next bit of the current image. The image will be padded for the current minimum scan line time. More... | |
int | t4_t6_encode_get (t4_t6_encode_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 scan line time. More... | |
int | t4_t6_encode_set_row_read_handler (t4_t6_encode_state_t *s, t4_row_read_handler_t handler, void *user_data) |
Set the row read handler for a T.4/T.6 encode context. More... | |
int | t4_t6_encode_set_encoding (t4_t6_encode_state_t *s, int encoding) |
Set the encoding for the encoded data. More... | |
void | t4_t6_encode_set_min_bits_per_row (t4_t6_encode_state_t *s, int bits) |
Set the minimum number of encoded bits per row. This allows the makes the encoding process to be set to comply with the minimum row time specified by a remote receiving machine. More... | |
int | t4_t6_encode_set_image_width (t4_t6_encode_state_t *s, int image_width) |
Set the width of the image. More... | |
int | t4_t6_encode_set_image_length (t4_t6_encode_state_t *s, int image_length) |
Set the length of the image. More... | |
uint32_t | t4_t6_encode_get_image_width (t4_t6_encode_state_t *s) |
Get the width of the image. More... | |
uint32_t | t4_t6_encode_get_image_length (t4_t6_encode_state_t *s) |
Get the length of the image. More... | |
int | t4_t6_encode_get_compressed_image_size (t4_t6_encode_state_t *s) |
Get the size of the compressed image, in bits. More... | |
void | t4_t6_encode_set_max_2d_rows_per_1d_row (t4_t6_encode_state_t *s, int max) |
Set the maximum number of 2D encoded rows between 1D encoded rows. This is only valid for T.4 2D encoding. More... | |
logging_state_t * | t4_t6_encode_get_logging_state (t4_t6_encode_state_t *s) |
Get the logging context associated with a T.4 or T.6 encode context. More... | |
int | t4_t6_encode_restart (t4_t6_encode_state_t *s, int image_width, int image_length) |
Restart a T.4 or T.6 encode context. More... | |
t4_t6_encode_state_t * | t4_t6_encode_init (t4_t6_encode_state_t *s, int encoding, int image_width, int image_length, t4_row_read_handler_t handler, void *user_data) |
Prepare to encode an image in T.4 or T.6 format. More... | |
int | t4_t6_encode_release (t4_t6_encode_state_t *s) |
int | t4_t6_encode_free (t4_t6_encode_state_t *s) |
#define EOLS_TO_END_T4_TX_PAGE 6 |
The number of EOLs to be sent at the end of a T.4 page
#define EOLS_TO_END_T6_TX_PAGE 2 |
The number of EOLs to be sent at the end of a T.6 page
int t4_t6_encode_get | ( | t4_t6_encode_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 scan line time.
s | The T.4/T.6 context. |
buf | The buffer into which the chunk is to written. |
max_len | The maximum length of the chunk. |
int t4_t6_encode_get_bit | ( | t4_t6_encode_state_t * | s | ) |
Get the next bit of the current image. The image will be padded for the current minimum scan line time.
s | The T.4/T.6 context. |
References t4_t6_encode_state_s::bitstream_iptr, and t4_t6_encode_state_s::bitstream_optr.
Referenced by t4_tx_get_bit().
int t4_t6_encode_get_compressed_image_size | ( | t4_t6_encode_state_t * | s | ) |
Get the size of the compressed image, in bits.
s | The T.4/T.6 context. |
References t4_t6_encode_state_s::compressed_image_size.
Referenced by t4_tx_get_transfer_statistics().
uint32_t t4_t6_encode_get_image_length | ( | t4_t6_encode_state_t * | s | ) |
Get the length of the image.
s | The T.4/T.6 context. |
References t4_t6_encode_state_s::image_length.
Referenced by t4_tx_get_transfer_statistics().
uint32_t t4_t6_encode_get_image_width | ( | t4_t6_encode_state_t * | s | ) |
Get the width of the image.
s | The T.4/T.6 context. |
References t4_t6_encode_state_s::image_width.
Referenced by t4_tx_get_transfer_statistics().
logging_state_t* t4_t6_encode_get_logging_state | ( | t4_t6_encode_state_t * | s | ) |
Get the logging context associated with a T.4 or T.6 encode context.
Get the logging context associated with a T.4 or T.6 encode context.
s | The T.4/T.6 context. |
References t4_t6_encode_state_s::logging.
int t4_t6_encode_image_complete | ( | t4_t6_encode_state_t * | s | ) |
Return the next bit of the current document page, without actually moving forward in the buffer. The document will be padded for the current minimum scan line time.
s | The T.4/T.6 context. |
References t4_t6_encode_state_s::bitstream_iptr, and t4_t6_encode_state_s::bitstream_optr.
Referenced by t4_tx_image_complete().
t4_t6_encode_state_t* t4_t6_encode_init | ( | t4_t6_encode_state_t * | s, |
int | encoding, | ||
int | image_width, | ||
int | image_length, | ||
t4_row_read_handler_t | handler, | ||
void * | user_data | ||
) |
Prepare to encode an image in T.4 or T.6 format.
s | The T.4/T.6 context. |
encoding | The encoding mode. |
image_width | The image width, in pixels. |
image_length | The image length, in pixels. This can be set to -1, if the length is not known. |
handler | A callback routine to handle decoded image rows. |
user_data | An opaque pointer passed to handler. |
int t4_t6_encode_restart | ( | t4_t6_encode_state_t * | s, |
int | image_width, | ||
int | image_length | ||
) |
Restart a T.4 or T.6 encode context.
s | The T.4/T.6 context. |
image_width | The image width, in pixels. |
image_length | The image length, in pixels. This can be set to -1, if the length is not known. |
References t4_t6_encode_state_s::bit_pos, t4_t6_encode_state_s::bitstream_iptr, t4_t6_encode_state_s::bitstream_optr, t4_t6_encode_state_s::compressed_image_size, t4_t6_encode_state_s::encoding, t4_t6_encode_state_s::image_length, t4_t6_decode_state_s::image_width, t4_t6_encode_state_s::image_width, t4_t6_encode_state_s::max_row_bits, t4_t6_encode_state_s::max_rows_to_next_1d_row, t4_t6_encode_state_s::min_row_bits, t4_t6_encode_state_s::ref_runs, t4_t6_encode_state_s::ref_steps, t4_t6_encode_state_s::row_bits, t4_t6_encode_state_s::row_is_2d, t4_t6_encode_state_s::rows_to_next_1d_row, T4_COMPRESSION_T6, t4_t6_encode_set_image_width(), t4_t6_encode_state_s::tx_bits, and t4_t6_encode_state_s::tx_bitstream.
int t4_t6_encode_set_encoding | ( | t4_t6_encode_state_t * | s, |
int | encoding | ||
) |
Set the encoding for the encoded data.
s | The T.4/T.6 context. |
encoding | The encoding. |
References t4_t6_decode_state_s::encoding, t4_t6_encode_state_s::encoding, t4_t6_encode_state_s::max_rows_to_next_1d_row, t4_t6_encode_state_s::min_bits_per_row, t4_t6_encode_state_s::row_is_2d, t4_t6_encode_state_s::rows_to_next_1d_row, T4_COMPRESSION_T4_1D, T4_COMPRESSION_T4_2D, and T4_COMPRESSION_T6.
int t4_t6_encode_set_image_length | ( | t4_t6_encode_state_t * | s, |
int | image_length | ||
) |
Set the length of the image.
s | The T.4/T.6 context. |
image_length | The image length, in pixels. |
int t4_t6_encode_set_image_width | ( | t4_t6_encode_state_t * | s, |
int | image_width | ||
) |
Set the width of the image.
s | The T.4/T.6 context. |
image_width | The image width, in pixels. |
References t4_t6_encode_state_s::bytes_per_row, t4_t6_encode_state_s::image_width, and t4_t6_decode_state_s::image_width.
Referenced by t4_t6_encode_restart().
void t4_t6_encode_set_max_2d_rows_per_1d_row | ( | t4_t6_encode_state_t * | s, |
int | max | ||
) |
Set the maximum number of 2D encoded rows between 1D encoded rows. This is only valid for T.4 2D encoding.
s | The T.4/T.6 context. |
max | The "K" parameter defined in the T.4 specification. This means the value is one greater than the maximum number of 2D rows between each 1D row. |
Referenced by t4_tx_set_max_2d_rows_per_1d_row().
void t4_t6_encode_set_min_bits_per_row | ( | t4_t6_encode_state_t * | s, |
int | bits | ||
) |
Set the minimum number of encoded bits per row. This allows the makes the encoding process to be set to comply with the minimum row time specified by a remote receiving machine.
s | The T.4/T.6 context. |
bits | The minimum number of bits per row. |
int t4_t6_encode_set_row_read_handler | ( | t4_t6_encode_state_t * | s, |
t4_row_read_handler_t | handler, | ||
void * | user_data | ||
) |
Set the row read handler for a T.4/T.6 encode context.
s | The T.4/T.6 context. |
handler | A pointer to the handler routine. |
user_data | An opaque pointer passed to the handler routine. |
References t4_t6_encode_state_s::row_read_handler, and t4_t6_encode_state_s::row_read_user_data.