Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ typedef struct {
int32_t mic_samples_passthrough[appconfAUDIO_PIPELINE_CHANNELS][appconfAUDIO_PIPELINE_FRAME_ADVANCE];

/* Below is additional context needed by other stages on a per frame basis */
int32_t vnr_pred_flag;
float_s32_t vnr_pred_flag;
float_s32_t max_ref_energy;
float_s32_t aec_corr_factor;
int32_t ref_active_flag;
Expand Down
8 changes: 4 additions & 4 deletions modules/audio_pipelines/reference/adec/audio_pipeline_t0.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ static void stage_vnr_and_ic(frame_data_t *frame_data)
vnr_pred_state_t *vnr_pred_state = &vnr_pred_stage_state.vnr_pred_state;
ic_calc_vnr_pred(&ic_stage_state.state, &vnr_pred_state->input_vnr_pred, &vnr_pred_state->output_vnr_pred);

float_s32_t agc_vnr_threshold = f32_to_float_s32(VNR_AGC_THRESHOLD);
frame_data->vnr_pred_flag = float_s32_gt(vnr_pred_stage_state.vnr_pred_state.output_vnr_pred, agc_vnr_threshold);
frame_data->vnr_pred_flag = vnr_pred_stage_state.vnr_pred_state.input_vnr_pred;

ic_adapt(&ic_stage_state.state, vnr_pred_stage_state.vnr_pred_state.input_vnr_pred);
ic_adapt(&ic_stage_state.state, ic_stage_state.state.vnr_pred_state.input_vnr_pred);

/* Intentionally ignoring comms ch from here on out */
memcpy(frame_data->samples, ic_output, appconfAUDIO_PIPELINE_FRAME_ADVANCE * sizeof(int32_t));
Expand Down Expand Up @@ -120,6 +119,7 @@ static void stage_agc(frame_data_t *frame_data)
agc_stage_state.md.vnr_flag = frame_data->vnr_pred_flag;
agc_stage_state.md.aec_ref_power = frame_data->max_ref_energy;
agc_stage_state.md.aec_corr_factor = frame_data->aec_corr_factor;
agc_stage_state.md.ref_active_flag = frame_data->ref_active_flag;

agc_process_frame(
&agc_stage_state.state,
Expand All @@ -136,7 +136,7 @@ static void initialize_pipeline_stages(void)

ns_init(&ns_stage_state.state);

agc_init(&agc_stage_state.state, &AGC_PROFILE_ASR);
agc_init(&agc_stage_state.state, &AGC_PROFILE_XCV_COMMS);
agc_stage_state.md.aec_ref_power = AGC_META_DATA_NO_AEC;
agc_stage_state.md.aec_corr_factor = AGC_META_DATA_NO_AEC;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/audio_pipelines/reference/adec/audio_pipeline_t1.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static void *audio_pipeline_input_i(void *input_app_data)
4,
appconfAUDIO_PIPELINE_FRAME_ADVANCE);

frame_data->vnr_pred_flag = 0;
frame_data->vnr_pred_flag = AGC_META_DATA_NO_VNR;

memcpy(frame_data->samples, frame_data->mic_samples_passthrough, sizeof(frame_data->samples));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ typedef struct {
int32_t mic_samples_passthrough[appconfAUDIO_PIPELINE_CHANNELS][appconfAUDIO_PIPELINE_FRAME_ADVANCE];

/* Below is additional context needed by other stages on a per frame basis */
int32_t vnr_pred_flag;
float_s32_t vnr_pred_flag;
float_s32_t max_ref_energy;
float_s32_t aec_corr_factor;
int32_t ref_active_flag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,9 @@ static void stage_vnr_and_ic(frame_data_t *frame_data)
vnr_pred_state_t *vnr_pred_state = &vnr_pred_stage_state.vnr_pred_state;
ic_calc_vnr_pred(&ic_stage_state.state, &vnr_pred_state->input_vnr_pred, &vnr_pred_state->output_vnr_pred);

float_s32_t agc_vnr_threshold = f32_to_float_s32(VNR_AGC_THRESHOLD);
frame_data->vnr_pred_flag = float_s32_gt(vnr_pred_stage_state.vnr_pred_state.output_vnr_pred, agc_vnr_threshold);
frame_data->vnr_pred_flag = vnr_pred_stage_state.vnr_pred_state.input_vnr_pred;

ic_adapt(&ic_stage_state.state, vnr_pred_stage_state.vnr_pred_state.input_vnr_pred);
ic_adapt(&ic_stage_state.state, ic_stage_state.state.vnr_pred_state.input_vnr_pred);

/* Intentionally ignoring comms ch from here on out */
memcpy(frame_data->samples, ic_output, appconfAUDIO_PIPELINE_FRAME_ADVANCE * sizeof(int32_t));
Expand Down Expand Up @@ -127,6 +126,7 @@ static void stage_agc(frame_data_t *frame_data)
agc_stage_state.md.vnr_flag = frame_data->vnr_pred_flag;
agc_stage_state.md.aec_ref_power = frame_data->max_ref_energy;
agc_stage_state.md.aec_corr_factor = frame_data->aec_corr_factor;
agc_stage_state.md.ref_active_flag = frame_data->ref_active_flag;

agc_process_frame(
&agc_stage_state.state,
Expand All @@ -143,10 +143,12 @@ static void initialize_pipeline_stages(void)

ns_init(&ns_stage_state.state);

agc_init(&agc_stage_state.state, &AGC_PROFILE_ASR);
agc_init(&agc_stage_state.state, &AGC_PROFILE_XCV_COMMS);

agc_stage_state.md.aec_ref_power = AGC_META_DATA_NO_AEC;
agc_stage_state.md.aec_corr_factor = AGC_META_DATA_NO_AEC;
agc_stage_state.md.vnr_flag = AGC_META_DATA_NO_VNR;
agc_stage_state.md.ref_active_flag = AGC_META_DATA_NO_REF;
}

void audio_pipeline_init(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void *audio_pipeline_input_i(void *input_app_data)
4,
appconfAUDIO_PIPELINE_FRAME_ADVANCE);

frame_data->vnr_pred_flag = 0;
frame_data->vnr_pred_flag = AGC_META_DATA_NO_VNR;

memcpy(frame_data->samples, frame_data->mic_samples_passthrough, sizeof(frame_data->samples));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ typedef struct {
int32_t mic_samples_passthrough[appconfAUDIO_PIPELINE_CHANNELS][appconfAUDIO_PIPELINE_FRAME_ADVANCE];

/* Below is additional context needed by other stages on a per frame basis */
int32_t vnr_pred_flag;
float_s32_t vnr_pred_flag;
float_s32_t max_ref_energy;
float_s32_t aec_corr_factor;
int32_t ref_active_flag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ static void stage_vnr_and_ic(frame_data_t *frame_data)
vnr_pred_state_t *vnr_pred_state = &vnr_pred_stage_state.vnr_pred_state;
ic_calc_vnr_pred(&ic_stage_state.state, &vnr_pred_state->input_vnr_pred, &vnr_pred_state->output_vnr_pred);

float_s32_t agc_vnr_threshold = f32_to_float_s32(VNR_AGC_THRESHOLD);
frame_data->vnr_pred_flag = float_s32_gt(vnr_pred_stage_state.vnr_pred_state.output_vnr_pred, agc_vnr_threshold);
frame_data->vnr_pred_flag = vnr_pred_stage_state.vnr_pred_state.input_vnr_pred;

ic_adapt(&ic_stage_state.state, vnr_pred_stage_state.vnr_pred_state.input_vnr_pred);
ic_adapt(&ic_stage_state.state, ic_stage_state.state.vnr_pred_state.input_vnr_pred);

/* Intentionally ignoring comms ch from here on out */
memcpy(frame_data->samples, ic_output, appconfAUDIO_PIPELINE_FRAME_ADVANCE * sizeof(int32_t));
Expand Down Expand Up @@ -119,6 +118,7 @@ static void stage_agc(frame_data_t *frame_data)
agc_stage_state.md.vnr_flag = frame_data->vnr_pred_flag;
agc_stage_state.md.aec_ref_power = frame_data->max_ref_energy;
agc_stage_state.md.aec_corr_factor = frame_data->aec_corr_factor;
agc_stage_state.md.ref_active_flag = frame_data->ref_active_flag;

agc_process_frame(
&agc_stage_state.state,
Expand All @@ -135,7 +135,7 @@ static void initialize_pipeline_stages(void)

ns_init(&ns_stage_state.state);

agc_init(&agc_stage_state.state, &AGC_PROFILE_ASR);
agc_init(&agc_stage_state.state, &AGC_PROFILE_XCV_COMMS);
agc_stage_state.md.aec_ref_power = AGC_META_DATA_NO_AEC;
agc_stage_state.md.aec_corr_factor = AGC_META_DATA_NO_AEC;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void *audio_pipeline_input_i(void *input_app_data)
4,
appconfAUDIO_PIPELINE_FRAME_ADVANCE);

frame_data->vnr_pred_flag = 0;
frame_data->vnr_pred_flag = AGC_META_DATA_NO_VNR;

memcpy(frame_data->samples, frame_data->mic_samples_passthrough, sizeof(frame_data->samples));

Expand Down
4 changes: 2 additions & 2 deletions modules/audio_pipelines/referenceless/audio_pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void stage_vnr_and_ic(frame_data_t *frame_data)
vnr_pred_state_t *vnr_pred_state = &vnr_pred_stage_state.vnr_pred_state;
ic_calc_vnr_pred(&ic_stage_state.state, &vnr_pred_state->input_vnr_pred, &vnr_pred_state->output_vnr_pred);

ic_adapt(&ic_stage_state.state, vnr_pred_stage_state.vnr_pred_state.input_vnr_pred);
ic_adapt(&ic_stage_state.state, ic_stage_state.state.vnr_pred_state.input_vnr_pred);

frame_data->input_vnr_pred = vnr_pred_stage_state.vnr_pred_state.input_vnr_pred;
frame_data->output_vnr_pred = vnr_pred_stage_state.vnr_pred_state.output_vnr_pred;
Expand Down Expand Up @@ -156,7 +156,7 @@ static void stage_agc(frame_data_t *frame_data)
int32_t DWORD_ALIGNED agc_output[appconfAUDIO_PIPELINE_FRAME_ADVANCE];
configASSERT(AGC_FRAME_ADVANCE == appconfAUDIO_PIPELINE_FRAME_ADVANCE);

agc_stage_state.md.vnr_flag = float_s32_gt(frame_data->output_vnr_pred, f32_to_float_s32(VNR_AGC_THRESHOLD));
agc_stage_state.md.vnr_flag = frame_data->input_vnr_pred;

agc_process_frame(
&agc_stage_state.state,
Expand Down
2 changes: 1 addition & 1 deletion modules/voice
Submodule voice updated 28 files
+241 −241 Jenkinsfile
+5 −3 examples/bare-metal/pipeline_multi_threaded/src/pipeline.c
+1 −1 examples/bare-metal/pipeline_multi_threaded/src/pipeline_state.h
+5 −3 examples/bare-metal/pipeline_single_threaded/src/pipeline.c
+1 −1 examples/bare-metal/pipeline_single_threaded/src/pipeline_state.h
+1 −1 examples/bare-metal/shared_src/external_deps/fetch_deps.cmake
+16 −2 modules/lib_agc/api/agc_api.h
+41 −0 modules/lib_agc/api/agc_profiles.h
+5 −3 modules/lib_agc/src/agc_defines.h
+59 −54 modules/lib_agc/src/agc_impl.c
+1 −0 modules/lib_ic/api/ic_api.h
+1 −1 modules/lib_ic/src/ic.c
+1 −1 requirements.txt
+2 −2 requirements_test.txt
+4 −4 test/lib_agc/test_process_frame/conftest.py
+2 −1 test/lib_agc/test_process_frame/src/test_input_output.c
+41 −8 test/lib_agc/test_process_frame/src/test_lc_transitions.c
+18 −7 test/lib_agc/test_process_frame/src/test_loss_control.c
+1 −0 test/lib_agc/test_process_frame/src/test_lower_threshold.c
+1 −0 test/lib_agc/test_process_frame/src/test_max_gain.c
+1 −0 test/lib_agc/test_process_frame/src/test_min_gain.c
+1 −0 test/lib_agc/test_process_frame/src/test_no_gain.c
+33 −2 test/lib_agc/test_process_frame/src/test_process_frame.h
+1 −0 test/lib_agc/test_process_frame/src/test_reset.c
+1 −0 test/lib_agc/test_process_frame/src/test_simple_gain.c
+1 −0 test/lib_agc/test_process_frame/src/test_soft_clipping.c
+1 −0 test/lib_agc/test_process_frame/src/test_upper_threshold.c
+4 −2 test/lib_agc/test_process_frame/src/test_vnr_flag.c