spandsp: t4_t6_decode.h Source File

spandsp 0.0.6

private/t4_t6_decode.h
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * private/t4_t6_decode.h - definitions for T.4/T.6 fax decoding
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2003, 2009 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
26#if !defined(_SPANDSP_PRIVATE_T4_T6_DECODE_H_)
27#define _SPANDSP_PRIVATE_T4_T6_DECODE_H_
28
29/*!
30 T.4 1D, T4 2D and T6 decompressor state.
31*/
32 struct t4_t6_decode_state_s
33{
34 /*! \brief The type of compression used between the FAX machines. */
35 //int encoding;
36 /*! \brief Width of the current page, in pixels. */
37 //int image_width;
38
39 /*! \brief Callback function to write a row of pixels to the image destination. */
40 t4_row_write_handler_t row_write_handler;
41 /*! \brief Opaque pointer passed to row_write_handler. */
42 void *row_write_user_data;
43
44 /*! \brief A pointer into the image buffer indicating where the last row begins */
45 int last_row_starts_at;
46
47 /*! \brief This variable is used to count the consecutive EOLS we have seen. If it
48 reaches six, this is the end of the image. It is initially set to -1 for
49 1D and 2D decoding, as an indicator that we must wait for the first EOL,
50 before decoding any image data. */
51 int consecutive_eols;
52
53 /*! \brief The reference or starting changing element on the coding line. At the
54 start of the coding line, a0 is set on an imaginary white changing element
55 situated just before the first element on the line. During the coding of
56 the coding line, the position of a0 is defined by the previous coding mode.
57 (See T.4/4.2.1.3.2.). */
58 int a0;
59 /*! \brief The first changing element on the reference line to the right of a0 and of
60 opposite colour to a0. */
61 int b1;
62 /*! \brief The length of the in-progress run of black or white. */
63 int run_length;
64 /*! \brief 2D horizontal mode control. */
65 int black_white;
66 /*! \brief TRUE if the current run is black */
67 int its_black;
68
69 /*! \brief The current step into the current row run-lengths buffer. */
70 int a_cursor;
71 /*! \brief The current step into the reference row run-lengths buffer. */
72 int b_cursor;
73
74 /*! \brief Incoming bit buffer for decompression. */
75 uint32_t rx_bitstream;
76 /*! \brief The number of bits currently in rx_bitstream. */
77 int rx_bits;
78 /*! \brief The number of bits to be skipped before trying to match the next code word. */
79 int rx_skip_bits;
80
81 /*! \brief Decoded pixel buffer. */
82 //uint32_t pixel_stream;
83 /*! \brief The number of bits currently in pixel_stream. */
84 //int tx_bits;
85
86 /*! \brief Current pixel row number. */
87 //int row;
88
89 /*! \brief The current number of consecutive bad rows. */
90 int curr_bad_row_run;
91 /*! \brief The longest run of consecutive bad rows seen in the current page. */
92 int longest_bad_row_run;
93 /*! \brief The total number of bad rows in the current page. */
94 int bad_rows;
95
96 /*! \brief Error and flow logging control */
97 //logging_state_t logging;
98};
99
100#endif
101/*- End of file ------------------------------------------------------------*/
t4_t6_decode_state_s
Definition private/t4_t6_decode.h:33
t4_t6_decode_state_s::longest_bad_row_run
int longest_bad_row_run
The longest run of consecutive bad rows seen in the current page.
Definition private/t4_t6_decode.h:92
t4_t6_decode_state_s::a0
int a0
The reference or starting changing element on the coding line. At the start of the coding line,...
Definition private/t4_t6_decode.h:58
t4_t6_decode_state_s::b1
int b1
The first changing element on the reference line to the right of a0 and of opposite colour to a0.
Definition private/t4_t6_decode.h:61
t4_t6_decode_state_s::bad_rows
int bad_rows
The total number of bad rows in the current page.
Definition private/t4_t6_decode.h:94
t4_t6_decode_state_s::black_white
int black_white
2D horizontal mode control.
Definition private/t4_t6_decode.h:65
t4_t6_decode_state_s::row_write_handler
t4_row_write_handler_t row_write_handler
The type of compression used between the FAX machines.
Definition private/t4_t6_decode.h:40
t4_t6_decode_state_s::row_write_user_data
void * row_write_user_data
Opaque pointer passed to row_write_handler.
Definition private/t4_t6_decode.h:42
t4_t6_decode_state_s::last_row_starts_at
int last_row_starts_at
A pointer into the image buffer indicating where the last row begins.
Definition private/t4_t6_decode.h:45
t4_t6_decode_state_s::rx_bitstream
uint32_t rx_bitstream
Incoming bit buffer for decompression.
Definition private/t4_t6_decode.h:75
t4_t6_decode_state_s::b_cursor
int b_cursor
The current step into the reference row run-lengths buffer.
Definition private/t4_t6_decode.h:72
t4_t6_decode_state_s::its_black
int its_black
TRUE if the current run is black.
Definition private/t4_t6_decode.h:67
t4_t6_decode_state_s::rx_skip_bits
int rx_skip_bits
The number of bits to be skipped before trying to match the next code word.
Definition private/t4_t6_decode.h:79
t4_t6_decode_state_s::curr_bad_row_run
int curr_bad_row_run
Decoded pixel buffer.
Definition private/t4_t6_decode.h:90
t4_t6_decode_state_s::a_cursor
int a_cursor
The current step into the current row run-lengths buffer.
Definition private/t4_t6_decode.h:70
t4_t6_decode_state_s::rx_bits
int rx_bits
The number of bits currently in rx_bitstream.
Definition private/t4_t6_decode.h:77
t4_t6_decode_state_s::run_length
int run_length
The length of the in-progress run of black or white.
Definition private/t4_t6_decode.h:63
t4_t6_decode_state_s::consecutive_eols
int consecutive_eols
This variable is used to count the consecutive EOLS we have seen. If it reaches six,...
Definition private/t4_t6_decode.h:51
t4_row_write_handler_t
int(* t4_row_write_handler_t)(void *user_data, const uint8_t buf[], size_t len)
Definition t4_rx.h:46