t4.h

Go to the documentation of this file.
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * t4.h - definitions for T.4 fax 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 General Public License version 2, as
00014  * 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 General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  *
00025  * $Id: t4.h,v 1.41 2007/10/13 14:10:20 steveu Exp $
00026  */
00027 
00028 /*! \file */
00029 
00030 #if !defined(_SPANDSP_T4_H_)
00031 #define _SPANDSP_T4_H_
00032 
00033 /*! \page t4_page T.4 image compression and decompression
00034 
00035 \section t4_page_sec_1 What does it do?
00036 The T.4 image compression and decompression routines implement the 1D and 2D
00037 encoding methods defined in ITU specification T.4. They also implement the pure
00038 2D encoding method defined in T.6. These are image compression algorithms used
00039 for FAX transmission.
00040 
00041 \section t4_page_sec_1 How does it work?
00042 */
00043 
00044 typedef int (*t4_row_read_handler_t)(void *user_data, uint8_t buf[], size_t len);
00045 typedef int (*t4_row_write_handler_t)(void *user_data, const uint8_t buf[], size_t len);
00046 
00047 typedef enum
00048 {
00049     T4_COMPRESSION_ITU_T4_1D = 1,
00050     T4_COMPRESSION_ITU_T4_2D = 2,
00051     T4_COMPRESSION_ITU_T6 = 3
00052 } t4_image_compression_t;
00053 
00054 typedef enum
00055 {
00056     T4_X_RESOLUTION_R4 = 4016,
00057     T4_X_RESOLUTION_R8 = 8031,
00058     T4_X_RESOLUTION_300 = 11811,
00059     T4_X_RESOLUTION_R16 = 16063,
00060     T4_X_RESOLUTION_600 = 23622,
00061     T4_X_RESOLUTION_800 = 31496,
00062     T4_X_RESOLUTION_1200 = 47244
00063 } t4_image_x_resolution_t;
00064 
00065 typedef enum
00066 {
00067     T4_Y_RESOLUTION_STANDARD = 3850,
00068     T4_Y_RESOLUTION_FINE = 7700,
00069     T4_Y_RESOLUTION_300 = 11811,
00070     T4_Y_RESOLUTION_SUPERFINE = 15400,  /* 400 is 15748 */
00071     T4_Y_RESOLUTION_600 = 23622,
00072     T4_Y_RESOLUTION_800 = 31496,
00073     T4_Y_RESOLUTION_1200 = 47244
00074 } t4_image_y_resolution_t;
00075 
00076 /*!
00077     Exact widths in PELs for the difference resolutions, and page widths.
00078     Note:
00079         The A4 widths also apply to North American letter and legal.
00080         The R4 resolution widths are not supported in recent versions of T.30
00081         Only images of exactly these widths are acceptable for FAX transmisson.
00082 
00083     R4    864 pels/215mm for ISO A4, North American Letter and Legal
00084     R4   1024 pels/255mm for ISO B4
00085     R4   1216 pels/303mm for ISO A3
00086     R8   1728 pels/215mm for ISO A4, North American Letter and Legal
00087     R8   2048 pels/255mm for ISO B4
00088     R8   2432 pels/303mm for ISO A3
00089     R16  3456 pels/215mm for ISO A4, North American Letter and Legal
00090     R16  4096 pels/255mm for ISO B4
00091     R16  4864 pels/303mm for ISO A3
00092 */
00093 typedef enum
00094 {
00095     T4_WIDTH_R4_A4 = 864,
00096     T4_WIDTH_R4_B4 = 1024,
00097     T4_WIDTH_R4_A3 = 1216,
00098     T4_WIDTH_R8_A4 = 1728,
00099     T4_WIDTH_R8_B4 = 2048,
00100     T4_WIDTH_R8_A3 = 2432,
00101     T4_WIDTH_300_A4 = 2592,
00102     T4_WIDTH_300_B4 = 3072,
00103     T4_WIDTH_300_A3 = 3648,
00104     T4_WIDTH_R16_A4 = 3456,
00105     T4_WIDTH_R16_B4 = 4096,
00106     T4_WIDTH_R16_A3 = 4864,
00107     T4_WIDTH_600_A4 = 5184,
00108     T4_WIDTH_600_B4 = 6144,
00109     T4_WIDTH_600_A3 = 7296,
00110     T4_WIDTH_1200_A4 = 10368,
00111     T4_WIDTH_1200_B4 = 12288,
00112     T4_WIDTH_1200_A3 = 14592
00113 } t4_image_width_t;
00114 
00115 /*!
00116     Length of the various supported paper sizes, in pixels at the various Y resolutions.
00117     Paper sizes are
00118         A4 (215mm x 297mm)
00119         B4 (255mm x 364mm)
00120         A3 (303mm x 418.56mm)
00121         North American Letter (215.9mm x 279.4mm)
00122         North American Legal (215.9mm x 355.6mm)
00123         Unlimited
00124 */
00125 typedef enum
00126 {
00127     /* A4 is 297mm long */
00128     T4_LENGTH_STANDARD_A4 = 1143,
00129     T4_LENGTH_FINE_A4 = 2286,
00130     T4_LENGTH_300_A4 = 4665,
00131     T4_LENGTH_SUPERFINE_A4 = 4573,
00132     T4_LENGTH_600_A4 = 6998,
00133     T4_LENGTH_800_A4 = 9330,
00134     T4_LENGTH_1200_A4 = 13996,
00135     /* B4 is 364mm long */
00136     T4_LENGTH_STANDARD_B4 = 1401,
00137     T4_LENGTH_FINE_B4 = 2802,
00138     T4_LENGTH_300_B4 = 0,
00139     T4_LENGTH_SUPERFINE_B4 = 5605,
00140     T4_LENGTH_600_B4 = 0,
00141     T4_LENGTH_800_B4 = 0,
00142     T4_LENGTH_1200_B4 = 0,
00143     /* North American letter is 279.4mm long */
00144     T4_LENGTH_STANDARD_US_LETTER = 1075,
00145     T4_LENGTH_FINE_US_LETTER = 2151,
00146     T4_LENGTH_300_US_LETTER = 0,
00147     T4_LENGTH_SUPERFINE_US_LETTER = 4302,
00148     T4_LENGTH_600_US_LETTER = 0,
00149     T4_LENGTH_800_US_LETTER = 0,
00150     T4_LENGTH_1200_US_LETTER = 0,
00151     /* North American legal is 355.6mm long */
00152     T4_LENGTH_STANDARD_US_LEGAL = 1369,
00153     T4_LENGTH_FINE_US_LEGAL = 2738,
00154     T4_LENGTH_300_US_LEGAL = 0,
00155     T4_LENGTH_SUPERFINE_US_LEGAL = 5476,
00156     T4_LENGTH_600_US_LEGAL = 0,
00157     T4_LENGTH_800_US_LEGAL = 0,
00158     T4_LENGTH_1200_US_LEGAL = 0
00159 } t4_image_length_t;
00160 
00161 /*!
00162     T.4 FAX compression/decompression descriptor. This defines the working state
00163     for a single instance of a T.4 FAX compression or decompression channel.
00164 */
00165 typedef struct
00166 {
00167     /* "Background" information about the FAX, which can be stored in a TIFF file. */
00168     /*! \brief The vendor of the machine which produced the TIFF file. */ 
00169     const char *vendor;
00170     /*! \brief The model of machine which produced the TIFF file. */ 
00171     const char *model;
00172     /*! \brief The local ident string. */ 
00173     const char *local_ident;
00174     /*! \brief The remote end's ident string. */ 
00175     const char *far_ident;
00176     /*! \brief The FAX sub-address. */ 
00177     const char *sub_address;
00178     /*! \brief The FAX DCS information, as an ASCII string. */ 
00179     const char *dcs;
00180     /*! \brief The text which will be used in FAX page header. No text results
00181                in no header line. */
00182     const char *header_info;
00183 
00184     /*! \brief The type of compression used between the FAX machines. */
00185     int line_encoding;
00186     /*! \brief The minimum number of bits per scan row. This is a timing thing
00187                for hardware FAX machines. */
00188     int min_scan_line_bits;
00189     
00190     /*! \brief The compression type for output to the TIFF file. */
00191     int output_compression;
00192     /*! \brief The TIFF G3 FAX options. */
00193     int output_t4_options;
00194 
00195     /*! \brief The time at which handling of the current page began. */
00196     time_t page_start_time;
00197 
00198     /*! \brief The current number of bytes per row of uncompressed image data. */
00199     int bytes_per_row;
00200     /*! \brief The size of the image in the image buffer, in bytes. */
00201     int image_size;
00202     /*! \brief The current size of the image buffer. */
00203     int image_buffer_size;
00204     uint8_t *image_buffer;
00205 
00206     /*! \brief The libtiff context for the current TIFF file */
00207     TIFF *tiff_file;
00208     /*! \brief The current file name. */
00209     const char *file;
00210     /*! \brief The first page to transfer. -1 to start at the beginning of the file. */
00211     int start_page;
00212     /*! \brief The last page to transfer. -1 to continue to the end of the file. */
00213     int stop_page;
00214 
00215     /*! \brief The number of pages transferred to date. */
00216     int pages_transferred;
00217     /*! \brief The number of pages in the current TIFF file. */
00218     int pages_in_file;
00219     /*! \brief Column-to-column (X) resolution in pixels per metre. */
00220     int x_resolution;
00221     /*! \brief Row-to-row (Y) resolution in pixels per metre. */
00222     int y_resolution;
00223     /*! \brief Width of the current page, in pixels. */
00224     int image_width;
00225     /*! \brief Current pixel row number. */
00226     int row;
00227     /*! \brief Total pixel rows in the current page. */
00228     int image_length;
00229     /*! \brief The current number of consecutive bad rows. */
00230     int curr_bad_row_run;
00231     /*! \brief The longest run of consecutive bad rows seen in the current page. */
00232     int longest_bad_row_run;
00233     /*! \brief The total number of bad rows in the current page. */
00234     int bad_rows;
00235 
00236     uint32_t bits_to_date;
00237     int bits;
00238 
00239     /*! \brief This variable is set if we are treating the current row as a 2D encoded
00240                one. */
00241     int row_is_2d;
00242     /*! \brief TRUE if the current run is black */
00243     int its_black;
00244     /*! \brief The current length of the current row. */
00245     int row_len;
00246     /*! \brief This variable is used to record the fact we have seen at least one EOL
00247                since we started decoding. We will not try to interpret the received
00248                data as an image until we have seen the first EOL. */
00249     int first_eol_seen;
00250     /*! \brief This variable is used to count the consecutive EOLS we have seen. If it
00251                reaches six, this is the end of the image. */
00252     int consecutive_eols;
00253 
00254     /*! \brief Black and white run-lengths for the current row. */
00255     uint32_t *cur_runs;
00256     /*! \brief Black and white run-lengths for the reference row. */
00257     uint32_t *ref_runs;
00258     /*! \brief The number of runs currently in the reference row. */
00259     int ref_steps;
00260     /*! \brief The current step into the reference row run-lengths buffer. */
00261     int b_cursor;
00262     /*! \brief The current step into the current row run-lengths buffer. */
00263     int a_cursor;
00264 
00265     /*! \brief The reference or starting changing element on the coding line. At the
00266                start of the coding line, a0 is set on an imaginary white changing element
00267                situated just before the first element on the line. During the coding of
00268                the coding line, the position of a0 is defined by the previous coding mode.
00269                (See 4.2.1.3.2.). */
00270     int a0;
00271     /*! \brief The first changing element on the reference line to the right of a0 and of
00272                opposite colour to a0. */
00273     int b1;
00274     /*! \brief The length of the in-progress run of black or white. */
00275     int run_length;
00276     /*! \brief 2D horizontal mode control. */
00277     int black_white;
00278 
00279     uint32_t data;
00280     int bit;
00281 
00282     /*! \brief A pointer into the image buffer indicating where the last row begins */
00283     int last_row_starts_at;
00284     int row_starts_at;
00285     
00286     /*! \brief Pointer to the buffer for the current pixel row. */
00287     uint8_t *row_buf;
00288     
00289     int bit_pos;
00290     int bit_ptr;
00291 
00292     /*! \brief The maximum contiguous rows that will be 2D encoded. */
00293     int max_rows_to_next_1d_row;
00294     /*! \brief Number of rows left that can be 2D encoded, before a 1D encoded row
00295                must be used. */
00296     int rows_to_next_1d_row;
00297     /*! \brief The minimum number of encoded bits per row. */
00298     int min_row_bits;
00299     /*! \brief The current number of bits in the current encoded row. */
00300     int row_bits;
00301 
00302     t4_row_read_handler_t row_read_handler;
00303     void *row_read_user_data;
00304     t4_row_write_handler_t row_write_handler;
00305     void *row_write_user_data;
00306 
00307     /*! \brief Error and flow logging control */
00308     logging_state_t logging;
00309 } t4_state_t;
00310 
00311 /*!
00312     T.4 FAX compression/decompression statistics.
00313 */
00314 typedef struct
00315 {
00316     /*! \brief The number of pages transferred so far. */
00317     int pages_transferred;
00318     /*! \brief The number of pages in the file (<0 if unknown). */
00319     int pages_in_file;
00320     /*! \brief The number of horizontal pixels in the most recent page. */
00321     int width;
00322     /*! \brief The number of vertical pixels in the most recent page. */
00323     int length;
00324     /*! \brief The number of bad pixel rows in the most recent page. */
00325     int bad_rows;
00326     /*! \brief The largest number of bad pixel rows in a block in the most recent page. */
00327     int longest_bad_row_run;
00328     /*! \brief The horizontal resolution of the page in pixels per metre */
00329     int x_resolution;
00330     /*! \brief The vertical resolution of the page in pixels per metre */
00331     int y_resolution;
00332     /*! \brief The type of compression used between the FAX machines */
00333     int encoding;
00334     /*! \brief The size of the image, in bytes */
00335     int image_size;
00336 } t4_stats_t;
00337     
00338 #if defined(__cplusplus)
00339 extern "C" {
00340 #endif
00341 
00342 /*! \brief Allocate a T.4 transmit handling context, and
00343            initialise it.
00344     \param file The name of the file to be received.
00345     \param output_encoding The output encoding.
00346     \return The T.4 context, or NULL. */
00347 t4_state_t *t4_rx_create(const char *file, int output_encoding);
00348 
00349 /*! \brief Prepare for reception of a document.
00350     \param s The T.4 context.
00351     \param file The name of the file to be received.
00352     \param output_encoding The output encoding.
00353     \return 0 for success, otherwise -1. */
00354 int t4_rx_init(t4_state_t *s, const char *file, int output_encoding);
00355 
00356 /*! \brief Prepare to receive the next page of the current document.
00357     \param s The T.4 context.
00358     \return zero for success, -1 for failure. */
00359 int t4_rx_start_page(t4_state_t *s);
00360 
00361 /*! \brief Put a bit of the current document page.
00362     \param s The T.4 context.
00363     \param bit The data bit.
00364     \return TRUE when the bit ends the document page, otherwise FALSE. */
00365 int t4_rx_put_bit(t4_state_t *s, int bit);
00366 
00367 /*! \brief Put a byte of the current document page.
00368     \param s The T.4 context.
00369     \param byte The data byte.
00370     \return TRUE when the byte ends the document page, otherwise FALSE. */
00371 int t4_rx_put_byte(t4_state_t *s, uint8_t byte);
00372 
00373 /*! \brief Put a byte of the current document page.
00374     \param s The T.4 context.
00375     \param buf The buffer containing the chunk.
00376     \param len The length of the chunk.
00377     \return TRUE when the byte ends the document page, otherwise FALSE. */
00378 int t4_rx_put_chunk(t4_state_t *s, const uint8_t buf[], int len);
00379 
00380 /*! \brief Complete the reception of a page.
00381     \param s The T.4 receive context.
00382     \return 0 for success, otherwise -1. */
00383 int t4_rx_end_page(t4_state_t *s);
00384 
00385 /*! \brief End reception of a document. Tidy up, close the file and
00386            free the context. This should be used to end T.4 reception
00387            started with t4_rx_create.
00388     \param s The T.4 receive context.
00389     \return 0 for success, otherwise -1. */
00390 int t4_rx_delete(t4_state_t *s);
00391 
00392 /*! \brief End reception of a document. Tidy up and close the file.
00393            This should be used to end T.4 reception started with
00394            t4_rx_init.
00395     \param s The T.4 context.
00396     \return 0 for success, otherwise -1. */
00397 int t4_rx_end(t4_state_t *s);
00398 
00399 int t4_rx_set_row_write_handler(t4_state_t *s, t4_row_write_handler_t handler, void *user_data);
00400 
00401 /*! \brief Set the encoding for the received data.
00402     \param s The T.4 context.
00403     \param encoding The encoding. */
00404 void t4_rx_set_rx_encoding(t4_state_t *s, int encoding);
00405 
00406 /*! \brief Set the expected width of the received image, in pixel columns.
00407     \param s The T.4 context.
00408     \param columns The number of pixels across the image. */
00409 void t4_rx_set_image_width(t4_state_t *s, int width);
00410 
00411 /*! \brief Set the row-to-row (y) resolution to expect for a received image.
00412     \param s The T.4 context.
00413     \param resolution The resolution, in pixels per metre. */
00414 void t4_rx_set_y_resolution(t4_state_t *s, int resolution);
00415 
00416 /*! \brief Set the column-to-column (x) resolution to expect for a received image.
00417     \param s The T.4 context.
00418     \param resolution The resolution, in pixels per metre. */
00419 void t4_rx_set_x_resolution(t4_state_t *s, int resolution);
00420 
00421 /*! \brief Set the DCS information of the fax, for inclusion in the file.
00422     \param s The T.4 context.
00423     \param dcs The DCS information, formatted as an ASCII string. */
00424 void t4_rx_set_dcs(t4_state_t *s, const char *dcs);
00425 
00426 /*! \brief Set the sub-address of the fax, for inclusion in the file.
00427     \param s The T.4 context.
00428     \param sub_address The sub-address string. */
00429 void t4_rx_set_sub_address(t4_state_t *s, const char *sub_address);
00430 
00431 /*! \brief Set the identity of the remote machine, for inclusion in the file.
00432     \param s The T.4 context.
00433     \param ident The identity string. */
00434 void t4_rx_set_far_ident(t4_state_t *s, const char *ident);
00435 
00436 /*! \brief Set the vendor of the remote machine, for inclusion in the file.
00437     \param s The T.4 context.
00438     \param vendor The vendor string, or NULL. */
00439 void t4_rx_set_vendor(t4_state_t *s, const char *vendor);
00440 
00441 /*! \brief Set the model of the remote machine, for inclusion in the file.
00442     \param s The T.4 context.
00443     \param model The model string, or NULL. */
00444 void t4_rx_set_model(t4_state_t *s, const char *model);
00445 
00446 /*! \brief Allocate a T.4 receive handling context, and
00447            initialise it.
00448     \param s The T.4 context.
00449     \param file The name of the file to be sent.
00450     \return 0 for success, otherwise -1. */
00451 t4_state_t *t4_tx_create(const char *file, int start_page, int stop_page);
00452 
00453 /*! \brief Prepare for transmission of a document.
00454     \param s The T.4 context.
00455     \param file The name of the file to be sent.
00456     \param start_page The first page to send. -1 for no restriction.
00457     \param stop_page The last page to send. -1 for no restriction.
00458     \return The T.4 context, or NULL. */
00459 int t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page);
00460 
00461 /*! \brief Prepare to send the next page of the current document.
00462     \param s The T.4 context.
00463     \return zero for success, -1 for failure. */
00464 int t4_tx_start_page(t4_state_t *s);
00465 
00466 /*! \brief Prepare the current page for a resend.
00467     \param s The T.4 context.
00468     \return zero for success, -1 for failure. */
00469 int t4_tx_restart_page(t4_state_t *s);
00470 
00471 /*! \brief Check for the existance of the next page. This information can
00472     be needed before it is determined that the current page is finished with.
00473     \param s The T.4 context.
00474     \return zero for next page found, -1 for failure. */
00475 int t4_tx_more_pages(t4_state_t *s);
00476 
00477 /*! \brief Complete the sending of a page.
00478     \param s The T.4 context.
00479     \return zero for success, -1 for failure. */
00480 int t4_tx_end_page(t4_state_t *s);
00481 
00482 /*! \brief Get the next bit of the current document page. The document will
00483            be padded for the current minimum scan line time. If the
00484            file does not contain an RTC (return to control) code at
00485            the end of the page, one will be added where appropriate.
00486     \param s The T.4 context.
00487     \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is
00488             set (i.e. the returned value is 2 or 3). */
00489 int t4_tx_get_bit(t4_state_t *s);
00490 
00491 /*! \brief Get the next byte of the current document page. The document will
00492            be padded for the current minimum scan line time. If the
00493            file does not contain an RTC (return to control) code at
00494            the end of the page, one will be added where appropriate.
00495     \param s The T.4 context.
00496     \return The next byte. For the last byte of data, bit 8 is
00497             set. In this case, one or more bits of the byte may be padded with
00498             zeros, to complete the byte. */
00499 int t4_tx_get_byte(t4_state_t *s);
00500 
00501 /*! \brief Get the next chunk of the current document page. The document will
00502            be padded for the current minimum scan line time. If the
00503            file does not contain an RTC (return to control) code at
00504            the end of the page, one will be added where appropriate.
00505     \param s The T.4 context.
00506     \param buf The buffer into which the chunk is to written.
00507     \param max_len The maximum length of the chunk.
00508     \return The actual length of the chunk. If this is less than max_len it 
00509             indicates that the end of the document has been reached. */
00510 int t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len);
00511 
00512 /*! \brief Return the next bit of the current document page, without actually
00513            moving forward in the buffer. The document will be padded for the
00514            current minimum scan line time. If the file does not contain an
00515            RTC (return to control) code at the end of the page, one will be
00516            added.
00517     \param s The T.4 context.
00518     \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is
00519             set (i.e. the returned value is 2 or 3). */
00520 int t4_tx_check_bit(t4_state_t *s);
00521 
00522 /*! \brief End the transmission of a document. Tidy up, close the file and
00523            free the context. This should be used to end T.4 transmission
00524            started with t4_tx_create.
00525     \param s The T.4 context.
00526     \return 0 for success, otherwise -1. */
00527 int t4_tx_delete(t4_state_t *s);
00528 
00529 /*! \brief End the transmission of a document. Tidy up and close the file.
00530            This should be used to end T.4 transmission started with t4_tx_init.
00531     \param s The T.4 context.
00532     \return 0 for success, otherwise -1. */
00533 int t4_tx_end(t4_state_t *s);
00534 
00535 /*! \brief Set the encoding for the encoded data.
00536     \param s The T.4 context.
00537     \param encoding The encoding. */
00538 void t4_tx_set_tx_encoding(t4_state_t *s, int encoding);
00539 
00540 /*! \brief Set the minimum number of encoded bits per row. This allows the
00541            makes the encoding process to be set to comply with the minimum row
00542            time specified by a remote receiving machine.
00543     \param s The T.4 context.
00544     \param bits The minimum number of bits per row. */
00545 void t4_tx_set_min_row_bits(t4_state_t *s, int bits);
00546 
00547 /*! \brief Set the identity of the local machine, for inclusion in page headers.
00548     \param s The T.4 context.
00549     \param ident The identity string. */
00550 void t4_tx_set_local_ident(t4_state_t *s, const char *ident);
00551 
00552 /*! Set the info field, included in the header line included in each page of an encoded
00553     FAX. This is a string of up to 50 characters. Other information (date, local ident, etc.)
00554     are automatically included in the header. If the header info is set to NULL or a zero
00555     length string, no header lines will be added to the encoded FAX.
00556     \brief Set the header info.
00557     \param s The T.4 context.
00558     \param info A string, of up to 50 bytes, which will form the info field. */
00559 void t4_tx_set_header_info(t4_state_t *s, const char *info);
00560 
00561 int t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data);
00562 
00563 /*! \brief Get the row-to-row (y) resolution of the current page.
00564     \param s The T.4 context.
00565     \return The resolution, in pixels per metre. */
00566 int t4_tx_get_y_resolution(t4_state_t *s);
00567 
00568 /*! \brief Get the column-to-column (x) resolution of the current page.
00569     \param s The T.4 context.
00570     \return The resolution, in pixels per metre. */
00571 int t4_tx_get_x_resolution(t4_state_t *s);
00572 
00573 /*! \brief Get the width of the current page, in pixel columns.
00574     \param s The T.4 context.
00575     \return The number of columns. */
00576 int t4_tx_get_image_width(t4_state_t *s);
00577 
00578 /*! \brief Get the number of pages in the file.
00579     \param s The T.4 context.
00580     \return The number of pages, or -1 if there is an error. */
00581 int t4_tx_get_pages_in_file(t4_state_t *s);
00582 
00583 /*! Get the current image transfer statistics. 
00584     \brief Get the current transfer statistics.
00585     \param s The T.4 context.
00586     \param t A pointer to a statistics structure. */
00587 void t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t);
00588 
00589 /*! Get the short text name of an encoding format. 
00590     \brief Get the short text name of an encoding format.
00591     \param encoding The encoding type.
00592     \return A pointer to the string. */
00593 const char *t4_encoding_to_str(int encoding);
00594 
00595 #if defined(__cplusplus)
00596 }
00597 #endif
00598 
00599 #endif
00600 /*- End of file ------------------------------------------------------------*/

Generated on Sat Nov 3 00:40:35 2007 for libspandsp by  doxygen 1.5.2