Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/private/t4_tx.h @ 4:26cd8f1ef0b1
import spandsp-0.0.6pre17
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Fri, 25 Jun 2010 15:50:58 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:c6c5a16ce2f2 | 4:26cd8f1ef0b1 |
---|---|
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 * $Id: t4_tx.h,v 1.7.2.4 2009/12/21 17:18:40 steveu Exp $ | |
26 */ | |
27 | |
28 #if !defined(_SPANDSP_PRIVATE_T4_TX_H_) | |
29 #define _SPANDSP_PRIVATE_T4_TX_H_ | |
30 | |
31 typedef struct t4_t6_encode_state_s t4_t6_encode_state_t; | |
32 | |
33 /*! | |
34 T.4 1D, T4 2D and T6 compressor state. | |
35 */ | |
36 struct t4_t6_encode_state_s | |
37 { | |
38 /*! \brief The minimum number of encoded bits per row. This is a timing thing | |
39 for hardware FAX machines. */ | |
40 int min_bits_per_row; | |
41 /*! \brief The current maximum contiguous rows that may be 2D encoded. */ | |
42 int max_rows_to_next_1d_row; | |
43 | |
44 /*! \brief The text which will be used in FAX page header. No text results | |
45 in no header line. */ | |
46 const char *header_info; | |
47 | |
48 /*! \brief Number of rows left that can be 2D encoded, before a 1D encoded row | |
49 must be used. */ | |
50 int rows_to_next_1d_row; | |
51 | |
52 /*! \brief The number of runs currently in the reference row. */ | |
53 int ref_steps; | |
54 | |
55 /*! \brief Pointer to the byte containing the next image bit to transmit. */ | |
56 int bit_pos; | |
57 /*! \brief Pointer to the bit within the byte containing the next image bit to transmit. */ | |
58 int bit_ptr; | |
59 | |
60 /*! \brief Callback function to read a row of pixels from the image source. */ | |
61 t4_row_read_handler_t row_read_handler; | |
62 /*! \brief Opaque pointer passed to row_read_handler. */ | |
63 void *row_read_user_data; | |
64 }; | |
65 | |
66 /*! | |
67 T.4 FAX compression/decompression descriptor. This defines the working state | |
68 for a single instance of a T.4 FAX compression or decompression channel. | |
69 */ | |
70 struct t4_state_s | |
71 { | |
72 /*! \brief The same structure is used for T.4 transmit and receive. This variable | |
73 records which mode is in progress. */ | |
74 int rx; | |
75 | |
76 /*! \brief The type of compression used between the FAX machines. */ | |
77 int line_encoding; | |
78 | |
79 /*! \brief The time at which handling of the current page began. */ | |
80 time_t page_start_time; | |
81 | |
82 /*! \brief The size of the compressed image on the line side, in bits. */ | |
83 int line_image_size; | |
84 | |
85 /*! \brief The current number of bytes per row of uncompressed image data. */ | |
86 int bytes_per_row; | |
87 /*! \brief The size of the image in the image buffer, in bytes. */ | |
88 int image_size; | |
89 /*! \brief The current size of the image buffer. */ | |
90 int image_buffer_size; | |
91 /*! \brief A point to the image buffer. */ | |
92 uint8_t *image_buffer; | |
93 | |
94 /*! \brief The number of pages transferred to date. */ | |
95 int current_page; | |
96 /*! \brief Column-to-column (X) resolution in pixels per metre. */ | |
97 int x_resolution; | |
98 /*! \brief Row-to-row (Y) resolution in pixels per metre. */ | |
99 int y_resolution; | |
100 /*! \brief Width of the current page, in pixels. */ | |
101 int image_width; | |
102 /*! \brief Length of the current page, in pixels. */ | |
103 int image_length; | |
104 /*! \brief Current pixel row number. */ | |
105 int row; | |
106 | |
107 /*! \brief This variable is set if we are treating the current row as a 2D encoded | |
108 one. */ | |
109 int row_is_2d; | |
110 /*! \brief The current length of the current row. */ | |
111 int row_len; | |
112 | |
113 /*! \brief Black and white run-lengths for the current row. */ | |
114 uint32_t *cur_runs; | |
115 /*! \brief Black and white run-lengths for the reference row. */ | |
116 uint32_t *ref_runs; | |
117 /*! \brief Pointer to the buffer for the current pixel row. */ | |
118 uint8_t *row_buf; | |
119 | |
120 /*! \brief Encoded data bits buffer. */ | |
121 uint32_t tx_bitstream; | |
122 /*! \brief The number of bits currently in tx_bitstream. */ | |
123 int tx_bits; | |
124 | |
125 /*! \brief The current number of bits in the current encoded row. */ | |
126 int row_bits; | |
127 /*! \brief The minimum bits in any row of the current page. For monitoring only. */ | |
128 int min_row_bits; | |
129 /*! \brief The maximum bits in any row of the current page. For monitoring only. */ | |
130 int max_row_bits; | |
131 | |
132 /*! \brief Error and flow logging control */ | |
133 logging_state_t logging; | |
134 | |
135 /*! \brief All TIFF file specific state information for the T.4 context. */ | |
136 t4_tiff_state_t tiff; | |
137 t4_t6_decode_state_t t4_t6_rx; | |
138 t4_t6_encode_state_t t4_t6_tx; | |
139 }; | |
140 | |
141 #endif | |
142 /*- End of file ------------------------------------------------------------*/ |