Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/private/v42bis.h @ 4:26cd8f1ef0b1
import spandsp-0.0.6pre17
| author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
|---|---|
| date | Fri, 25 Jun 2010 15:50:58 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 3:c6c5a16ce2f2 | 4:26cd8f1ef0b1 |
|---|---|
| 1 /* | |
| 2 * SpanDSP - a series of DSP components for telephony | |
| 3 * | |
| 4 * private/v42bis.h | |
| 5 * | |
| 6 * Written by Steve Underwood <steveu@coppice.org> | |
| 7 * | |
| 8 * Copyright (C) 2005 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 * $Id: v42bis.h,v 1.1 2008/11/15 14:43:08 steveu Exp $ | |
| 26 */ | |
| 27 | |
| 28 #if !defined(_SPANDSP_PRIVATE_V42BIS_H_) | |
| 29 #define _SPANDSP_PRIVATE_V42BIS_H_ | |
| 30 | |
| 31 /*! | |
| 32 V.42bis dictionary node. | |
| 33 */ | |
| 34 typedef struct | |
| 35 { | |
| 36 /*! \brief The prior code for each defined code. */ | |
| 37 uint16_t parent_code; | |
| 38 /*! \brief The number of leaf nodes this node has */ | |
| 39 int16_t leaves; | |
| 40 /*! \brief This leaf octet for each defined code. */ | |
| 41 uint8_t node_octet; | |
| 42 /*! \brief Bit map of the children which exist */ | |
| 43 uint32_t children[8]; | |
| 44 } v42bis_dict_node_t; | |
| 45 | |
| 46 /*! | |
| 47 V.42bis compression. This defines the working state for a single instance | |
| 48 of V.42bis compression. | |
| 49 */ | |
| 50 typedef struct | |
| 51 { | |
| 52 /*! \brief Compression mode. */ | |
| 53 int compression_mode; | |
| 54 /*! \brief Callback function to handle received frames. */ | |
| 55 v42bis_frame_handler_t handler; | |
| 56 /*! \brief An opaque pointer passed in calls to frame_handler. */ | |
| 57 void *user_data; | |
| 58 /*! \brief The maximum frame length allowed */ | |
| 59 int max_len; | |
| 60 | |
| 61 uint32_t string_code; | |
| 62 uint32_t latest_code; | |
| 63 int string_length; | |
| 64 uint32_t output_bit_buffer; | |
| 65 int output_bit_count; | |
| 66 int output_octet_count; | |
| 67 uint8_t output_buf[1024]; | |
| 68 v42bis_dict_node_t dict[V42BIS_MAX_CODEWORDS]; | |
| 69 /*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */ | |
| 70 int transparent; | |
| 71 int change_transparency; | |
| 72 /*! \brief IIR filter state, used in assessing compressibility. */ | |
| 73 int compressibility_filter; | |
| 74 int compressibility_persistence; | |
| 75 | |
| 76 /*! \brief Next empty dictionary entry */ | |
| 77 uint32_t v42bis_parm_c1; | |
| 78 /*! \brief Current codeword size */ | |
| 79 int v42bis_parm_c2; | |
| 80 /*! \brief Threshold for codeword size change */ | |
| 81 uint32_t v42bis_parm_c3; | |
| 82 | |
| 83 /*! \brief Mark that this is the first octet/code to be processed */ | |
| 84 int first; | |
| 85 uint8_t escape_code; | |
| 86 } v42bis_compress_state_t; | |
| 87 | |
| 88 /*! | |
| 89 V.42bis decompression. This defines the working state for a single instance | |
| 90 of V.42bis decompression. | |
| 91 */ | |
| 92 typedef struct | |
| 93 { | |
| 94 /*! \brief Callback function to handle decompressed data. */ | |
| 95 v42bis_data_handler_t handler; | |
| 96 /*! \brief An opaque pointer passed in calls to data_handler. */ | |
| 97 void *user_data; | |
| 98 /*! \brief The maximum decompressed data block length allowed */ | |
| 99 int max_len; | |
| 100 | |
| 101 uint32_t old_code; | |
| 102 uint32_t last_old_code; | |
| 103 uint32_t input_bit_buffer; | |
| 104 int input_bit_count; | |
| 105 int octet; | |
| 106 int last_length; | |
| 107 int output_octet_count; | |
| 108 uint8_t output_buf[1024]; | |
| 109 v42bis_dict_node_t dict[V42BIS_MAX_CODEWORDS]; | |
| 110 /*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */ | |
| 111 int transparent; | |
| 112 | |
| 113 int last_extra_octet; | |
| 114 | |
| 115 /*! \brief Next empty dictionary entry */ | |
| 116 uint32_t v42bis_parm_c1; | |
| 117 /*! \brief Current codeword size */ | |
| 118 int v42bis_parm_c2; | |
| 119 /*! \brief Threshold for codeword size change */ | |
| 120 uint32_t v42bis_parm_c3; | |
| 121 | |
| 122 /*! \brief Mark that this is the first octet/code to be processed */ | |
| 123 int first; | |
| 124 uint8_t escape_code; | |
| 125 int escaped; | |
| 126 } v42bis_decompress_state_t; | |
| 127 | |
| 128 /*! | |
| 129 V.42bis compression/decompression descriptor. This defines the working state for a | |
| 130 single instance of V.42bis compress/decompression. | |
| 131 */ | |
| 132 struct v42bis_state_s | |
| 133 { | |
| 134 /*! \brief V.42bis data compression directions. */ | |
| 135 int v42bis_parm_p0; | |
| 136 | |
| 137 /*! \brief Compression state. */ | |
| 138 v42bis_compress_state_t compress; | |
| 139 /*! \brief Decompression state. */ | |
| 140 v42bis_decompress_state_t decompress; | |
| 141 | |
| 142 /*! \brief Maximum codeword size (bits) */ | |
| 143 int v42bis_parm_n1; | |
| 144 /*! \brief Total number of codewords */ | |
| 145 uint32_t v42bis_parm_n2; | |
| 146 /*! \brief Maximum string length */ | |
| 147 int v42bis_parm_n7; | |
| 148 }; | |
| 149 | |
| 150 #endif | |
| 151 /*- End of file ------------------------------------------------------------*/ |
