├── .gitignore ├── LICENSE ├── README.md ├── arduino-build.sh ├── example-portenta-lorawan.ino ├── img ├── elephant.jpg └── not-elephant.jpg └── src ├── QCBOR ├── inc │ ├── UsefulBuf.h │ └── qcbor.h └── src │ ├── UsefulBuf.c │ ├── ieee754.c │ ├── ieee754.h │ ├── qcbor_decode.c │ └── qcbor_encode.c ├── drivers ├── Himax_HM01B0 │ ├── portenta_himax.cpp │ └── portenta_himax.h └── Portenta_Camera │ ├── portenta_camera.cpp │ └── portenta_camera.h ├── edge-impulse-sdk ├── CMSIS │ ├── Core │ │ └── Include │ │ │ ├── cachel1_armv7.h │ │ │ ├── cmsis_armcc.h │ │ │ ├── cmsis_armclang.h │ │ │ ├── cmsis_armclang_ltm.h │ │ │ ├── cmsis_compiler.h │ │ │ ├── cmsis_gcc.h │ │ │ ├── cmsis_iccarm.h │ │ │ ├── cmsis_version.h │ │ │ ├── core_armv81mml.h │ │ │ ├── core_armv8mbl.h │ │ │ ├── core_armv8mml.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm0plus.h │ │ │ ├── core_cm1.h │ │ │ ├── core_cm23.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cm33.h │ │ │ ├── core_cm35p.h │ │ │ ├── core_cm4.h │ │ │ ├── core_cm55.h │ │ │ ├── core_cm7.h │ │ │ ├── core_sc000.h │ │ │ ├── core_sc300.h │ │ │ ├── mpu_armv7.h │ │ │ ├── mpu_armv8.h │ │ │ ├── pmu_armv8.h │ │ │ └── tz_context.h │ ├── DSP │ │ ├── Include │ │ │ ├── arm_common_tables.h │ │ │ ├── arm_common_tables_f16.h │ │ │ ├── arm_const_structs.h │ │ │ ├── arm_const_structs_f16.h │ │ │ ├── arm_helium_utils.h │ │ │ ├── arm_math.h │ │ │ ├── arm_math_f16.h │ │ │ ├── arm_mve_tables.h │ │ │ ├── arm_mve_tables_f16.h │ │ │ └── arm_vec_math.h │ │ ├── PrivateInclude │ │ │ ├── arm_sorting.h │ │ │ ├── arm_vec_fft.h │ │ │ └── arm_vec_filtering.h │ │ └── Source │ │ │ ├── BasicMathFunctions │ │ │ ├── BasicMathFunctionsF16.c │ │ │ ├── BasicMathFunctionsF16.c'' │ │ │ ├── arm_abs_f16.c │ │ │ ├── arm_abs_f16.c'' │ │ │ ├── arm_abs_f32.c │ │ │ ├── arm_abs_f32.c'' │ │ │ ├── arm_abs_q15.c │ │ │ ├── arm_abs_q15.c'' │ │ │ ├── arm_abs_q31.c │ │ │ ├── arm_abs_q31.c'' │ │ │ ├── arm_abs_q7.c │ │ │ ├── arm_abs_q7.c'' │ │ │ ├── arm_add_f16.c │ │ │ ├── arm_add_f16.c'' │ │ │ ├── arm_add_f32.c │ │ │ ├── arm_add_f32.c'' │ │ │ ├── arm_add_q15.c │ │ │ ├── arm_add_q15.c'' │ │ │ ├── arm_add_q31.c │ │ │ ├── arm_add_q31.c'' │ │ │ ├── arm_add_q7.c │ │ │ ├── arm_add_q7.c'' │ │ │ ├── arm_and_u16.c │ │ │ ├── arm_and_u16.c'' │ │ │ ├── arm_and_u32.c │ │ │ ├── arm_and_u32.c'' │ │ │ ├── arm_and_u8.c │ │ │ ├── arm_and_u8.c'' │ │ │ ├── arm_dot_prod_f16.c │ │ │ ├── arm_dot_prod_f16.c'' │ │ │ ├── arm_dot_prod_f32.c │ │ │ ├── arm_dot_prod_f32.c'' │ │ │ ├── arm_dot_prod_q15.c │ │ │ ├── arm_dot_prod_q15.c'' │ │ │ ├── arm_dot_prod_q31.c │ │ │ ├── arm_dot_prod_q31.c'' │ │ │ ├── arm_dot_prod_q7.c │ │ │ ├── arm_dot_prod_q7.c'' │ │ │ ├── arm_mult_f16.c │ │ │ ├── arm_mult_f16.c'' │ │ │ ├── arm_mult_f32.c │ │ │ ├── arm_mult_f32.c'' │ │ │ ├── arm_mult_q15.c │ │ │ ├── arm_mult_q15.c'' │ │ │ ├── arm_mult_q31.c │ │ │ ├── arm_mult_q31.c'' │ │ │ ├── arm_mult_q7.c │ │ │ ├── arm_mult_q7.c'' │ │ │ ├── arm_negate_f16.c │ │ │ ├── arm_negate_f16.c'' │ │ │ ├── arm_negate_f32.c │ │ │ ├── arm_negate_f32.c'' │ │ │ ├── arm_negate_q15.c │ │ │ ├── arm_negate_q15.c'' │ │ │ ├── arm_negate_q31.c │ │ │ ├── arm_negate_q31.c'' │ │ │ ├── arm_negate_q7.c │ │ │ ├── arm_negate_q7.c'' │ │ │ ├── arm_not_u16.c │ │ │ ├── arm_not_u16.c'' │ │ │ ├── arm_not_u32.c │ │ │ ├── arm_not_u32.c'' │ │ │ ├── arm_not_u8.c │ │ │ ├── arm_not_u8.c'' │ │ │ ├── arm_offset_f16.c │ │ │ ├── arm_offset_f16.c'' │ │ │ ├── arm_offset_f32.c │ │ │ ├── arm_offset_f32.c'' │ │ │ ├── arm_offset_q15.c │ │ │ ├── arm_offset_q15.c'' │ │ │ ├── arm_offset_q31.c │ │ │ ├── arm_offset_q31.c'' │ │ │ ├── arm_offset_q7.c │ │ │ ├── arm_offset_q7.c'' │ │ │ ├── arm_or_u16.c │ │ │ ├── arm_or_u16.c'' │ │ │ ├── arm_or_u32.c │ │ │ ├── arm_or_u32.c'' │ │ │ ├── arm_or_u8.c │ │ │ ├── arm_or_u8.c'' │ │ │ ├── arm_scale_f16.c │ │ │ ├── arm_scale_f16.c'' │ │ │ ├── arm_scale_f32.c │ │ │ ├── arm_scale_f32.c'' │ │ │ ├── arm_scale_q15.c │ │ │ ├── arm_scale_q15.c'' │ │ │ ├── arm_scale_q31.c │ │ │ ├── arm_scale_q31.c'' │ │ │ ├── arm_scale_q7.c │ │ │ ├── arm_scale_q7.c'' │ │ │ ├── arm_shift_q15.c │ │ │ ├── arm_shift_q15.c'' │ │ │ ├── arm_shift_q31.c │ │ │ ├── arm_shift_q31.c'' │ │ │ ├── arm_shift_q7.c │ │ │ ├── arm_shift_q7.c'' │ │ │ ├── arm_sub_f16.c │ │ │ ├── arm_sub_f16.c'' │ │ │ ├── arm_sub_f32.c │ │ │ ├── arm_sub_f32.c'' │ │ │ ├── arm_sub_q15.c │ │ │ ├── arm_sub_q15.c'' │ │ │ ├── arm_sub_q31.c │ │ │ ├── arm_sub_q31.c'' │ │ │ ├── arm_sub_q7.c │ │ │ ├── arm_sub_q7.c'' │ │ │ ├── arm_xor_u16.c │ │ │ ├── arm_xor_u16.c'' │ │ │ ├── arm_xor_u32.c │ │ │ ├── arm_xor_u32.c'' │ │ │ ├── arm_xor_u8.c │ │ │ └── arm_xor_u8.c'' │ │ │ ├── BayesFunctions │ │ │ ├── arm_gaussian_naive_bayes_predict_f32.c │ │ │ └── arm_gaussian_naive_bayes_predict_f32.c'' │ │ │ ├── CommonTables │ │ │ ├── CommonTablesF16.c │ │ │ ├── CommonTablesF16.c'' │ │ │ ├── arm_common_tables.c │ │ │ ├── arm_common_tables.c'' │ │ │ ├── arm_common_tables_f16.c │ │ │ ├── arm_common_tables_f16.c'' │ │ │ ├── arm_const_structs.c │ │ │ ├── arm_const_structs.c'' │ │ │ ├── arm_const_structs_f16.c │ │ │ ├── arm_const_structs_f16.c'' │ │ │ ├── arm_mve_tables.c │ │ │ ├── arm_mve_tables.c'' │ │ │ ├── arm_mve_tables_f16.c │ │ │ └── arm_mve_tables_f16.c'' │ │ │ ├── ComplexMathFunctions │ │ │ ├── arm_cmplx_conj_f32.c │ │ │ ├── arm_cmplx_conj_f32.c'' │ │ │ ├── arm_cmplx_conj_q15.c │ │ │ ├── arm_cmplx_conj_q15.c'' │ │ │ ├── arm_cmplx_conj_q31.c │ │ │ ├── arm_cmplx_conj_q31.c'' │ │ │ ├── arm_cmplx_dot_prod_f32.c │ │ │ ├── arm_cmplx_dot_prod_f32.c'' │ │ │ ├── arm_cmplx_dot_prod_q15.c │ │ │ ├── arm_cmplx_dot_prod_q15.c'' │ │ │ ├── arm_cmplx_dot_prod_q31.c │ │ │ ├── arm_cmplx_dot_prod_q31.c'' │ │ │ ├── arm_cmplx_mag_f32.c │ │ │ ├── arm_cmplx_mag_f32.c'' │ │ │ ├── arm_cmplx_mag_q15.c │ │ │ ├── arm_cmplx_mag_q15.c'' │ │ │ ├── arm_cmplx_mag_q31.c │ │ │ ├── arm_cmplx_mag_q31.c'' │ │ │ ├── arm_cmplx_mag_squared_f32.c │ │ │ ├── arm_cmplx_mag_squared_f32.c'' │ │ │ ├── arm_cmplx_mag_squared_q15.c │ │ │ ├── arm_cmplx_mag_squared_q15.c'' │ │ │ ├── arm_cmplx_mag_squared_q31.c │ │ │ ├── arm_cmplx_mag_squared_q31.c'' │ │ │ ├── arm_cmplx_mult_cmplx_f32.c │ │ │ ├── arm_cmplx_mult_cmplx_f32.c'' │ │ │ ├── arm_cmplx_mult_cmplx_q15.c │ │ │ ├── arm_cmplx_mult_cmplx_q15.c'' │ │ │ ├── arm_cmplx_mult_cmplx_q31.c │ │ │ ├── arm_cmplx_mult_cmplx_q31.c'' │ │ │ ├── arm_cmplx_mult_real_f32.c │ │ │ ├── arm_cmplx_mult_real_f32.c'' │ │ │ ├── arm_cmplx_mult_real_q15.c │ │ │ ├── arm_cmplx_mult_real_q15.c'' │ │ │ ├── arm_cmplx_mult_real_q31.c │ │ │ └── arm_cmplx_mult_real_q31.c'' │ │ │ ├── ControllerFunctions │ │ │ ├── arm_pid_init_f32.c │ │ │ ├── arm_pid_init_f32.c'' │ │ │ ├── arm_pid_init_q15.c │ │ │ ├── arm_pid_init_q15.c'' │ │ │ ├── arm_pid_init_q31.c │ │ │ ├── arm_pid_init_q31.c'' │ │ │ ├── arm_pid_reset_f32.c │ │ │ ├── arm_pid_reset_f32.c'' │ │ │ ├── arm_pid_reset_q15.c │ │ │ ├── arm_pid_reset_q15.c'' │ │ │ ├── arm_pid_reset_q31.c │ │ │ ├── arm_pid_reset_q31.c'' │ │ │ ├── arm_sin_cos_f32.c │ │ │ ├── arm_sin_cos_f32.c'' │ │ │ ├── arm_sin_cos_q31.c │ │ │ └── arm_sin_cos_q31.c'' │ │ │ ├── DistanceFunctions │ │ │ ├── arm_boolean_distance.c │ │ │ ├── arm_boolean_distance.c'' │ │ │ ├── arm_boolean_distance_template.h │ │ │ ├── arm_braycurtis_distance_f32.c │ │ │ ├── arm_braycurtis_distance_f32.c'' │ │ │ ├── arm_canberra_distance_f32.c │ │ │ ├── arm_canberra_distance_f32.c'' │ │ │ ├── arm_chebyshev_distance_f32.c │ │ │ ├── arm_chebyshev_distance_f32.c'' │ │ │ ├── arm_cityblock_distance_f32.c │ │ │ ├── arm_cityblock_distance_f32.c'' │ │ │ ├── arm_correlation_distance_f32.c │ │ │ ├── arm_correlation_distance_f32.c'' │ │ │ ├── arm_cosine_distance_f32.c │ │ │ ├── arm_cosine_distance_f32.c'' │ │ │ ├── arm_dice_distance.c │ │ │ ├── arm_dice_distance.c'' │ │ │ ├── arm_euclidean_distance_f32.c │ │ │ ├── arm_euclidean_distance_f32.c'' │ │ │ ├── arm_hamming_distance.c │ │ │ ├── arm_hamming_distance.c'' │ │ │ ├── arm_jaccard_distance.c │ │ │ ├── arm_jaccard_distance.c'' │ │ │ ├── arm_jensenshannon_distance_f32.c │ │ │ ├── arm_jensenshannon_distance_f32.c'' │ │ │ ├── arm_kulsinski_distance.c │ │ │ ├── arm_kulsinski_distance.c'' │ │ │ ├── arm_minkowski_distance_f32.c │ │ │ ├── arm_minkowski_distance_f32.c'' │ │ │ ├── arm_rogerstanimoto_distance.c │ │ │ ├── arm_rogerstanimoto_distance.c'' │ │ │ ├── arm_russellrao_distance.c │ │ │ ├── arm_russellrao_distance.c'' │ │ │ ├── arm_sokalmichener_distance.c │ │ │ ├── arm_sokalmichener_distance.c'' │ │ │ ├── arm_sokalsneath_distance.c │ │ │ ├── arm_sokalsneath_distance.c'' │ │ │ ├── arm_yule_distance.c │ │ │ └── arm_yule_distance.c'' │ │ │ ├── FastMathFunctions │ │ │ ├── arm_cos_f32.c │ │ │ ├── arm_cos_f32.c'' │ │ │ ├── arm_cos_q15.c │ │ │ ├── arm_cos_q15.c'' │ │ │ ├── arm_cos_q31.c │ │ │ ├── arm_cos_q31.c'' │ │ │ ├── arm_sin_f32.c │ │ │ ├── arm_sin_f32.c'' │ │ │ ├── arm_sin_q15.c │ │ │ ├── arm_sin_q15.c'' │ │ │ ├── arm_sin_q31.c │ │ │ ├── arm_sin_q31.c'' │ │ │ ├── arm_sqrt_q15.c │ │ │ ├── arm_sqrt_q15.c'' │ │ │ ├── arm_sqrt_q31.c │ │ │ ├── arm_sqrt_q31.c'' │ │ │ ├── arm_vexp_f32.c │ │ │ ├── arm_vexp_f32.c'' │ │ │ ├── arm_vlog_f32.c │ │ │ └── arm_vlog_f32.c'' │ │ │ ├── FilteringFunctions │ │ │ ├── arm_biquad_cascade_df1_32x64_init_q31.c │ │ │ ├── arm_biquad_cascade_df1_32x64_init_q31.c'' │ │ │ ├── arm_biquad_cascade_df1_32x64_q31.c │ │ │ ├── arm_biquad_cascade_df1_32x64_q31.c'' │ │ │ ├── arm_biquad_cascade_df1_f32.c │ │ │ ├── arm_biquad_cascade_df1_f32.c'' │ │ │ ├── arm_biquad_cascade_df1_fast_q15.c │ │ │ ├── arm_biquad_cascade_df1_fast_q15.c'' │ │ │ ├── arm_biquad_cascade_df1_fast_q31.c │ │ │ ├── arm_biquad_cascade_df1_fast_q31.c'' │ │ │ ├── arm_biquad_cascade_df1_init_f32.c │ │ │ ├── arm_biquad_cascade_df1_init_f32.c'' │ │ │ ├── arm_biquad_cascade_df1_init_q15.c │ │ │ ├── arm_biquad_cascade_df1_init_q15.c'' │ │ │ ├── arm_biquad_cascade_df1_init_q31.c │ │ │ ├── arm_biquad_cascade_df1_init_q31.c'' │ │ │ ├── arm_biquad_cascade_df1_q15.c │ │ │ ├── arm_biquad_cascade_df1_q15.c'' │ │ │ ├── arm_biquad_cascade_df1_q31.c │ │ │ ├── arm_biquad_cascade_df1_q31.c'' │ │ │ ├── arm_biquad_cascade_df2T_f32.c │ │ │ ├── arm_biquad_cascade_df2T_f32.c'' │ │ │ ├── arm_biquad_cascade_df2T_f64.c │ │ │ ├── arm_biquad_cascade_df2T_f64.c'' │ │ │ ├── arm_biquad_cascade_df2T_init_f32.c │ │ │ ├── arm_biquad_cascade_df2T_init_f32.c'' │ │ │ ├── arm_biquad_cascade_df2T_init_f64.c │ │ │ ├── arm_biquad_cascade_df2T_init_f64.c'' │ │ │ ├── arm_biquad_cascade_stereo_df2T_f32.c │ │ │ ├── arm_biquad_cascade_stereo_df2T_f32.c'' │ │ │ ├── arm_biquad_cascade_stereo_df2T_init_f32.c │ │ │ ├── arm_biquad_cascade_stereo_df2T_init_f32.c'' │ │ │ ├── arm_conv_f32.c │ │ │ ├── arm_conv_f32.c'' │ │ │ ├── arm_conv_fast_opt_q15.c │ │ │ ├── arm_conv_fast_opt_q15.c'' │ │ │ ├── arm_conv_fast_q15.c │ │ │ ├── arm_conv_fast_q15.c'' │ │ │ ├── arm_conv_fast_q31.c │ │ │ ├── arm_conv_fast_q31.c'' │ │ │ ├── arm_conv_opt_q15.c │ │ │ ├── arm_conv_opt_q15.c'' │ │ │ ├── arm_conv_opt_q7.c │ │ │ ├── arm_conv_opt_q7.c'' │ │ │ ├── arm_conv_partial_f32.c │ │ │ ├── arm_conv_partial_f32.c'' │ │ │ ├── arm_conv_partial_fast_opt_q15.c │ │ │ ├── arm_conv_partial_fast_opt_q15.c'' │ │ │ ├── arm_conv_partial_fast_q15.c │ │ │ ├── arm_conv_partial_fast_q15.c'' │ │ │ ├── arm_conv_partial_fast_q31.c │ │ │ ├── arm_conv_partial_fast_q31.c'' │ │ │ ├── arm_conv_partial_opt_q15.c │ │ │ ├── arm_conv_partial_opt_q15.c'' │ │ │ ├── arm_conv_partial_opt_q7.c │ │ │ ├── arm_conv_partial_opt_q7.c'' │ │ │ ├── arm_conv_partial_q15.c │ │ │ ├── arm_conv_partial_q15.c'' │ │ │ ├── arm_conv_partial_q31.c │ │ │ ├── arm_conv_partial_q31.c'' │ │ │ ├── arm_conv_partial_q7.c │ │ │ ├── arm_conv_partial_q7.c'' │ │ │ ├── arm_conv_q15.c │ │ │ ├── arm_conv_q15.c'' │ │ │ ├── arm_conv_q31.c │ │ │ ├── arm_conv_q31.c'' │ │ │ ├── arm_conv_q7.c │ │ │ ├── arm_conv_q7.c'' │ │ │ ├── arm_correlate_f32.c │ │ │ ├── arm_correlate_f32.c'' │ │ │ ├── arm_correlate_fast_opt_q15.c │ │ │ ├── arm_correlate_fast_opt_q15.c'' │ │ │ ├── arm_correlate_fast_q15.c │ │ │ ├── arm_correlate_fast_q15.c'' │ │ │ ├── arm_correlate_fast_q31.c │ │ │ ├── arm_correlate_fast_q31.c'' │ │ │ ├── arm_correlate_opt_q15.c │ │ │ ├── arm_correlate_opt_q15.c'' │ │ │ ├── arm_correlate_opt_q7.c │ │ │ ├── arm_correlate_opt_q7.c'' │ │ │ ├── arm_correlate_q15.c │ │ │ ├── arm_correlate_q15.c'' │ │ │ ├── arm_correlate_q31.c │ │ │ ├── arm_correlate_q31.c'' │ │ │ ├── arm_correlate_q7.c │ │ │ ├── arm_correlate_q7.c'' │ │ │ ├── arm_fir_decimate_f32.c │ │ │ ├── arm_fir_decimate_f32.c'' │ │ │ ├── arm_fir_decimate_fast_q15.c │ │ │ ├── arm_fir_decimate_fast_q15.c'' │ │ │ ├── arm_fir_decimate_fast_q31.c │ │ │ ├── arm_fir_decimate_fast_q31.c'' │ │ │ ├── arm_fir_decimate_init_f32.c │ │ │ ├── arm_fir_decimate_init_f32.c'' │ │ │ ├── arm_fir_decimate_init_q15.c │ │ │ ├── arm_fir_decimate_init_q15.c'' │ │ │ ├── arm_fir_decimate_init_q31.c │ │ │ ├── arm_fir_decimate_init_q31.c'' │ │ │ ├── arm_fir_decimate_q15.c │ │ │ ├── arm_fir_decimate_q15.c'' │ │ │ ├── arm_fir_decimate_q31.c │ │ │ ├── arm_fir_decimate_q31.c'' │ │ │ ├── arm_fir_f32.c │ │ │ ├── arm_fir_f32.c'' │ │ │ ├── arm_fir_fast_q15.c │ │ │ ├── arm_fir_fast_q15.c'' │ │ │ ├── arm_fir_fast_q31.c │ │ │ ├── arm_fir_fast_q31.c'' │ │ │ ├── arm_fir_init_f32.c │ │ │ ├── arm_fir_init_f32.c'' │ │ │ ├── arm_fir_init_q15.c │ │ │ ├── arm_fir_init_q15.c'' │ │ │ ├── arm_fir_init_q31.c │ │ │ ├── arm_fir_init_q31.c'' │ │ │ ├── arm_fir_init_q7.c │ │ │ ├── arm_fir_init_q7.c'' │ │ │ ├── arm_fir_interpolate_f32.c │ │ │ ├── arm_fir_interpolate_f32.c'' │ │ │ ├── arm_fir_interpolate_init_f32.c │ │ │ ├── arm_fir_interpolate_init_f32.c'' │ │ │ ├── arm_fir_interpolate_init_q15.c │ │ │ ├── arm_fir_interpolate_init_q15.c'' │ │ │ ├── arm_fir_interpolate_init_q31.c │ │ │ ├── arm_fir_interpolate_init_q31.c'' │ │ │ ├── arm_fir_interpolate_q15.c │ │ │ ├── arm_fir_interpolate_q15.c'' │ │ │ ├── arm_fir_interpolate_q31.c │ │ │ ├── arm_fir_interpolate_q31.c'' │ │ │ ├── arm_fir_lattice_f32.c │ │ │ ├── arm_fir_lattice_f32.c'' │ │ │ ├── arm_fir_lattice_init_f32.c │ │ │ ├── arm_fir_lattice_init_f32.c'' │ │ │ ├── arm_fir_lattice_init_q15.c │ │ │ ├── arm_fir_lattice_init_q15.c'' │ │ │ ├── arm_fir_lattice_init_q31.c │ │ │ ├── arm_fir_lattice_init_q31.c'' │ │ │ ├── arm_fir_lattice_q15.c │ │ │ ├── arm_fir_lattice_q15.c'' │ │ │ ├── arm_fir_lattice_q31.c │ │ │ ├── arm_fir_lattice_q31.c'' │ │ │ ├── arm_fir_q15.c │ │ │ ├── arm_fir_q15.c'' │ │ │ ├── arm_fir_q31.c │ │ │ ├── arm_fir_q31.c'' │ │ │ ├── arm_fir_q7.c │ │ │ ├── arm_fir_q7.c'' │ │ │ ├── arm_fir_sparse_f32.c │ │ │ ├── arm_fir_sparse_f32.c'' │ │ │ ├── arm_fir_sparse_init_f32.c │ │ │ ├── arm_fir_sparse_init_f32.c'' │ │ │ ├── arm_fir_sparse_init_q15.c │ │ │ ├── arm_fir_sparse_init_q15.c'' │ │ │ ├── arm_fir_sparse_init_q31.c │ │ │ ├── arm_fir_sparse_init_q31.c'' │ │ │ ├── arm_fir_sparse_init_q7.c │ │ │ ├── arm_fir_sparse_init_q7.c'' │ │ │ ├── arm_fir_sparse_q15.c │ │ │ ├── arm_fir_sparse_q15.c'' │ │ │ ├── arm_fir_sparse_q31.c │ │ │ ├── arm_fir_sparse_q31.c'' │ │ │ ├── arm_fir_sparse_q7.c │ │ │ ├── arm_fir_sparse_q7.c'' │ │ │ ├── arm_iir_lattice_f32.c │ │ │ ├── arm_iir_lattice_f32.c'' │ │ │ ├── arm_iir_lattice_init_f32.c │ │ │ ├── arm_iir_lattice_init_f32.c'' │ │ │ ├── arm_iir_lattice_init_q15.c │ │ │ ├── arm_iir_lattice_init_q15.c'' │ │ │ ├── arm_iir_lattice_init_q31.c │ │ │ ├── arm_iir_lattice_init_q31.c'' │ │ │ ├── arm_iir_lattice_q15.c │ │ │ ├── arm_iir_lattice_q15.c'' │ │ │ ├── arm_iir_lattice_q31.c │ │ │ ├── arm_iir_lattice_q31.c'' │ │ │ ├── arm_lms_f32.c │ │ │ ├── arm_lms_f32.c'' │ │ │ ├── arm_lms_init_f32.c │ │ │ ├── arm_lms_init_f32.c'' │ │ │ ├── arm_lms_init_q15.c │ │ │ ├── arm_lms_init_q15.c'' │ │ │ ├── arm_lms_init_q31.c │ │ │ ├── arm_lms_init_q31.c'' │ │ │ ├── arm_lms_norm_f32.c │ │ │ ├── arm_lms_norm_f32.c'' │ │ │ ├── arm_lms_norm_init_f32.c │ │ │ ├── arm_lms_norm_init_f32.c'' │ │ │ ├── arm_lms_norm_init_q15.c │ │ │ ├── arm_lms_norm_init_q15.c'' │ │ │ ├── arm_lms_norm_init_q31.c │ │ │ ├── arm_lms_norm_init_q31.c'' │ │ │ ├── arm_lms_norm_q15.c │ │ │ ├── arm_lms_norm_q15.c'' │ │ │ ├── arm_lms_norm_q31.c │ │ │ ├── arm_lms_norm_q31.c'' │ │ │ ├── arm_lms_q15.c │ │ │ ├── arm_lms_q15.c'' │ │ │ ├── arm_lms_q31.c │ │ │ └── arm_lms_q31.c'' │ │ │ ├── MatrixFunctions │ │ │ ├── arm_mat_add_f32.c │ │ │ ├── arm_mat_add_f32.c'' │ │ │ ├── arm_mat_add_q15.c │ │ │ ├── arm_mat_add_q15.c'' │ │ │ ├── arm_mat_add_q31.c │ │ │ ├── arm_mat_add_q31.c'' │ │ │ ├── arm_mat_cmplx_mult_f32.c │ │ │ ├── arm_mat_cmplx_mult_f32.c'' │ │ │ ├── arm_mat_cmplx_mult_q15.c │ │ │ ├── arm_mat_cmplx_mult_q15.c'' │ │ │ ├── arm_mat_cmplx_mult_q31.c │ │ │ ├── arm_mat_cmplx_mult_q31.c'' │ │ │ ├── arm_mat_init_f32.c │ │ │ ├── arm_mat_init_f32.c'' │ │ │ ├── arm_mat_init_q15.c │ │ │ ├── arm_mat_init_q15.c'' │ │ │ ├── arm_mat_init_q31.c │ │ │ ├── arm_mat_init_q31.c'' │ │ │ ├── arm_mat_inverse_f32.c │ │ │ ├── arm_mat_inverse_f32.c'' │ │ │ ├── arm_mat_inverse_f64.c │ │ │ ├── arm_mat_inverse_f64.c'' │ │ │ ├── arm_mat_mult_f32.c │ │ │ ├── arm_mat_mult_f32.c'' │ │ │ ├── arm_mat_mult_fast_q15.c │ │ │ ├── arm_mat_mult_fast_q15.c'' │ │ │ ├── arm_mat_mult_fast_q31.c │ │ │ ├── arm_mat_mult_fast_q31.c'' │ │ │ ├── arm_mat_mult_q15.c │ │ │ ├── arm_mat_mult_q15.c'' │ │ │ ├── arm_mat_mult_q31.c │ │ │ ├── arm_mat_mult_q31.c'' │ │ │ ├── arm_mat_scale_f32.c │ │ │ ├── arm_mat_scale_f32.c'' │ │ │ ├── arm_mat_scale_q15.c │ │ │ ├── arm_mat_scale_q15.c'' │ │ │ ├── arm_mat_scale_q31.c │ │ │ ├── arm_mat_scale_q31.c'' │ │ │ ├── arm_mat_sub_f32.c │ │ │ ├── arm_mat_sub_f32.c'' │ │ │ ├── arm_mat_sub_q15.c │ │ │ ├── arm_mat_sub_q15.c'' │ │ │ ├── arm_mat_sub_q31.c │ │ │ ├── arm_mat_sub_q31.c'' │ │ │ ├── arm_mat_trans_f32.c │ │ │ ├── arm_mat_trans_f32.c'' │ │ │ ├── arm_mat_trans_q15.c │ │ │ ├── arm_mat_trans_q15.c'' │ │ │ ├── arm_mat_trans_q31.c │ │ │ └── arm_mat_trans_q31.c'' │ │ │ ├── SVMFunctions │ │ │ ├── arm_svm_linear_init_f32.c │ │ │ ├── arm_svm_linear_init_f32.c'' │ │ │ ├── arm_svm_linear_predict_f32.c │ │ │ ├── arm_svm_linear_predict_f32.c'' │ │ │ ├── arm_svm_polynomial_init_f32.c │ │ │ ├── arm_svm_polynomial_init_f32.c'' │ │ │ ├── arm_svm_polynomial_predict_f32.c │ │ │ ├── arm_svm_polynomial_predict_f32.c'' │ │ │ ├── arm_svm_rbf_init_f32.c │ │ │ ├── arm_svm_rbf_init_f32.c'' │ │ │ ├── arm_svm_rbf_predict_f32.c │ │ │ ├── arm_svm_rbf_predict_f32.c'' │ │ │ ├── arm_svm_sigmoid_init_f32.c │ │ │ ├── arm_svm_sigmoid_init_f32.c'' │ │ │ ├── arm_svm_sigmoid_predict_f32.c │ │ │ └── arm_svm_sigmoid_predict_f32.c'' │ │ │ ├── StatisticsFunctions │ │ │ ├── arm_entropy_f32.c │ │ │ ├── arm_entropy_f32.c'' │ │ │ ├── arm_entropy_f64.c │ │ │ ├── arm_entropy_f64.c'' │ │ │ ├── arm_kullback_leibler_f32.c │ │ │ ├── arm_kullback_leibler_f32.c'' │ │ │ ├── arm_kullback_leibler_f64.c │ │ │ ├── arm_kullback_leibler_f64.c'' │ │ │ ├── arm_logsumexp_dot_prod_f32.c │ │ │ ├── arm_logsumexp_dot_prod_f32.c'' │ │ │ ├── arm_logsumexp_f32.c │ │ │ ├── arm_logsumexp_f32.c'' │ │ │ ├── arm_max_f32.c │ │ │ ├── arm_max_f32.c'' │ │ │ ├── arm_max_no_idx_f32.c │ │ │ ├── arm_max_no_idx_f32.c'' │ │ │ ├── arm_max_q15.c │ │ │ ├── arm_max_q15.c'' │ │ │ ├── arm_max_q31.c │ │ │ ├── arm_max_q31.c'' │ │ │ ├── arm_max_q7.c │ │ │ ├── arm_max_q7.c'' │ │ │ ├── arm_mean_f32.c │ │ │ ├── arm_mean_f32.c'' │ │ │ ├── arm_mean_q15.c │ │ │ ├── arm_mean_q15.c'' │ │ │ ├── arm_mean_q31.c │ │ │ ├── arm_mean_q31.c'' │ │ │ ├── arm_mean_q7.c │ │ │ ├── arm_mean_q7.c'' │ │ │ ├── arm_min_f32.c │ │ │ ├── arm_min_f32.c'' │ │ │ ├── arm_min_q15.c │ │ │ ├── arm_min_q15.c'' │ │ │ ├── arm_min_q31.c │ │ │ ├── arm_min_q31.c'' │ │ │ ├── arm_min_q7.c │ │ │ ├── arm_min_q7.c'' │ │ │ ├── arm_power_f32.c │ │ │ ├── arm_power_f32.c'' │ │ │ ├── arm_power_q15.c │ │ │ ├── arm_power_q15.c'' │ │ │ ├── arm_power_q31.c │ │ │ ├── arm_power_q31.c'' │ │ │ ├── arm_power_q7.c │ │ │ ├── arm_power_q7.c'' │ │ │ ├── arm_rms_f32.c │ │ │ ├── arm_rms_f32.c'' │ │ │ ├── arm_rms_q15.c │ │ │ ├── arm_rms_q15.c'' │ │ │ ├── arm_rms_q31.c │ │ │ ├── arm_rms_q31.c'' │ │ │ ├── arm_std_f32.c │ │ │ ├── arm_std_f32.c'' │ │ │ ├── arm_std_q15.c │ │ │ ├── arm_std_q15.c'' │ │ │ ├── arm_std_q31.c │ │ │ ├── arm_std_q31.c'' │ │ │ ├── arm_var_f32.c │ │ │ ├── arm_var_f32.c'' │ │ │ ├── arm_var_q15.c │ │ │ ├── arm_var_q15.c'' │ │ │ ├── arm_var_q31.c │ │ │ └── arm_var_q31.c'' │ │ │ ├── SupportFunctions │ │ │ ├── arm_barycenter_f32.c │ │ │ ├── arm_barycenter_f32.c'' │ │ │ ├── arm_bitonic_sort_f32.c │ │ │ ├── arm_bitonic_sort_f32.c'' │ │ │ ├── arm_bubble_sort_f32.c │ │ │ ├── arm_bubble_sort_f32.c'' │ │ │ ├── arm_copy_f32.c │ │ │ ├── arm_copy_f32.c'' │ │ │ ├── arm_copy_q15.c │ │ │ ├── arm_copy_q15.c'' │ │ │ ├── arm_copy_q31.c │ │ │ ├── arm_copy_q31.c'' │ │ │ ├── arm_copy_q7.c │ │ │ ├── arm_copy_q7.c'' │ │ │ ├── arm_fill_f32.c │ │ │ ├── arm_fill_f32.c'' │ │ │ ├── arm_fill_q15.c │ │ │ ├── arm_fill_q15.c'' │ │ │ ├── arm_fill_q31.c │ │ │ ├── arm_fill_q31.c'' │ │ │ ├── arm_fill_q7.c │ │ │ ├── arm_fill_q7.c'' │ │ │ ├── arm_float_to_q15.c │ │ │ ├── arm_float_to_q15.c'' │ │ │ ├── arm_float_to_q31.c │ │ │ ├── arm_float_to_q31.c'' │ │ │ ├── arm_float_to_q7.c │ │ │ ├── arm_float_to_q7.c'' │ │ │ ├── arm_heap_sort_f32.c │ │ │ ├── arm_heap_sort_f32.c'' │ │ │ ├── arm_insertion_sort_f32.c │ │ │ ├── arm_insertion_sort_f32.c'' │ │ │ ├── arm_merge_sort_f32.c │ │ │ ├── arm_merge_sort_f32.c'' │ │ │ ├── arm_merge_sort_init_f32.c │ │ │ ├── arm_merge_sort_init_f32.c'' │ │ │ ├── arm_q15_to_float.c │ │ │ ├── arm_q15_to_float.c'' │ │ │ ├── arm_q15_to_q31.c │ │ │ ├── arm_q15_to_q31.c'' │ │ │ ├── arm_q15_to_q7.c │ │ │ ├── arm_q15_to_q7.c'' │ │ │ ├── arm_q31_to_float.c │ │ │ ├── arm_q31_to_float.c'' │ │ │ ├── arm_q31_to_q15.c │ │ │ ├── arm_q31_to_q15.c'' │ │ │ ├── arm_q31_to_q7.c │ │ │ ├── arm_q31_to_q7.c'' │ │ │ ├── arm_q7_to_float.c │ │ │ ├── arm_q7_to_float.c'' │ │ │ ├── arm_q7_to_q15.c │ │ │ ├── arm_q7_to_q15.c'' │ │ │ ├── arm_q7_to_q31.c │ │ │ ├── arm_q7_to_q31.c'' │ │ │ ├── arm_quick_sort_f32.c │ │ │ ├── arm_quick_sort_f32.c'' │ │ │ ├── arm_selection_sort_f32.c │ │ │ ├── arm_selection_sort_f32.c'' │ │ │ ├── arm_sort_f32.c │ │ │ ├── arm_sort_f32.c'' │ │ │ ├── arm_sort_init_f32.c │ │ │ ├── arm_sort_init_f32.c'' │ │ │ ├── arm_spline_interp_f32.c │ │ │ ├── arm_spline_interp_f32.c'' │ │ │ ├── arm_spline_interp_init_f32.c │ │ │ ├── arm_spline_interp_init_f32.c'' │ │ │ ├── arm_weighted_sum_f32.c │ │ │ └── arm_weighted_sum_f32.c'' │ │ │ └── TransformFunctions │ │ │ ├── TransformFunctionsF16.c │ │ │ ├── TransformFunctionsF16.c'' │ │ │ ├── arm_bitreversal.c │ │ │ ├── arm_bitreversal.c'' │ │ │ ├── arm_bitreversal2.c │ │ │ ├── arm_bitreversal2.c'' │ │ │ ├── arm_cfft_f16.c │ │ │ ├── arm_cfft_f16.c'' │ │ │ ├── arm_cfft_f32.c │ │ │ ├── arm_cfft_f32.c'' │ │ │ ├── arm_cfft_f64.c │ │ │ ├── arm_cfft_f64.c'' │ │ │ ├── arm_cfft_init_f16.c │ │ │ ├── arm_cfft_init_f16.c'' │ │ │ ├── arm_cfft_init_f32.c │ │ │ ├── arm_cfft_init_f32.c'' │ │ │ ├── arm_cfft_init_f64.c │ │ │ ├── arm_cfft_init_f64.c'' │ │ │ ├── arm_cfft_init_q15.c │ │ │ ├── arm_cfft_init_q15.c'' │ │ │ ├── arm_cfft_init_q31.c │ │ │ ├── arm_cfft_init_q31.c'' │ │ │ ├── arm_cfft_q15.c │ │ │ ├── arm_cfft_q15.c'' │ │ │ ├── arm_cfft_q31.c │ │ │ ├── arm_cfft_q31.c'' │ │ │ ├── arm_cfft_radix2_f16.c │ │ │ ├── arm_cfft_radix2_f16.c'' │ │ │ ├── arm_cfft_radix2_f32.c │ │ │ ├── arm_cfft_radix2_f32.c'' │ │ │ ├── arm_cfft_radix2_init_f32.c │ │ │ ├── arm_cfft_radix2_init_f32.c'' │ │ │ ├── arm_cfft_radix2_init_q15.c │ │ │ ├── arm_cfft_radix2_init_q15.c'' │ │ │ ├── arm_cfft_radix2_init_q31.c │ │ │ ├── arm_cfft_radix2_init_q31.c'' │ │ │ ├── arm_cfft_radix2_q15.c │ │ │ ├── arm_cfft_radix2_q15.c'' │ │ │ ├── arm_cfft_radix2_q31.c │ │ │ ├── arm_cfft_radix2_q31.c'' │ │ │ ├── arm_cfft_radix4_f16.c │ │ │ ├── arm_cfft_radix4_f16.c'' │ │ │ ├── arm_cfft_radix4_f32.c │ │ │ ├── arm_cfft_radix4_f32.c'' │ │ │ ├── arm_cfft_radix4_init_f32.c │ │ │ ├── arm_cfft_radix4_init_f32.c'' │ │ │ ├── arm_cfft_radix4_init_q15.c │ │ │ ├── arm_cfft_radix4_init_q15.c'' │ │ │ ├── arm_cfft_radix4_init_q31.c │ │ │ ├── arm_cfft_radix4_init_q31.c'' │ │ │ ├── arm_cfft_radix4_q15.c │ │ │ ├── arm_cfft_radix4_q15.c'' │ │ │ ├── arm_cfft_radix4_q31.c │ │ │ ├── arm_cfft_radix4_q31.c'' │ │ │ ├── arm_cfft_radix8_f32.c │ │ │ ├── arm_cfft_radix8_f32.c'' │ │ │ ├── arm_dct4_f32.c │ │ │ ├── arm_dct4_f32.c'' │ │ │ ├── arm_dct4_init_f32.c │ │ │ ├── arm_dct4_init_f32.c'' │ │ │ ├── arm_dct4_init_q15.c │ │ │ ├── arm_dct4_init_q15.c'' │ │ │ ├── arm_dct4_init_q31.c │ │ │ ├── arm_dct4_init_q31.c'' │ │ │ ├── arm_dct4_q15.c │ │ │ ├── arm_dct4_q15.c'' │ │ │ ├── arm_dct4_q31.c │ │ │ ├── arm_dct4_q31.c'' │ │ │ ├── arm_rfft_f32.c │ │ │ ├── arm_rfft_f32.c'' │ │ │ ├── arm_rfft_fast_f32.c │ │ │ ├── arm_rfft_fast_f32.c'' │ │ │ ├── arm_rfft_fast_f64.c │ │ │ ├── arm_rfft_fast_f64.c'' │ │ │ ├── arm_rfft_fast_init_f32.c │ │ │ ├── arm_rfft_fast_init_f32.c'' │ │ │ ├── arm_rfft_fast_init_f64.c │ │ │ ├── arm_rfft_fast_init_f64.c'' │ │ │ ├── arm_rfft_init_f32.c │ │ │ ├── arm_rfft_init_f32.c'' │ │ │ ├── arm_rfft_init_q15.c │ │ │ ├── arm_rfft_init_q15.c'' │ │ │ ├── arm_rfft_init_q31.c │ │ │ ├── arm_rfft_init_q31.c'' │ │ │ ├── arm_rfft_q15.c │ │ │ ├── arm_rfft_q15.c'' │ │ │ ├── arm_rfft_q31.c │ │ │ └── arm_rfft_q31.c'' │ ├── NN │ │ ├── Include │ │ │ ├── arm_nn_tables.h │ │ │ ├── arm_nn_types.h │ │ │ ├── arm_nnfunctions.h │ │ │ └── arm_nnsupportfunctions.h │ │ └── Source │ │ │ ├── ActivationFunctions │ │ │ ├── arm_nn_activations_q15.c │ │ │ ├── arm_nn_activations_q7.c │ │ │ ├── arm_relu6_s8.c │ │ │ ├── arm_relu_q15.c │ │ │ └── arm_relu_q7.c │ │ │ ├── BasicMathFunctions │ │ │ ├── arm_elementwise_add_s8.c │ │ │ └── arm_elementwise_mul_s8.c │ │ │ ├── ConcatenationFunctions │ │ │ ├── arm_concatenation_s8_w.c │ │ │ ├── arm_concatenation_s8_x.c │ │ │ ├── arm_concatenation_s8_y.c │ │ │ └── arm_concatenation_s8_z.c │ │ │ ├── ConvolutionFunctions │ │ │ ├── arm_convolve_1_x_n_s8.c │ │ │ ├── arm_convolve_1x1_HWC_q7_fast_nonsquare.c │ │ │ ├── arm_convolve_1x1_s8_fast.c │ │ │ ├── arm_convolve_HWC_q15_basic.c │ │ │ ├── arm_convolve_HWC_q15_fast.c │ │ │ ├── arm_convolve_HWC_q15_fast_nonsquare.c │ │ │ ├── arm_convolve_HWC_q7_RGB.c │ │ │ ├── arm_convolve_HWC_q7_basic.c │ │ │ ├── arm_convolve_HWC_q7_basic_nonsquare.c │ │ │ ├── arm_convolve_HWC_q7_fast.c │ │ │ ├── arm_convolve_HWC_q7_fast_nonsquare.c │ │ │ ├── arm_convolve_s8.c │ │ │ ├── arm_convolve_wrapper_s8.c │ │ │ ├── arm_depthwise_conv_3x3_s8.c │ │ │ ├── arm_depthwise_conv_s8.c │ │ │ ├── arm_depthwise_conv_s8_opt.c │ │ │ ├── arm_depthwise_conv_u8_basic_ver1.c │ │ │ ├── arm_depthwise_separable_conv_HWC_q7.c │ │ │ ├── arm_depthwise_separable_conv_HWC_q7_nonsquare.c │ │ │ ├── arm_nn_depthwise_conv_s8_core.c │ │ │ ├── arm_nn_mat_mult_kernel_q7_q15.c │ │ │ ├── arm_nn_mat_mult_kernel_q7_q15_reordered.c │ │ │ ├── arm_nn_mat_mult_kernel_s8_s16.c │ │ │ ├── arm_nn_mat_mult_kernel_s8_s16_reordered.c │ │ │ └── arm_nn_mat_mult_s8.c │ │ │ ├── FullyConnectedFunctions │ │ │ ├── arm_fully_connected_mat_q7_vec_q15.c │ │ │ ├── arm_fully_connected_mat_q7_vec_q15_opt.c │ │ │ ├── arm_fully_connected_q15.c │ │ │ ├── arm_fully_connected_q15_opt.c │ │ │ ├── arm_fully_connected_q7.c │ │ │ ├── arm_fully_connected_q7_opt.c │ │ │ └── arm_fully_connected_s8.c │ │ │ ├── NNSupportFunctions │ │ │ ├── arm_nn_accumulate_q7_to_q15.c │ │ │ ├── arm_nn_add_q7.c │ │ │ ├── arm_nn_depthwise_conv_nt_t_padded_s8.c │ │ │ ├── arm_nn_depthwise_conv_nt_t_s8.c │ │ │ ├── arm_nn_mat_mul_core_1x_s8.c │ │ │ ├── arm_nn_mat_mul_core_4x_s8.c │ │ │ ├── arm_nn_mat_mult_nt_t_s8.c │ │ │ ├── arm_nn_mult_q15.c │ │ │ ├── arm_nn_mult_q7.c │ │ │ ├── arm_nn_vec_mat_mult_t_s8.c │ │ │ ├── arm_nntables.c │ │ │ ├── arm_q7_to_q15_no_shift.c │ │ │ ├── arm_q7_to_q15_reordered_no_shift.c │ │ │ ├── arm_q7_to_q15_reordered_with_offset.c │ │ │ └── arm_q7_to_q15_with_offset.c │ │ │ ├── PoolingFunctions │ │ │ ├── arm_avgpool_s8.c │ │ │ ├── arm_max_pool_s8.c │ │ │ ├── arm_max_pool_s8_opt.c │ │ │ └── arm_pool_q7_HWC.c │ │ │ ├── ReshapeFunctions │ │ │ └── arm_reshape_s8.c │ │ │ └── SoftmaxFunctions │ │ │ ├── arm_softmax_q15.c │ │ │ ├── arm_softmax_q7.c │ │ │ ├── arm_softmax_s8.c │ │ │ ├── arm_softmax_u8.c │ │ │ └── arm_softmax_with_batch_q7.c │ └── sources.txt ├── LICENSE ├── LICENSE-apache-2.0.txt ├── README.md ├── anomaly │ └── anomaly.h ├── classifier │ ├── ei_aligned_malloc.h │ ├── ei_classifier_config.h │ ├── ei_classifier_smooth.h │ ├── ei_classifier_types.h │ ├── ei_model_types.h │ ├── ei_run_classifier.h │ ├── ei_run_classifier_image.h │ └── ei_run_dsp.h ├── cmake │ ├── utils.cmake │ └── zephyr │ │ └── CMakeLists.txt ├── create-arduino-library.sh ├── dsp │ ├── config.hpp │ ├── dct │ │ ├── LICENSE │ │ ├── README.md │ │ ├── fast-dct-fft.cpp │ │ └── fast-dct-fft.h │ ├── kissfft │ │ ├── LICENSE │ │ ├── README.md │ │ ├── _kiss_fft_guts.h │ │ ├── kiss_fft.cpp │ │ ├── kiss_fft.h │ │ ├── kiss_fftr.cpp │ │ ├── kiss_fftr.h │ │ ├── kissfft.h │ │ ├── kissfft.hh │ │ └── kissfft_i32.hh │ ├── memory.cpp │ ├── memory.hpp │ ├── numpy.hpp │ ├── numpy_types.h │ ├── returntypes.hpp │ ├── spectral │ │ ├── feature.hpp │ │ ├── filters.hpp │ │ ├── processing.hpp │ │ └── spectral.hpp │ └── speechpy │ │ ├── feature.hpp │ │ ├── functions.hpp │ │ ├── processing.hpp │ │ └── speechpy.hpp ├── porting │ ├── arduino │ │ ├── debug_log.cpp │ │ └── ei_classifier_porting.cpp │ └── ei_classifier_porting.h ├── sources.txt ├── tensorflow │ ├── LICENSE │ ├── core │ │ └── public │ │ │ └── version.h │ └── lite │ │ ├── c │ │ ├── builtin_op_data.h │ │ ├── common.c │ │ └── common.h │ │ ├── core │ │ └── api │ │ │ ├── error_reporter.cpp │ │ │ ├── error_reporter.h │ │ │ ├── flatbuffer_conversions.cpp │ │ │ ├── flatbuffer_conversions.h │ │ │ ├── op_resolver.cpp │ │ │ ├── op_resolver.h │ │ │ ├── profiler.h │ │ │ ├── tensor_utils.cpp │ │ │ └── tensor_utils.h │ │ ├── kernels │ │ ├── internal │ │ │ ├── common.h │ │ │ ├── compatibility.h │ │ │ ├── cppmath.h │ │ │ ├── max.h │ │ │ ├── min.h │ │ │ ├── optimized │ │ │ │ └── neon_check.h │ │ │ ├── quantization_util.cpp │ │ │ ├── quantization_util.h │ │ │ ├── reference │ │ │ │ ├── add.h │ │ │ │ ├── arg_min_max.h │ │ │ │ ├── binary_function.h │ │ │ │ ├── ceil.h │ │ │ │ ├── comparisons.h │ │ │ │ ├── concatenation.h │ │ │ │ ├── conv.h │ │ │ │ ├── depthwiseconv_float.h │ │ │ │ ├── depthwiseconv_uint8.h │ │ │ │ ├── dequantize.h │ │ │ │ ├── floor.h │ │ │ │ ├── fully_connected.h │ │ │ │ ├── integer_ops │ │ │ │ │ ├── add.h │ │ │ │ │ ├── conv.h │ │ │ │ │ ├── depthwise_conv.h │ │ │ │ │ ├── fully_connected.h │ │ │ │ │ ├── l2normalization.h │ │ │ │ │ ├── logistic.h │ │ │ │ │ ├── mul.h │ │ │ │ │ ├── pooling.h │ │ │ │ │ └── tanh.h │ │ │ │ ├── l2normalization.h │ │ │ │ ├── logistic.h │ │ │ │ ├── maximum_minimum.h │ │ │ │ ├── mul.h │ │ │ │ ├── neg.h │ │ │ │ ├── pad.h │ │ │ │ ├── pooling.h │ │ │ │ ├── prelu.h │ │ │ │ ├── process_broadcast_shapes.h │ │ │ │ ├── quantize.h │ │ │ │ ├── reduce.h │ │ │ │ ├── requantize.h │ │ │ │ ├── resize_nearest_neighbor.h │ │ │ │ ├── round.h │ │ │ │ ├── softmax.h │ │ │ │ ├── strided_slice.h │ │ │ │ ├── sub.h │ │ │ │ └── tanh.h │ │ │ ├── strided_slice_logic.h │ │ │ ├── tensor.h │ │ │ ├── tensor_ctypes.h │ │ │ └── types.h │ │ ├── kernel_util.h │ │ ├── kernel_util_lite.cpp │ │ ├── op_macros.h │ │ └── padding.h │ │ ├── micro │ │ ├── all_ops_resolver.cpp │ │ ├── all_ops_resolver.h │ │ ├── compatibility.h │ │ ├── debug_log.h │ │ ├── kernels │ │ │ ├── activation_utils.h │ │ │ ├── activations.cpp │ │ │ ├── add.cpp │ │ │ ├── arg_min_max.cpp │ │ │ ├── ceil.cpp │ │ │ ├── circular_buffer.cpp │ │ │ ├── comparisons.cpp │ │ │ ├── concatenation.cpp │ │ │ ├── conv.cpp │ │ │ ├── depthwise_conv.cpp │ │ │ ├── dequantize.cpp │ │ │ ├── elementwise.cpp │ │ │ ├── ethosu.cpp │ │ │ ├── floor.cpp │ │ │ ├── fully_connected.cpp │ │ │ ├── l2norm.cpp │ │ │ ├── logical.cpp │ │ │ ├── logistic.cpp │ │ │ ├── maximum_minimum.cpp │ │ │ ├── micro_ops.h │ │ │ ├── micro_utils.h │ │ │ ├── mli_slicers.cpp │ │ │ ├── mli_slicers.h │ │ │ ├── mli_tf_utils.h │ │ │ ├── mul.cpp │ │ │ ├── neg.cpp │ │ │ ├── pack.cpp │ │ │ ├── pad.cpp │ │ │ ├── pooling.cpp │ │ │ ├── prelu.cpp │ │ │ ├── quantize.cpp │ │ │ ├── reduce.cpp │ │ │ ├── reshape.cpp │ │ │ ├── resize_nearest_neighbor.cpp │ │ │ ├── round.cpp │ │ │ ├── scratch_buf_mgr.cpp │ │ │ ├── scratch_buf_mgr.h │ │ │ ├── scratch_buffers.cpp │ │ │ ├── scratch_buffers.h │ │ │ ├── softmax.cpp │ │ │ ├── split.cpp │ │ │ ├── strided_slice.cpp │ │ │ ├── sub.cpp │ │ │ ├── svdf.cpp │ │ │ ├── tanh.cpp │ │ │ └── unpack.cpp │ │ ├── memory_helpers.cpp │ │ ├── memory_helpers.h │ │ ├── memory_planner │ │ │ ├── greedy_memory_planner.cpp │ │ │ ├── greedy_memory_planner.h │ │ │ ├── linear_memory_planner.cpp │ │ │ ├── linear_memory_planner.h │ │ │ └── memory_planner.h │ │ ├── micro_allocator.cpp │ │ ├── micro_allocator.h │ │ ├── micro_error_reporter.cpp │ │ ├── micro_error_reporter.h │ │ ├── micro_interpreter.cpp │ │ ├── micro_interpreter.h │ │ ├── micro_mutable_op_resolver.h │ │ ├── micro_op_resolver.h │ │ ├── micro_optional_debug_tools.cpp │ │ ├── micro_optional_debug_tools.h │ │ ├── micro_profiler.cpp │ │ ├── micro_profiler.h │ │ ├── micro_string.cpp │ │ ├── micro_string.h │ │ ├── micro_time.cpp │ │ ├── micro_time.h │ │ ├── micro_utils.cpp │ │ ├── micro_utils.h │ │ ├── recording_micro_allocator.cpp │ │ ├── recording_micro_allocator.h │ │ ├── recording_micro_interpreter.h │ │ ├── recording_simple_memory_allocator.cpp │ │ ├── recording_simple_memory_allocator.h │ │ ├── simple_memory_allocator.cpp │ │ ├── simple_memory_allocator.h │ │ ├── test_helpers.cpp │ │ ├── test_helpers.h │ │ └── testing │ │ │ ├── micro_test.h │ │ │ ├── test_conv_model.cpp │ │ │ ├── test_conv_model.h │ │ │ ├── test_utils.cpp │ │ │ └── test_utils.h │ │ ├── schema │ │ └── schema_generated.h │ │ ├── string_type.h │ │ ├── string_util.h │ │ ├── type_to_tflitetype.h │ │ └── version.h └── third_party │ ├── flatbuffers │ ├── LICENSE.txt │ └── include │ │ └── flatbuffers │ │ ├── base.h │ │ ├── flatbuffers.h │ │ └── stl_emulation.h │ ├── gemmlowp │ ├── LICENSE │ ├── fixedpoint │ │ ├── fixedpoint.h │ │ ├── fixedpoint_neon.h │ │ └── fixedpoint_sse.h │ └── internal │ │ └── detect_platform.h │ └── ruy │ └── ruy │ └── profiler │ └── instrumentation.h ├── ei_main.cpp ├── ei_main.h ├── ingestion-sdk-c ├── ei_run_impulse.cpp ├── ei_run_impulse.h ├── ei_sampler.cpp ├── ei_sampler.h └── inc │ ├── ei_config.h │ ├── ei_config_types.h │ ├── sensor_aq.cpp │ ├── sensor_aq.h │ └── signing │ ├── sensor_aq_mbedtls_hs256.cpp │ ├── sensor_aq_mbedtls_hs256.h │ └── sensor_aq_none.h ├── ingestion-sdk-platform └── portenta │ ├── ei_device_info.h │ ├── ei_device_portenta.cpp │ ├── ei_device_portenta.h │ ├── ei_portenta_fs_commands.cpp │ └── ei_portenta_fs_commands.h ├── mbedtls_hmac_sha256_sw └── ei_mbedtls_md.h ├── model-parameters ├── dsp_blocks.h └── model_metadata.h ├── repl ├── at_base64.cpp ├── at_base64.h ├── at_cmd_interface.h ├── at_cmd_repl_mbed.h ├── at_cmds.h └── repl.h ├── sensors ├── ei_camera.cpp ├── ei_camera.h ├── ei_microphone.cpp └── ei_microphone.h └── tflite-model ├── trained_model_compiled.cpp └── trained_model_compiled.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.bin 2 | *.hex 3 | *.map 4 | *.elf 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The Clear BSD License 2 | 3 | Copyright (c) 2025 EdgeImpulse Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted (subject to the limitations in the disclaimer 8 | below) provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | * Neither the name of the copyright holder nor the names of its 18 | contributors may be used to endorse or promote products derived from this 19 | software without specific prior written permission. 20 | 21 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /example-portenta-lorawan.ino: -------------------------------------------------------------------------------- 1 | /* Edge Impulse ingestion SDK 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* Include ----------------------------------------------------------------- */ 24 | #include "mbed.h" 25 | #include "src/ei_main.h" 26 | 27 | 28 | /* Private variables ------------------------------------------------------- */ 29 | static rtos::Thread mbed_thread(osPriorityAboveNormal, 8 * 1024); 30 | 31 | /* Public functions -------------------------------------------------------- */ 32 | 33 | void setup() { 34 | 35 | Serial.begin(115200); 36 | 37 | ei_main(); 38 | 39 | mbed_thread.start(&ei_main); 40 | } 41 | 42 | void loop() { 43 | // delay will pause the thread, so the loop won't take any cycles away from us here 44 | delay(10000); 45 | } 46 | -------------------------------------------------------------------------------- /img/elephant.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgeimpulse/example-portenta-lorawan/0a9f8d08d82613e071eb13bfaef49a0f87187092/img/elephant.jpg -------------------------------------------------------------------------------- /img/not-elephant.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgeimpulse/example-portenta-lorawan/0a9f8d08d82613e071eb13bfaef49a0f87187092/img/not-elephant.jpg -------------------------------------------------------------------------------- /src/drivers/Portenta_Camera/portenta_camera.h: -------------------------------------------------------------------------------- 1 | class CameraClass { 2 | public: 3 | int begin(int horizontalResolution, int verticalResolution); 4 | int grab(uint8_t *buffer, uint32_t timeout=5000); 5 | void testPattern(bool walking); 6 | int skip_frames(uint8_t *buffer, uint32_t n_frames, uint32_t timeout=5000); 7 | }; 8 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/Core/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.4 5 | * @date 23. July 2019 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2019 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 4U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Include/arm_const_structs_f16.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_const_structs_f16.h 4 | * Description: Constant structs that are initialized for user convenience. 5 | * For example, some can be given as arguments to the arm_cfft_f16() function. 6 | * 7 | * $Date: 20. April 2020 8 | * $Revision: V.1.5.1 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #ifndef _ARM_CONST_STRUCTS_F16_H 31 | #define _ARM_CONST_STRUCTS_F16_H 32 | 33 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math_f16.h" 34 | #include "arm_common_tables_f16.h" 35 | 36 | #ifdef __cplusplus 37 | extern "C" 38 | { 39 | #endif 40 | 41 | #if !defined(__CC_ARM) && defined(ARM_FLOAT16_SUPPORTED) 42 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len16; 43 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len32; 44 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len64; 45 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len128; 46 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len256; 47 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len512; 48 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len1024; 49 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len2048; 50 | extern const arm_cfft_instance_f16 arm_cfft_sR_f16_len4096; 51 | #endif 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/PrivateInclude/arm_vec_fft.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file arm_vec_fft.h 3 | * @brief Private header file for CMSIS DSP Library 4 | * @version V1.7.0 5 | * @date 07. January 2020 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #ifndef _ARM_VEC_FFT_H_ 26 | #define _ARM_VEC_FFT_H_ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include "arm_helium_utils.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" 33 | { 34 | #endif 35 | 36 | #if (defined(ARM_MATH_MVEF) || defined(ARM_MATH_MVEI) || defined(ARM_MATH_HELIUM)) && !defined(ARM_MATH_AUTOVECTORIZE) 37 | 38 | #define MVE_CMPLX_ADD_A_ixB(A, B) vcaddq_rot90(A,B) 39 | #define MVE_CMPLX_SUB_A_ixB(A,B) vcaddq_rot270(A,B) 40 | #define MVE_CMPLX_MULT_FLT_AxB(A,B) vcmlaq_rot90(vcmulq(A, B), A, B) 41 | #define MVE_CMPLX_MULT_FLT_Conj_AxB(A,B) vcmlaq_rot270(vcmulq(A, B), A, B) 42 | 43 | #define MVE_CMPLX_MULT_FX_AxB(A,B) vqdmladhxq(vqdmlsdhq((__typeof(A))vuninitializedq_s32(), A, B), A, B); 44 | #define MVE_CMPLX_MULT_FX_AxConjB(A,B) vqdmladhq(vqdmlsdhxq((__typeof(A))vuninitializedq_s32(), A, B), A, B); 45 | 46 | #define MVE_CMPLX_ADD_FX_A_ixB(A, B) vhcaddq_rot90(A,B) 47 | #define MVE_CMPLX_SUB_FX_A_ixB(A,B) vhcaddq_rot270(A,B) 48 | 49 | 50 | #endif /* (defined(ARM_MATH_MVEF) || defined(ARM_MATH_HELIUM)) && !defined(ARM_MATH_AUTOVECTORIZE)*/ 51 | 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | 58 | #endif /* _ARM_VEC_FFT_H_ */ 59 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/BasicMathFunctions/BasicMathFunctionsF16.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: BasicMathFunctionsF16.c 6 | * Description: Combination of all basic math function f16 source files. 7 | * 8 | * $Date: 20. April 2020 9 | * $Revision: V1.1.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "arm_abs_f16.c" 32 | #include "arm_add_f16.c" 33 | #include "arm_dot_prod_f16.c" 34 | #include "arm_mult_f16.c" 35 | #include "arm_negate_f16.c" 36 | #include "arm_offset_f16.c" 37 | #include "arm_scale_f16.c" 38 | #include "arm_sub_f16.c" 39 | 40 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 41 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/BasicMathFunctions/BasicMathFunctionsF16.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: BasicMathFunctionsF16.c 4 | * Description: Combination of all basic math function f16 source files. 5 | * 6 | * $Date: 20. April 2020 7 | * $Revision: V1.1.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_abs_f16.c" 30 | #include "arm_add_f16.c" 31 | #include "arm_dot_prod_f16.c" 32 | #include "arm_mult_f16.c" 33 | #include "arm_negate_f16.c" 34 | #include "arm_offset_f16.c" 35 | #include "arm_scale_f16.c" 36 | #include "arm_sub_f16.c" 37 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/CommonTables/CommonTablesF16.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: CommonTables.c 6 | * Description: Combination of all common table source files. 7 | * 8 | * $Date: 08. January 2020 9 | * $Revision: V1.1.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "arm_common_tables_f16.c" 32 | #include "arm_const_structs_f16.c" 33 | #include "arm_mve_tables_f16.c" 34 | 35 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 36 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/CommonTables/CommonTablesF16.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: CommonTables.c 4 | * Description: Combination of all common table source files. 5 | * 6 | * $Date: 08. January 2020 7 | * $Revision: V1.1.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_common_tables_f16.c" 30 | #include "arm_const_structs_f16.c" 31 | #include "arm_mve_tables_f16.c" 32 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_pid_reset_f32.c 6 | * Description: Floating-point PID Control reset function 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @addtogroup PID 35 | @{ 36 | */ 37 | 38 | /** 39 | @brief Reset function for the floating-point PID Control. 40 | @param[in,out] S points to an instance of the floating-point PID structure 41 | @return none 42 | 43 | @par Details 44 | The function resets the state buffer to zeros. 45 | */ 46 | 47 | void arm_pid_reset_f32( 48 | arm_pid_instance_f32 * S) 49 | { 50 | /* Reset state to zero, The size will be always 3 samples */ 51 | memset(S->state, 0, 3U * sizeof(float32_t)); 52 | } 53 | 54 | /** 55 | @} end of PID group 56 | */ 57 | 58 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 59 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_f32.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_f32.c 4 | * Description: Floating-point PID Control reset function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the floating-point PID Control. 38 | @param[in,out] S points to an instance of the floating-point PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_f32( 46 | arm_pid_instance_f32 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(float32_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q15.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_pid_reset_q15.c 6 | * Description: Q15 PID Control reset function 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @addtogroup PID 35 | @{ 36 | */ 37 | 38 | /** 39 | @brief Reset function for the Q15 PID Control. 40 | @param[in,out] S points to an instance of the Q15 PID structure 41 | @return none 42 | 43 | @par Details 44 | The function resets the state buffer to zeros. 45 | */ 46 | 47 | void arm_pid_reset_q15( 48 | arm_pid_instance_q15 * S) 49 | { 50 | /* Reset state to zero, The size will be always 3 samples */ 51 | memset(S->state, 0, 3U * sizeof(q15_t)); 52 | } 53 | 54 | /** 55 | @} end of PID group 56 | */ 57 | 58 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 59 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q15.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_q15.c 4 | * Description: Q15 PID Control reset function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the Q15 PID Control. 38 | @param[in,out] S points to an instance of the Q15 PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_q15( 46 | arm_pid_instance_q15 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(q15_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q31.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_pid_reset_q31.c 6 | * Description: Q31 PID Control reset function 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @addtogroup PID 35 | @{ 36 | */ 37 | 38 | /** 39 | @brief Reset function for the Q31 PID Control. 40 | @param[in,out] S points to an instance of the Q31 PID structure 41 | @return none 42 | 43 | @par Details 44 | The function resets the state buffer to zeros. 45 | */ 46 | 47 | void arm_pid_reset_q31( 48 | arm_pid_instance_q31 * S) 49 | { 50 | /* Reset state to zero, The size will be always 3 samples */ 51 | memset(S->state, 0, 3U * sizeof(q31_t)); 52 | } 53 | 54 | /** 55 | @} end of PID group 56 | */ 57 | 58 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 59 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q31.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_q31.c 4 | * Description: Q31 PID Control reset function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the Q31 PID Control. 38 | @param[in,out] S points to an instance of the Q31 PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_q31( 46 | arm_pid_instance_q31 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(q31_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_svm_linear_init_f32.c 7 | * Description: SVM Linear Instance Initialization 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | 36 | 37 | #if defined(ARM_MATH_NEON) 38 | 39 | #include "NEMath.h" 40 | 41 | #endif 42 | 43 | 44 | #define TT 45 | #define TF 46 | #define FT 47 | #define EXT _TT_TF_FT 48 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 49 | 50 | #undef TT 51 | #undef FF 52 | #undef TF 53 | #undef FT 54 | #undef EXT 55 | #define TF 56 | #define FT 57 | #define EXT _TF_FT 58 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 59 | 60 | #undef TT 61 | #undef FF 62 | #undef TF 63 | #undef FT 64 | #undef EXT 65 | #define TT 66 | #define FF 67 | #define TF 68 | #define FT 69 | #define EXT _TT_FF_TF_FT 70 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 71 | 72 | #undef TT 73 | #undef FF 74 | #undef TF 75 | #undef FT 76 | #undef EXT 77 | #define TT 78 | #define EXT _TT 79 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 80 | 81 | 82 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 83 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance.c'': -------------------------------------------------------------------------------- 1 | 2 | /* ---------------------------------------------------------------------- 3 | * Project: CMSIS DSP Library 4 | * Title: arm_svm_linear_init_f32.c 5 | * Description: SVM Linear Instance Initialization 6 | * 7 | * 8 | * Target Processor: Cortex-M cores 9 | * -------------------------------------------------------------------- */ 10 | /* 11 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 12 | * 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the License); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include 30 | #include 31 | 32 | 33 | 34 | 35 | #if defined(ARM_MATH_NEON) 36 | 37 | #include "NEMath.h" 38 | 39 | #endif 40 | 41 | 42 | #define TT 43 | #define TF 44 | #define FT 45 | #define EXT _TT_TF_FT 46 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 47 | 48 | #undef TT 49 | #undef FF 50 | #undef TF 51 | #undef FT 52 | #undef EXT 53 | #define TF 54 | #define FT 55 | #define EXT _TF_FT 56 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 57 | 58 | #undef TT 59 | #undef FF 60 | #undef TF 61 | #undef FT 62 | #undef EXT 63 | #define TT 64 | #define FF 65 | #define TF 66 | #define FT 67 | #define EXT _TT_FF_TF_FT 68 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 69 | 70 | #undef TT 71 | #undef FF 72 | #undef TF 73 | #undef FT 74 | #undef EXT 75 | #define TT 76 | #define EXT _TT 77 | #include "edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_boolean_distance_template.h" 78 | 79 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_correlation_distance_f32.c'': -------------------------------------------------------------------------------- 1 | 2 | /* ---------------------------------------------------------------------- 3 | * Project: CMSIS DSP Library 4 | * Title: arm_correlation_distance_f32.c 5 | * Description: Correlation distance between two vectors 6 | * 7 | * 8 | * Target Processor: Cortex-M cores 9 | * -------------------------------------------------------------------- */ 10 | /* 11 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 12 | * 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the License); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include 30 | #include 31 | 32 | 33 | 34 | /** 35 | @addtogroup FloatDist 36 | @{ 37 | */ 38 | 39 | 40 | /** 41 | * @brief Correlation distance between two vectors 42 | * 43 | * The input vectors are modified in place ! 44 | * 45 | * @param[in] pA First vector 46 | * @param[in] pB Second vector 47 | * @param[in] blockSize vector length 48 | * @return distance 49 | * 50 | */ 51 | 52 | float32_t arm_correlation_distance_f32(float32_t *pA,float32_t *pB, uint32_t blockSize) 53 | { 54 | float32_t ma,mb,pwra,pwrb,dot,tmp; 55 | 56 | arm_mean_f32(pA, blockSize, &ma); 57 | arm_mean_f32(pB, blockSize, &mb); 58 | 59 | arm_offset_f32(pA, -ma, pA, blockSize); 60 | arm_offset_f32(pB, -mb, pB, blockSize); 61 | 62 | arm_power_f32(pA, blockSize, &pwra); 63 | arm_power_f32(pB, blockSize, &pwrb); 64 | 65 | arm_dot_prod_f32(pA,pB,blockSize,&dot); 66 | 67 | dot = dot / blockSize; 68 | pwra = pwra / blockSize; 69 | pwrb = pwrb / blockSize; 70 | 71 | arm_sqrt_f32(pwra * pwrb,&tmp); 72 | 73 | return(1.0f - dot / tmp); 74 | 75 | 76 | } 77 | 78 | 79 | 80 | /** 81 | * @} end of FloatDist group 82 | */ 83 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_cosine_distance_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_cosine_distance_f32.c 7 | * Description: Cosine distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | /** 36 | @addtogroup FloatDist 37 | @{ 38 | */ 39 | 40 | 41 | 42 | /** 43 | * @brief Cosine distance between two vectors 44 | * 45 | * @param[in] pA First vector 46 | * @param[in] pB Second vector 47 | * @param[in] blockSize vector length 48 | * @return distance 49 | * 50 | */ 51 | 52 | float32_t arm_cosine_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize) 53 | { 54 | float32_t pwra,pwrb,dot,tmp; 55 | 56 | arm_power_f32(pA, blockSize, &pwra); 57 | arm_power_f32(pB, blockSize, &pwrb); 58 | 59 | arm_dot_prod_f32(pA,pB,blockSize,&dot); 60 | 61 | arm_sqrt_f32(pwra * pwrb, &tmp); 62 | return(1.0f - dot / tmp); 63 | 64 | } 65 | 66 | 67 | 68 | /** 69 | * @} end of FloatDist group 70 | */ 71 | 72 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 73 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_cosine_distance_f32.c'': -------------------------------------------------------------------------------- 1 | 2 | /* ---------------------------------------------------------------------- 3 | * Project: CMSIS DSP Library 4 | * Title: arm_cosine_distance_f32.c 5 | * Description: Cosine distance between two vectors 6 | * 7 | * 8 | * Target Processor: Cortex-M cores 9 | * -------------------------------------------------------------------- */ 10 | /* 11 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 12 | * 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the License); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include 30 | #include 31 | 32 | 33 | /** 34 | @addtogroup FloatDist 35 | @{ 36 | */ 37 | 38 | 39 | 40 | /** 41 | * @brief Cosine distance between two vectors 42 | * 43 | * @param[in] pA First vector 44 | * @param[in] pB Second vector 45 | * @param[in] blockSize vector length 46 | * @return distance 47 | * 48 | */ 49 | 50 | float32_t arm_cosine_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize) 51 | { 52 | float32_t pwra,pwrb,dot,tmp; 53 | 54 | arm_power_f32(pA, blockSize, &pwra); 55 | arm_power_f32(pB, blockSize, &pwrb); 56 | 57 | arm_dot_prod_f32(pA,pB,blockSize,&dot); 58 | 59 | arm_sqrt_f32(pwra * pwrb, &tmp); 60 | return(1.0f - dot / tmp); 61 | 62 | } 63 | 64 | 65 | 66 | /** 67 | * @} end of FloatDist group 68 | */ 69 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_hamming_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_hamming_distance.c 7 | * Description: Hamming distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | extern void arm_boolean_distance_TF_FT(const uint32_t *pA 36 | , const uint32_t *pB 37 | , uint32_t numberOfBools 38 | , uint32_t *cTF 39 | , uint32_t *cFT 40 | ); 41 | 42 | /** 43 | @addtogroup BoolDist 44 | @{ 45 | */ 46 | 47 | 48 | /** 49 | * @brief Hamming distance between two vectors 50 | * 51 | * @param[in] pA First vector of packed booleans 52 | * @param[in] pB Second vector of packed booleans 53 | * @param[in] numberOfBools Number of booleans 54 | * @return distance 55 | * 56 | */ 57 | 58 | float32_t arm_hamming_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 59 | { 60 | uint32_t ctf=0,cft=0; 61 | 62 | arm_boolean_distance_TF_FT(pA, pB, numberOfBools, &ctf, &cft); 63 | 64 | return(1.0*(ctf + cft) / numberOfBools); 65 | } 66 | 67 | 68 | /** 69 | * @} end of BoolDist group 70 | */ 71 | 72 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 73 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_hamming_distance.c'': -------------------------------------------------------------------------------- 1 | 2 | /* ---------------------------------------------------------------------- 3 | * Project: CMSIS DSP Library 4 | * Title: arm_hamming_distance.c 5 | * Description: Hamming distance between two vectors 6 | * 7 | * 8 | * Target Processor: Cortex-M cores 9 | * -------------------------------------------------------------------- */ 10 | /* 11 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 12 | * 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the License); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include 30 | #include 31 | 32 | 33 | extern void arm_boolean_distance_TF_FT(const uint32_t *pA 34 | , const uint32_t *pB 35 | , uint32_t numberOfBools 36 | , uint32_t *cTF 37 | , uint32_t *cFT 38 | ); 39 | 40 | /** 41 | @addtogroup BoolDist 42 | @{ 43 | */ 44 | 45 | 46 | /** 47 | * @brief Hamming distance between two vectors 48 | * 49 | * @param[in] pA First vector of packed booleans 50 | * @param[in] pB Second vector of packed booleans 51 | * @param[in] numberOfBools Number of booleans 52 | * @return distance 53 | * 54 | */ 55 | 56 | float32_t arm_hamming_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 57 | { 58 | uint32_t ctf=0,cft=0; 59 | 60 | arm_boolean_distance_TF_FT(pA, pB, numberOfBools, &ctf, &cft); 61 | 62 | return(1.0*(ctf + cft) / numberOfBools); 63 | } 64 | 65 | 66 | /** 67 | * @} end of BoolDist group 68 | */ 69 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_jaccard_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_jaccard_distance.c 7 | * Description: Jaccard distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | 36 | extern void arm_boolean_distance_TT_TF_FT(const uint32_t *pA 37 | , const uint32_t *pB 38 | , uint32_t numberOfBools 39 | , uint32_t *cTT 40 | , uint32_t *cTF 41 | , uint32_t *cFT 42 | ); 43 | 44 | 45 | /** 46 | @addtogroup BoolDist 47 | @{ 48 | */ 49 | 50 | /** 51 | * @brief Jaccard distance between two vectors 52 | * 53 | * @param[in] pA First vector of packed booleans 54 | * @param[in] pB Second vector of packed booleans 55 | * @param[in] numberOfBools Number of booleans 56 | * @return distance 57 | * 58 | */ 59 | 60 | float32_t arm_jaccard_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 61 | { 62 | uint32_t ctt=0,ctf=0,cft=0; 63 | 64 | arm_boolean_distance_TT_TF_FT(pA, pB, numberOfBools, &ctt, &ctf, &cft); 65 | 66 | return(1.0*(ctf + cft) / (ctt + cft + ctf)); 67 | } 68 | 69 | 70 | /** 71 | * @} end of BoolDist group 72 | */ 73 | 74 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 75 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_jaccard_distance.c'': -------------------------------------------------------------------------------- 1 | 2 | /* ---------------------------------------------------------------------- 3 | * Project: CMSIS DSP Library 4 | * Title: arm_jaccard_distance.c 5 | * Description: Jaccard distance between two vectors 6 | * 7 | * 8 | * Target Processor: Cortex-M cores 9 | * -------------------------------------------------------------------- */ 10 | /* 11 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 12 | * 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the License); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include 30 | #include 31 | 32 | 33 | 34 | extern void arm_boolean_distance_TT_TF_FT(const uint32_t *pA 35 | , const uint32_t *pB 36 | , uint32_t numberOfBools 37 | , uint32_t *cTT 38 | , uint32_t *cTF 39 | , uint32_t *cFT 40 | ); 41 | 42 | 43 | /** 44 | @addtogroup BoolDist 45 | @{ 46 | */ 47 | 48 | /** 49 | * @brief Jaccard distance between two vectors 50 | * 51 | * @param[in] pA First vector of packed booleans 52 | * @param[in] pB Second vector of packed booleans 53 | * @param[in] numberOfBools Number of booleans 54 | * @return distance 55 | * 56 | */ 57 | 58 | float32_t arm_jaccard_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 59 | { 60 | uint32_t ctt=0,ctf=0,cft=0; 61 | 62 | arm_boolean_distance_TT_TF_FT(pA, pB, numberOfBools, &ctt, &ctf, &cft); 63 | 64 | return(1.0*(ctf + cft) / (ctt + cft + ctf)); 65 | } 66 | 67 | 68 | /** 69 | * @} end of BoolDist group 70 | */ 71 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_kulsinski_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_kulsinski_distance.c 7 | * Description: Kulsinski distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | 36 | extern void arm_boolean_distance_TT_TF_FT(const uint32_t *pA 37 | , const uint32_t *pB 38 | , uint32_t numberOfBools 39 | , uint32_t *cTT 40 | , uint32_t *cTF 41 | , uint32_t *cFT 42 | ); 43 | 44 | 45 | /** 46 | @addtogroup BoolDist 47 | @{ 48 | */ 49 | 50 | 51 | /** 52 | * @brief Kulsinski distance between two vectors 53 | * 54 | * @param[in] pA First vector of packed booleans 55 | * @param[in] pB Second vector of packed booleans 56 | * @param[in] numberOfBools Number of booleans 57 | * @return distance 58 | * 59 | */ 60 | 61 | float32_t arm_kulsinski_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 62 | { 63 | uint32_t ctt=0,ctf=0,cft=0; 64 | 65 | arm_boolean_distance_TT_TF_FT(pA, pB, numberOfBools, &ctt, &ctf, &cft); 66 | 67 | return(1.0*(ctf + cft - ctt + numberOfBools) / (cft + ctf + numberOfBools)); 68 | } 69 | 70 | 71 | /** 72 | * @} end of BoolDist group 73 | */ 74 | 75 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 76 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_kulsinski_distance.c'': -------------------------------------------------------------------------------- 1 | 2 | /* ---------------------------------------------------------------------- 3 | * Project: CMSIS DSP Library 4 | * Title: arm_kulsinski_distance.c 5 | * Description: Kulsinski distance between two vectors 6 | * 7 | * 8 | * Target Processor: Cortex-M cores 9 | * -------------------------------------------------------------------- */ 10 | /* 11 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 12 | * 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the License); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include 30 | #include 31 | 32 | 33 | 34 | extern void arm_boolean_distance_TT_TF_FT(const uint32_t *pA 35 | , const uint32_t *pB 36 | , uint32_t numberOfBools 37 | , uint32_t *cTT 38 | , uint32_t *cTF 39 | , uint32_t *cFT 40 | ); 41 | 42 | 43 | /** 44 | @addtogroup BoolDist 45 | @{ 46 | */ 47 | 48 | 49 | /** 50 | * @brief Kulsinski distance between two vectors 51 | * 52 | * @param[in] pA First vector of packed booleans 53 | * @param[in] pB Second vector of packed booleans 54 | * @param[in] numberOfBools Number of booleans 55 | * @return distance 56 | * 57 | */ 58 | 59 | float32_t arm_kulsinski_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 60 | { 61 | uint32_t ctt=0,ctf=0,cft=0; 62 | 63 | arm_boolean_distance_TT_TF_FT(pA, pB, numberOfBools, &ctt, &ctf, &cft); 64 | 65 | return(1.0*(ctf + cft - ctt + numberOfBools) / (cft + ctf + numberOfBools)); 66 | } 67 | 68 | 69 | /** 70 | * @} end of BoolDist group 71 | */ 72 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_rogerstanimoto_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_rogerstanimoto_distance.c 7 | * Description: Roger Stanimoto distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | 36 | extern void arm_boolean_distance_TT_FF_TF_FT(const uint32_t *pA 37 | , const uint32_t *pB 38 | , uint32_t numberOfBools 39 | , uint32_t *cTT 40 | , uint32_t *cFF 41 | , uint32_t *cTF 42 | , uint32_t *cFT 43 | ); 44 | 45 | 46 | /** 47 | @addtogroup BoolDist 48 | @{ 49 | */ 50 | 51 | /** 52 | * @brief Roger Stanimoto distance between two vectors 53 | * 54 | * @param[in] pA First vector of packed booleans 55 | * @param[in] pB Second vector of packed booleans 56 | * @param[in] numberOfBools Number of booleans 57 | * @return distance 58 | * 59 | */ 60 | 61 | float32_t arm_rogerstanimoto_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 62 | { 63 | uint32_t ctt=0,cff=0,ctf=0,cft=0,r; 64 | 65 | arm_boolean_distance_TT_FF_TF_FT(pA, pB, numberOfBools, &ctt,&cff, &ctf, &cft); 66 | 67 | r = 2*(ctf + cft); 68 | 69 | return(1.0*r / (r + ctt + cff)); 70 | } 71 | 72 | 73 | /** 74 | * @} end of BoolDist group 75 | */ 76 | 77 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 78 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_rogerstanimoto_distance.c'': -------------------------------------------------------------------------------- 1 | 2 | /* ---------------------------------------------------------------------- 3 | * Project: CMSIS DSP Library 4 | * Title: arm_rogerstanimoto_distance.c 5 | * Description: Roger Stanimoto distance between two vectors 6 | * 7 | * 8 | * Target Processor: Cortex-M cores 9 | * -------------------------------------------------------------------- */ 10 | /* 11 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 12 | * 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the License); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include 30 | #include 31 | 32 | 33 | 34 | extern void arm_boolean_distance_TT_FF_TF_FT(const uint32_t *pA 35 | , const uint32_t *pB 36 | , uint32_t numberOfBools 37 | , uint32_t *cTT 38 | , uint32_t *cFF 39 | , uint32_t *cTF 40 | , uint32_t *cFT 41 | ); 42 | 43 | 44 | /** 45 | @addtogroup BoolDist 46 | @{ 47 | */ 48 | 49 | /** 50 | * @brief Roger Stanimoto distance between two vectors 51 | * 52 | * @param[in] pA First vector of packed booleans 53 | * @param[in] pB Second vector of packed booleans 54 | * @param[in] numberOfBools Number of booleans 55 | * @return distance 56 | * 57 | */ 58 | 59 | float32_t arm_rogerstanimoto_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 60 | { 61 | uint32_t ctt=0,cff=0,ctf=0,cft=0,r; 62 | 63 | arm_boolean_distance_TT_FF_TF_FT(pA, pB, numberOfBools, &ctt,&cff, &ctf, &cft); 64 | 65 | r = 2*(ctf + cft); 66 | 67 | return(1.0*r / (r + ctt + cff)); 68 | } 69 | 70 | 71 | /** 72 | * @} end of BoolDist group 73 | */ 74 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_russellrao_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_russellrao_distance.c 7 | * Description: Russell-Rao distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | 36 | extern void arm_boolean_distance_TT(const uint32_t *pA 37 | , const uint32_t *pB 38 | , uint32_t numberOfBools 39 | , uint32_t *cTT 40 | ); 41 | 42 | 43 | /** 44 | @addtogroup BoolDist 45 | @{ 46 | */ 47 | 48 | /** 49 | * @brief Russell-Rao distance between two vectors 50 | * 51 | * @param[in] pA First vector of packed booleans 52 | * @param[in] pB Second vector of packed booleans 53 | * @param[in] numberOfBools Number of booleans 54 | * @return distance 55 | * 56 | */ 57 | 58 | float32_t arm_russellrao_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 59 | { 60 | uint32_t ctt=0; 61 | 62 | 63 | arm_boolean_distance_TT(pA, pB, numberOfBools, &ctt); 64 | 65 | 66 | return(1.0*(numberOfBools - ctt) / ((float32_t)numberOfBools)); 67 | } 68 | 69 | 70 | /** 71 | * @} end of BoolDist group 72 | */ 73 | 74 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 75 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_russellrao_distance.c'': -------------------------------------------------------------------------------- 1 | 2 | /* ---------------------------------------------------------------------- 3 | * Project: CMSIS DSP Library 4 | * Title: arm_russellrao_distance.c 5 | * Description: Russell-Rao distance between two vectors 6 | * 7 | * 8 | * Target Processor: Cortex-M cores 9 | * -------------------------------------------------------------------- */ 10 | /* 11 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 12 | * 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the License); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include 30 | #include 31 | 32 | 33 | 34 | extern void arm_boolean_distance_TT(const uint32_t *pA 35 | , const uint32_t *pB 36 | , uint32_t numberOfBools 37 | , uint32_t *cTT 38 | ); 39 | 40 | 41 | /** 42 | @addtogroup BoolDist 43 | @{ 44 | */ 45 | 46 | /** 47 | * @brief Russell-Rao distance between two vectors 48 | * 49 | * @param[in] pA First vector of packed booleans 50 | * @param[in] pB Second vector of packed booleans 51 | * @param[in] numberOfBools Number of booleans 52 | * @return distance 53 | * 54 | */ 55 | 56 | float32_t arm_russellrao_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 57 | { 58 | uint32_t ctt=0; 59 | 60 | 61 | arm_boolean_distance_TT(pA, pB, numberOfBools, &ctt); 62 | 63 | 64 | return(1.0*(numberOfBools - ctt) / ((float32_t)numberOfBools)); 65 | } 66 | 67 | 68 | /** 69 | * @} end of BoolDist group 70 | */ 71 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_sokalmichener_distance.c'': -------------------------------------------------------------------------------- 1 | 2 | /* ---------------------------------------------------------------------- 3 | * Project: CMSIS DSP Library 4 | * Title: arm_sokalmichener_distance.c 5 | * Description: Sokal-Michener distance between two vectors 6 | * 7 | * 8 | * Target Processor: Cortex-M cores 9 | * -------------------------------------------------------------------- */ 10 | /* 11 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 12 | * 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the License); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include 30 | #include 31 | 32 | 33 | extern void arm_boolean_distance_TT_FF_TF_FT(const uint32_t *pA 34 | , const uint32_t *pB 35 | , uint32_t numberOfBools 36 | , uint32_t *cTT 37 | , uint32_t *cFF 38 | , uint32_t *cTF 39 | , uint32_t *cFT 40 | ); 41 | 42 | 43 | /** 44 | @addtogroup BoolDist 45 | @{ 46 | */ 47 | 48 | /** 49 | * @brief Sokal-Michener distance between two vectors 50 | * 51 | * @param[in] pA First vector of packed booleans 52 | * @param[in] pB Second vector of packed booleans 53 | * @param[in] numberOfBools Number of booleans 54 | * @return distance 55 | * 56 | */ 57 | 58 | float32_t arm_sokalmichener_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 59 | { 60 | uint32_t ctt=0,cff=0,cft=0,ctf=0; 61 | float32_t r,s; 62 | 63 | arm_boolean_distance_TT_FF_TF_FT(pA, pB, numberOfBools, &ctt, &cff, &ctf, &cft); 64 | 65 | r = 2.0*(ctf + cft); 66 | s = 1.0*(cff + ctt); 67 | 68 | return(r / (s+r)); 69 | } 70 | 71 | 72 | /** 73 | * @} end of BoolDist group 74 | */ 75 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_sokalsneath_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_sokalsneath_distance.c 7 | * Description: Sokal-Sneath distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | extern void arm_boolean_distance_TT_TF_FT(const uint32_t *pA 36 | , const uint32_t *pB 37 | , uint32_t numberOfBools 38 | , uint32_t *cTT 39 | , uint32_t *cTF 40 | , uint32_t *cFT 41 | ); 42 | 43 | 44 | /** 45 | @addtogroup BoolDist 46 | @{ 47 | */ 48 | 49 | /** 50 | * @brief Sokal-Sneath distance between two vectors 51 | * 52 | * @param[in] pA First vector of packed booleans 53 | * @param[in] pB Second vector of packed booleans 54 | * @param[in] numberOfBools Number of booleans 55 | * @return distance 56 | * 57 | */ 58 | 59 | float32_t arm_sokalsneath_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 60 | { 61 | uint32_t ctt=0,cft=0,ctf=0; 62 | float32_t r; 63 | 64 | arm_boolean_distance_TT_TF_FT(pA, pB, numberOfBools, &ctt, &ctf, &cft); 65 | 66 | r = 2.0*(ctf + cft); 67 | 68 | return(r / (r + ctt)); 69 | } 70 | 71 | 72 | /** 73 | * @} end of BoolDist group 74 | */ 75 | 76 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 77 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_sokalsneath_distance.c'': -------------------------------------------------------------------------------- 1 | 2 | /* ---------------------------------------------------------------------- 3 | * Project: CMSIS DSP Library 4 | * Title: arm_sokalsneath_distance.c 5 | * Description: Sokal-Sneath distance between two vectors 6 | * 7 | * 8 | * Target Processor: Cortex-M cores 9 | * -------------------------------------------------------------------- */ 10 | /* 11 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 12 | * 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the License); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include 30 | #include 31 | 32 | 33 | extern void arm_boolean_distance_TT_TF_FT(const uint32_t *pA 34 | , const uint32_t *pB 35 | , uint32_t numberOfBools 36 | , uint32_t *cTT 37 | , uint32_t *cTF 38 | , uint32_t *cFT 39 | ); 40 | 41 | 42 | /** 43 | @addtogroup BoolDist 44 | @{ 45 | */ 46 | 47 | /** 48 | * @brief Sokal-Sneath distance between two vectors 49 | * 50 | * @param[in] pA First vector of packed booleans 51 | * @param[in] pB Second vector of packed booleans 52 | * @param[in] numberOfBools Number of booleans 53 | * @return distance 54 | * 55 | */ 56 | 57 | float32_t arm_sokalsneath_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 58 | { 59 | uint32_t ctt=0,cft=0,ctf=0; 60 | float32_t r; 61 | 62 | arm_boolean_distance_TT_TF_FT(pA, pB, numberOfBools, &ctt, &ctf, &cft); 63 | 64 | r = 2.0*(ctf + cft); 65 | 66 | return(r / (r + ctt)); 67 | } 68 | 69 | 70 | /** 71 | * @} end of BoolDist group 72 | */ 73 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_yule_distance.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | 4 | /* ---------------------------------------------------------------------- 5 | * Project: CMSIS DSP Library 6 | * Title: arm_yule_distance.c 7 | * Description: Yule distance between two vectors 8 | * 9 | * 10 | * Target Processor: Cortex-M cores 11 | * -------------------------------------------------------------------- */ 12 | /* 13 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 14 | * 15 | * SPDX-License-Identifier: Apache-2.0 16 | * 17 | * Licensed under the Apache License, Version 2.0 (the License); you may 18 | * not use this file except in compliance with the License. 19 | * You may obtain a copy of the License at 20 | * 21 | * www.apache.org/licenses/LICENSE-2.0 22 | * 23 | * Unless required by applicable law or agreed to in writing, software 24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | * See the License for the specific language governing permissions and 27 | * limitations under the License. 28 | */ 29 | 30 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 31 | #include 32 | #include 33 | 34 | 35 | extern void arm_boolean_distance_TT_FF_TF_FT(const uint32_t *pA 36 | , const uint32_t *pB 37 | , uint32_t numberOfBools 38 | , uint32_t *cTT 39 | , uint32_t *cFF 40 | , uint32_t *cTF 41 | , uint32_t *cFT 42 | ); 43 | 44 | /** 45 | @addtogroup BoolDist 46 | @{ 47 | */ 48 | 49 | 50 | /** 51 | * @brief Yule distance between two vectors 52 | * 53 | * @param[in] pA First vector of packed booleans 54 | * @param[in] pB Second vector of packed booleans 55 | * @param[in] numberOfBools Number of booleans 56 | * @return distance 57 | * 58 | */ 59 | 60 | float32_t arm_yule_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 61 | { 62 | uint32_t ctt=0,cff=0,ctf=0,cft=0,r; 63 | 64 | arm_boolean_distance_TT_FF_TF_FT(pA, pB, numberOfBools, &ctt,&cff, &ctf, &cft); 65 | 66 | r = 2*(ctf * cft); 67 | 68 | return(1.0*r / (r/2.0 + ctt * cff)); 69 | } 70 | 71 | 72 | /** 73 | * @} end of BoolDist group 74 | */ 75 | 76 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 77 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/DistanceFunctions/arm_yule_distance.c'': -------------------------------------------------------------------------------- 1 | 2 | /* ---------------------------------------------------------------------- 3 | * Project: CMSIS DSP Library 4 | * Title: arm_yule_distance.c 5 | * Description: Yule distance between two vectors 6 | * 7 | * 8 | * Target Processor: Cortex-M cores 9 | * -------------------------------------------------------------------- */ 10 | /* 11 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 12 | * 13 | * SPDX-License-Identifier: Apache-2.0 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the License); you may 16 | * not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 29 | #include 30 | #include 31 | 32 | 33 | extern void arm_boolean_distance_TT_FF_TF_FT(const uint32_t *pA 34 | , const uint32_t *pB 35 | , uint32_t numberOfBools 36 | , uint32_t *cTT 37 | , uint32_t *cFF 38 | , uint32_t *cTF 39 | , uint32_t *cFT 40 | ); 41 | 42 | /** 43 | @addtogroup BoolDist 44 | @{ 45 | */ 46 | 47 | 48 | /** 49 | * @brief Yule distance between two vectors 50 | * 51 | * @param[in] pA First vector of packed booleans 52 | * @param[in] pB Second vector of packed booleans 53 | * @param[in] numberOfBools Number of booleans 54 | * @return distance 55 | * 56 | */ 57 | 58 | float32_t arm_yule_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools) 59 | { 60 | uint32_t ctt=0,cff=0,ctf=0,cft=0,r; 61 | 62 | arm_boolean_distance_TT_FF_TF_FT(pA, pB, numberOfBools, &ctt,&cff, &ctf, &cft); 63 | 64 | r = 2*(ctf * cft); 65 | 66 | return(1.0*r / (r/2.0 + ctt * cff)); 67 | } 68 | 69 | 70 | /** 71 | * @} end of BoolDist group 72 | */ 73 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/FilteringFunctions/arm_fir_lattice_init_f32.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_f32.c 4 | * Description: Floating-point FIR Lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the floating-point FIR lattice filter. 42 | @param[in] S points to an instance of the floating-point FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_f32( 50 | arm_fir_lattice_instance_f32 * S, 51 | uint16_t numStages, 52 | const float32_t * pCoeffs, 53 | float32_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(float32_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/FilteringFunctions/arm_fir_lattice_init_q15.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_q15.c 4 | * Description: Q15 FIR Lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q15 FIR lattice filter. 42 | @param[in] S points to an instance of the Q15 FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_q15( 50 | arm_fir_lattice_instance_q15 * S, 51 | uint16_t numStages, 52 | const q15_t * pCoeffs, 53 | q15_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(q15_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/FilteringFunctions/arm_fir_lattice_init_q31.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_q31.c 4 | * Description: Q31 FIR lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q31 FIR lattice filter. 42 | @param[in] S points to an instance of the Q31 FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_q31( 50 | arm_fir_lattice_instance_q31 * S, 51 | uint16_t numStages, 52 | const q31_t * pCoeffs, 53 | q31_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(q31_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_f32.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_f32.c 4 | * Description: Floating-point matrix initialization 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @defgroup MatrixInit Matrix Initialization 37 | 38 | Initializes the underlying matrix data structure. 39 | The functions set the numRows, 40 | numCols, and pData fields 41 | of the matrix data structure. 42 | */ 43 | 44 | /** 45 | @addtogroup MatrixInit 46 | @{ 47 | */ 48 | 49 | /** 50 | @brief Floating-point matrix initialization. 51 | @param[in,out] S points to an instance of the floating-point matrix structure 52 | @param[in] nRows number of rows in the matrix 53 | @param[in] nColumns number of columns in the matrix 54 | @param[in] pData points to the matrix data array 55 | @return none 56 | */ 57 | 58 | void arm_mat_init_f32( 59 | arm_matrix_instance_f32 * S, 60 | uint16_t nRows, 61 | uint16_t nColumns, 62 | float32_t * pData) 63 | { 64 | /* Assign Number of Rows */ 65 | S->numRows = nRows; 66 | 67 | /* Assign Number of Columns */ 68 | S->numCols = nColumns; 69 | 70 | /* Assign Data pointer */ 71 | S->pData = pData; 72 | } 73 | 74 | /** 75 | @} end of MatrixInit group 76 | */ 77 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_q15.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_mat_init_q15.c 6 | * Description: Q15 matrix initialization 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @ingroup groupMatrix 35 | */ 36 | 37 | /** 38 | @addtogroup MatrixInit 39 | @{ 40 | */ 41 | 42 | /** 43 | @brief Q15 matrix initialization. 44 | @param[in,out] S points to an instance of the floating-point matrix structure 45 | @param[in] nRows number of rows in the matrix 46 | @param[in] nColumns number of columns in the matrix 47 | @param[in] pData points to the matrix data array 48 | @return none 49 | */ 50 | 51 | void arm_mat_init_q15( 52 | arm_matrix_instance_q15 * S, 53 | uint16_t nRows, 54 | uint16_t nColumns, 55 | q15_t * pData) 56 | { 57 | /* Assign Number of Rows */ 58 | S->numRows = nRows; 59 | 60 | /* Assign Number of Columns */ 61 | S->numCols = nColumns; 62 | 63 | /* Assign Data pointer */ 64 | S->pData = pData; 65 | } 66 | 67 | /** 68 | @} end of MatrixInit group 69 | */ 70 | 71 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 72 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_q15.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_q15.c 4 | * Description: Q15 matrix initialization 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @addtogroup MatrixInit 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Q15 matrix initialization. 42 | @param[in,out] S points to an instance of the floating-point matrix structure 43 | @param[in] nRows number of rows in the matrix 44 | @param[in] nColumns number of columns in the matrix 45 | @param[in] pData points to the matrix data array 46 | @return none 47 | */ 48 | 49 | void arm_mat_init_q15( 50 | arm_matrix_instance_q15 * S, 51 | uint16_t nRows, 52 | uint16_t nColumns, 53 | q15_t * pData) 54 | { 55 | /* Assign Number of Rows */ 56 | S->numRows = nRows; 57 | 58 | /* Assign Number of Columns */ 59 | S->numCols = nColumns; 60 | 61 | /* Assign Data pointer */ 62 | S->pData = pData; 63 | } 64 | 65 | /** 66 | @} end of MatrixInit group 67 | */ 68 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_q31.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_mat_init_q31.c 6 | * Description: Q31 matrix initialization 7 | * 8 | * $Date: 18. March 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @ingroup groupMatrix 35 | */ 36 | 37 | /** 38 | @defgroup MatrixInit Matrix Initialization 39 | 40 | */ 41 | 42 | /** 43 | @addtogroup MatrixInit 44 | @{ 45 | */ 46 | 47 | /** 48 | @brief Q31 matrix initialization. 49 | @param[in,out] S points to an instance of the Q31 matrix structure 50 | @param[in] nRows number of rows in the matrix 51 | @param[in] nColumns number of columns in the matrix 52 | @param[in] pData points to the matrix data array 53 | @return none 54 | */ 55 | 56 | void arm_mat_init_q31( 57 | arm_matrix_instance_q31 * S, 58 | uint16_t nRows, 59 | uint16_t nColumns, 60 | q31_t * pData) 61 | { 62 | /* Assign Number of Rows */ 63 | S->numRows = nRows; 64 | 65 | /* Assign Number of Columns */ 66 | S->numCols = nColumns; 67 | 68 | /* Assign Data pointer */ 69 | S->pData = pData; 70 | } 71 | 72 | /** 73 | @} end of MatrixInit group 74 | */ 75 | 76 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 77 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_q31.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_q31.c 4 | * Description: Q31 matrix initialization 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @defgroup MatrixInit Matrix Initialization 37 | 38 | */ 39 | 40 | /** 41 | @addtogroup MatrixInit 42 | @{ 43 | */ 44 | 45 | /** 46 | @brief Q31 matrix initialization. 47 | @param[in,out] S points to an instance of the Q31 matrix structure 48 | @param[in] nRows number of rows in the matrix 49 | @param[in] nColumns number of columns in the matrix 50 | @param[in] pData points to the matrix data array 51 | @return none 52 | */ 53 | 54 | void arm_mat_init_q31( 55 | arm_matrix_instance_q31 * S, 56 | uint16_t nRows, 57 | uint16_t nColumns, 58 | q31_t * pData) 59 | { 60 | /* Assign Number of Rows */ 61 | S->numRows = nRows; 62 | 63 | /* Assign Number of Columns */ 64 | S->numCols = nColumns; 65 | 66 | /* Assign Data pointer */ 67 | S->pData = pData; 68 | } 69 | 70 | /** 71 | @} end of MatrixInit group 72 | */ 73 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_entropy_f64.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_logsumexp_f64.c 6 | * Description: LogSumExp 7 | * 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | #include 31 | #include 32 | 33 | /** 34 | * @addtogroup groupStats 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @brief Entropy 40 | * 41 | * @param[in] pSrcA Array of input values. 42 | * @param[in] blockSize Number of samples in the input array. 43 | * @return Entropy -Sum(p ln p) 44 | * 45 | */ 46 | 47 | float64_t arm_entropy_f64(const float64_t * pSrcA, uint32_t blockSize) 48 | { 49 | const float64_t *pIn; 50 | uint32_t blkCnt; 51 | float64_t accum, p; 52 | 53 | pIn = pSrcA; 54 | blkCnt = blockSize; 55 | 56 | accum = 0.0f; 57 | 58 | while(blkCnt > 0) 59 | { 60 | p = *pIn++; 61 | 62 | accum += p * log(p); 63 | 64 | blkCnt--; 65 | 66 | } 67 | 68 | return(-accum); 69 | } 70 | 71 | /** 72 | * @} end of groupStats group 73 | */ 74 | 75 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 76 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_entropy_f64.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_logsumexp_f64.c 4 | * Description: LogSumExp 5 | * 6 | * 7 | * Target Processor: Cortex-M and Cortex-A cores 8 | * -------------------------------------------------------------------- */ 9 | /* 10 | * Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved. 11 | * 12 | * SPDX-License-Identifier: Apache-2.0 13 | * 14 | * Licensed under the Apache License, Version 2.0 (the License); you may 15 | * not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at 17 | * 18 | * www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | */ 26 | 27 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 28 | #include 29 | #include 30 | 31 | /** 32 | * @addtogroup groupStats 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Entropy 38 | * 39 | * @param[in] pSrcA Array of input values. 40 | * @param[in] blockSize Number of samples in the input array. 41 | * @return Entropy -Sum(p ln p) 42 | * 43 | */ 44 | 45 | float64_t arm_entropy_f64(const float64_t * pSrcA, uint32_t blockSize) 46 | { 47 | const float64_t *pIn; 48 | uint32_t blkCnt; 49 | float64_t accum, p; 50 | 51 | pIn = pSrcA; 52 | blkCnt = blockSize; 53 | 54 | accum = 0.0f; 55 | 56 | while(blkCnt > 0) 57 | { 58 | p = *pIn++; 59 | 60 | accum += p * log(p); 61 | 62 | blkCnt--; 63 | 64 | } 65 | 66 | return(-accum); 67 | } 68 | 69 | /** 70 | * @} end of groupStats group 71 | */ 72 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_kullback_leibler_f64.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_logsumexp_f64.c 6 | * Description: LogSumExp 7 | * 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | #include 31 | #include 32 | 33 | /** 34 | * @addtogroup groupStats 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @brief Kullback-Leibler 40 | * 41 | * @param[in] *pSrcA points to an array of input values for probaility distribution A. 42 | * @param[in] *pSrcB points to an array of input values for probaility distribution B. 43 | * @param[in] blockSize number of samples in the input array. 44 | * @return Kullback-Leibler divergence D(A || B) 45 | * 46 | */ 47 | 48 | float64_t arm_kullback_leibler_f64(const float64_t * pSrcA, const float64_t * pSrcB, uint32_t blockSize) 49 | { 50 | const float64_t *pInA, *pInB; 51 | uint32_t blkCnt; 52 | float64_t accum, pA,pB; 53 | 54 | pInA = pSrcA; 55 | pInB = pSrcB; 56 | blkCnt = blockSize; 57 | 58 | accum = 0.0f; 59 | 60 | while(blkCnt > 0) 61 | { 62 | pA = *pInA++; 63 | pB = *pInB++; 64 | 65 | accum += pA * log(pB / pA); 66 | 67 | blkCnt--; 68 | } 69 | 70 | return(-accum); 71 | } 72 | 73 | /** 74 | * @} end of groupStats group 75 | */ 76 | 77 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 78 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_kullback_leibler_f64.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_logsumexp_f64.c 4 | * Description: LogSumExp 5 | * 6 | * 7 | * Target Processor: Cortex-M and Cortex-A cores 8 | * -------------------------------------------------------------------- */ 9 | /* 10 | * Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved. 11 | * 12 | * SPDX-License-Identifier: Apache-2.0 13 | * 14 | * Licensed under the Apache License, Version 2.0 (the License); you may 15 | * not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at 17 | * 18 | * www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | */ 26 | 27 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 28 | #include 29 | #include 30 | 31 | /** 32 | * @addtogroup groupStats 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Kullback-Leibler 38 | * 39 | * @param[in] *pSrcA points to an array of input values for probaility distribution A. 40 | * @param[in] *pSrcB points to an array of input values for probaility distribution B. 41 | * @param[in] blockSize number of samples in the input array. 42 | * @return Kullback-Leibler divergence D(A || B) 43 | * 44 | */ 45 | 46 | float64_t arm_kullback_leibler_f64(const float64_t * pSrcA, const float64_t * pSrcB, uint32_t blockSize) 47 | { 48 | const float64_t *pInA, *pInB; 49 | uint32_t blkCnt; 50 | float64_t accum, pA,pB; 51 | 52 | pInA = pSrcA; 53 | pInB = pSrcB; 54 | blkCnt = blockSize; 55 | 56 | accum = 0.0f; 57 | 58 | while(blkCnt > 0) 59 | { 60 | pA = *pInA++; 61 | pB = *pInB++; 62 | 63 | accum += pA * log(pB / pA); 64 | 65 | blkCnt--; 66 | } 67 | 68 | return(-accum); 69 | } 70 | 71 | /** 72 | * @} end of groupStats group 73 | */ 74 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_logsumexp_dot_prod_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_logsumexp_f32.c 6 | * Description: LogSumExp 7 | * 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | #include 31 | #include 32 | 33 | 34 | /** 35 | * @addtogroup groupStats 36 | * @{ 37 | */ 38 | 39 | 40 | /** 41 | * @brief Dot product with log arithmetic 42 | * 43 | * Vectors are containing the log of the samples 44 | * 45 | * @param[in] *pSrcA points to the first input vector 46 | * @param[in] *pSrcB points to the second input vector 47 | * @param[in] blockSize number of samples in each vector 48 | * @param[in] *pTmpBuffer temporary buffer of length blockSize 49 | * @return The log of the dot product. 50 | * 51 | */ 52 | 53 | 54 | float32_t arm_logsumexp_dot_prod_f32(const float32_t * pSrcA, 55 | const float32_t * pSrcB, 56 | uint32_t blockSize, 57 | float32_t *pTmpBuffer) 58 | { 59 | float32_t result; 60 | arm_add_f32((float32_t*)pSrcA, (float32_t*)pSrcB, pTmpBuffer, blockSize); 61 | 62 | result = arm_logsumexp_f32(pTmpBuffer, blockSize); 63 | return(result); 64 | } 65 | 66 | /** 67 | * @} end of groupStats group 68 | */ 69 | 70 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 71 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_logsumexp_dot_prod_f32.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_logsumexp_f32.c 4 | * Description: LogSumExp 5 | * 6 | * 7 | * Target Processor: Cortex-M and Cortex-A cores 8 | * -------------------------------------------------------------------- */ 9 | /* 10 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 11 | * 12 | * SPDX-License-Identifier: Apache-2.0 13 | * 14 | * Licensed under the Apache License, Version 2.0 (the License); you may 15 | * not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at 17 | * 18 | * www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | */ 26 | 27 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 28 | #include 29 | #include 30 | 31 | 32 | /** 33 | * @addtogroup groupStats 34 | * @{ 35 | */ 36 | 37 | 38 | /** 39 | * @brief Dot product with log arithmetic 40 | * 41 | * Vectors are containing the log of the samples 42 | * 43 | * @param[in] *pSrcA points to the first input vector 44 | * @param[in] *pSrcB points to the second input vector 45 | * @param[in] blockSize number of samples in each vector 46 | * @param[in] *pTmpBuffer temporary buffer of length blockSize 47 | * @return The log of the dot product. 48 | * 49 | */ 50 | 51 | 52 | float32_t arm_logsumexp_dot_prod_f32(const float32_t * pSrcA, 53 | const float32_t * pSrcB, 54 | uint32_t blockSize, 55 | float32_t *pTmpBuffer) 56 | { 57 | float32_t result; 58 | arm_add_f32((float32_t*)pSrcA, (float32_t*)pSrcB, pTmpBuffer, blockSize); 59 | 60 | result = arm_logsumexp_f32(pTmpBuffer, blockSize); 61 | return(result); 62 | } 63 | 64 | /** 65 | * @} end of groupStats group 66 | */ 67 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/SupportFunctions/arm_merge_sort_init_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_merge_sort_init_f32.c 6 | * Description: Floating point merge sort initialization function 7 | * 8 | * $Date: 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M and Cortex-A cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | 33 | /** 34 | @ingroup groupSupport 35 | */ 36 | 37 | /** 38 | @addtogroup Sorting 39 | @{ 40 | */ 41 | 42 | 43 | /** 44 | * @param[in,out] S points to an instance of the sorting structure. 45 | * @param[in] dir Sorting order. 46 | * @param[in] buffer Working buffer. 47 | */ 48 | void arm_merge_sort_init_f32(arm_merge_sort_instance_f32 * S, arm_sort_dir dir, float32_t * buffer) 49 | { 50 | S->dir = dir; 51 | S->buffer = buffer; 52 | } 53 | /** 54 | @} end of Sorting group 55 | */ 56 | 57 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 58 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/SupportFunctions/arm_merge_sort_init_f32.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_merge_sort_init_f32.c 4 | * Description: Floating point merge sort initialization function 5 | * 6 | * $Date: 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup Sorting 37 | @{ 38 | */ 39 | 40 | 41 | /** 42 | * @param[in,out] S points to an instance of the sorting structure. 43 | * @param[in] dir Sorting order. 44 | * @param[in] buffer Working buffer. 45 | */ 46 | void arm_merge_sort_init_f32(arm_merge_sort_instance_f32 * S, arm_sort_dir dir, float32_t * buffer) 47 | { 48 | S->dir = dir; 49 | S->buffer = buffer; 50 | } 51 | /** 52 | @} end of Sorting group 53 | */ 54 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/SupportFunctions/arm_sort_init_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_sort_init_f32.c 6 | * Description: Floating point sort initialization function 7 | * 8 | * $Date: 2019 9 | * $Revision: V1.6.0 10 | * 11 | * Target Processor: Cortex-M and Cortex-A cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | #include "edge-impulse-sdk/CMSIS/DSP/PrivateInclude/arm_sorting.h" 33 | 34 | /** 35 | @ingroup groupSupport 36 | */ 37 | 38 | /** 39 | @addtogroup Sorting 40 | @{ 41 | */ 42 | 43 | 44 | /** 45 | * @param[in,out] S points to an instance of the sorting structure. 46 | * @param[in] alg Selected algorithm. 47 | * @param[in] dir Sorting order. 48 | */ 49 | void arm_sort_init_f32(arm_sort_instance_f32 * S, arm_sort_alg alg, arm_sort_dir dir) 50 | { 51 | S->alg = alg; 52 | S->dir = dir; 53 | } 54 | 55 | /** 56 | @} end of Sorting group 57 | */ 58 | 59 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 60 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/SupportFunctions/arm_sort_init_f32.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_sort_init_f32.c 4 | * Description: Floating point sort initialization function 5 | * 6 | * $Date: 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M and Cortex-A cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 30 | #include "edge-impulse-sdk/CMSIS/DSP/PrivateInclude/arm_sorting.h" 31 | 32 | /** 33 | @ingroup groupSupport 34 | */ 35 | 36 | /** 37 | @addtogroup Sorting 38 | @{ 39 | */ 40 | 41 | 42 | /** 43 | * @param[in,out] S points to an instance of the sorting structure. 44 | * @param[in] alg Selected algorithm. 45 | * @param[in] dir Sorting order. 46 | */ 47 | void arm_sort_init_f32(arm_sort_instance_f32 * S, arm_sort_alg alg, arm_sort_dir dir) 48 | { 49 | S->alg = alg; 50 | S->dir = dir; 51 | } 52 | 53 | /** 54 | @} end of Sorting group 55 | */ 56 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/TransformFunctionsF16.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: TransformFunctionsF16.c 6 | * Description: Combination of all transform function f16 source files. 7 | * 8 | * $Date: 20. April 2020 9 | * $Revision: V1.0.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "arm_cfft_f16.c" 32 | #include "arm_cfft_init_f16.c" 33 | #include "arm_cfft_radix2_f16.c" 34 | #include "arm_cfft_radix4_f16.c" 35 | 36 | 37 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 38 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/TransformFunctionsF16.c'': -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: TransformFunctionsF16.c 4 | * Description: Combination of all transform function f16 source files. 5 | * 6 | * $Date: 20. April 2020 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_cfft_f16.c" 30 | #include "arm_cfft_init_f16.c" 31 | #include "arm_cfft_radix2_f16.c" 32 | #include "arm_cfft_radix4_f16.c" 33 | 34 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/NN/Include/arm_nn_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS NN Library 3 | * Title: arm_nn_tables.h 4 | * Description: Extern declaration for NN tables 5 | * 6 | * $Date: 17. January 2018 7 | * $Revision: V.1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #ifndef _ARM_NN_TABLES_H 30 | #define _ARM_NN_TABLES_H 31 | 32 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 33 | 34 | /** 35 | * @brief tables for various activation functions 36 | * 37 | */ 38 | 39 | extern const q15_t sigmoidTable_q15[256]; 40 | extern const q7_t sigmoidTable_q7[256]; 41 | 42 | extern const q7_t tanhTable_q7[256]; 43 | extern const q15_t tanhTable_q15[256]; 44 | 45 | /** 46 | * @brief 2-way tables for various activation functions 47 | * 48 | * 2-way table, H table for value larger than 1/4 49 | * L table for value smaller than 1/4, H table for remaining 50 | * We have this only for the q15_t version. It does not make 51 | * sense to have it for q7_t type 52 | */ 53 | extern const q15_t sigmoidHTable_q15[192]; 54 | extern const q15_t sigmoidLTable_q15[128]; 55 | 56 | #endif /* ARM_NN_TABLES_H */ 57 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/NN/Source/ActivationFunctions/arm_relu6_s8.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_relu6_s8.c 22 | * Description: Basic s8 version of ReLU6 23 | * 24 | * $Date: Spetember 2019 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h" 32 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 33 | 34 | /** 35 | * @ingroup groupNN 36 | */ 37 | 38 | /** 39 | * @addtogroup Acti 40 | * @{ 41 | */ 42 | 43 | /* 44 | * Basic ReLU6 function 45 | * 46 | * Refer to header file for details. 47 | * 48 | */ 49 | 50 | void arm_relu6_s8(q7_t *data, uint16_t size) 51 | { 52 | int32_t i; 53 | 54 | for (i = 0; i < size; i++) 55 | { 56 | int32_t ip = data[i]; 57 | 58 | ip = MAX(ip, 0); 59 | data[i] = MIN(ip, 6); 60 | } 61 | } 62 | 63 | /** 64 | * @} end of Acti group 65 | */ 66 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/NN/Source/ConcatenationFunctions/arm_concatenation_s8_w.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_concatenation_s8_w.c 22 | * Description: s8 version of concatenation along the W axis 23 | * 24 | * $Date: October 2019 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 32 | 33 | /** 34 | * @ingroup groupNN 35 | */ 36 | 37 | /** 38 | * @addtogroup Concatenation 39 | * @{ 40 | */ 41 | 42 | /* 43 | * s8 version of concatenation along the W axis 44 | * 45 | * Refer to header file for details. 46 | * 47 | */ 48 | void arm_concatenation_s8_w(const int8_t *input, 49 | const uint16_t input_x, 50 | const uint16_t input_y, 51 | const uint16_t input_z, 52 | const uint16_t input_w, 53 | int8_t *output, 54 | const uint32_t offset_w) 55 | { 56 | const uint32_t input_copy_size = input_x * input_y * input_z * input_w; 57 | 58 | output += offset_w * (input_x * input_y * input_z); 59 | 60 | memcpy(output, input, input_copy_size); 61 | } 62 | 63 | /** 64 | * @} end of Concatenation group 65 | */ 66 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/NN/Source/ConcatenationFunctions/arm_concatenation_s8_x.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_concatenation_s8_x.c 22 | * Description: s8 version of concatenation along the X axis 23 | * 24 | * $Date: October 2019 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 32 | 33 | /** 34 | * @ingroup groupNN 35 | */ 36 | 37 | /** 38 | * @addtogroup Concatenation 39 | * @{ 40 | */ 41 | 42 | /* 43 | * s8 version of concatenation along the X axis 44 | * 45 | * Refer to header file for details. 46 | * 47 | */ 48 | void arm_concatenation_s8_x(const int8_t *input, 49 | const uint16_t input_x, 50 | const uint16_t input_y, 51 | const uint16_t input_z, 52 | const uint16_t input_w, 53 | int8_t *output, 54 | const uint16_t output_x, 55 | const uint32_t offset_x) 56 | { 57 | const uint32_t num_iterations = input_y * input_z * input_w; 58 | 59 | output += offset_x; 60 | 61 | uint32_t i; 62 | 63 | // Copy per row 64 | for (i = 0; i < num_iterations; ++i) 65 | { 66 | memcpy(output, input, input_x); 67 | input += input_x; 68 | output += output_x; 69 | } 70 | } 71 | 72 | /** 73 | * @} end of Concatenation group 74 | */ 75 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/NN/Source/ReshapeFunctions/arm_reshape_s8.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_reshape_s8.c 22 | * Description: Reshape a s8 vector 23 | * 24 | * $Date: September 2019 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 32 | 33 | /** 34 | * @ingroup groupNN 35 | */ 36 | 37 | /** 38 | * @addtogroup Reshape 39 | * @{ 40 | */ 41 | 42 | /** 43 | * Basic s8 reshape function. 44 | * 45 | * Refer header file for details. 46 | * 47 | */ 48 | 49 | void arm_reshape_s8(const int8_t *input, 50 | int8_t *output, 51 | const uint32_t total_size) 52 | { 53 | memcpy(output, input, total_size); 54 | } 55 | 56 | /** 57 | * @} end of Reshape group 58 | */ 59 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/CMSIS/sources.txt: -------------------------------------------------------------------------------- 1 | Created by update_tflite.sh 2 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/LICENSE: -------------------------------------------------------------------------------- 1 | Unless specifically indicated otherwise in a file, files are licensed under the Apache 2.0 license, as can be found in: LICENSE-apache-2.0.txt 2 | 3 | Folders containing files under different permissive license than Apache 2.0 are listed below. Each folder contains its own license specified for its files. 4 | 5 | * CMSIS - Apache 2.0 6 | * dsp/kissfft - BSD-3-Clause 7 | * dsp/dct - MIT 8 | * tensorflow - Apache 2.0 9 | * third_party/flatbuffers - Apache 2.0 10 | * third_party/gemmlowp - Apache 2.0 11 | * utensor - Apache 2.0 12 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/README.md: -------------------------------------------------------------------------------- 1 | # Edge Impulse DSP and Inferencing SDK 2 | 3 | Portable library for digital signal processing and machine learning inferencing. This repository contains the device implementation in C++ for both processing and learning blocks in [Edge Impulse](https://www.edgeimpulse.com). 4 | 5 | [Documentation](https://docs.edgeimpulse.com/reference#inferencing-sdk) 6 | 7 | ## Develop locally 8 | 9 | If you want to develop locally the easiest is to grab the [example-standalone-inferencing](https://github.com/edgeimpulse/example-standalone-inferencing) (Desktop) or [example-standalone-inferencing-mbed](https://github.com/edgeimpulse/example-standalone-inferencing-mbed) (ST IoT Discovery Kit, f.e. to test CMSIS-DSP / CMSIS-NN integration) example applications, add your Edge Impulse project (use the C++ Library export option), then symlink this repository in. 10 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/classifier/ei_classifier_types.h: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EDGE_IMPULSE_RUN_CLASSIFIER_TYPES_H_ 24 | #define _EDGE_IMPULSE_RUN_CLASSIFIER_TYPES_H_ 25 | 26 | #include 27 | #include "model-parameters/model_metadata.h" 28 | 29 | typedef struct { 30 | const char *label; 31 | float value; 32 | } ei_impulse_result_classification_t; 33 | 34 | typedef struct { 35 | int sampling; 36 | int dsp; 37 | int classification; 38 | int anomaly; 39 | } ei_impulse_result_timing_t; 40 | 41 | typedef struct { 42 | ei_impulse_result_classification_t classification[EI_CLASSIFIER_LABEL_COUNT]; 43 | float anomaly; 44 | ei_impulse_result_timing_t timing; 45 | } ei_impulse_result_t; 46 | 47 | typedef struct { 48 | uint32_t buf_idx; 49 | float running_sum; 50 | float maf_buffer[EI_CLASSIFIER_SLICES_PER_MODEL_WINDOW >> 1]; 51 | }ei_impulse_maf; 52 | 53 | #endif // _EDGE_IMPULSE_RUN_CLASSIFIER_TYPES_H_ 54 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/classifier/ei_model_types.h: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EDGE_IMPULSE_MODEL_TYPES_H_ 24 | #define _EDGE_IMPULSE_MODEL_TYPES_H_ 25 | 26 | #include 27 | #include "edge-impulse-sdk/dsp/numpy.hpp" 28 | 29 | typedef struct { 30 | size_t n_output_features; 31 | int (*extract_fn)(ei::signal_t *signal, ei::matrix_t *output_matrix, void *config, const float frequency); 32 | void *config; 33 | } ei_model_dsp_t; 34 | 35 | #endif // _EDGE_IMPULSE_MODEL_TYPES_H_ 36 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/classifier/ei_run_classifier_image.h: -------------------------------------------------------------------------------- 1 | #ifndef _EDGE_IMPULSE_RUN_CLASSIFIER_IMAGE_H_ 2 | #define _EDGE_IMPULSE_RUN_CLASSIFIER_IMAGE_H_ 3 | 4 | #include "ei_run_classifier.h" 5 | 6 | 7 | 8 | #endif // _EDGE_IMPULSE_RUN_CLASSIFIER_IMAGE_H_ 9 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/cmake/zephyr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13.1) 2 | 3 | set(CMAKE_CXX_STANDARD 11) 4 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 5 | 6 | set(EI_SDK_FOLDER ../../) 7 | 8 | include(${EI_SDK_FOLDER}/cmake/utils.cmake) 9 | 10 | target_include_directories(app PRIVATE 11 | ${EI_SDK_FOLDER} 12 | ${EI_SDK_FOLDER}/third_party/ruy 13 | ${EI_SDK_FOLDER}/third_party/gemmlowp 14 | ${EI_SDK_FOLDER}/third_party/flatbuffers/include 15 | ${EI_SDK_FOLDER}/third_party 16 | ${EI_SDK_FOLDER}/tensorflow 17 | ${EI_SDK_FOLDER}/dsp 18 | ${EI_SDK_FOLDER}/classifier 19 | ${EI_SDK_FOLDER}/anomaly 20 | ${EI_SDK_FOLDER}/CMSIS/NN/Include 21 | ${EI_SDK_FOLDER}/CMSIS/DSP/PrivateInclude 22 | ${EI_SDK_FOLDER}/CMSIS/DSP/Include 23 | ${EI_SDK_FOLDER}/CMSIS/Core/Include 24 | ) 25 | 26 | RECURSIVE_FIND_FILE(SOURCE_FILES "${EI_SDK_FOLDER}" "*.cpp") 27 | RECURSIVE_FIND_FILE(CC_FILES "${EI_SDK_FOLDER}" "*.cc") 28 | RECURSIVE_FIND_FILE(S_FILES "${EI_SDK_FOLDER}" "*.s") 29 | RECURSIVE_FIND_FILE(C_FILES "${EI_SDK_FOLDER}" "*.c") 30 | list(APPEND SOURCE_FILES ${S_FILES}) 31 | list(APPEND SOURCE_FILES ${C_FILES}) 32 | list(APPEND SOURCE_FILES ${CC_FILES}) 33 | 34 | target_sources(app PRIVATE ${SOURCE_FILES}) 35 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/dsp/dct/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 Project Nayuki. (MIT License) 2 | https://www.nayuki.io/page/fast-discrete-cosine-transform-algorithms 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8 | the Software, and to permit persons to whom the Software is furnished to do so, 9 | subject to the following conditions: 10 | - The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | - The Software is provided "as is", without warranty of any kind, express or 13 | implied, including but not limited to the warranties of merchantability, 14 | fitness for a particular purpose and noninfringement. In no event shall the 15 | authors or copyright holders be liable for any claim, damages or other 16 | liability, whether in an action of contract, tort or otherwise, arising from, 17 | out of or in connection with the Software or the use or other dealings in the 18 | Software. 19 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/dsp/dct/README.md: -------------------------------------------------------------------------------- 1 | # Fast discrete cosine transform algorithms (C) 2 | 3 | DCT type 2 and type 3 algorithms based on https://www.nayuki.io/page/fast-discrete-cosine-transform-algorithms. These are modified to use KissFFT or hardware accelerated RFFT support with CMSIS-DSP. 4 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/dsp/dct/fast-dct-fft.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Fast discrete cosine transform algorithms (C) 3 | * 4 | * Copyright (c) 2018 Project Nayuki. (MIT License) 5 | * https://www.nayuki.io/page/fast-discrete-cosine-transform-algorithms 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | * the Software, and to permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * - The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * - The Software is provided "as is", without warranty of any kind, express or 16 | * implied, including but not limited to the warranties of merchantability, 17 | * fitness for a particular purpose and noninfringement. In no event shall the 18 | * authors or copyright holders be liable for any claim, damages or other 19 | * liability, whether in an action of contract, tort or otherwise, arising from, 20 | * out of or in connection with the Software or the use or other dealings in the 21 | * Software. 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include "../kissfft/kiss_fft.h" 29 | 30 | namespace ei { 31 | namespace dct { 32 | 33 | int transform(float vector[], size_t len); 34 | int inverse_transform(float vector[], size_t len); 35 | 36 | } // namespace dct 37 | } // namespace ei 38 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/dsp/kissfft/LICENSE: -------------------------------------------------------------------------------- 1 | Revised BSD License, see COPYING for verbiage. 2 | Basically, "free to use&change, give credit where due, no guarantees" 3 | Note this license is compatible with GPL at one end of the spectrum and closed, commercial software at 4 | the other end. See http://www.fsf.org/licensing/licenses 5 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/dsp/kissfft/README.md: -------------------------------------------------------------------------------- 1 | # KissFFT 2 | 3 | Software FFT library used for devices that do not have hardware accelerated RFFT, or where we want to use mixed-radix FFT. Based off of https://github.com/mborgerding/kissfft. 4 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/dsp/kissfft/kiss_fftr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2004, Mark Borgerding. All rights reserved. 3 | * This file is part of KISS FFT - https://github.com/mborgerding/kissfft 4 | * 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | * See COPYING file for more information. 7 | */ 8 | 9 | #ifndef KISS_FTR_H 10 | #define KISS_FTR_H 11 | 12 | #include "kiss_fft.h" 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | 18 | /* 19 | 20 | Real optimized version can save about 45% cpu time vs. complex fft of a real seq. 21 | 22 | 23 | 24 | */ 25 | 26 | typedef struct kiss_fftr_state *kiss_fftr_cfg; 27 | 28 | 29 | kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem, size_t * memallocated = NULL); 30 | /* 31 | nfft must be even 32 | 33 | If you don't care to allocate space, use mem = lenmem = NULL 34 | */ 35 | 36 | 37 | void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata); 38 | /* 39 | input timedata has nfft scalar points 40 | output freqdata has nfft/2+1 complex points 41 | */ 42 | 43 | void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata); 44 | /* 45 | input freqdata has nfft/2+1 complex points 46 | output timedata has nfft scalar points 47 | */ 48 | 49 | #define kiss_fftr_free KISS_FFT_FREE 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | #endif 55 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/dsp/memory.cpp: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #include "memory.hpp" 24 | 25 | size_t ei_memory_in_use = 0; 26 | size_t ei_memory_peak_use = 0; 27 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/dsp/returntypes.hpp: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EIDSP_RETURN_TYPES_H_ 24 | #define _EIDSP_RETURN_TYPES_H_ 25 | 26 | #include 27 | 28 | namespace ei { 29 | 30 | typedef enum { 31 | EIDSP_OK = 0, 32 | EIDSP_OUT_OF_MEM = -1002, 33 | EIDSP_SIGNAL_SIZE_MISMATCH = -1003, 34 | EIDSP_MATRIX_SIZE_MISMATCH = -1004, 35 | EIDSP_DCT_ERROR = -1005, 36 | EIDSP_INPUT_MATRIX_EMPTY = -1006, 37 | EIDSP_BUFFER_SIZE_MISMATCH = -1007, 38 | EIDSP_PARAMETER_INVALID = -1008, 39 | EIDSP_UNEXPECTED_NEXT_OFFSET = -1009, 40 | EIDSP_OUT_OF_BOUNDS = -1010, 41 | EIDSP_UNSUPPORTED_FILTER_CONFIG = -1011, 42 | EIDSP_NARROWING = -1012 43 | } EIDSP_RETURN_T; 44 | 45 | } // namespace ei 46 | 47 | #endif // _EIDSP_RETURN_TYPES_H_ 48 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/dsp/spectral/spectral.hpp: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EIDSP_SPECTRAL_SPECTRAL_H_ 24 | #define _EIDSP_SPECTRAL_SPECTRAL_H_ 25 | 26 | #include "../config.hpp" 27 | #include "processing.hpp" 28 | #include "feature.hpp" 29 | 30 | #endif // _EIDSP_SPECTRAL_SPECTRAL_H_ 31 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/dsp/speechpy/speechpy.hpp: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EIDSP_SPEECHPY_SPEECHPY_H_ 24 | #define _EIDSP_SPEECHPY_SPEECHPY_H_ 25 | 26 | #include "../config.hpp" 27 | #include "feature.hpp" 28 | #include "functions.hpp" 29 | #include "processing.hpp" 30 | 31 | #endif // _EIDSP_SPEECHPY_SPEECHPY_H_ 32 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/porting/arduino/debug_log.cpp: -------------------------------------------------------------------------------- 1 | /* Edge Impulse inferencing library 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #include "../ei_classifier_porting.h" 24 | #if EI_PORTING_ARDUINO == 1 25 | 26 | // #include "edge-impulse-sdk/tensorflow/lite/micro/debug_log.h" 27 | #include 28 | #include 29 | 30 | // On mbed platforms, we set up a serial port and write to it for debug logging. 31 | #if defined(__cplusplus) && EI_C_LINKAGE == 1 32 | extern "C" 33 | #endif // defined(__cplusplus) && EI_C_LINKAGE == 1 34 | void DebugLog(const char* s) { 35 | ei_printf("%s", s); 36 | } 37 | 38 | #endif // EI_PORTING_ARDUINO 39 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/sources.txt: -------------------------------------------------------------------------------- 1 | tensorflow and third_party folders based on: https://github.com/tensorflow/tensorflow/#c903b4607821a03c36c17b0befa2535c7dd0e066 2 | TensorFlow source was prepared using `make -f tensorflow/lite/micro/tools/make/Makefile generate_projects` 3 | The folders were taken from `tensorflow/lite/micro/tools/make/gen/osx_x86_64/prj/hello_world/make` 4 | These files and directories were then deleted: 5 | - `tensorflow/lite/micro/debug_log.cc` 6 | - `tensorflow/lite/micro/examples/hello_world` 7 | CMSIS-DSP based on: https://github.com/ARM-software/CMSIS_5/tree/4d378e81968c6bec5441a42885b24db7cf189bca 8 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 16 | #include 17 | 18 | namespace tflite { 19 | 20 | int ErrorReporter::Report(const char* format, ...) { 21 | va_list args; 22 | va_start(args, format); 23 | int code = Report(format, args); 24 | va_end(args); 25 | return code; 26 | } 27 | 28 | // TODO(aselle): Make the name of ReportError on context the same, so 29 | // we can use the ensure functions w/o a context and w/ a reporter. 30 | int ErrorReporter::ReportError(void*, const char* format, ...) { 31 | va_list args; 32 | va_start(args, format); 33 | int code = Report(format, args); 34 | va_end(args); 35 | return code; 36 | } 37 | 38 | } // namespace tflite 39 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/core/api/op_resolver.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_CORE_API_OP_RESOLVER_H_ 16 | #define TENSORFLOW_LITE_CORE_API_OP_RESOLVER_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/schema/schema_generated.h" 21 | 22 | namespace tflite { 23 | 24 | /// Abstract interface that returns TfLiteRegistrations given op codes or custom 25 | /// op names. This is the mechanism that ops being referenced in the flatbuffer 26 | /// model are mapped to executable function pointers (TfLiteRegistrations). 27 | class OpResolver { 28 | public: 29 | /// Finds the op registration for a builtin operator by enum code. 30 | virtual const TfLiteRegistration* FindOp(tflite::BuiltinOperator op, 31 | int version) const = 0; 32 | /// Finds the op registration of a custom operator by op name. 33 | virtual const TfLiteRegistration* FindOp(const char* op, 34 | int version) const = 0; 35 | virtual ~OpResolver() {} 36 | }; 37 | 38 | // Handles the logic for converting between an OperatorCode structure extracted 39 | // from a flatbuffer and information about a registered operator 40 | // implementation. 41 | TfLiteStatus GetRegistrationFromOpCode(const OperatorCode* opcode, 42 | const OpResolver& op_resolver, 43 | ErrorReporter* error_reporter, 44 | const TfLiteRegistration** registration); 45 | 46 | } // namespace tflite 47 | 48 | #endif // TENSORFLOW_LITE_CORE_API_OP_RESOLVER_H_ 49 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/core/api/tensor_utils.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/core/api/tensor_utils.h" 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 21 | 22 | namespace tflite { 23 | 24 | TfLiteStatus ResetVariableTensor(TfLiteTensor* tensor) { 25 | if (!tensor->is_variable) { 26 | return kTfLiteOk; 27 | } 28 | // TODO(b/115961645): Implement - If a variable tensor has a buffer, reset it 29 | // to the value of the buffer. 30 | int value = 0; 31 | if (tensor->type == kTfLiteInt8) { 32 | value = tensor->params.zero_point; 33 | } 34 | // TODO(b/139446230): Provide a platform header to better handle these 35 | // specific scenarios. 36 | #if __ANDROID__ || defined(__x86_64__) || defined(__i386__) || \ 37 | defined(__i386) || defined(__x86__) || defined(__X86__) || \ 38 | defined(_X86_) || defined(_M_IX86) || defined(_M_X64) 39 | memset(tensor->data.raw, value, tensor->bytes); 40 | #else 41 | char* raw_ptr = tensor->data.raw; 42 | for (size_t i = 0; i < tensor->bytes; ++i) { 43 | *raw_ptr = value; 44 | raw_ptr++; 45 | } 46 | #endif 47 | return kTfLiteOk; 48 | } 49 | 50 | } // namespace tflite 51 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/core/api/tensor_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_CORE_API_TENSOR_UTILS_H_ 17 | #define TENSORFLOW_LITE_CORE_API_TENSOR_UTILS_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 20 | 21 | namespace tflite { 22 | 23 | // Resets a variable tensor to the default value. 24 | TfLiteStatus ResetVariableTensor(TfLiteTensor* tensor); 25 | 26 | } // namespace tflite 27 | 28 | #endif // TENSORFLOW_LITE_CORE_API_TENSOR_UTILS_H_ 29 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/kernels/internal/cppmath.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | #if defined(TF_LITE_USE_GLOBAL_CMATH_FUNCTIONS) || \ 23 | (defined(__ANDROID__) && !defined(__NDK_MAJOR__)) || defined(ARDUINO) || \ 24 | defined(__ZEPHYR__) 25 | #define TF_LITE_GLOBAL_STD_PREFIX 26 | #else 27 | #define TF_LITE_GLOBAL_STD_PREFIX std 28 | #endif 29 | 30 | #define DECLARE_STD_GLOBAL_SWITCH1(tf_name, std_name) \ 31 | template \ 32 | inline T tf_name(const T x) { \ 33 | return TF_LITE_GLOBAL_STD_PREFIX::std_name(x); \ 34 | } 35 | 36 | DECLARE_STD_GLOBAL_SWITCH1(TfLiteRound, round); 37 | 38 | } // namespace tflite 39 | 40 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_ 41 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/kernels/internal/max.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | // Patched by Edge Impulse, remove std::fmax 23 | template 24 | inline T TfLiteMax(const T& x, const T& y) { 25 | return std::max(x, y); 26 | } 27 | 28 | } // namespace tflite 29 | 30 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_ 31 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/kernels/internal/min.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | // Patched by Edge Impulse, remove std::fmin 23 | template 24 | inline T TfLiteMin(const T& x, const T& y) { 25 | return std::min(x, y); 26 | } 27 | 28 | } // namespace tflite 29 | 30 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_ 31 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/kernels/internal/optimized/neon_check.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_ 17 | 18 | #if defined(__ARM_NEON__) || defined(__ARM_NEON) 19 | #define USE_NEON 20 | #include 21 | #endif 22 | 23 | #if defined __GNUC__ && defined __SSE4_1__ && !defined TF_LITE_DISABLE_X86_NEON 24 | #define USE_NEON 25 | #include "NEON_2_SSE.h" 26 | #endif 27 | 28 | // NEON_OR_PORTABLE(SomeFunc, args) calls NeonSomeFunc(args) if USE_NEON is 29 | // defined, PortableSomeFunc(args) otherwise. 30 | #ifdef USE_NEON 31 | // Always use Neon code 32 | #define NEON_OR_PORTABLE(funcname, ...) Neon##funcname(__VA_ARGS__) 33 | 34 | #else 35 | // No NEON available: Use Portable code 36 | #define NEON_OR_PORTABLE(funcname, ...) Portable##funcname(__VA_ARGS__) 37 | 38 | #endif // defined(USE_NEON) 39 | 40 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_ 41 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/ceil.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CEIL_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CEIL_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 21 | 22 | namespace tflite { 23 | 24 | namespace reference_ops { 25 | 26 | inline void Ceil(const RuntimeShape& input_shape, const float* input_data, 27 | const RuntimeShape& output_shape, float* output_data) { 28 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 29 | 30 | for (int i = 0; i < flat_size; ++i) { 31 | output_data[i] = std::ceil(input_data[i]); 32 | } 33 | } 34 | 35 | } // namespace reference_ops 36 | } // namespace tflite 37 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CEIL_H_ 38 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/floor.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 21 | 22 | namespace tflite { 23 | 24 | namespace reference_ops { 25 | 26 | inline void Floor(const RuntimeShape& input_shape, const float* input_data, 27 | const RuntimeShape& output_shape, float* output_data) { 28 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 29 | 30 | for (int i = 0; i < flat_size; i++) { 31 | int offset = i; 32 | output_data[offset] = std::floor(input_data[offset]); 33 | } 34 | } 35 | 36 | } // namespace reference_ops 37 | } // namespace tflite 38 | 39 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ 40 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/neg.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NEG_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NEG_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 19 | 20 | namespace tflite { 21 | 22 | namespace reference_ops { 23 | 24 | template 25 | inline void Negate(const RuntimeShape& input_shape, const T* input_data, 26 | const RuntimeShape& output_shape, T* output_data) { 27 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 28 | 29 | for (int i = 0; i < flat_size; ++i) { 30 | output_data[i] = -input_data[i]; 31 | } 32 | } 33 | 34 | } // namespace reference_ops 35 | } // namespace tflite 36 | 37 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NEG_H_ 38 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/round.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ROUND_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ROUND_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 21 | 22 | namespace tflite { 23 | 24 | namespace reference_ops { 25 | 26 | inline float RoundToNearest(float value) { 27 | auto floor_val = std::floor(value); 28 | auto diff = value - floor_val; 29 | if ((diff < 0.5f) || 30 | ((diff == 0.5f) && (static_cast(floor_val) % 2 == 0))) { 31 | return floor_val; 32 | } else { 33 | return floor_val = floor_val + 1.0f; 34 | } 35 | } 36 | 37 | inline void Round(const RuntimeShape& input_shape, const float* input_data, 38 | const RuntimeShape& output_shape, float* output_data) { 39 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 40 | for (int i = 0; i < flat_size; ++i) { 41 | // Note that this implementation matches that of tensorFlow tf.round 42 | // and corresponds to the bankers rounding method. 43 | // cfenv (for fesetround) is not yet supported universally on Android, so 44 | // using a work around. 45 | output_data[i] = RoundToNearest(input_data[i]); 46 | } 47 | } 48 | 49 | } // namespace reference_ops 50 | } // namespace tflite 51 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ROUND_H_ 52 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 20 | 21 | namespace tflite { 22 | 23 | template 24 | inline T* GetTensorData(TfLiteTensor* tensor) { 25 | return tensor != nullptr ? reinterpret_cast(tensor->data.raw) : nullptr; 26 | } 27 | 28 | template 29 | inline const T* GetTensorData(const TfLiteTensor* tensor) { 30 | return tensor != nullptr ? reinterpret_cast(tensor->data.raw) 31 | : nullptr; 32 | } 33 | 34 | inline RuntimeShape GetTensorShape(const TfLiteTensor* tensor) { 35 | if (tensor == nullptr) { 36 | return RuntimeShape(); 37 | } 38 | 39 | TfLiteIntArray* dims = tensor->dims; 40 | const int dims_size = dims->size; 41 | const int32_t* dims_data = reinterpret_cast(dims->data); 42 | return RuntimeShape(dims_size, dims_data); 43 | } 44 | 45 | } // namespace tflite 46 | 47 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_ 48 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/all_ops_resolver.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software 7 | distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | See the License for the specific language governing permissions and 10 | limitations under the License. 11 | ==============================================================================*/ 12 | #ifndef TENSORFLOW_LITE_MICRO_ALL_OPS_RESOLVER_H_ 13 | #define TENSORFLOW_LITE_MICRO_ALL_OPS_RESOLVER_H_ 14 | 15 | #include "edge-impulse-sdk/tensorflow/lite/micro/compatibility.h" 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_mutable_op_resolver.h" 17 | 18 | namespace tflite { 19 | 20 | // The magic number in the template parameter is the maximum number of ops that 21 | // can be added to AllOpsResolver. It can be increased if needed. And most 22 | // applications that care about the memory footprint will want to directly use 23 | // MicroMutableOpResolver and have an application specific template parameter. 24 | // The examples directory has sample code for this. 25 | class AllOpsResolver : public MicroMutableOpResolver<128> { 26 | public: 27 | AllOpsResolver(); 28 | 29 | private: 30 | TF_LITE_REMOVE_VIRTUAL_DELETE 31 | }; 32 | 33 | } // namespace tflite 34 | 35 | #endif // TENSORFLOW_LITE_MICRO_ALL_OPS_RESOLVER_H_ 36 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/compatibility.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_ 16 | #define TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_ 17 | 18 | // C++ will automatically create class-specific delete operators for virtual 19 | // objects, which by default call the global delete function. For embedded 20 | // applications we want to avoid this, and won't be calling new/delete on these 21 | // objects, so we need to override the default implementation with one that does 22 | // nothing to avoid linking in ::delete(). 23 | // This macro needs to be included in all subclasses of a virtual base class in 24 | // the private section. 25 | #ifdef TF_LITE_STATIC_MEMORY 26 | #define TF_LITE_REMOVE_VIRTUAL_DELETE \ 27 | void operator delete(void* p) {} 28 | #else 29 | #define TF_LITE_REMOVE_VIRTUAL_DELETE 30 | #endif 31 | 32 | #endif // TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_ 33 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/debug_log.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_ 16 | #define TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_ 17 | 18 | // This function should be implemented by each target platform, and provide a 19 | // way for strings to be output to some text stream. For more information, see 20 | // tensorflow/lite/micro/debug_log.cc. 21 | #if defined(__cplusplus) && EI_C_LINKAGE == 1 22 | extern "C" void DebugLog(const char* s); 23 | #else 24 | void DebugLog(const char* s); 25 | #endif // defined(__cplusplus) && EI_C_LINKAGE == 1 26 | 27 | #endif // TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_ 28 | 29 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/kernels/activation_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_ACTIVATION_UTILS_H_ 17 | #define TENSORFLOW_LITE_MICRO_KERNELS_ACTIVATION_UTILS_H_ 18 | 19 | #include 20 | #include 21 | 22 | #include "edge-impulse-sdk/tensorflow/lite/c/builtin_op_data.h" 23 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/cppmath.h" 24 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/max.h" 25 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/min.h" 26 | 27 | namespace tflite { 28 | namespace ops { 29 | namespace micro { 30 | 31 | // Returns the floating point value for a fused activation: 32 | inline float ActivationValFloat(TfLiteFusedActivation act, float a) { 33 | switch (act) { 34 | case kTfLiteActNone: 35 | return a; 36 | case kTfLiteActRelu: 37 | return TfLiteMax(0.0f, a); 38 | case kTfLiteActReluN1To1: 39 | return TfLiteMax(-1.0f, TfLiteMin(a, 1.0f)); 40 | case kTfLiteActRelu6: 41 | return TfLiteMax(0.0f, TfLiteMin(a, 6.0f)); 42 | case kTfLiteActTanh: 43 | return std::tanh(a); 44 | case kTfLiteActSignBit: 45 | return std::signbit(a); 46 | case kTfLiteActSigmoid: 47 | return 1.0f / (1.0f + std::exp(-a)); 48 | } 49 | return 0.0f; // To indicate an unsupported activation (i.e. when a new fused 50 | // activation is added to the enum and not handled here). 51 | } 52 | 53 | } // namespace micro 54 | } // namespace ops 55 | } // namespace tflite 56 | 57 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_ACTIVATION_UTILS_H_ 58 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/kernels/ethosu.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | // 17 | // This is a stub file for non-Ethos platforms 18 | // 19 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 20 | 21 | namespace tflite { 22 | namespace ops { 23 | namespace micro { 24 | namespace custom { 25 | TfLiteRegistration* Register_ETHOSU() { return nullptr; } 26 | 27 | const char* GetString_ETHOSU() { return ""; } 28 | 29 | } // namespace custom 30 | } // namespace micro 31 | } // namespace ops 32 | } // namespace tflite 33 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/kernels/floor.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/floor.h" 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/kernel_util.h" 21 | 22 | namespace tflite { 23 | namespace ops { 24 | namespace micro { 25 | namespace floor { 26 | 27 | constexpr int kInputTensor = 0; 28 | constexpr int kOutputTensor = 0; 29 | 30 | TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { 31 | const TfLiteTensor* input = GetInput(context, node, kInputTensor); 32 | TF_LITE_ENSURE_TYPES_EQ(context, input->type, kTfLiteFloat32); 33 | TfLiteTensor* output = GetOutput(context, node, kOutputTensor); 34 | reference_ops::Floor(GetTensorShape(input), GetTensorData(input), 35 | GetTensorShape(output), GetTensorData(output)); 36 | return kTfLiteOk; 37 | } 38 | } // namespace floor 39 | 40 | TfLiteRegistration* Register_FLOOR() { 41 | static TfLiteRegistration r = {/*init=*/nullptr, 42 | /*free=*/nullptr, 43 | /*prepare=*/nullptr, 44 | /*invoke=*/floor::Eval, 45 | /*profiling_string=*/nullptr, 46 | /*builtin_code=*/0, 47 | /*custom_name=*/nullptr, 48 | /*version=*/0}; 49 | return &r; 50 | } 51 | 52 | } // namespace micro 53 | } // namespace ops 54 | } // namespace tflite 55 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/kernels/micro_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software 7 | distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | See the License for the specific language governing permissions and 10 | limitations under the License. 11 | ==============================================================================*/ 12 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_MICRO_UTILS_H_ 13 | #define TENSORFLOW_LITE_MICRO_KERNELS_MICRO_UTILS_H_ 14 | namespace tflite { 15 | namespace ops { 16 | namespace micro { 17 | 18 | // Same as gtl::Greater but defined here to reduce dependencies and 19 | // binary size for micro environment. 20 | struct Greater { 21 | template 22 | bool operator()(const T& x, const T& y) const { 23 | return x > y; 24 | } 25 | }; 26 | 27 | struct Less { 28 | template 29 | bool operator()(const T& x, const T& y) const { 30 | return x < y; 31 | } 32 | }; 33 | 34 | } // namespace micro 35 | } // namespace ops 36 | } // namespace tflite 37 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_MICRO_UTILS_H_ 38 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/kernels/mli_slicers.h: -------------------------------------------------------------------------------- 1 | // Patched by Edge Impulse to include reference, CMSIS-NN and ARC kernels 2 | #include "../../../../classifier/ei_classifier_config.h" 3 | #if EI_CLASSIFIER_TFLITE_ENABLE_ARC == 1 4 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | ==============================================================================*/ 18 | 19 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_SLICERS_H_ 20 | #define TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_SLICERS_H_ 21 | 22 | #include "mli_api.h" // NOLINT 23 | namespace tflite { 24 | namespace ops { 25 | namespace micro { 26 | 27 | class TensorSlicer { 28 | public: 29 | TensorSlicer(const mli_tensor* full_tensor, int slice_dim, int slice_size, 30 | int padding_pre = 0, int padding_post = 0, int overlap = 0, 31 | bool interleave_mode = false); 32 | ~TensorSlicer() = default; 33 | 34 | void Next(); 35 | bool Done(); 36 | int GetPaddingPre(); 37 | int GetPaddingPost(); 38 | 39 | mli_tensor* Sub(); 40 | 41 | // Default constructor is deleted 42 | TensorSlicer() = delete; 43 | 44 | private: 45 | const mli_tensor* full_tensor_; 46 | mli_tensor sub_tensor_; 47 | mli_sub_tensor_cfg sub_cfg_; 48 | bool done_; 49 | int sliceDim_; 50 | int pad_pre_, pad_post_, overlap_; 51 | int actual_padding_pre, actual_padding_post; 52 | 53 | void ComputeSubTensor(); 54 | }; 55 | 56 | } // namespace micro 57 | } // namespace ops 58 | } // namespace tflite 59 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_SLICERS_H_ 60 | 61 | #endif // EI_CLASSIFIER_TFLITE_ENABLE_ARC == 1 62 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/memory_helpers.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_MEMORY_HELPERS_H_ 16 | #define TENSORFLOW_LITE_MICRO_MEMORY_HELPERS_H_ 17 | 18 | #include 19 | #include 20 | 21 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 22 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 23 | #include "edge-impulse-sdk/tensorflow/lite/schema/schema_generated.h" 24 | 25 | namespace tflite { 26 | 27 | // Returns the next pointer address aligned to the given alignment. 28 | uint8_t* AlignPointerUp(uint8_t* data, size_t alignment); 29 | 30 | // Returns the previous pointer address aligned to the given alignment. 31 | uint8_t* AlignPointerDown(uint8_t* data, size_t alignment); 32 | 33 | // Returns an increased size that's a multiple of alignment. 34 | size_t AlignSizeUp(size_t size, size_t alignment); 35 | 36 | // Returns size in bytes for a given TfLiteType. 37 | TfLiteStatus TfLiteTypeSizeOf(TfLiteType type, size_t* size, 38 | ErrorReporter* reporter); 39 | 40 | // How many bytes are needed to hold a tensor's contents. 41 | TfLiteStatus BytesRequiredForTensor(const tflite::Tensor& flatbuffer_tensor, 42 | size_t* bytes, size_t* type_size, 43 | ErrorReporter* error_reporter); 44 | 45 | } // namespace tflite 46 | 47 | #endif // TENSORFLOW_LITE_MICRO_MEMORY_HELPERS_H_ 48 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/memory_planner/linear_memory_planner.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/memory_planner/linear_memory_planner.h" 17 | 18 | namespace tflite { 19 | 20 | LinearMemoryPlanner::LinearMemoryPlanner() 21 | : current_buffer_count_(0), next_free_offset_(0) {} 22 | LinearMemoryPlanner::~LinearMemoryPlanner() {} 23 | 24 | TfLiteStatus LinearMemoryPlanner::AddBuffer( 25 | tflite::ErrorReporter* error_reporter, int size, int first_time_used, 26 | int last_time_used) { 27 | if (current_buffer_count_ >= kMaxBufferCount) { 28 | TF_LITE_REPORT_ERROR(error_reporter, "Too many buffers (max is %d)", 29 | kMaxBufferCount); 30 | return kTfLiteError; 31 | } 32 | buffer_offsets_[current_buffer_count_] = next_free_offset_; 33 | next_free_offset_ += size; 34 | ++current_buffer_count_; 35 | return kTfLiteOk; 36 | } 37 | 38 | size_t LinearMemoryPlanner::GetMaximumMemorySize() { return next_free_offset_; } 39 | 40 | int LinearMemoryPlanner::GetBufferCount() { return current_buffer_count_; } 41 | 42 | TfLiteStatus LinearMemoryPlanner::GetOffsetForBuffer( 43 | tflite::ErrorReporter* error_reporter, int buffer_index, int* offset) { 44 | if ((buffer_index < 0) || (buffer_index >= current_buffer_count_)) { 45 | TF_LITE_REPORT_ERROR(error_reporter, 46 | "buffer index %d is outside range 0 to %d", 47 | buffer_index, current_buffer_count_); 48 | return kTfLiteError; 49 | } 50 | *offset = buffer_offsets_[buffer_index]; 51 | return kTfLiteOk; 52 | } 53 | 54 | } // namespace tflite 55 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/memory_planner/linear_memory_planner.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ 17 | #define TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/micro/compatibility.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/micro/memory_planner/memory_planner.h" 21 | 22 | namespace tflite { 23 | 24 | // The simplest possible memory planner that just lays out all buffers at 25 | // increasing offsets without trying to reuse memory. 26 | class LinearMemoryPlanner : public MemoryPlanner { 27 | public: 28 | LinearMemoryPlanner(); 29 | ~LinearMemoryPlanner() override; 30 | 31 | TfLiteStatus AddBuffer(tflite::ErrorReporter* error_reporter, int size, 32 | int first_time_used, int last_time_used) override; 33 | 34 | size_t GetMaximumMemorySize() override; 35 | int GetBufferCount() override; 36 | TfLiteStatus GetOffsetForBuffer(tflite::ErrorReporter* error_reporter, 37 | int buffer_index, int* offset) override; 38 | 39 | private: 40 | static constexpr int kMaxBufferCount = 1024; 41 | size_t buffer_offsets_[kMaxBufferCount]; 42 | int current_buffer_count_; 43 | size_t next_free_offset_; 44 | 45 | TF_LITE_REMOVE_VIRTUAL_DELETE 46 | }; 47 | 48 | } // namespace tflite 49 | 50 | #endif // TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ 51 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/micro_error_reporter.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_error_reporter.h" 17 | 18 | #include 19 | 20 | #ifndef TF_LITE_STRIP_ERROR_STRINGS 21 | #include "edge-impulse-sdk/tensorflow/lite/micro/debug_log.h" 22 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_string.h" 23 | #endif 24 | 25 | namespace tflite { 26 | 27 | int MicroErrorReporter::Report(const char* format, va_list args) { 28 | #ifndef TF_LITE_STRIP_ERROR_STRINGS 29 | // Only pulling in the implementation of this function for builds where we 30 | // expect to make use of it to be extra cautious about not increasing the code 31 | // size. 32 | static constexpr int kMaxLogLen = 256; 33 | char log_buffer[kMaxLogLen]; 34 | MicroVsnprintf(log_buffer, kMaxLogLen, format, args); 35 | DebugLog(log_buffer); 36 | DebugLog("\r\n"); 37 | #endif 38 | return 0; 39 | } 40 | 41 | } // namespace tflite 42 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/micro_error_reporter.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_ERROR_REPORTER_H_ 16 | #define TENSORFLOW_LITE_MICRO_MICRO_ERROR_REPORTER_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 21 | #include "edge-impulse-sdk/tensorflow/lite/micro/compatibility.h" 22 | 23 | namespace tflite { 24 | 25 | class MicroErrorReporter : public ErrorReporter { 26 | public: 27 | ~MicroErrorReporter() override {} 28 | int Report(const char* format, va_list args) override; 29 | 30 | private: 31 | TF_LITE_REMOVE_VIRTUAL_DELETE 32 | }; 33 | 34 | } // namespace tflite 35 | 36 | #endif // TENSORFLOW_LITE_MICRO_MICRO_ERROR_REPORTER_H_ 37 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/micro_optional_debug_tools.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | // Optional debugging functionality. For small sized binaries, these are not 16 | // needed. 17 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_OPTIONAL_DEBUG_TOOLS_H_ 18 | #define TENSORFLOW_LITE_MICRO_MICRO_OPTIONAL_DEBUG_TOOLS_H_ 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_interpreter.h" 21 | 22 | namespace tflite { 23 | // Helper function to print model flatbuffer data. This function is not called 24 | // by default. Hence it's not linked in to the final binary code. 25 | void PrintModelData(const Model* model, ErrorReporter* error_reporter); 26 | // Prints a dump of what tensors and what nodes are in the interpreter. 27 | void PrintInterpreterState(MicroInterpreter* interpreter); 28 | } // namespace tflite 29 | 30 | #endif // TENSORFLOW_LITE_MICRO_MICRO_OPTIONAL_DEBUG_TOOLS_H_ 31 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/micro_profiler.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_profiler.h" 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/compatibility.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_time.h" 20 | 21 | namespace tflite { 22 | 23 | MicroProfiler::MicroProfiler(tflite::ErrorReporter* reporter) 24 | : reporter_(reporter) {} 25 | 26 | uint32_t MicroProfiler::BeginEvent(const char* tag, EventType event_type, 27 | int64_t event_metadata1, 28 | int64_t event_metadata2) { 29 | start_time_ = GetCurrentTimeTicks(); 30 | TFLITE_DCHECK(tag != nullptr); 31 | event_tag_ = tag; 32 | return 0; 33 | } 34 | 35 | void MicroProfiler::EndEvent(uint32_t event_handle) { 36 | int32_t end_time = GetCurrentTimeTicks(); 37 | TF_LITE_REPORT_ERROR(reporter_, "%s took %d cycles\n", event_tag_, 38 | end_time - start_time_); 39 | } 40 | 41 | } // namespace tflite 42 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/micro_string.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_STRING_H_ 16 | #define TENSORFLOW_LITE_MICRO_MICRO_STRING_H_ 17 | 18 | #include 19 | 20 | // Implements simple string formatting for numeric types. Returns the number of 21 | // bytes written to output. 22 | extern "C" { 23 | // Functionally equivalent to vsnprintf, trimmed down for TFLite Micro. 24 | // MicroSnprintf() is implemented using MicroVsnprintf(). 25 | int MicroVsnprintf(char* output, int len, const char* format, va_list args); 26 | // Functionally equavalent to snprintf, trimmed down for TFLite Micro. 27 | // For example, MicroSnprintf(buffer, 10, "int %d", 10) will put the string 28 | // "int 10" in the buffer. 29 | // Floating point values are logged in exponent notation (1.XXX*2^N). 30 | int MicroSnprintf(char* output, int len, const char* format, ...); 31 | } 32 | 33 | #endif // TENSORFLOW_LITE_MICRO_MICRO_STRING_H_ 34 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/micro_time.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | // Reference implementation of timer functions. Platforms are not required to 17 | // implement these timer methods, but they are required to enable profiling. 18 | 19 | // On platforms that have a POSIX stack or C library, it can be written using 20 | // methods from or clock() from . 21 | 22 | // To add an equivalent function for your own platform, create your own 23 | // implementation file, and place it in a subfolder with named after the OS 24 | // you're targeting. For example, see the Cortex M bare metal version in 25 | // tensorflow/lite/micro/bluepill/micro_time.cc or the mbed one on 26 | // tensorflow/lite/micro/mbed/micro_time.cc. 27 | 28 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_time.h" 29 | 30 | namespace tflite { 31 | 32 | // Reference implementation of the ticks_per_second() function that's required 33 | // for a platform to support Tensorflow Lite for Microcontrollers profiling. 34 | // This returns 0 by default because timing is an optional feature that builds 35 | // without errors on platforms that do not need it. 36 | int32_t ticks_per_second() { return 0; } 37 | 38 | // Reference implementation of the GetCurrentTimeTicks() function that's 39 | // required for a platform to support Tensorflow Lite for Microcontrollers 40 | // profiling. This returns 0 by default because timing is an optional feature 41 | // that builds without errors on platforms that do not need it. 42 | int32_t GetCurrentTimeTicks() { return 0; } 43 | 44 | } // namespace tflite 45 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/micro_time.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ 16 | #define TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | // These functions should be implemented by each target platform, and provide an 23 | // accurate tick count along with how many ticks there are per second. 24 | int32_t ticks_per_second(); 25 | 26 | // Return time in ticks. The meaning of a tick varies per platform. 27 | int32_t GetCurrentTimeTicks(); 28 | 29 | } // namespace tflite 30 | 31 | #endif // TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ 32 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/micro/testing/test_conv_model.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_TESTING_TEST_CONV_MODEL_H_ 17 | #define TENSORFLOW_LITE_MICRO_TESTING_TEST_CONV_MODEL_H_ 18 | 19 | // See generate_test_models.py for updating the contents of this model: 20 | extern const unsigned char kTestConvModelData[]; 21 | extern const unsigned int kTestConvModelDataSize; 22 | 23 | #endif // TENSORFLOW_LITE_MICRO_TESTING_TEST_CONV_MODEL_H_ 24 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/string_type.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | // Abstract string. We don't want even absl at this level. 16 | #ifndef TENSORFLOW_LITE_STRING_TYPE_H_ 17 | #define TENSORFLOW_LITE_STRING_TYPE_H_ 18 | 19 | #include 20 | 21 | namespace tflite { 22 | 23 | using std::string; 24 | 25 | } // namespace tflite 26 | 27 | #endif // TENSORFLOW_LITE_STRING_TYPE_H_ 28 | -------------------------------------------------------------------------------- /src/edge-impulse-sdk/tensorflow/lite/version.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_VERSION_H_ 16 | #define TENSORFLOW_LITE_VERSION_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/core/public/version.h" 19 | 20 | // The version number of the Schema. Ideally all changes will be backward 21 | // compatible. If that ever changes, we must ensure that version is the first 22 | // entry in the new tflite root so that we can see that version is not 1. 23 | #define TFLITE_SCHEMA_VERSION (3) 24 | 25 | // TensorFlow Lite Runtime version. 26 | // This value is currently shared with that of TensorFlow. 27 | #define TFLITE_VERSION_STRING TF_VERSION_STRING 28 | 29 | #endif // TENSORFLOW_LITE_VERSION_H_ 30 | -------------------------------------------------------------------------------- /src/ei_main.h: -------------------------------------------------------------------------------- 1 | /* Edge Impulse ingestion SDK 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef EI_MAIN_H 24 | #define EI_MAIN_H 25 | 26 | #include "mbed.h" 27 | 28 | #define TARGET "PORTENTA_H7" 29 | 30 | using namespace rtos; 31 | using namespace events; 32 | 33 | extern void ei_printf(const char *format, ...); 34 | extern void ei_write_string(char *data, int length); 35 | extern mbed::Stream* ei_get_serial(); 36 | int ei_get_serial_available(void); 37 | char ei_get_serial_byte(void); 38 | 39 | void print_memory_info(); 40 | void ei_main(); 41 | 42 | #endif // EI_MAIN_H 43 | -------------------------------------------------------------------------------- /src/ingestion-sdk-c/ei_run_impulse.h: -------------------------------------------------------------------------------- 1 | /* Edge Impulse ingestion SDK 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef EI_RUN_IMPULSE_H 24 | #define EI_RUN_IMPULSE_H 25 | 26 | /* Prototypes -------------------------------------------------------------- */ 27 | void run_nn_normal(void (*changed_cb)(const char*)); 28 | void run_nn_continuous_normal(); 29 | void run_nn_debug(void (*changed_cb)(const char*)); 30 | 31 | #endif -------------------------------------------------------------------------------- /src/ingestion-sdk-c/ei_sampler.h: -------------------------------------------------------------------------------- 1 | /* Edge Impulse ingestion SDK 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef _EI_SAMPLER_H 24 | #define _EI_SAMPLER_H 25 | 26 | 27 | /** ei sampler callback function, call with sample data */ 28 | typedef bool (*sampler_callback)(const void *sample_buf, uint32_t byteLenght); 29 | 30 | /* Function prototypes ----------------------------------------------------- */ 31 | bool ei_sampler_start_sampling(void *v_ptr_payload, uint32_t sample_size); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/ingestion-sdk-c/inc/ei_config_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _EI_CONFIG_TYPES_H 2 | #define _EI_CONFIG_TYPES_H 3 | 4 | // return types 5 | typedef enum { 6 | EI_CONFIG_OK = 0, 7 | EI_CONFIG_BOUNDS_ERROR = -1, 8 | EI_CONFIG_CONTEXT_ERROR = -2, 9 | EI_CONFIG_NO_CONTEXT = -8, 10 | EI_CONFIG_WIFI_CONN_FAILED = -9, 11 | EI_CONFIG_NOT_IMPLEMENTED = -10 12 | } EI_CONFIG_ERROR; 13 | 14 | // same as https://github.com/ARMmbed/mbed-os/blob/d4122b0b3a091d3f1130f3bb0d91c96f9183e2de/features/netsocket/nsapi_types.h#L115 15 | typedef enum { 16 | EI_SECURITY_NONE = 0x0, /*!< open access point */ 17 | EI_SECURITY_WEP = 0x1, /*!< phrase conforms to WEP */ 18 | EI_SECURITY_WPA = 0x2, /*!< phrase conforms to WPA */ 19 | EI_SECURITY_WPA2 = 0x3, /*!< phrase conforms to WPA2 */ 20 | EI_SECURITY_WPA_WPA2 = 0x4, /*!< phrase conforms to WPA/WPA2 */ 21 | EI_SECURITY_PAP = 0x5, /*!< phrase conforms to PPP authentication context */ 22 | EI_SECURITY_CHAP = 0x6, /*!< phrase conforms to PPP authentication context */ 23 | EI_SECURITY_EAP_TLS = 0x7, /*!< phrase conforms to EAP-TLS */ 24 | EI_SECURITY_PEAP = 0x8, /*!< phrase conforms to PEAP */ 25 | EI_SECURITY_UNKNOWN = 0xFF, /*!< unknown/unsupported security in scan results */ 26 | } ei_config_security_t; 27 | 28 | 29 | // All the possible configuration options we can set 30 | typedef struct { 31 | char wifi_ssid[128]; 32 | char wifi_password[128]; 33 | ei_config_security_t wifi_security; 34 | float sample_interval_ms; 35 | uint32_t sample_length_ms; 36 | char sample_label[128]; 37 | char sample_hmac_key[33]; 38 | char upload_host[128]; 39 | char upload_path[128]; 40 | char upload_api_key[128]; 41 | char mgmt_url[128]; 42 | uint32_t magic; 43 | } ei_config_t; 44 | 45 | #endif -------------------------------------------------------------------------------- /src/model-parameters/dsp_blocks.h: -------------------------------------------------------------------------------- 1 | /* Generated by Edge Impulse 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | #ifndef _EI_CLASSIFIER_DSP_BLOCKS_H_ 23 | #define _EI_CLASSIFIER_DSP_BLOCKS_H_ 24 | 25 | #include "model-parameters/model_metadata.h" 26 | #include "edge-impulse-sdk/classifier/ei_run_dsp.h" 27 | #include "edge-impulse-sdk/classifier/ei_model_types.h" 28 | 29 | const size_t ei_dsp_blocks_size = 1; 30 | ei_model_dsp_t ei_dsp_blocks[ei_dsp_blocks_size] = { 31 | { // DSP block 3 32 | 4096, 33 | &extract_image_features, 34 | (void*)&ei_dsp_config_3 35 | } 36 | }; 37 | 38 | #endif // _EI_CLASSIFIER_DSP_BLOCKS_H_ -------------------------------------------------------------------------------- /src/repl/at_base64.cpp: -------------------------------------------------------------------------------- 1 | #include "at_base64.h" 2 | 3 | extern void ei_printf(const char *format, ...); 4 | 5 | static const char *base64_chars = 6 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 7 | "abcdefghijklmnopqrstuvwxyz" 8 | "0123456789+/"; 9 | 10 | static inline bool is_base64(unsigned char c) { 11 | return (isalnum(c) || (c == '+') || (c == '/')); 12 | } 13 | 14 | int base64_encode(const char *input, size_t input_size, char *output, size_t output_size) { 15 | size_t output_size_check = floor(input_size / 3 * 4); 16 | size_t mod = input_size % 3; 17 | output_size_check += mod; 18 | 19 | if (output_size < output_size_check) { 20 | return -10; 21 | } 22 | 23 | int i = 0; 24 | int j = 0; 25 | unsigned char char_array_3[3]; 26 | unsigned char char_array_4[4]; 27 | size_t output_ix = 0; 28 | 29 | while (input_size--) { 30 | char_array_3[i++] = *(input++); 31 | if (i == 3) { 32 | char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; 33 | char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); 34 | char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); 35 | char_array_4[3] = char_array_3[2] & 0x3f; 36 | 37 | for(i = 0; (i < 4) ; i++) { 38 | output[output_ix++] = base64_chars[char_array_4[i]]; 39 | } 40 | i = 0; 41 | } 42 | } 43 | 44 | if (i) { 45 | for(j = i; j < 3; j++) { 46 | char_array_3[j] = '\0'; 47 | } 48 | 49 | char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; 50 | char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); 51 | char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); 52 | char_array_4[3] = char_array_3[2] & 0x3f; 53 | 54 | for (j = 0; (j < i + 1); j++) { 55 | output[output_ix++] = base64_chars[char_array_4[j]]; 56 | } 57 | 58 | while((i++ < 3)) { 59 | output[output_ix++] = '='; 60 | } 61 | } 62 | 63 | return output_ix; 64 | } 65 | -------------------------------------------------------------------------------- /src/repl/at_base64.h: -------------------------------------------------------------------------------- 1 | #ifndef _EDGE_IMPULSE_SDK_BASE64_H_ 2 | #define _EDGE_IMPULSE_SDK_BASE64_H_ 3 | 4 | /* 5 | base64.cpp and base64.h 6 | 7 | Copyright (C) 2004-2008 René Nyffenegger 8 | 9 | This source code is provided 'as-is', without any express or implied 10 | warranty. In no event will the author be held liable for any damages 11 | arising from the use of this software. 12 | 13 | Permission is granted to anyone to use this software for any purpose, 14 | including commercial applications, and to alter it and redistribute it 15 | freely, subject to the following restrictions: 16 | 17 | 1. The origin of this source code must not be misrepresented; you must not 18 | claim that you wrote the original source code. If you use this source code 19 | in a product, an acknowledgment in the product documentation would be 20 | appreciated but is not required. 21 | 22 | 2. Altered source versions must be plainly marked as such, and must not be 23 | misrepresented as being the original source code. 24 | 25 | 3. This notice may not be removed or altered from any source distribution. 26 | 27 | René Nyffenegger rene.nyffenegger@adp-gmbh.ch 28 | 29 | */ 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | int base64_encode(const char *input, size_t input_size, char *output, size_t output_size); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/sensors/ei_microphone.h: -------------------------------------------------------------------------------- 1 | /* Edge Impulse ingestion SDK 2 | * Copyright (c) 2020 EdgeImpulse Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | #ifndef EI_MICROPHONE_H 24 | #define EI_MICROPHONE_H 25 | 26 | /* Include ----------------------------------------------------------------- */ 27 | #include 28 | #include 29 | #include 30 | 31 | /* Function prototypes ----------------------------------------------------- */ 32 | bool ei_microphone_inference_start(uint32_t n_samples); 33 | 34 | 35 | bool ei_microphone_sample_start(void); 36 | bool ei_microphone_inference_record(void); 37 | void ei_microphone_inference_reset_buffers(void); 38 | int ei_microphone_audio_signal_get_data(size_t offset, size_t length, float *out_ptr); 39 | bool ei_microphone_inference_end(void); 40 | 41 | 42 | #endif --------------------------------------------------------------------------------