line_model.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 #if !defined(_SPANDSP_LINE_MODEL_H_)
00057 #define _SPANDSP_LINE_MODEL_H_
00058
00059 #define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
00060 #include <spandsp.h>
00061
00062 #define LINE_FILTER_SIZE 129
00063
00064
00065
00066
00067
00068 typedef struct
00069 {
00070 codec_munge_state_t *munge;
00071
00072
00073 float *near_filter;
00074
00075 int near_filter_len;
00076
00077 float near_buf[LINE_FILTER_SIZE];
00078
00079 int near_buf_ptr;
00080
00081 awgn_state_t near_noise;
00082
00083
00084 int bulk_delay;
00085
00086 int bulk_delay_ptr;
00087
00088 int16_t bulk_delay_buf[8000];
00089
00090
00091 float *far_filter;
00092
00093 int far_filter_len;
00094
00095 float far_buf[LINE_FILTER_SIZE];
00096
00097 int far_buf_ptr;
00098
00099 awgn_state_t far_noise;
00100
00101
00102 float near_cpe_hybrid_echo;
00103
00104 float near_co_hybrid_echo;
00105
00106
00107 float far_cpe_hybrid_echo;
00108
00109 float far_co_hybrid_echo;
00110
00111 float dc_offset;
00112
00113
00114 int mains_interference;
00115 tone_gen_state_t mains_tone;
00116 } one_way_line_model_state_t;
00117
00118
00119
00120
00121
00122 typedef struct
00123 {
00124 one_way_line_model_state_t line1;
00125 one_way_line_model_state_t line2;
00126 float fout1;
00127 float fout2;
00128 } both_ways_line_model_state_t;
00129
00130 #ifdef __cplusplus
00131 extern "C"
00132 {
00133 #endif
00134
00135 SPAN_DECLARE(void) both_ways_line_model(both_ways_line_model_state_t *s,
00136 int16_t output1[],
00137 const int16_t input1[],
00138 int16_t output2[],
00139 const int16_t input2[],
00140 int samples);
00141
00142 SPAN_DECLARE(void) both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2);
00143
00144 SPAN_DECLARE(void) both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2);
00145
00146 SPAN_DECLARE(both_ways_line_model_state_t) *both_ways_line_model_init(int model1,
00147 float noise1,
00148 int model2,
00149 float noise2,
00150 int codec,
00151 int rbs_pattern);
00152
00153 SPAN_DECLARE(int) both_ways_line_model_release(both_ways_line_model_state_t *s);
00154
00155 SPAN_DECLARE(void) one_way_line_model(one_way_line_model_state_t *s,
00156 int16_t output[],
00157 const int16_t input[],
00158 int samples);
00159
00160 SPAN_DECLARE(void) one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc);
00161
00162 SPAN_DECLARE(void) one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level);
00163
00164 SPAN_DECLARE(one_way_line_model_state_t) *one_way_line_model_init(int model, float noise, int codec, int rbs_pattern);
00165
00166 SPAN_DECLARE(int) one_way_line_model_release(one_way_line_model_state_t *s);
00167
00168 #ifdef __cplusplus
00169 }
00170 #endif
00171
00172 #endif
00173