mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 22:20:37 +00:00
cvsd: fix scaling factor to max of 1 instead of 1.2
This commit is contained in:
parent
21045273fa
commit
cf8890c436
@ -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;i<plc_state->cvsd_fs;i++){
|
||||
out[i] = plc_state->hist[CVSD_LHIST+i];
|
||||
}
|
||||
|
||||
// shift the history buffer
|
||||
for (i=0;i<CVSD_LHIST+CVSD_RT+CVSD_OLAL;i++){
|
||||
|
||||
// shift the history buffer
|
||||
for (i=0;i<CVSD_LHIST+CVSD_RT+CVSD_OLAL;i++){
|
||||
plc_state->hist[i] = plc_state->hist[i+plc_state->cvsd_fs];
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user