1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/echo.h - An echo cancellor, suitable for electrical and acoustic
5  *                  cancellation. This code does not currently comply with
6  *                  any relevant standards (e.g. G.164/5/7/8).
7  *
8  * Written by Steve Underwood <steveu@coppice.org>
9  *
10  * Copyright (C) 2001 Steve Underwood
11  *
12  * All rights reserved.
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License version 2.1,
16  * as published by the Free Software Foundation.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public
24  * License along with this program; if not, write to the Free Software
25  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26  */
27 
28 /*! \file */
29 
30 #if !defined(_SPANDSP_PRIVATE_ECHO_H_)
31 #define _SPANDSP_PRIVATE_ECHO_H_
32 
33 /*!
34     G.168 echo canceller descriptor. This defines the working state for a line
35     echo canceller.
36 */
37 struct echo_can_state_s
38 {
39     int tx_power[4];
40     int rx_power[3];
41     int clean_rx_power;
42 
43     int rx_power_threshold;
44     int nonupdate_dwell;
45 
46     int curr_pos;
47 
48     int taps;
49     int tap_mask;
50     int adaption_mode;
51 
52     int32_t supp_test1;
53     int32_t supp_test2;
54     int32_t supp1;
55     int32_t supp2;
56     int vad;
57     int cng;
58 
59     int16_t geigel_max;
60     int geigel_lag;
61     int dtd_onset;
62     int tap_set;
63     int tap_rotate_counter;
64 
65     int32_t latest_correction;  /* Indication of the magnitude of the latest
66                                    adaption, or a code to indicate why adaption
67                                    was skipped, for test purposes */
68     int32_t last_acf[28];
69     int narrowband_count;
70     int narrowband_score;
71 
72     fir16_state_t fir_state;
73     /*! Echo FIR taps (16 bit version) */
74     int16_t *fir_taps16[4];
75     /*! Echo FIR taps (32 bit version) */
76     int32_t *fir_taps32;
77 
78     /* DC and near DC blocking filter states */
79     int32_t tx_hpf[2];
80     int32_t rx_hpf[2];
81 
82     /* Parameters for the optional Hoth noise generator */
83     int cng_level;
84     int cng_rndnum;
85     int cng_filter;
86 
87     /* Snapshot sample of coeffs used for development */
88     int16_t *snapshot;
89 };
90 
91 #endif
92 /*- End of file ------------------------------------------------------------*/
93