diff --git a/src/classic/btstack_cvsd_plc.c b/src/classic/btstack_cvsd_plc.c index 180b5e2a2..4a2d60a34 100644 --- a/src/classic/btstack_cvsd_plc.c +++ b/src/classic/btstack_cvsd_plc.c @@ -126,7 +126,7 @@ static float AmplitudeMatch(btstack_cvsd_plc_state_t *plc_state, SAMPLE_FORMAT * sf = sumx/sumy; // This is not in the paper, but limit the scaling factor to something reasonable to avoid creating artifacts if (sf<0.75f) sf=0.75f; - if (sf>1.2f) sf=1.2f; + if (sf>1.0) sf=1.0f; return sf; } @@ -146,7 +146,7 @@ void btstack_cvsd_plc_bad_frame(btstack_cvsd_plc_state_t *plc_state, SAMPLE_FORM int i = 0; float sf = 1; plc_state->nbf++; - + // plc_state->cvsd_fs = CVSD_FS_MAX; if (plc_state->nbf==1){ // Perform pattern matching to find where to replicate plc_state->bestlag = PatternMatch(plc_state->hist); @@ -180,12 +180,13 @@ void btstack_cvsd_plc_bad_frame(btstack_cvsd_plc_state_t *plc_state, SAMPLE_FORM plc_state->hist[CVSD_LHIST+i] = plc_state->hist[plc_state->bestlag+i]; } } + for (i=0;icvsd_fs;i++){ out[i] = plc_state->hist[CVSD_LHIST+i]; } - - // shift the history buffer - for (i=0;ihist[i] = plc_state->hist[i+plc_state->cvsd_fs]; } } diff --git a/src/classic/btstack_cvsd_plc.h b/src/classic/btstack_cvsd_plc.h index 006aeef94..0be28cdce 100644 --- a/src/classic/btstack_cvsd_plc.h +++ b/src/classic/btstack_cvsd_plc.h @@ -49,12 +49,13 @@ extern "C" { #endif + #define CVSD_FS_MAX 60 /* CVSD Frame Size */ -#define CVSD_N 128 /* 16ms - Window Length for pattern matching */ +#define CVSD_N 256 /* Window Length for pattern matching */ #define CVSD_M 10 /* Template for matching */ #define CVSD_LHIST (CVSD_N+CVSD_FS_MAX-1) /* Length of history buffer required */ #define CVSD_RT 5 /* Reconvergence Time (samples) */ -#define CVSD_OLAL 16 /* OverLap-Add Length (samples) */ +#define CVSD_OLAL 16 /* OverLap-Add Length (samples) */ /* PLC State Information */ typedef struct cvsd_plc_state {