Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  OSLEC - A line echo canceller.  This code is being developed
0004  *          against and partially complies with G168. Using code from SpanDSP
0005  *
0006  * Written by Steve Underwood <steveu@coppice.org>
0007  *         and David Rowe <david_at_rowetel_dot_com>
0008  *
0009  * Copyright (C) 2001 Steve Underwood and 2007-2008 David Rowe
0010  *
0011  * All rights reserved.
0012  */
0013 
0014 #ifndef __OSLEC_H
0015 #define __OSLEC_H
0016 
0017 /* Mask bits for the adaption mode */
0018 #define ECHO_CAN_USE_ADAPTION   0x01
0019 #define ECHO_CAN_USE_NLP    0x02
0020 #define ECHO_CAN_USE_CNG    0x04
0021 #define ECHO_CAN_USE_CLIP   0x08
0022 #define ECHO_CAN_USE_TX_HPF 0x10
0023 #define ECHO_CAN_USE_RX_HPF 0x20
0024 #define ECHO_CAN_DISABLE    0x40
0025 
0026 /**
0027  * oslec_state: G.168 echo canceller descriptor.
0028  *
0029  * This defines the working state for a line echo canceller.
0030  */
0031 struct oslec_state;
0032 
0033 /**
0034  * oslec_create - Create a voice echo canceller context.
0035  * @len: The length of the canceller, in samples.
0036  * @return: The new canceller context, or NULL if the canceller could not be
0037  * created.
0038  */
0039 struct oslec_state *oslec_create(int len, int adaption_mode);
0040 
0041 /**
0042  * oslec_free - Free a voice echo canceller context.
0043  * @ec: The echo canceller context.
0044  */
0045 void oslec_free(struct oslec_state *ec);
0046 
0047 /**
0048  * oslec_flush - Flush (reinitialise) a voice echo canceller context.
0049  * @ec: The echo canceller context.
0050  */
0051 void oslec_flush(struct oslec_state *ec);
0052 
0053 /**
0054  * oslec_adaption_mode - set the adaption mode of a voice echo canceller context.
0055  * @ec The echo canceller context.
0056  * @adaption_mode: The mode.
0057  */
0058 void oslec_adaption_mode(struct oslec_state *ec, int adaption_mode);
0059 
0060 void oslec_snapshot(struct oslec_state *ec);
0061 
0062 /**
0063  * oslec_update: Process a sample through a voice echo canceller.
0064  * @ec: The echo canceller context.
0065  * @tx: The transmitted audio sample.
0066  * @rx: The received audio sample.
0067  *
0068  * The return value is the clean (echo cancelled) received sample.
0069  */
0070 int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx);
0071 
0072 /**
0073  * oslec_hpf_tx: Process to high pass filter the tx signal.
0074  * @ec: The echo canceller context.
0075  * @tx: The transmitted auio sample.
0076  *
0077  * The return value is the HP filtered transmit sample, send this to your D/A.
0078  */
0079 int16_t oslec_hpf_tx(struct oslec_state *ec, int16_t tx);
0080 
0081 #endif /* __OSLEC_H */