Mic loop unrolled once

This commit is contained in:
Ross Owen
2016-04-19 14:23:38 +01:00
parent b28ca58c8d
commit 8a26f42a85

View File

@@ -51,6 +51,8 @@ void pdm_process(streaming chanend c_ds_output[2], chanend c_audio
unsigned decimationfactor = 96000/samplerate; unsigned decimationfactor = 96000/samplerate;
/* Note, loops is unrolled once - allows for while(1) select {} and thus combinable */
unsafe unsafe
{ {
const int * unsafe fir_coefs[7] = {0, g_third_stage_div_2_fir, g_third_stage_div_4_fir, g_third_stage_div_6_fir, g_third_stage_div_8_fir, 0, g_third_stage_div_12_fir}; const int * unsafe fir_coefs[7] = {0, g_third_stage_div_2_fir, g_third_stage_div_4_fir, g_third_stage_div_6_fir, g_third_stage_div_8_fir, 0, g_third_stage_div_12_fir};
@@ -61,21 +63,23 @@ void pdm_process(streaming chanend c_ds_output[2], chanend c_audio
mic_array_init_time_domain_frame(c_ds_output, 2, buffer, mic_audio, dc); mic_array_init_time_domain_frame(c_ds_output, 2, buffer, mic_audio, dc);
while(1)
{
mic_array_frame_time_domain * unsafe current = mic_array_get_next_time_domain_frame(c_ds_output, 2, buffer, mic_audio, dc); mic_array_frame_time_domain * unsafe current = mic_array_get_next_time_domain_frame(c_ds_output, 2, buffer, mic_audio, dc);
unsafe
{
int req;
#ifdef MIC_PROCESSING_USE_INTERFACE #ifdef MIC_PROCESSING_USE_INTERFACE
i_mic_process.transfer_buffers(current, output); i_mic_process.transfer_buffers(current, output);
#else #else
user_pdm_process(current, output); user_pdm_process(current, output);
#endif #endif
c_audio :> req;
while(1)
{
unsafe
{
int req;
c_audio :> req;
if(req) if(req)
{ {
for(int i = 0; i < NUM_PDM_MICS; i++) for(int i = 0; i < NUM_PDM_MICS; i++)
@@ -87,6 +91,16 @@ void pdm_process(streaming chanend c_ds_output[2], chanend c_audio
{ {
break; break;
} }
mic_array_frame_time_domain * unsafe current = mic_array_get_next_time_domain_frame(c_ds_output, 2, buffer, mic_audio, dc);
#ifdef MIC_PROCESSING_USE_INTERFACE
i_mic_process.transfer_buffers(current, output);
#else
user_pdm_process(current, output);
#endif
} }
} }
} }