Lessen CPU load

This commit is contained in:
Sélène Corbineau 2025-01-30 02:06:59 +01:00
parent 4ff5624f18
commit 79470a8ce1
3 changed files with 13 additions and 5 deletions

View file

@ -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);
let
count = 0 -> if( red<<power_acc, 10>>(0.0, delayed_array<<10>>(pre y)) >= 16.0 * e * 10.0)
then 3600
else (if (pre count) > 0 then (pre count) - 1 else 0);
count = 0 -> if (pre count) > 0 then (pre count) - 1 else (
if( red<<power_acc, 10>>(0.0, delayed_array<<10>>(pre y)) >= 16.0 * e * 10.0)
then 3600 else 0);
y, h = NLMS_FIR<<n>>(ref,x, if (count > 0) and not force then 0.0 else mu);
tel

View file

@ -81,6 +81,9 @@ void aec_stream::on_process() {
params.echo_return_gain *= 1/(.1*.1);
// Renormalize
params.learn_rate = 1.0/256;
params.force_learn = 1.0/256;
float max_cov2 = 0.0f;
for(int i = 0; i < 8192; ++i) {
if(cov[i]*cov[i] >= max_cov2) {
@ -105,9 +108,9 @@ void aec_stream::on_process() {
double dsp_out;
dsp_EchoCancel_step(hp_rb->buffer[t+1],
(double)dst[effective - i],
(remaining_samples >= 0) ? 1.0/256 : 1e-4/256,
params.learn_rate,
(double)params.noise_power,
remaining_samples >= 0,
params.force_learn,
&dsp_out,
h, &cnt, ctx);
dst[effective - i] = dsp_out;
@ -118,6 +121,8 @@ void aec_stream::on_process() {
if((remaining_samples -= effective) <= 0) {
pstrm.request_noise(false, 0.f);
params.learn_rate = 1e-4/256;
params.force_learn = false;
}
break;

View file

@ -14,6 +14,8 @@ struct aec_params {
int sample_delay = 0;
bool valid = false;
bool force_learn = true;
};
class aec_stream : public pwstream {