00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/t42.h - ITU T.42 JPEG for FAX image processing 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2011 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_T42_H_) 00027 #define _SPANDSP_PRIVATE_T42_H_ 00028 00029 struct lab_params_s 00030 { 00031 /* Lab gamut */ 00032 float range_L; 00033 float range_a; 00034 float range_b; 00035 float offset_L; 00036 float offset_a; 00037 float offset_b; 00038 int ab_are_signed; 00039 00040 /* Illuminant */ 00041 float x_n; 00042 float y_n; 00043 float z_n; 00044 }; 00045 00046 /* State of a working instance of the T.42 JPEG FAX encoder */ 00047 struct t42_encode_state_s 00048 { 00049 /*! \brief Callback function to read a row of pixels from the image source. */ 00050 t4_row_read_handler_t row_read_handler; 00051 /*! \brief Opaque pointer passed to row_read_handler. */ 00052 void *row_read_user_data; 00053 00054 lab_params_t lab_params; 00055 00056 /*! \brief The size of the compressed image, in bytes. */ 00057 int compressed_image_size; 00058 00059 /*! \brief Error and flow logging control */ 00060 logging_state_t logging; 00061 }; 00062 00063 /* State of a working instance of the T.42 JPEG FAX decoder */ 00064 struct t42_decode_state_s 00065 { 00066 /*! A callback routine to handle decoded pixel rows */ 00067 t4_row_write_handler_t row_write_handler; 00068 /*! An opaque pointer passed to row_write_handler() */ 00069 void *row_write_user_data; 00070 /*! A callback routine to handle decoded comments */ 00071 t4_row_write_handler_t comment_handler; 00072 /*! An opaque pointer passed to comment_handler() */ 00073 void *comment_user_data; 00074 /*! The maximum length of comment to be passed to the comment handler */ 00075 uint32_t max_comment_len; 00076 00077 lab_params_t lab_params; 00078 00079 /*! The contents for a COMMENT marker segment, to be added to the 00080 image at the next opportunity. This is set to NULL when nothing is 00081 pending. */ 00082 uint8_t *comment; 00083 /*! Length of data pointed to by comment */ 00084 size_t comment_len; 00085 00086 /*! \brief The size of the compressed image, in bytes. */ 00087 int compressed_image_size; 00088 00089 int buf_size; 00090 uint8_t *compressed_buf; 00091 00092 /*! \brief Error and flow logging control */ 00093 logging_state_t logging; 00094 }; 00095 00096 #endif 00097 /*- End of file ------------------------------------------------------------*/
1.6.1