spandsp  3.0.0
private/t4_t6_encode.h
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/t4_t6_encode.h - definitions for T.4/T.6 fax compression
5  *
6  * Written by Steve Underwood <steveu@coppice.org>
7  *
8  * Copyright (C) 2003 Steve Underwood
9  *
10  * All rights reserved.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 2.1,
14  * as published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this program; if not, write to the Free Software
23  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25 
26 #if !defined(_SPANDSP_PRIVATE_T4_T6_ENCODE_H_)
27 #define _SPANDSP_PRIVATE_T4_T6_ENCODE_H_
28 
29 /*!
30  T.4 1D, T4 2D and T6 compressor state.
31 */
33 {
34  /*! \brief Callback function to read a row of pixels from the image source. */
36  /*! \brief Opaque pointer passed to row_read_handler. */
38 
39  /*! \brief The type of compression used. */
40  int encoding;
41  /*! \brief Width of the current page, in pixels. */
43  /*! \brief The minimum number of encoded bits per row. This is a timing thing
44  for hardware FAX machines. */
46  /*! \brief The current maximum contiguous rows that may be 2D encoded. */
48 
49  /*! \brief Length of the current page, in pixels. */
51  /*! \brief The current number of bytes per row of uncompressed image data. */
53 
54  /*! \brief Number of rows left that can be 2D encoded, before a 1D encoded row
55  must be used. */
57  /*! \brief The current number of bits in the current encoded row. */
58  int row_bits;
59 
60  /*! \brief This variable is set if we are treating the current row as a 2D encoded
61  one. */
62  bool row_is_2d;
63 
64  /*! \brief Encoded data bits buffer. */
65  uint32_t tx_bitstream;
66  /*! \brief The number of bits currently in tx_bitstream. */
67  int tx_bits;
68  /*! \brief The working chunk of the output bit stream */
69  uint8_t *bitstream;
70  /*! \brief Input pointer to the output bit stream buffer. */
72  /*! \brief Output pointer to the output bit stream buffer. */
74  /*! \brief Pointer to the bit within the byte containing the next image bit to transmit. */
75  int bit_pos;
76 
77  /*! \brief Black and white run-lengths for the current row. */
78  uint32_t *cur_runs;
79  /*! \brief Black and white run-lengths for the reference row. */
80  uint32_t *ref_runs;
81  /*! \brief The number of runs currently in the reference row. */
82  int ref_steps;
83 
84  /*! \brief The minimum bits in any row of the current page. For monitoring only. */
86  /*! \brief The maximum bits in any row of the current page. For monitoring only. */
88 
89  /*! \brief The size of the compressed image, in bits. */
91 
92  /*! \brief Error and flow logging control */
94 };
95 
96 #endif
97 /*- End of file ------------------------------------------------------------*/
Definition: private/logging.h:34
Definition: private/t4_t6_encode.h:33
int image_width
Width of the current page, in pixels.
Definition: private/t4_t6_encode.h:42
int bytes_per_row
The current number of bytes per row of uncompressed image data.
Definition: private/t4_t6_encode.h:52
int min_bits_per_row
The minimum number of encoded bits per row. This is a timing thing for hardware FAX machines.
Definition: private/t4_t6_encode.h:45
uint32_t tx_bitstream
Encoded data bits buffer.
Definition: private/t4_t6_encode.h:65
int rows_to_next_1d_row
Number of rows left that can be 2D encoded, before a 1D encoded row must be used.
Definition: private/t4_t6_encode.h:56
int min_row_bits
The minimum bits in any row of the current page. For monitoring only.
Definition: private/t4_t6_encode.h:85
uint32_t * cur_runs
Black and white run-lengths for the current row.
Definition: private/t4_t6_encode.h:78
void * row_read_user_data
Opaque pointer passed to row_read_handler.
Definition: private/t4_t6_encode.h:37
int max_rows_to_next_1d_row
The current maximum contiguous rows that may be 2D encoded.
Definition: private/t4_t6_encode.h:47
int tx_bits
The number of bits currently in tx_bitstream.
Definition: private/t4_t6_encode.h:67
int compressed_image_size
The size of the compressed image, in bits.
Definition: private/t4_t6_encode.h:90
uint32_t * ref_runs
Black and white run-lengths for the reference row.
Definition: private/t4_t6_encode.h:80
int bit_pos
Pointer to the bit within the byte containing the next image bit to transmit.
Definition: private/t4_t6_encode.h:75
int bitstream_optr
Output pointer to the output bit stream buffer.
Definition: private/t4_t6_encode.h:73
int ref_steps
The number of runs currently in the reference row.
Definition: private/t4_t6_encode.h:82
uint8_t * bitstream
The working chunk of the output bit stream.
Definition: private/t4_t6_encode.h:69
int row_bits
The current number of bits in the current encoded row.
Definition: private/t4_t6_encode.h:58
int bitstream_iptr
Input pointer to the output bit stream buffer.
Definition: private/t4_t6_encode.h:71
t4_row_read_handler_t row_read_handler
Callback function to read a row of pixels from the image source.
Definition: private/t4_t6_encode.h:35
logging_state_t logging
Error and flow logging control.
Definition: private/t4_t6_encode.h:93
bool row_is_2d
This variable is set if we are treating the current row as a 2D encoded one.
Definition: private/t4_t6_encode.h:62
int max_row_bits
The maximum bits in any row of the current page. For monitoring only.
Definition: private/t4_t6_encode.h:87
int image_length
Length of the current page, in pixels.
Definition: private/t4_t6_encode.h:50
int encoding
The type of compression used.
Definition: private/t4_t6_encode.h:40
int(* t4_row_read_handler_t)(void *user_data, uint8_t buf[], size_t len)
Definition: t4_tx.h:34