00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/t4_rx.h - definitions for T.4 FAX receive processing 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2003 Steve Underwood 00009 * 00010 * All rights reserved. 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 2.1, 00014 * as published by the Free Software Foundation. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 */ 00025 00026 #if !defined(_SPANDSP_PRIVATE_T4_RX_H_) 00027 #define _SPANDSP_PRIVATE_T4_RX_H_ 00028 00029 /*! 00030 TIFF specific state information to go with T.4 compression or decompression handling. 00031 */ 00032 typedef struct 00033 { 00034 /*! \brief The current file name. */ 00035 const char *file; 00036 /*! \brief The libtiff context for the current TIFF file */ 00037 TIFF *tiff_file; 00038 00039 /*! Image type - bilevel, gray, colour */ 00040 int image_type; 00041 /*! \brief The compression type for output to the TIFF file. */ 00042 int output_encoding; 00043 /*! \brief The TIFF photometric setting for the current page. */ 00044 uint16_t photo_metric; 00045 /*! \brief The TIFF fill order setting for the current page. */ 00046 uint16_t fill_order; 00047 00048 /*! \brief The number of pages in the current image file. */ 00049 int pages_in_file; 00050 00051 /*! \brief The time at which handling of the current page began. */ 00052 time_t page_start_time; 00053 00054 /*! \brief A point to the image buffer. */ 00055 uint8_t *image_buffer; 00056 /*! \brief The size of the image in the image buffer, in bytes. */ 00057 int image_size; 00058 /*! \brief The current size of the image buffer. */ 00059 int image_buffer_size; 00060 } t4_rx_tiff_state_t; 00061 00062 /*! 00063 T.4 FAX decompression metadata descriptor. This contains information about the image 00064 which may be relevant to the backend, but is not relevant to the image decoding process. 00065 */ 00066 typedef struct 00067 { 00068 /*! \brief Column-to-column (X) resolution in pixels per metre. */ 00069 int x_resolution; 00070 /*! \brief Row-to-row (Y) resolution in pixels per metre. */ 00071 int y_resolution; 00072 00073 /* "Background" information about the FAX, which can be stored in the image file. */ 00074 /*! \brief The vendor of the machine which produced the file. */ 00075 const char *vendor; 00076 /*! \brief The model of machine which produced the file. */ 00077 const char *model; 00078 /*! \brief The remote end's ident string. */ 00079 const char *far_ident; 00080 /*! \brief The FAX sub-address. */ 00081 const char *sub_address; 00082 /*! \brief The FAX DCS information, as an ASCII hex string. */ 00083 const char *dcs; 00084 } t4_rx_metadata_t; 00085 00086 /*! 00087 T.4 FAX decompression descriptor. This defines the working state 00088 for a single instance of a T.4 FAX decompression channel. 00089 */ 00090 struct t4_rx_state_s 00091 { 00092 /*! \brief Callback function to write a row of pixels to the image destination. */ 00093 t4_row_write_handler_t row_handler; 00094 /*! \brief Opaque pointer passed to row_write_handler. */ 00095 void *row_handler_user_data; 00096 00097 /*! \brief The number of pages transferred to date. */ 00098 int current_page; 00099 00100 /*! \brief The size of the compressed image on the line side, in bits. */ 00101 int line_image_size; 00102 00103 /*! \brief The type of compression used between the FAX machines. */ 00104 int line_encoding; 00105 00106 /*! \brief The width of the current page, in pixels. */ 00107 uint32_t image_width; 00108 00109 union 00110 { 00111 t4_t6_decode_state_t t4_t6; 00112 t42_decode_state_t t42; 00113 #if defined(SPANDSP_SUPPORT_T43) 00114 t43_decode_state_t t43; 00115 #endif 00116 t85_decode_state_t t85; 00117 } decoder; 00118 00119 /* Supporting information, like resolutions, which the backend may want. */ 00120 t4_rx_metadata_t metadata; 00121 00122 /*! \brief All TIFF file specific state information for the T.4 context. */ 00123 t4_rx_tiff_state_t tiff; 00124 00125 /*! \brief Error and flow logging control */ 00126 logging_state_t logging; 00127 }; 00128 00129 #endif 00130 /*- End of file ------------------------------------------------------------*/
1.6.1