Lessen CPU load
This commit is contained in:
parent
4ff5624f18
commit
79470a8ce1
3 changed files with 13 additions and 5 deletions
|
@ -60,9 +60,10 @@ node VD_wrapper<< const n : int >>(ref : real; x : real; mu : real; e : real; fo
|
||||||
returns (y : real; h : real^n; count : int);
|
returns (y : real; h : real^n; count : int);
|
||||||
let
|
let
|
||||||
|
|
||||||
count = 0 -> if( red<<power_acc, 10>>(0.0, delayed_array<<10>>(pre y)) >= 16.0 * e * 10.0)
|
count = 0 -> if (pre count) > 0 then (pre count) - 1 else (
|
||||||
then 3600
|
if( red<<power_acc, 10>>(0.0, delayed_array<<10>>(pre y)) >= 16.0 * e * 10.0)
|
||||||
else (if (pre count) > 0 then (pre count) - 1 else 0);
|
then 3600 else 0);
|
||||||
|
|
||||||
y, h = NLMS_FIR<<n>>(ref,x, if (count > 0) and not force then 0.0 else mu);
|
y, h = NLMS_FIR<<n>>(ref,x, if (count > 0) and not force then 0.0 else mu);
|
||||||
tel
|
tel
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,9 @@ void aec_stream::on_process() {
|
||||||
params.echo_return_gain *= 1/(.1*.1);
|
params.echo_return_gain *= 1/(.1*.1);
|
||||||
// Renormalize
|
// Renormalize
|
||||||
|
|
||||||
|
params.learn_rate = 1.0/256;
|
||||||
|
params.force_learn = 1.0/256;
|
||||||
|
|
||||||
float max_cov2 = 0.0f;
|
float max_cov2 = 0.0f;
|
||||||
for(int i = 0; i < 8192; ++i) {
|
for(int i = 0; i < 8192; ++i) {
|
||||||
if(cov[i]*cov[i] >= max_cov2) {
|
if(cov[i]*cov[i] >= max_cov2) {
|
||||||
|
@ -105,9 +108,9 @@ void aec_stream::on_process() {
|
||||||
double dsp_out;
|
double dsp_out;
|
||||||
dsp_EchoCancel_step(hp_rb->buffer[t+1],
|
dsp_EchoCancel_step(hp_rb->buffer[t+1],
|
||||||
(double)dst[effective - i],
|
(double)dst[effective - i],
|
||||||
(remaining_samples >= 0) ? 1.0/256 : 1e-4/256,
|
params.learn_rate,
|
||||||
(double)params.noise_power,
|
(double)params.noise_power,
|
||||||
remaining_samples >= 0,
|
params.force_learn,
|
||||||
&dsp_out,
|
&dsp_out,
|
||||||
h, &cnt, ctx);
|
h, &cnt, ctx);
|
||||||
dst[effective - i] = dsp_out;
|
dst[effective - i] = dsp_out;
|
||||||
|
@ -118,6 +121,8 @@ void aec_stream::on_process() {
|
||||||
|
|
||||||
if((remaining_samples -= effective) <= 0) {
|
if((remaining_samples -= effective) <= 0) {
|
||||||
pstrm.request_noise(false, 0.f);
|
pstrm.request_noise(false, 0.f);
|
||||||
|
params.learn_rate = 1e-4/256;
|
||||||
|
params.force_learn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -14,6 +14,8 @@ struct aec_params {
|
||||||
|
|
||||||
int sample_delay = 0;
|
int sample_delay = 0;
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
|
|
||||||
|
bool force_learn = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
class aec_stream : public pwstream {
|
class aec_stream : public pwstream {
|
||||||
|
|
Loading…
Add table
Reference in a new issue