spandsp  0.0.6
private/t4_tx.h
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/t4_tx.h - definitions for T.4 FAX transmit processing
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_TX_H_)
27 #define _SPANDSP_PRIVATE_T4_TX_H_
28 
29 /*!
30  T.4 FAX compression/decompression descriptor. This defines the working state
31  for a single instance of a T.4 FAX compression or decompression channel.
32 */
33 struct t4_state_s
34 {
35  /*! \brief The same structure is used for T.4 transmit and receive. This variable
36  records which mode is in progress. */
37  int rx;
38 
39  /*! \brief The type of compression used between the FAX machines. */
41 
42  /*! \brief The time at which handling of the current page began. */
44 
45  /*! \brief The text which will be used in FAX page header. No text results
46  in no header line. */
47  const char *header_info;
48  /*! \brief Optional per instance time zone for the FAX pager header timestamp. */
49  struct tz_s *tz;
50 
51  /*! \brief The size of the compressed image on the line side, in bits. */
53 
54  /*! \brief The current number of bytes per row of uncompressed image data. */
56  /*! \brief The size of the image in the image buffer, in bytes. */
58  /*! \brief The current size of the image buffer. */
60  /*! \brief A point to the image buffer. */
61  uint8_t *image_buffer;
62 
63  /*! \brief The number of pages transferred to date. */
65  /*! \brief Column-to-column (X) resolution in pixels per metre. */
67  /*! \brief Row-to-row (Y) resolution in pixels per metre. */
69  /*! \brief Width of the current page, in pixels. */
71  /*! \brief Length of the current page, in pixels. */
73  /*! \brief Current pixel row number. */
74  int row;
75 
76  /*! \brief This variable is set if we are treating the current row as a 2D encoded
77  one. */
78  int row_is_2d;
79  /*! \brief The current length of the current row. */
80  int row_len;
81 
82  /*! \brief Black and white run-lengths for the current row. */
83  uint32_t *cur_runs;
84  /*! \brief Black and white run-lengths for the reference row. */
85  uint32_t *ref_runs;
86  /*! \brief Pointer to the buffer for the current pixel row. */
87  uint8_t *row_buf;
88 
89  /*! \brief Encoded data bits buffer. */
90  uint32_t tx_bitstream;
91  /*! \brief The number of bits currently in tx_bitstream. */
92  int tx_bits;
93 
94  /*! \brief The current number of bits in the current encoded row. */
95  int row_bits;
96  /*! \brief The minimum bits in any row of the current page. For monitoring only. */
98  /*! \brief The maximum bits in any row of the current page. For monitoring only. */
100 
101  /*! \brief Error and flow logging control */
103 
104  /*! \brief All TIFF file specific state information for the T.4 context. */
106  t4_t6_decode_state_t t4_t6_rx;
107  t4_t6_encode_state_t t4_t6_tx;
108 };
109 
110 #endif
111 /*- End of file ------------------------------------------------------------*/