private/t4_t6_decode.h

00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * private/t4_t6_decode.h - definitions for T.4/T.6 fax decoding
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2003, 2009 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_DECODE_H_)
00027 #define _SPANDSP_PRIVATE_T4_T6_DECODE_H_
00028 
00029 /*!
00030     T.4 1D, T4 2D and T6 decompressor state.
00031 */
00032 struct t4_t6_decode_state_s
00033 {
00034     /*! \brief The type of compression used between the FAX machines. */
00035     //int encoding;
00036     /*! \brief Width of the current page, in pixels. */
00037     //int image_width;
00038 
00039     /*! \brief Callback function to write a row of pixels to the image destination. */
00040     t4_row_write_handler_t row_write_handler;
00041     /*! \brief Opaque pointer passed to row_write_handler. */
00042     void *row_write_user_data;
00043 
00044     /*! \brief A pointer into the image buffer indicating where the last row begins */
00045     int last_row_starts_at;
00046 
00047     /*! \brief This variable is used to count the consecutive EOLS we have seen. If it
00048                reaches six, this is the end of the image. It is initially set to -1 for
00049                1D and 2D decoding, as an indicator that we must wait for the first EOL,
00050                before decoding any image data. */
00051     int consecutive_eols;
00052 
00053     /*! \brief The reference or starting changing element on the coding line. At the
00054                start of the coding line, a0 is set on an imaginary white changing element
00055                situated just before the first element on the line. During the coding of
00056                the coding line, the position of a0 is defined by the previous coding mode.
00057                (See T.4/4.2.1.3.2.). */
00058     int a0;
00059     /*! \brief The first changing element on the reference line to the right of a0 and of
00060                opposite colour to a0. */
00061     int b1;
00062     /*! \brief The length of the in-progress run of black or white. */
00063     int run_length;
00064     /*! \brief 2D horizontal mode control. */
00065     int black_white;
00066     /*! \brief TRUE if the current run is black */
00067     int its_black;
00068 
00069     /*! \brief The current step into the current row run-lengths buffer. */
00070     int a_cursor;
00071     /*! \brief The current step into the reference row run-lengths buffer. */
00072     int b_cursor;
00073 
00074     /*! \brief Incoming bit buffer for decompression. */
00075     uint32_t rx_bitstream;
00076     /*! \brief The number of bits currently in rx_bitstream. */
00077     int rx_bits;
00078     /*! \brief The number of bits to be skipped before trying to match the next code word. */
00079     int rx_skip_bits;
00080 
00081     /*! \brief Decoded pixel buffer. */
00082     //uint32_t pixel_stream;
00083     /*! \brief The number of bits currently in pixel_stream. */
00084     //int tx_bits;
00085 
00086     /*! \brief Current pixel row number. */
00087     //int row;
00088 
00089     /*! \brief The current number of consecutive bad rows. */
00090     int curr_bad_row_run;
00091     /*! \brief The longest run of consecutive bad rows seen in the current page. */
00092     int longest_bad_row_run;
00093     /*! \brief The total number of bad rows in the current page. */
00094     int bad_rows;
00095 
00096     /*! \brief Error and flow logging control */
00097     //logging_state_t logging;
00098 };
00099 
00100 #endif
00101 /*- End of file ------------------------------------------------------------*/

Generated on Wed Feb 8 18:38:18 2012 for spandsp by  doxygen 1.4.7