XCORE SDK
XCORE Software Development Kit
ic_defines.h
1 // Copyright 2022 XMOS LIMITED.
2 // This Software is subject to the terms of the XMOS Public Licence: Version 1.
3 #ifndef IC_DEFINES_H
4 #define IC_DEFINES_H
5 
6 #include <stdio.h>
7 #include <limits.h>
8 #include <string.h>
9 #include "bfp_math.h"
10 #include "xs3_math.h"
11 
12 
29 #define IC_INIT_MU 0.369566 //From Python test_wav_ic
32 #define IC_INIT_EMA_ALPHA 0.9995117188 //from two_mic_stereo.json
36 #define IC_INIT_LEAKAGE_ALPHA 0.995 //from two_mic_stereo.json
37 
45 #define IC_FILTER_PHASES 10 //two_mic_stereo.json
51 #define IC_Y_CHANNEL_DELAY_SAMPS 180 //From Python model
52 
55 #define IC_INIT_SIGMA_XX_SHIFT 11 //From XC IC and Python AEC
58 #define IC_INIT_GAMMA_LOG2 1 //from two_mic_stereo.json(2^1 = 2.0)
61 #define IC_INIT_DELTA 7.450580593454381e-09 //from two_mic_stereo.json
62 
63 
67 #define IC_INIT_ENABLE_FILTER_INSTABILITY_RECOVERY 1//from ap_stage_b.py
71 #define IC_INIT_INSTABILITY_RATIO_LIMIT 2.0//from ap_stage_b.py
74 #define IC_INIT_SMOOTHED_VOICE_CHANCE_ALPHA 0.99//from ap_stage_b.py
77 #define IC_INIT_ENERGY_ALPHA_SLOW 0.999//from ap_stage_b.py
80 #define IC_INIT_ENERGY_ALPHA_FAST 0.98//from ap_stage_b.py
84 #define IC_INIT_INSTABILITY_RECOVERY_LEAKAGE_ALPHA 0.995//from ap_stage_b.py
88 #define IC_INIT_SMOOTHED_VOICE_CHANCE 1.0//from ap_stage_b.py
89 
90 
94 
101 #define IC_Y_CHANNELS 1
102 
109  #define IC_X_CHANNELS 1
110 
111 
117 #define IC_FRAME_LENGTH 512
118 
126 #define IC_FRAME_ADVANCE 240
127 
128 #define IC_FRAME_OVERLAP (IC_FRAME_LENGTH - (2 * IC_FRAME_ADVANCE))
129 
135 #define IC_FD_FRAME_LENGTH ((IC_FRAME_LENGTH / 2) + 1) //Frequency domain frame length
136 
142 //
143 #define FFT_PADDING 2
144 
145 //For unit tests
146 #ifdef __XC__
147 #undef DWORD_ALIGNED
148 #define DWORD_ALIGNED
149 #endif
150 
151 //For the IC example
152 #if !PROFILE_PROCESSING
153  #define prof(n, str)
154  #define print_prof(start, end, framenum)
155 #endif
156 
157 #endif