diff --git a/src/classic/btstack_cvsd_plc.c b/src/classic/btstack_cvsd_plc.c index 5e137003c..b6b659778 100644 --- a/src/classic/btstack_cvsd_plc.c +++ b/src/classic/btstack_cvsd_plc.c @@ -56,9 +56,52 @@ static float rcos[CVSD_OLAL] = { 0.45386582,0.36316850,0.27713082,0.19868268, 0.13049554,0.07489143,0.03376389,0.00851345}; -static float CrossCorrelation(int8_t *x, int8_t *y); -static int PatternMatch(int8_t *y); -static float AmplitudeMatch(int8_t *y, int8_t bestmatch); +static float CrossCorrelation(int8_t *x, int8_t *y){ + float num = 0; + float den = 0; + float x2 = 0; + float y2 = 0; + int m; + for (m=0;mmaxCn){ + bestmatch=n; + maxCn = Cn; + } + } + return bestmatch; +} + +static float AmplitudeMatch(int8_t *y, int8_t bestmatch) { + int i; + float sumx = 0; + float sumy = 0.000001f; + float sf; + + for (i=0;i1.2f) sf=1.2f; + return sf; +} static int8_t crop_to_int8(float val){ float croped_val = 0; @@ -109,12 +152,14 @@ void btstack_cvsd_plc_bad_frame(btstack_cvsd_plc_state_t *plc_state, int8_t *out plc_state->hist[CVSD_LHIST+i] = crop_to_int8(val); } - for (i=CVSD_FS+CVSD_OLAL;ihist[CVSD_LHIST+i] = plc_state->hist[plc_state->bestlag+i]; + } } else { - for (i=0;ihist[CVSD_LHIST+i] = plc_state->hist[plc_state->bestlag+i]; + } } for (i=0;inbf=0; } - -float CrossCorrelation(int8_t *x, int8_t *y){ - float num = 0; - float den = 0; - float x2 = 0; - float y2 = 0; - int m; - for (m=0;mmaxCn){ - bestmatch=n; - maxCn = Cn; - } - } - return bestmatch; -} - - -float AmplitudeMatch(int8_t *y, int8_t bestmatch) { - int i; - float sumx = 0; - float sumy = 0.000001f; - float sf; - - for (i=0;i1.2f) sf=1.2f; - return sf; -} \ No newline at end of file diff --git a/src/classic/btstack_sbc_plc.c b/src/classic/btstack_sbc_plc.c index 331f571e9..4035862c9 100644 --- a/src/classic/btstack_sbc_plc.c +++ b/src/classic/btstack_sbc_plc.c @@ -63,9 +63,53 @@ static float rcos[SBC_OLAL] = { 0.45386582f,0.36316850f,0.27713082f,0.19868268f, 0.13049554f,0.07489143f,0.03376389f,0.00851345f}; -static float CrossCorrelation(int16_t *x, int16_t *y); -static int PatternMatch(int16_t *y); -static float AmplitudeMatch(int16_t *y, int16_t bestmatch); +static float CrossCorrelation(int16_t *x, int16_t *y){ + float num = 0; + float den = 0; + float x2 = 0; + float y2 = 0; + int m; + for (m=0;mmaxCn){ + bestmatch=n; + maxCn = Cn; + } + } + return bestmatch; +} + + +static float AmplitudeMatch(int16_t *y, int16_t bestmatch) { + int i; + float sumx = 0; + float sumy = 0.000001f; + float sf; + + for (i=0;i1.2f) sf=1.2f; + return sf; +} static int16_t crop_to_int16(float val){ float croped_val = 0; @@ -123,8 +167,9 @@ void btstack_sbc_plc_bad_frame(btstack_sbc_plc_state_t *plc_state, int16_t *ZIRb } } else { - for (i=0;ihist[SBC_LHIST+i] = plc_state->hist[plc_state->bestlag+i]; + } } for (i=0;ihist[SBC_LHIST+i]; @@ -167,52 +212,3 @@ void btstack_sbc_plc_good_frame(btstack_sbc_plc_state_t *plc_state, int16_t *in, plc_state->nbf=0; } - - -float CrossCorrelation(int16_t *x, int16_t *y){ - float num = 0; - float den = 0; - float x2 = 0; - float y2 = 0; - int m; - for (m=0;mmaxCn){ - bestmatch=n; - maxCn = Cn; - } - } - return bestmatch; -} - - -float AmplitudeMatch(int16_t *y, int16_t bestmatch) { - int i; - float sumx = 0; - float sumy = 0.000001f; - float sf; - - for (i=0;i1.2f) sf=1.2f; - return sf; -} \ No newline at end of file