spandsp 3.0.0
private/t4_rx.h
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * private/t4_rx.h - definitions for T.4 FAX receive 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_RX_H_)
27#define _SPANDSP_PRIVATE_T4_RX_H_
28
29typedef int (*t4_image_put_handler_t)(void *user_data, const uint8_t buf[], size_t len);
30
31/*!
32 TIFF specific state information to go with T.4 compression or decompression handling.
33*/
34typedef struct
35{
36 /*! \brief The current file name. */
37 const char *file;
38 /*! \brief The libtiff context for the current TIFF file */
39 TIFF *tiff_file;
40
41 /*! Image type - bilevel, gray, colour */
43 /*! \brief The compression type for output to the TIFF file. */
45 /*! \brief The TIFF photometric setting for the current page. */
46 uint16_t photo_metric;
47 /*! \brief The TIFF fill order setting for the current page. */
48 uint16_t fill_order;
49
50 /*! \brief The number of pages in the current image file. */
52
53 /*! \brief The time at which handling of the current page began. */
55
56 /*! \brief A point to the image buffer. */
57 uint8_t *image_buffer;
58 /*! \brief The size of the image in the image buffer, in bytes. */
60 /*! \brief The current size of the image buffer. */
63
64/*!
65 T.4 FAX decompression metadata descriptor. This contains information about the image
66 which may be relevant to the backend, but is not relevant to the image decoding process.
67*/
68typedef struct
69{
70 /*! \brief The type of compression used on the wire. */
72 /*! \brief The width of the current page, in pixels. */
73 uint32_t image_width;
74 /*! \brief The length of the current page, in pixels. */
75 uint32_t image_length;
76 /*! \brief Column-to-column (X) resolution in pixels per metre. */
78 /*! \brief Row-to-row (Y) resolution in pixels per metre. */
80
81 /* "Background" information about the FAX, which can be stored in the image file. */
82 /*! \brief The vendor of the machine which produced the file. */
83 const char *vendor;
84 /*! \brief The model of machine which produced the file. */
85 const char *model;
86 /*! \brief The remote end's ident string. */
87 const char *far_ident;
88 /*! \brief The FAX sub-address. */
89 const char *sub_address;
90 /*! \brief The FAX DCS information, as an ASCII hex string. */
91 const char *dcs;
93
94typedef struct
95{
96 uint8_t *buf;
97 int buf_len;
98 int buf_ptr;
100
101/*!
102 T.4 FAX decompression descriptor. This defines the working state
103 for a single instance of a T.4 FAX decompression channel.
104*/
106{
107 /*! \brief Callback function to write a row of pixels to the image destination. */
109 /*! \brief Opaque pointer passed to row_write_handler. */
111
112 /*! \brief A bit mask of the currently supported image compression modes for writing
113 to the TIFF file. */
115
116 /*! \brief The number of pages transferred to date. */
118
119 /*! \brief The size of the compressed image on the line side, in bits. */
121
122 union
123 {
124 no_decoder_state_t no_decoder;
127#if defined(SPANDSP_SUPPORT_T88)
128 t88_decode_state_t t88;
129#endif
132#if defined(SPANDSP_SUPPORT_T45)
133 t45_decode_state_t t45;
134#endif
135 } decoder;
136
137 t4_image_put_handler_t image_put_handler;
138
139 int current_decoder;
140
141 /* Supporting information, like resolutions, which the backend may want. */
142 t4_rx_metadata_t metadata;
143
144 /*! \brief All TIFF file specific state information for the T.4 context. */
146
147 /*! \brief Error and flow logging control */
149};
150
151#endif
152/*- End of file ------------------------------------------------------------*/
Definition private/logging.h:34
Definition private/t4_rx.h:95
Definition private/t42.h:99
Definition private/t43.h:62
Definition private/t4_rx.h:69
const char * model
The model of machine which produced the file.
Definition private/t4_rx.h:85
const char * sub_address
The FAX sub-address.
Definition private/t4_rx.h:89
const char * far_ident
The remote end's ident string.
Definition private/t4_rx.h:87
int x_resolution
Column-to-column (X) resolution in pixels per metre.
Definition private/t4_rx.h:77
uint32_t image_length
The length of the current page, in pixels.
Definition private/t4_rx.h:75
int y_resolution
Row-to-row (Y) resolution in pixels per metre.
Definition private/t4_rx.h:79
int compression
The type of compression used on the wire.
Definition private/t4_rx.h:71
const char * vendor
The vendor of the machine which produced the file.
Definition private/t4_rx.h:83
uint32_t image_width
The width of the current page, in pixels.
Definition private/t4_rx.h:73
const char * dcs
The FAX DCS information, as an ASCII hex string.
Definition private/t4_rx.h:91
Definition private/t4_rx.h:106
t4_rx_tiff_state_t tiff
All TIFF file specific state information for the T.4 context.
Definition private/t4_rx.h:145
int supported_tiff_compressions
A bit mask of the currently supported image compression modes for writing to the TIFF file.
Definition private/t4_rx.h:114
void * row_handler_user_data
Opaque pointer passed to row_write_handler.
Definition private/t4_rx.h:110
t4_row_write_handler_t row_handler
Callback function to write a row of pixels to the image destination.
Definition private/t4_rx.h:108
logging_state_t logging
Error and flow logging control.
Definition private/t4_rx.h:148
int current_page
The number of pages transferred to date.
Definition private/t4_rx.h:117
int line_image_size
The size of the compressed image on the line side, in bits.
Definition private/t4_rx.h:120
Definition private/t4_rx.h:35
uint16_t fill_order
The TIFF fill order setting for the current page.
Definition private/t4_rx.h:48
int image_type
Definition private/t4_rx.h:42
int pages_in_file
The number of pages in the current image file.
Definition private/t4_rx.h:51
const char * file
The current file name.
Definition private/t4_rx.h:37
int image_size
The size of the image in the image buffer, in bytes.
Definition private/t4_rx.h:59
int compression
The compression type for output to the TIFF file.
Definition private/t4_rx.h:44
uint16_t photo_metric
The TIFF photometric setting for the current page.
Definition private/t4_rx.h:46
int image_buffer_size
The current size of the image buffer.
Definition private/t4_rx.h:61
uint8_t * image_buffer
A point to the image buffer.
Definition private/t4_rx.h:57
TIFF * tiff_file
The libtiff context for the current TIFF file.
Definition private/t4_rx.h:39
time_t page_start_time
The time at which handling of the current page began.
Definition private/t4_rx.h:54
Definition private/t4_t6_decode.h:33
Definition private/t85.h:117
int(* t4_row_write_handler_t)(void *user_data, const uint8_t buf[], size_t len)
Definition t4_rx.h:46