mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-26 18:41:12 +00:00
plc: add max num consecutive bad frames statistic
This commit is contained in:
parent
1db30a88d0
commit
de854f9a28
@ -147,6 +147,11 @@ void btstack_cvsd_plc_bad_frame(btstack_cvsd_plc_state_t *plc_state, uint16_t nu
|
||||
int i = 0;
|
||||
float sf = 1;
|
||||
plc_state->nbf++;
|
||||
|
||||
if (plc_state->max_consecutive_bad_frames_nr < plc_state->nbf){
|
||||
plc_state->max_consecutive_bad_frames_nr = plc_state->nbf;
|
||||
}
|
||||
|
||||
// plc_state->cvsd_fs = CVSD_FS_MAX;
|
||||
if (plc_state->nbf==1){
|
||||
// Perform pattern matching to find where to replicate
|
||||
@ -298,4 +303,5 @@ void btstack_cvsd_dump_statistics(btstack_cvsd_plc_state_t * state){
|
||||
log_info("Good frames: %d\n", state->good_frames_nr);
|
||||
log_info("Bad frames: %d\n", state->bad_frames_nr);
|
||||
log_info("Zero frames: %d\n", state->zero_frames_nr);
|
||||
log_info("Max Consecutive bad frames: %d\n", state->max_consecutive_bad_frames_nr);
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ typedef struct cvsd_plc_state {
|
||||
int bad_frames_nr;
|
||||
int zero_frames_nr;
|
||||
int frame_count;
|
||||
int max_consecutive_bad_frames_nr;
|
||||
} btstack_cvsd_plc_state_t;
|
||||
|
||||
// All int16 audio samples are in host endiness
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "btstack_sbc_plc.h"
|
||||
#include "btstack_debug.h"
|
||||
|
||||
#define SAMPLE_FORMAT int16_t
|
||||
|
||||
@ -158,6 +159,12 @@ void btstack_sbc_plc_bad_frame(btstack_sbc_plc_state_t *plc_state, SAMPLE_FORMAT
|
||||
float sf = 1;
|
||||
plc_state->nbf++;
|
||||
|
||||
plc_state->bad_frames_nr++;
|
||||
plc_state->frame_count++;
|
||||
if (plc_state->max_consecutive_bad_frames_nr < plc_state->nbf){
|
||||
plc_state->max_consecutive_bad_frames_nr = plc_state->nbf;
|
||||
}
|
||||
|
||||
if (plc_state->nbf==1){
|
||||
// Perform pattern matching to find where to replicate
|
||||
plc_state->bestlag = PatternMatch(plc_state->hist);
|
||||
@ -206,6 +213,9 @@ void btstack_sbc_plc_bad_frame(btstack_sbc_plc_state_t *plc_state, SAMPLE_FORMAT
|
||||
void btstack_sbc_plc_good_frame(btstack_sbc_plc_state_t *plc_state, SAMPLE_FORMAT *in, SAMPLE_FORMAT *out){
|
||||
float val;
|
||||
int i = 0;
|
||||
plc_state->good_frames_nr++;
|
||||
plc_state->frame_count++;
|
||||
|
||||
if (plc_state->nbf>0){
|
||||
for (i=0;i<SBC_RT;i++){
|
||||
out[i] = plc_state->hist[SBC_LHIST+i];
|
||||
@ -233,3 +243,9 @@ void btstack_sbc_plc_good_frame(btstack_sbc_plc_state_t *plc_state, SAMPLE_FORMA
|
||||
|
||||
plc_state->nbf=0;
|
||||
}
|
||||
|
||||
void btstack_sbc_dump_statistics(btstack_sbc_plc_state_t * state){
|
||||
log_info("Good frames: %d\n", state->good_frames_nr);
|
||||
log_info("Bad frames: %d\n", state->bad_frames_nr);
|
||||
log_info("Max Consecutive bad frames: %d\n", state->max_consecutive_bad_frames_nr);
|
||||
}
|
||||
|
@ -61,6 +61,12 @@ typedef struct sbc_plc_state {
|
||||
int16_t hist[SBC_LHIST+SBC_FS+SBC_RT+SBC_OLAL];
|
||||
int16_t bestlag;
|
||||
int nbf;
|
||||
|
||||
// summary of processed good and bad frames
|
||||
int good_frames_nr;
|
||||
int bad_frames_nr;
|
||||
int frame_count;
|
||||
int max_consecutive_bad_frames_nr;
|
||||
} btstack_sbc_plc_state_t;
|
||||
|
||||
// All int16 audio samples are in host endiness
|
||||
@ -68,6 +74,7 @@ void btstack_sbc_plc_init(btstack_sbc_plc_state_t *plc_state);
|
||||
void btstack_sbc_plc_bad_frame(btstack_sbc_plc_state_t *plc_state, int16_t *ZIRbuf, int16_t *out);
|
||||
void btstack_sbc_plc_good_frame(btstack_sbc_plc_state_t *plc_state, int16_t *in, int16_t *out);
|
||||
uint8_t * btstack_sbc_plc_zero_signal_frame(void);
|
||||
void btstack_sbc_dump_statistics(btstack_sbc_plc_state_t * state);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user