00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/t4_tx.h - definitions for T.4 FAX transmit 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_TX_H_) 00027 #define _SPANDSP_PRIVATE_T4_TX_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 /*! \brief The compression type used in the TIFF file */ 00040 uint16_t compression; 00041 /*! \brief Image type - bi-level, gray, colour, etc. */ 00042 int image_type; 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 A pointer to the image buffer. */ 00052 uint8_t *image_buffer; 00053 /*! \brief The size of the image in the image buffer, in bytes. */ 00054 int image_size; 00055 /*! \brief The current size of the image buffer. */ 00056 int image_buffer_size; 00057 /*! \brief Row counter for playing out the rows of the image. */ 00058 int row; 00059 00060 /*! \brief Image length of the image in the file. This is used when the 00061 image is resized or dithered flat. */ 00062 int image_length; 00063 /*! \brief Row counter used when the image is resized or dithered flat. */ 00064 int raw_row; 00065 } t4_tx_tiff_state_t; 00066 00067 /*! 00068 T.4 FAX compression metadata descriptor. This contains information about the image 00069 which may be relevant to the backend, but is not generally relevant to the image 00070 encoding process. The exception here is the y-resolution, which is used in T.4 2-D 00071 encoding for non-ECM applications, to optimise the balance of density and robustness. 00072 */ 00073 typedef struct 00074 { 00075 /*! \brief Column-to-column (X) resolution in pixels per metre. */ 00076 int x_resolution; 00077 /*! \brief Row-to-row (Y) resolution in pixels per metre. */ 00078 int y_resolution; 00079 } t4_tx_metadata_t; 00080 00081 /*! 00082 T.4 FAX compression descriptor. This defines the working state 00083 for a single instance of a T.4 FAX compression channel. 00084 */ 00085 struct t4_tx_state_s 00086 { 00087 /*! \brief Callback function to read a row of pixels from the image source. */ 00088 t4_row_read_handler_t row_handler; 00089 /*! \brief Opaque pointer passed to row_read_handler. */ 00090 void *row_handler_user_data; 00091 00092 /*! \brief The type of compression used between the FAX machines. */ 00093 int line_encoding; 00094 00095 int line_encoding_bilevel; 00096 int line_encoding_gray; 00097 int line_encoding_colour; 00098 00099 /*! \brief When superfine and fine resolution images need to be squahed vertically 00100 to a lower resolution, this value sets the number of source rows which 00101 must be squashed to form each row on the wire. */ 00102 int row_squashing_ratio; 00103 00104 /*! \brief The width of the current page, in pixels. */ 00105 uint32_t image_width; 00106 /*! \brief The length of the current page, in pixels. */ 00107 uint32_t image_length; 00108 00109 /*! \brief The size of the compressed image on the line side, in bits. */ 00110 int line_image_size; 00111 00112 /*! \brief The first page to transfer. -1 to start at the beginning of the file. */ 00113 int start_page; 00114 /*! \brief The last page to transfer. -1 to continue to the end of the file. */ 00115 int stop_page; 00116 00117 /*! \brief TRUE for FAX page headers to overlay (i.e. replace) the beginning of the 00118 page image. FALSE for FAX page headers to add to the overall length of 00119 the page. */ 00120 int header_overlays_image; 00121 /*! \brief The text which will be used in FAX page header. No text results 00122 in no header line. */ 00123 const char *header_info; 00124 /*! \brief The local ident string. This is used with header_info to form a 00125 page header line. */ 00126 const char *local_ident; 00127 /*! \brief The page number of current page. The first page is zero. If FAX page 00128 headers are used, the page number in the header will be one more than 00129 this value (i.e. they start from 1). */ 00130 int current_page; 00131 00132 /*! \brief The composed text of the FAX page header, if there is one. */ 00133 char *header_text; 00134 /*! \brief Optional per instance time zone for the FAX page header timestamp. */ 00135 tz_t *tz; 00136 00137 /*! \brief Row counter for playing out the rows of the header line. */ 00138 int header_row; 00139 00140 union 00141 { 00142 t4_t6_encode_state_t t4_t6; 00143 t42_encode_state_t t42; 00144 #if defined(SPANDSP_SUPPORT_T43) 00145 t43_encode_state_t t43; 00146 #endif 00147 t85_encode_state_t t85; 00148 } encoder; 00149 00150 image_translate_state_t translator; 00151 00152 int apply_lab; 00153 lab_params_t lab_params; 00154 uint8_t *colour_map; 00155 int colour_map_entries; 00156 00157 /* Supporting information, like resolutions, which the backend may want. */ 00158 t4_tx_metadata_t metadata; 00159 00160 /*! \brief All TIFF file specific state information for the T.4 context. */ 00161 t4_tx_tiff_state_t tiff; 00162 00163 /*! \brief Error and flow logging control */ 00164 logging_state_t logging; 00165 }; 00166 00167 #endif 00168 /*- End of file ------------------------------------------------------------*/
1.6.1