00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/t4_t6_encode.h - definitions for T.4/T.6 fax compression 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_T6_ENCODE_H_) 00027 #define _SPANDSP_PRIVATE_T4_T6_ENCODE_H_ 00028 00029 /*! 00030 T.4 1D, T4 2D and T6 compressor state. 00031 */ 00032 struct t4_t6_encode_state_s 00033 { 00034 /*! \brief Callback function to read a row of pixels from the image source. */ 00035 t4_row_read_handler_t row_read_handler; 00036 /*! \brief Opaque pointer passed to row_read_handler. */ 00037 void *row_read_user_data; 00038 00039 /*! \brief The type of compression used. */ 00040 int encoding; 00041 /*! \brief Width of the current page, in pixels. */ 00042 int image_width; 00043 /*! \brief The minimum number of encoded bits per row. This is a timing thing 00044 for hardware FAX machines. */ 00045 int min_bits_per_row; 00046 /*! \brief The current maximum contiguous rows that may be 2D encoded. */ 00047 int max_rows_to_next_1d_row; 00048 00049 /*! \brief Length of the current page, in pixels. */ 00050 int image_length; 00051 /*! \brief The current number of bytes per row of uncompressed image data. */ 00052 int bytes_per_row; 00053 00054 /*! \brief Number of rows left that can be 2D encoded, before a 1D encoded row 00055 must be used. */ 00056 int rows_to_next_1d_row; 00057 /*! \brief The current number of bits in the current encoded row. */ 00058 int row_bits; 00059 00060 /*! \brief This variable is set if we are treating the current row as a 2D encoded 00061 one. */ 00062 int row_is_2d; 00063 00064 /*! \brief Encoded data bits buffer. */ 00065 uint32_t tx_bitstream; 00066 /*! \brief The number of bits currently in tx_bitstream. */ 00067 int tx_bits; 00068 /*! \brief The working chunk of the output bit stream */ 00069 uint8_t *bitstream; 00070 /*! \brief Input pointer to the output bit stream buffer. */ 00071 int bitstream_iptr; 00072 /*! \brief Output pointer to the output bit stream buffer. */ 00073 int bitstream_optr; 00074 /*! \brief Pointer to the bit within the byte containing the next image bit to transmit. */ 00075 int bit_pos; 00076 00077 /*! \brief Black and white run-lengths for the current row. */ 00078 uint32_t *cur_runs; 00079 /*! \brief Black and white run-lengths for the reference row. */ 00080 uint32_t *ref_runs; 00081 /*! \brief The number of runs currently in the reference row. */ 00082 int ref_steps; 00083 00084 /*! \brief The minimum bits in any row of the current page. For monitoring only. */ 00085 int min_row_bits; 00086 /*! \brief The maximum bits in any row of the current page. For monitoring only. */ 00087 int max_row_bits; 00088 00089 /*! \brief The size of the compressed image, in bits. */ 00090 int compressed_image_size; 00091 00092 /*! \brief Error and flow logging control */ 00093 logging_state_t logging; 00094 }; 00095 00096 #endif 00097 /*- End of file ------------------------------------------------------------*/
1.6.1