spandsp 3.0.0
|
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "spandsp/stdbool.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/private/logging.h"
#include "spandsp/private/t81_t82_arith_coding.h"
#include "spandsp/private/t85.h"
Enumerations | |
enum | { NEWLEN_NONE = 0 , NEWLEN_PENDING = 1 , NEWLEN_HANDLED = 2 } |
Functions | |
void | t85_encode_set_options (t85_encode_state_t *s, uint32_t l0, int mx, int options) |
Set the T.85 options. | |
int | t85_encode_set_image_width (t85_encode_state_t *s, uint32_t image_width) |
Set the image width. | |
int | t85_encode_set_image_length (t85_encode_state_t *s, uint32_t image_length) |
Alter the length of a T.85 encoded image. The new length cannot be greater than the originally specified length. If the new length is less than the current length it will be silently adjusted to the current length. Therefore, adjust the length to 1 will make the currently encoded length the final length. | |
void | t85_encode_abort (t85_encode_state_t *s) |
Stop image encoding prematurely. | |
void | t85_encode_comment (t85_encode_state_t *s, const uint8_t comment[], size_t len) |
Insert a comment in the encoded file. | |
int | t85_encode_image_complete (t85_encode_state_t *s) |
Check if we are at the end of the current document page. | |
int | t85_encode_get (t85_encode_state_t *s, uint8_t buf[], size_t max_len) |
Get the next chunk of the current document page. The document will be padded for the current minimum scan line time. | |
uint32_t | t85_encode_get_image_width (t85_encode_state_t *s) |
Get the width of the image. | |
uint32_t | t85_encode_get_image_length (t85_encode_state_t *s) |
Get the length of the image. | |
int | t85_encode_get_compressed_image_size (t85_encode_state_t *s) |
Get the size of the compressed image, in bits. | |
int | t85_encode_set_row_read_handler (t85_encode_state_t *s, t4_row_read_handler_t handler, void *user_data) |
Set the row read handler for a T.85 encode context. | |
logging_state_t * | t85_encode_get_logging_state (t85_encode_state_t *s) |
Get the logging context associated with a T.85 encode context. | |
int | t85_encode_restart (t85_encode_state_t *s, uint32_t image_width, uint32_t image_length) |
Restart a T.85 encode context. | |
t85_encode_state_t * | t85_encode_init (t85_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.85 format. | |
int | t85_encode_release (t85_encode_state_t *s) |
Release a T.85 encode context. | |
int | t85_encode_free (t85_encode_state_t *s) |
Free a T.85 encode context. |
void t85_encode_abort | ( | t85_encode_state_t * | s | ) |
Stop image encoding prematurely.
s | The T.85 context. |
References t85_encode_state_s::y, and t85_encode_state_s::yd.
void t85_encode_comment | ( | t85_encode_state_t * | s, |
const uint8_t | comment[], | ||
size_t | len ) |
Insert a comment in the encoded file.
s | The T.85 context. |
comment | The comment. Note that this is not a C string, and may contain any bytes. |
len | The length of the comment. |
References t85_encode_state_s::comment, and t85_encode_state_s::comment_len.
int t85_encode_free | ( | t85_encode_state_t * | s | ) |
Free a T.85 encode context.
s | The T.85 encode context. |
References t85_encode_release().
int t85_encode_get | ( | t85_encode_state_t * | s, |
uint8_t | buf[], | ||
size_t | 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.85 context. |
buf | The buffer into which the chunk is to written. |
max_len | The maximum length of the chunk. |
Referenced by t4_tx_start_page().
int t85_encode_get_compressed_image_size | ( | t85_encode_state_t * | s | ) |
Get the size of the compressed image, in bits.
s | The T.85 context. |
References t85_encode_state_s::compressed_image_size.
Referenced by t4_tx_get_transfer_statistics().
uint32_t t85_encode_get_image_length | ( | t85_encode_state_t * | s | ) |
Get the length of the image.
s | The T.85 context. |
References t85_encode_state_s::yd.
Referenced by t4_tx_get_transfer_statistics().
uint32_t t85_encode_get_image_width | ( | t85_encode_state_t * | s | ) |
Get the width of the image.
s | The T.85 context. |
References t85_encode_state_s::xd.
Referenced by t4_tx_get_transfer_statistics().
logging_state_t * t85_encode_get_logging_state | ( | t85_encode_state_t * | s | ) |
Get the logging context associated with a T.85 encode context.
Get the logging context associated with a T.85 encode context.
s | The T.85 encode context. |
References t85_encode_state_s::logging.
int t85_encode_image_complete | ( | t85_encode_state_t * | s | ) |
Check if we are at the end of the current document page.
s | The T.85 context. |
References SIG_STATUS_END_OF_DATA, t85_encode_state_s::y, and t85_encode_state_s::yd.
Referenced by t4_tx_image_complete().
t85_encode_state_t * t85_encode_init | ( | t85_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.85 format.
s | The T.85 context. |
image_width | The image width, in pixels. |
image_length | The image length, in pixels. |
handler | A callback routine to handle encoded image rows. |
user_data | An opaque pointer passed to handler. |
References t85_encode_state_s::bit_planes, t85_encode_state_s::l0, t85_encode_state_s::logging, t85_encode_state_s::mx, t85_encode_state_s::options, t85_encode_state_s::row_read_handler, t85_encode_state_s::row_read_user_data, t85_encode_restart(), T85_TPBON, and T85_VLENGTH.
Referenced by t43_encode_init(), and t4_tx_set_tx_image_format().
int t85_encode_release | ( | t85_encode_state_t * | s | ) |
Release a T.85 encode context.
s | The T.85 encode context. |
References t85_encode_state_s::row_buf.
Referenced by t43_encode_free(), t43_encode_release(), and t85_encode_free().
int t85_encode_restart | ( | t85_encode_state_t * | s, |
uint32_t | image_width, | ||
uint32_t | image_length ) |
Restart a T.85 encode context.
s | The T.85 context. |
image_width | The image width, in pixels. |
image_length | The image length, in pixels. |
References t85_encode_state_s::comment, t85_encode_state_s::comment_len, t85_encode_state_s::compressed_image_size, t85_encode_state_s::i, t85_encode_state_s::new_tx, t85_encode_state_s::newlen, t85_encode_state_s::prev_ltp, t85_encode_state_s::row_buf, t85_encode_state_s::s, t85_encode_set_image_width(), t85_encode_state_s::tx, t85_encode_state_s::xd, t85_encode_state_s::y, and t85_encode_state_s::yd.
Referenced by t4_tx_start_page(), and t85_encode_init().
int t85_encode_set_image_length | ( | t85_encode_state_t * | s, |
uint32_t | image_length ) |
Alter the length of a T.85 encoded image. The new length cannot be greater than the originally specified length. If the new length is less than the current length it will be silently adjusted to the current length. Therefore, adjust the length to 1 will make the currently encoded length the final length.
s | The T.85 context. |
image_length | The new image length, in pixels. |
References t85_encode_state_s::i, t85_encode_state_s::newlen, t85_encode_state_s::options, t85_encode_state_s::s, T85_VLENGTH, t85_encode_state_s::y, and t85_encode_state_s::yd.
int t85_encode_set_image_width | ( | t85_encode_state_t * | s, |
uint32_t | image_width ) |
Set the image width.
s | The T.85 context. |
image_width | The width of the image. |
References t85_encode_state_s::prev_row, t85_encode_state_s::row_buf, t85_encode_state_s::xd, and t85_encode_state_s::y.
Referenced by t85_encode_restart().
void t85_encode_set_options | ( | t85_encode_state_t * | s, |
uint32_t | l0, | ||
int | mx, | ||
int | options ) |
Set the T.85 options.
s | The T.85 context. |
l0 ???
mx ???
options ???.
References t85_encode_state_s::l0, t85_encode_state_s::mx, t85_encode_state_s::options, T85_LRLTWO, T85_TPBON, T85_VLENGTH, and t85_encode_state_s::y.
int t85_encode_set_row_read_handler | ( | t85_encode_state_t * | s, |
t4_row_read_handler_t | handler, | ||
void * | user_data ) |
Set the row read handler for a T.85 encode context.
s | The T.85 context. |
handler | A pointer to the handler routine. |
user_data | An opaque pointer passed to the handler routine. |
References t85_encode_state_s::row_read_handler, and t85_encode_state_s::row_read_user_data.