/usr/include/spandsp/line_model.h is in libspandsp-dev 0.0.6~pre20-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | /*
* SpanDSP - a series of DSP components for telephony
*
* line_model.h - Model a telephone line.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2004 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
/*! \page line_model_page Telephone line model
\section line_model_page_sec_1 What does it do?
The telephone line modelling module provides simple modelling of one way and two
way telephone lines.
The path being modelled is:
- terminal
- | < hybrid echo (2-way models)
- |
- | < noise and filtering
- |
- | < hybrid echo (2-way models)
- CO
- |
- | < A-law distortion + bulk delay
- |
- CO
- | < hybrid echo (2-way models)
- |
- | < noise and filtering
- |
- | < hybrid echo (2-way models)
- terminal
*/
#if !defined(_SPANDSP_LINE_MODEL_H_)
#define _SPANDSP_LINE_MODEL_H_
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
#include <spandsp.h>
#define LINE_FILTER_SIZE 129
/*!
One way line model descriptor. This holds the complete state of
a line model with transmission in only one direction.
*/
typedef struct
{
codec_munge_state_t *munge;
/*! The coefficients for the near end analogue section simulation filter */
const float *near_filter;
/*! The number of coefficients for the near end analogue section simulation filter */
int near_filter_len;
/*! Last transmitted samples (ring buffer, used by the line filter) */
float near_buf[LINE_FILTER_SIZE];
/*! Pointer of the last transmitted sample in buf */
int near_buf_ptr;
/*! The noise source for local analogue section of the line */
awgn_state_t near_noise;
/*! The bulk delay of the path, in samples */
int bulk_delay;
/*! A pointer to the current write position in the bulk delay store. */
int bulk_delay_ptr;
/*! The data store for simulating the bulk delay */
int16_t bulk_delay_buf[8000];
/*! The coefficients for the far end analogue section simulation filter */
const float *far_filter;
/*! The number of coefficients for the far end analogue section simulation filter */
int far_filter_len;
/*! Last transmitted samples (ring buffer, used by the line filter) */
float far_buf[LINE_FILTER_SIZE];
/*! Pointer of the last transmitted sample in buf */
int far_buf_ptr;
/*! The noise source for distant analogue section of the line */
awgn_state_t far_noise;
/*! The scaling factor for the local CPE hybrid echo */
float near_cpe_hybrid_echo;
/*! The scaling factor for the local CO hybrid echo */
float near_co_hybrid_echo;
/*! The scaling factor for the far CPE hybrid echo */
float far_cpe_hybrid_echo;
/*! The scaling factor for the far CO hybrid echo */
float far_co_hybrid_echo;
/*! DC offset impairment */
float dc_offset;
/*! Mains pickup impairment */
int mains_interference;
tone_gen_state_t mains_tone;
} one_way_line_model_state_t;
/*!
Two way line model descriptor. This holds the complete state of
a line model with transmission in both directions.
*/
typedef struct
{
one_way_line_model_state_t line1;
one_way_line_model_state_t line2;
float fout1;
float fout2;
} both_ways_line_model_state_t;
#ifdef __cplusplus
extern "C"
{
#endif
SPAN_DECLARE_DATA extern const float *line_models[];
SPAN_DECLARE(void) both_ways_line_model(both_ways_line_model_state_t *s,
int16_t output1[],
const int16_t input1[],
int16_t output2[],
const int16_t input2[],
int samples);
SPAN_DECLARE(void) both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2);
SPAN_DECLARE(void) both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2);
SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model1,
float noise1,
float echo_level_cpe1,
float echo_level_co1,
int model2,
float noise2,
float echo_level_cpe2,
float echo_level_co2,
int codec,
int rbs_pattern);
SPAN_DECLARE(int) both_ways_line_model_release(both_ways_line_model_state_t *s);
SPAN_DECLARE(void) one_way_line_model(one_way_line_model_state_t *s,
int16_t output[],
const int16_t input[],
int samples);
SPAN_DECLARE(void) one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc);
SPAN_DECLARE(void) one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level);
SPAN_DECLARE(one_way_line_model_state_t *) one_way_line_model_init(int model, float noise, int codec, int rbs_pattern);
SPAN_DECLARE(int) one_way_line_model_release(one_way_line_model_state_t *s);
#ifdef __cplusplus
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/
|