Background
Echoes generally include two categories: one is network echo, which is a reflected signal in a public switched telephone network due to impedance mismatch of a 2-4 line conversion unit at a near end; another type is acoustic echo, which is a signal resulting from acoustic reflections off the surfaces of surrounding objects, for example sound being sampled by a microphone, reflected from the loudspeaker of a near-end hands-free device, directly or via the surface of the surrounding object. The echo path of the network echo is relatively stable, and the echo path length does not exceed 32ms; the echo path of an acoustic echo is subject to change, the echo path length can reach several hundred ms, and the echo path is nonlinear. In the actual call process, echo exceeding 20ms can seriously affect the call quality. For telecommunication systems, such as long distance telephones, cancellation of network echo is necessary; for the IP telephone and digital video conference system based on the packet switching network, the actual delay caused by the network jitter, audio encoding and decoding, audio pre-and post-processing and the like is far greater than 20ms, and the elimination of the acoustic echo is necessary.
An echo cancellation system may be used to cancel echo in general, typically the echo canceller 100 shown in fig. 1. The echo canceller 100 includes an adaptive filtering unit 101 and a step parameter adjusting unit 102, wherein:
(1) The adaptive filtering unit 101 may be an adaptive filter, which may perform filtering using LMS (Least Mean Square), NLMS (Normalized Least Mean Square), RLS (Recursive Least Square), and the like, and may be implemented in a time domain or a frequency domain. In practical applications, in order to reduce the complexity of operations and increase the convergence speed, most of the echo cancellers used in practice (especially, acoustic echo cancellers) are implemented in a frequency domain (including subband analysis-synthesis), and fig. 2 is a schematic diagram of the echo cancellers performing echo cancellation in an exemplary scenario.
(2) The step size parameter adjusting unit 102 is configured to adjust the step size parameter of the filter during a two-way call (that means that the far end and the near end talk simultaneously), so as to avoid signal distortion caused by severe divergence of the filter.
The step parameter adjustment unit 102 uses a step parameter adjustment method, which is mostly based on the signal strength or correlation of the output signal e (n) and/or the far-end signal x (n), and the algorithm itself has one or more parameters that are difficult to set. In a typical example, the step size parameter adjusting unit 102 is a Double Talk Detector (DTD), and the step size parameter adjusting method adopted by the DTD is a double talk detection method, which stops the filter coefficient adaptation or decreases the filter adaptation step size parameter to reduce the adaptation rate immediately after detecting the near-end speech signal.
At present, there are two main algorithms used in the step size parameter adjustment method (including the double talk detection method), one is based on the signal strength between the far-end signal x (n) and the microphone signal d (n), and the other is based on the correlation between the two signals. The specific method comprises the following steps: in step S301, after a near-end voice signal is detected during a two-way call, a threshold value of signal strength or signal correlation is obtained; in step S302, the step size parameter is adjusted based on the threshold of the signal strength or signal correlation to avoid filter divergence. However, since the characteristics of the actual speech signal are non-static and highly auto-correlated (i.e. the condition number of the correlation matrix of the speech signal is large), the variation range of the speech signal strength is large and the variation speed is fast, so it is difficult to select an appropriate signal strength decision threshold; both methods are unreliable because of the inevitable non-linearity of the actual echo path and the significant effects of environmental noise, circuit noise and quantization noise on the correlation between the signals, and it is similarly difficult to select an appropriate signal correlation decision threshold.
The double talk detection method can be considered as a special case of the more general variable step size parameter method. The variable step size parameter method is to continuously adjust the step size parameter through a certain strategy, and usually does not comprise an explicit two-way call detector. Most of the current variable step parameter methods are based on the signal strength or correlation of the output signal and/or the far-end signal, and the specific contents thereof can be referred to as: H. shin, A.H.Sayed, W.J.Song, "Variable Step-Size NLMS and affinity project Algorithms," IEEE Signal Processing Letters, vol.11, no.2, pp.132-135, feb 2004. And the algorithm itself has one or more parameters that are difficult to set, as described above, algorithms based directly on variable step-size parameters of signal strength or correlation are unreliable. If the method uses the output signal without taking precautionary measures it is less reliable because the output signal is equal to the microphone signal minus the estimated echo signal, and small perturbations to the estimated echo signal will affect the step size parameter by the output signal, while erroneous changes in the step size parameter will increase the perturbation to the estimated echo signal, which will constitute a positive feedback, thus undermining the stability of the filter.
Therefore, a new step size parameter adjustment method is needed, which can ensure the stability of the adaptive filter while the echo canceller performs echo cancellation by using the adaptive filter.
Disclosure of Invention
The invention aims to provide echo cancellation equipment, which aims to solve the problem that the stability of a filter cannot be ensured in the echo cancellation process in the prior art.
The present invention also aims to provide a step size parameter adjustment method for echo cancellation to better solve the above problems in the prior art.
In order to achieve the purpose of the invention, the device, namely the echo canceller, comprises a self-adaptive filtering unit for echo cancellation and a step parameter adjusting unit connected with the self-adaptive filtering unit, wherein the step parameter adjusting unit comprises an energy distribution judging module, a divergence value judging module and a step control module;
the energy distribution judging module is connected with the divergence value judging module and used for acquiring the filter coefficient, calculating the probability distribution of the filter coefficient energy and sending the calculation result to the divergence value judging module;
the divergence value judging module is respectively connected with the energy distribution judging module and the step length control module and is used for calculating the probability distribution of the filter coefficient energyRelevant JS divergence value D JS And will the JS divergence value D JS Sending the data into a step length control module;
step length control module through one JS divergence value D JS The step size parameter is adjusted for the step size parameter function of the argument.
Preferably, the divergence value decision module is configured to calculate a JS divergence value D between a discrete probability distribution and a uniform probability distribution of filter coefficient energy JS The calculation formula is:
wherein p is
(1) Is a discrete probability distribution of filter coefficient energies, p
(2) Is a uniform probability distribution of the filter coefficient energy,
i =0, 1.. Ang., N-1, and j =1,2, π
(j) Is a probability distribution p
(j) Weight of (b) satisfies
And 0. Ltoreq. Pi
(j) Less than or equal to 1; h (p) is the entropy of the probability distribution p.
Preferably, the step size parameter function adopted by the step size control module is: mu (D) JS )=μ min +f(D JS )·(μ max -μ min );
Wherein D is JS Is JS divergence value related to the probability distribution of filter coefficient energy, and D is more than or equal to 0 JS ≤1; μ max 、μ min Respectively a preset maximum step length parameter and a preset minimum step length parameter, and the value is more than or equal to 0 mu min <μ max ≤1; f(D JS ) Is as a result of D JS The step size control factor is an independent variable.
Preferably, the step size control factor f (D) JS ) Is one of D JS As a monotonically increasing function of the argument,the functional expression is as follows:
wherein D is not less than 0 JS Alpha and beta are more than 0 and are algorithm parameters which can be flexibly set.
In order to better achieve the object of the present invention, the method for adjusting step size parameters is based on the aforementioned echo canceller, and the method includes the following steps:
A. obtaining a filter coefficient, and calculating the probability distribution of filter coefficient energy;
B. calculating JS divergence value D related to probability distribution of filter coefficient energy JS ;
C. Make use of to the JS divergence value D JS The step size parameter is adjusted for the step size parameter function of the argument.
Preferably, before the step a, the method further comprises:
end value of preset step size parameter, i.e. maximum step size parameter mu max And the minimum step size parameter mu min Wherein 0 is less than or equal to mu min <μ max ≤1。
Preferably, the JS divergence value D is calculated by the probability distribution of the filter coefficient energy in the step B JS The formula of (A) is as follows:
wherein p is
(1) Is a discrete probability distribution, p, of filter coefficient energy
(2) Is a uniform probability distribution of the filter coefficient energy,
i =0,1, N-1, and j =1,2, h (p) is the entropy of the probability distribution p, defined as
Preferably, the step size parameter function adopted in step C is: mu (D) JS )=μ min +f(D JS )·(μ max -μ min );
Wherein D is JS JS divergence value related to probability distribution of filter coefficient energy, and D is more than or equal to 0 JS ≤1; μ max 、μ min Respectively is a preset maximum step length parameter and a preset minimum step length parameter, and mu is more than or equal to 0 min <μ max ≤1; f(D JS ) Is as a result of D JS The step size control factor is an independent variable.
Preferably, the step size control factor f (D) JS ) Is one of D JS Is a monotone increasing function of an independent variable, and the function expression is as follows:
wherein D is not less than 0 JS Alpha and beta are more than 0 and are algorithm parameters which can be flexibly set.
The invention adds an energy distribution judging module and a divergence value judging module in a step parameter adjusting unit of an echo eliminator, and one of the energy distribution judging module and the divergence value judging module in a step control module is connected with a D converter JS Step size control factor f (D) as an argument JS ) The step length parameter is accurately and reliably adjusted, and the stability of the filter is ensured.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
The core idea of the invention is as follows: if the filter is stable, the step size is increased, otherwise the step size is decreased. To achieve this, it is desirable to have a parameter that can directly describe the steady state of the filter quantitatively and use it to control the step size parameter of the filter.
Therefore, in the present invention, the echo canceller includes an adaptive filtering unit and a step size parameter adjusting unit, and the step size parameter adjusting unit includes three modules: the device comprises an energy distribution judging module, a divergence value judging module and a step length control module. The energy distribution judging module acquires filter coefficients and calculates the probability distribution of the filter coefficient energy; the divergence value judgment module calculates a JS divergence value D by utilizing the probability distribution of the filter coefficient energy JS And sending the calculation result to a step length control module; the latter is passed through a filter with D JS The step size parameter is adjusted for the parameter function of the argument. Since the invention is based on a probability distribution of filter coefficient energies that can be unambiguously quantized,rather than signal strength or signal correlation, which cannot be accurately defined, the present invention is therefore able to align stepsThe long parameter is accurately and reliably adjusted, so that the stability of the filter is ensured.
Fig. 4 is a structural diagram of the echo canceller 100 in the invention. The echo canceller 100 comprises an adaptive filtering unit 101 and a step parameter adjustment unit 102. It should be noted that the connection relationship among the devices in all the figures of the present invention is for clearly explaining the need of information interaction and control process, and therefore, should be regarded as a connection relationship in logic, and should not be limited to physical connection. Wherein:
the adaptive filtering unit 101 is used for echo cancellation, and may perform filtering by using LMS, NLMS, RLS, and the like as described above, and may be implemented in a time domain or a frequency domain.
The step size parameter adjusting unit 102 is connected to the adaptive filtering unit 101, and is configured to detect the stability of the filter in real time and adjust the step size parameter. It includes an energy distribution determination module 1021, a divergence value determination module 1022, and a step size control module 1023, wherein:
(1) The energy distribution determining module 1021 is connected to the divergence value determining module 1022, and is configured to obtain the filter coefficients and calculate the probability distribution of the filter coefficient energy, including the discrete probability distribution and the uniform probability distribution.
In one example scheme, the echo canceller 100 simulates an echo path using a Finite Impulse Response (FIR) filter, and then, in most cases, the FIR impulse Response (i.e., filter coefficients) h = (h =) in most cases 0 ,h 1 ,…,h N-1 ) The total energy (defined as the absolute value of each real coefficient or the sum of squares of the modes of the complex coefficients) of (c) is concentrated on a small fraction of the coefficients, as shown in fig. 5.
The discrete probability distribution of filter coefficient energies can be represented by the following equation:
the uniform probability distribution of filter coefficient energies can be expressed by the following equation:
satisfy the usual restrictions
And
i =0,1,.. N-1 and j =1,2.
Therefore, the number of the first and second electrodes is increased,
can be viewed as a discrete probability distribution of FIR filter coefficient energies,
is a uniform probability distribution, i.e. as shown in fig. 6.
(2) The divergence value determining module 1022 is respectively connected to the energy distribution determining module 1021 and the step length control module1023, which calculates a JS divergence value D associated with the probability distribution of the filter coefficient energies using the calculation result of the energy distribution determination module 1021 JS Then, the JS divergence value D is set JS Into the step size control module 1023.
In the foregoing example scenario, the JS divergence value D associated with the probability distribution of filter coefficient energies JS The calculation formula of (2) is:
wherein p is
(1) Is a discrete probability distribution of filter coefficient energies, p
(2) Is a uniform probability distribution of the filter coefficient energy,
i =0, 1.. Ang., N-1, and j =1,2, π
(j) Is a probability distribution p
(j) Weight of, satisfy
And 0. Ltoreq. Pi
(j) Less than or equal to 1; h (p) is the entropy of the probability distribution p, defined as
In addition, the peak position pOS of the probability distribution of the filter coefficient energy can be further calculated max The formula is as follows:
(3) The step size control module 1023 is coupled to the divergence value decision module 1022 for passing through a plurality of D' s JS Step size parameter function pair step size parameter mu (D) as argument JS ) And (6) adjusting. In one example scenario, it utilizes a step size control factor f (D) JS ) The specific adjustment is carried out by adopting a step length parameter function as follows:
μ(D JS )=μ min +f(D JS )·(μ max -μ min ) (5)
wherein D is JS Is JS divergence value related to the probability distribution of filter coefficient energy, and D is more than or equal to 0 JS ≤1; μ max 、μ min Respectively is a preset maximum step length parameter and a preset minimum step length parameter, and mu is more than or equal to 0 min <μ max ≤1; f(D JS ) Is as a result of D JS The step size control factor is an independent variable.
In one example scenario, the step size control factor f (D) JS ) Is one with D JS Is a monotone increasing function of an independent variable, and the function expression is as follows:
wherein, D is more than or equal to 0 JS The alpha and beta are the algorithm parameters of the invention, and can be flexibly set according to specific conditions. FIG. 7 is thatStep size control factor included in step size parameter function in one embodiment of the present inventionf(D JS ) Schematic representation of (a).
Fig. 8 shows the flow of the method for adjusting the step size parameter in the echo cancellation process according to the present invention.
Before all steps, a step size parameter μ (D) is preset in the step size parameter adjustment unit 102 of the echo canceller 100 JS ) End value of, i.e. maximum step parameter mu max And the minimum step size parameter mu min Wherein 0 is not more than mu min <μ max ≤1。
In step S801, filter coefficients are acquired, and a probability distribution of filter coefficient energies is calculated. Specifically, the echo canceller 100 obtains the filter coefficients by using the energy distribution determining module 1021 in the step parameter adjusting unit 102, and calculates the discrete probability distribution and the uniform probability distribution of the filter coefficient energy.
First, an FIR filter is used to simulate an echo path, and the obtained filter coefficients, i.e., impulse response h = (h) 0 ,h 1 ,…,h N-1 ) The schematic diagram is shown in fig. 5, and the energy probability distribution is shown in fig. 6. Calculating discrete probability distribution and uniform probability distribution of filter coefficient energy by equations (1) and (2), respectively, and calculating peak position pos by equation (4) max 。
In step S802, JS divergence value D associated with the probability distribution of filter coefficient energy is calculated from expression (3) JS The stability of the filter is detected in real time, and the detailed implementation process of this step can refer to the content in fig. 2.
In step S803, step length adjusting section 102 passes through one step by D from expressions (5) and (6) JS The step size parameter is adjusted for the step size parameter function of the independent variable, and the step size parameter function comprises a step size control factor f (D) JS )。
Fig. 9 is a diagram illustrating the state transition of the filter when step size parameter adjustment is performed during echo cancellation according to the present invention. For convenience of description, in the present invention, a significant echo path change and a near-end voice signal are regarded as external forces acting on an echo cancellation system, a boolean variable bface is defined, and when a significant echo path change or a near-end voice signal occurs, the bface is 1, otherwise, the bface is 0. And defines two possible filter states: a stable state and an unstable state.
When the filter is in steady state, if bface =0, the filter remains in steady state, D JS The step length parameter is larger, and the method has good tracking capability on echo path change.
If bface =1, the filter will gradually transition from a stable state to an unstable state, when an external force is dominant, which results in D JS And reducing the step length of the filter, slowing down the adaptation rate and avoiding large divergence.
If the external force continues, the filter will reach and stay in an unstable state, at which time D JS And step sizeAre small and the adaptation rate becomes very slow, avoiding severe divergence. At this point the filter outputs a signal with some residual echo. If the external force is removed, the filter is transited from the unstable state to the stable state and enters an accelerated recovery process: d JS Increase, resulting in increased step size, faster filter convergence rate, and increased D JS Further increasing, thus creating positive feedback.
In a specific application scenario of the present invention, the step parameter adjustment process is detailed as follows:
before the step length parameter adjustment is carried out, the following presetting needs to be carried out:
the basic adaptive filter algorithm for echo cancellation, e.g., NLMS, PNLMS, APA, FAP, MDF- α, etc., is selected according to the application scenario, computational resources, etc. In order to reduce the operation complexity and improve the convergence speed, the frequency domain (including sub-band analysis-synthesis) implementation mode is selected as much as possible.
Setting the appropriate step size parameter according to the selected adaptive filter algorithmLower limit μ of min And upper limit μ max E.g. mu min =0,μ max =0.5。
Parameters alpha and beta of the step size parameter adaptive adjustment algorithm are determined. Beta determines the function f (D) JS ) The horizontal position of the symmetrical point of (2), for example, β =0.325, is a closed interval [0.15,0.5 ]]A center point of (a); alpha determines the function f (D) JS ) The value of (a) is in the range of 6 to 15, for example, α =12.
Determining the quantity h = h of the analog echo path 0 ,h 1 ,…,h N-1 ) E.g. filter coefficients of the transverse structure of an FIR filter, or filter reflection coefficients of a lattice structure, for calculating the probability distribution p of the filter coefficient energies (1) 。
The appropriate filter order is selected. In the case of a network echo cancellation application, the echo path length may be set to 32 ms. In the case of acoustic echo cancellation applications, the following method can be used to estimate the optimal filter order.
The echo path length is assumed in advance to be 128 or 256ms.
If the filter remains in a stable state (D) JS Greater and smaller fluctuation amplitude, pos max Substantially unchanged) and maintained for about 10 seconds. The optimum filter order should be such that D JS Is between 0.5 and 0.6;
if D is JS An average value of (d) above this range indicates that the filter order is set too large, both wasting computational resources (especially in the case of high sampling rates) and reducing the filter convergence rate; on the contrary, if D JS If the average value of (c) is below this range, it means that the filter order is set too small, which will result in a large residual echo and affect the effect of the step size adjustment method of the present invention. Therefore, unless computational resource constraints are imposed, the filter order should be adjusted to provide a steady state D JS Is within the above range.
To reduce the computation D JS And the operation complexity of the step size parameter, which can be:
1) If the filter is implemented in a subband analysis-synthesis mode, the filter coefficients or reflection coefficients of the low frequency subbands without the DC frequency are selected for calculating the probability distribution of the filter coefficient energies.
2) When the filter order is large, the filter coefficient h = h
0 ,h
1 ,…,h
N-1 ) Dividing the filter coefficient block into a plurality of continuous coefficient blocks with equal length, and replacing the original coefficient energy distribution with the energy distribution of the filter coefficient block. Let the integer B denote the number of coefficients per block, the integer
Representing the number of blocks, the energy distribution of the filter coefficient block is:
wherein, h is defined when i > N-1 i And =0. It can be seen that formula (1) is a special case of the above formula (B = 1). And the number of coefficients N in the equation (2-4) is replaced with the number of coefficient blocks K. For example, if N =2048, B =16,k =128 may be taken;
3) Periodically calculating D JS 、pos max And step length, for example, calculating once every 1-6ms and storing the result, and using the stored calculation result at the rest time;
4) Sub-expression xlog for Shannon entropy calculation by table lookup and linear interpolation 2 x,x∈[0,1]。
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.