Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/private/t4_rx.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_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 * $Id: t4_rx.h,v 1.6.2.8 2009/12/21 17:18:40 steveu Exp $ | |
| 26 */ | |
| 27 | |
| 28 #if !defined(_SPANDSP_PRIVATE_T4_RX_H_) | |
| 29 #define _SPANDSP_PRIVATE_T4_RX_H_ | |
| 30 | |
| 31 /*! | |
| 32 TIFF specific state information to go with T.4 compression or decompression handling. | |
| 33 */ | |
| 34 typedef 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 /*! \brief The number of pages in the current image file. */ | |
| 42 int pages_in_file; | |
| 43 | |
| 44 /*! \brief The compression type for output to the TIFF file. */ | |
| 45 int32_t output_compression; | |
| 46 /*! \brief The TIFF photometric setting for the current page. */ | |
| 47 uint16_t photo_metric; | |
| 48 /*! \brief The TIFF fill order setting for the current page. */ | |
| 49 uint16_t fill_order; | |
| 50 /*! \brief The TIFF G3 FAX options. */ | |
| 51 int32_t output_t4_options; | |
| 52 | |
| 53 /* "Background" information about the FAX, which can be stored in the image file. */ | |
| 54 /*! \brief The vendor of the machine which produced the file. */ | |
| 55 const char *vendor; | |
| 56 /*! \brief The model of machine which produced the file. */ | |
| 57 const char *model; | |
| 58 /*! \brief The local ident string. */ | |
| 59 const char *local_ident; | |
| 60 /*! \brief The remote end's ident string. */ | |
| 61 const char *far_ident; | |
| 62 /*! \brief The FAX sub-address. */ | |
| 63 const char *sub_address; | |
| 64 /*! \brief The FAX DCS information, as an ASCII string. */ | |
| 65 const char *dcs; | |
| 66 | |
| 67 /*! \brief The first page to transfer. -1 to start at the beginning of the file. */ | |
| 68 int start_page; | |
| 69 /*! \brief The last page to transfer. -1 to continue to the end of the file. */ | |
| 70 int stop_page; | |
| 71 } t4_tiff_state_t; | |
| 72 | |
| 73 typedef struct t4_t6_decode_state_s t4_t6_decode_state_t; | |
| 74 | |
| 75 /*! | |
| 76 T.4 1D, T4 2D and T6 decompressor state. | |
| 77 */ | |
| 78 struct t4_t6_decode_state_s | |
| 79 { | |
| 80 /*! \brief Callback function to write a row of pixels to the image destination. */ | |
| 81 t4_row_write_handler_t row_write_handler; | |
| 82 /*! \brief Opaque pointer passed to row_write_handler. */ | |
| 83 void *row_write_user_data; | |
| 84 | |
| 85 /*! \brief Incoming bit buffer for decompression. */ | |
| 86 uint32_t rx_bitstream; | |
| 87 /*! \brief The number of bits currently in rx_bitstream. */ | |
| 88 int rx_bits; | |
| 89 /*! \brief The number of bits to be skipped before trying to match the next code word. */ | |
| 90 int rx_skip_bits; | |
| 91 | |
| 92 /*! \brief This variable is used to count the consecutive EOLS we have seen. If it | |
| 93 reaches six, this is the end of the image. It is initially set to -1 for | |
| 94 1D and 2D decoding, as an indicator that we must wait for the first EOL, | |
| 95 before decoding any image data. */ | |
| 96 int consecutive_eols; | |
| 97 | |
| 98 /*! \brief The reference or starting changing element on the coding line. At the | |
| 99 start of the coding line, a0 is set on an imaginary white changing element | |
| 100 situated just before the first element on the line. During the coding of | |
| 101 the coding line, the position of a0 is defined by the previous coding mode. | |
| 102 (See T.4/4.2.1.3.2.). */ | |
| 103 int a0; | |
| 104 /*! \brief The first changing element on the reference line to the right of a0 and of | |
| 105 opposite colour to a0. */ | |
| 106 int b1; | |
| 107 /*! \brief The length of the in-progress run of black or white. */ | |
| 108 int run_length; | |
| 109 /*! \brief 2D horizontal mode control. */ | |
| 110 int black_white; | |
| 111 /*! \brief TRUE if the current run is black */ | |
| 112 int its_black; | |
| 113 | |
| 114 /*! \brief The current step into the current row run-lengths buffer. */ | |
| 115 int a_cursor; | |
| 116 /*! \brief The current step into the reference row run-lengths buffer. */ | |
| 117 int b_cursor; | |
| 118 | |
| 119 /*! \brief A pointer into the image buffer indicating where the last row begins */ | |
| 120 int last_row_starts_at; | |
| 121 | |
| 122 /*! \brief The current number of consecutive bad rows. */ | |
| 123 int curr_bad_row_run; | |
| 124 /*! \brief The longest run of consecutive bad rows seen in the current page. */ | |
| 125 int longest_bad_row_run; | |
| 126 /*! \brief The total number of bad rows in the current page. */ | |
| 127 int bad_rows; | |
| 128 }; | |
| 129 | |
| 130 #endif | |
| 131 /*- End of file ------------------------------------------------------------*/ |
