mfccdata.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef _MFCC_DATA_H_
  2. #define _MFCC_DATA_H_
  3. {% macro iff16(s,c) -%}
  4. {%- if configs[s][c]["hasF16"] %}
  5. #if defined(ARM_FLOAT16_SUPPORTED)
  6. {%- endif %}
  7. {% endmacro -%}
  8. {% macro endiff16(s,c) -%}
  9. {%- if configs[s][c]["hasF16"] %}
  10. #endif /*defined(ARM_FLOAT16_SUPPORTED) */
  11. {%- endif %}
  12. {% endmacro -%}
  13. #include "arm_math_types.h"
  14. {% if configs["hasF16"] %}
  15. #include "arm_math_types_f16.h"
  16. {% endif %}
  17. #ifdef __cplusplus
  18. extern "C"
  19. {
  20. #endif
  21. /*****
  22. DCT COEFFICIENTS FOR THE MFCC
  23. *****/
  24. {% for config in configs["dct"] %}
  25. {{iff16("dct",config)}}
  26. #define NB_MFCC_DCT_COEFS_{{config.upper()}} {{configs["dct"][config]['dctMatrixLength']}}
  27. extern const {{configs["dct"][config]["ctype"]}} mfcc_dct_coefs_{{config}}[NB_MFCC_DCT_COEFS_{{config.upper()}}];
  28. {{endiff16("dct",config)}}
  29. {% endfor %}
  30. /*****
  31. WINDOW COEFFICIENTS
  32. *****/
  33. {% for config in configs["window"] %}
  34. {{iff16("window",config)}}
  35. #define NB_MFCC_WIN_COEFS_{{config.upper()}} {{configs["window"][config]['fftlength']}}
  36. extern const {{configs["window"][config]["ctype"]}} mfcc_window_coefs_{{config}}[NB_MFCC_WIN_COEFS_{{config.upper()}}];
  37. {{endiff16("window",config)}}
  38. {% endfor %}
  39. /*****
  40. MEL FILTER COEFFICIENTS FOR THE MFCC
  41. *****/
  42. {% for config in configs["melfilter"] %}
  43. #define NB_MFCC_NB_FILTER_{{config.upper()}} {{configs["melfilter"][config]['melFilters']}}
  44. extern const uint32_t mfcc_filter_pos_{{config}}[NB_MFCC_NB_FILTER_{{config.upper()}}];
  45. extern const uint32_t mfcc_filter_len_{{config}}[NB_MFCC_NB_FILTER_{{config.upper()}}];
  46. {% endfor %}
  47. {% for config in configs["melfilter"] %}
  48. {{iff16("melfilter",config)}}
  49. #define NB_MFCC_FILTER_COEFS_{{config.upper()}} {{configs["melfilter"][config]['totalLen']}}
  50. extern const {{configs["melfilter"][config]["ctype"]}} mfcc_filter_coefs_{{config}}[NB_MFCC_FILTER_COEFS_{{config.upper()}}];
  51. {{endiff16("melfilter",config)}}
  52. {% endfor %}
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif