xmos-ai-tools 1.1.2.dev216__py3-none-macosx_11_0_arm64.whl → 1.1.2.dev236__py3-none-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. xmos_ai_tools/runtime/include/lib_nn/api/nn_layers.h +16 -0
  2. xmos_ai_tools/runtime/include/lib_nn/api/quadratic_approximation.h +80 -0
  3. xmos_ai_tools/runtime/include/lib_nn/api/quadratic_interpolation.h +23 -0
  4. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_ops.h +15 -15
  5. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/simple_features/model.h → signal/micro/kernels/delay_flexbuffers_generated_data.h} +7 -9
  6. xmos_ai_tools/runtime/include/signal/micro/kernels/energy_flexbuffers_generated_data.h +28 -0
  7. xmos_ai_tools/runtime/include/signal/micro/kernels/fft_flexbuffers_generated_data.h +37 -0
  8. xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_flexbuffers_generated_data.h +25 -0
  9. xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_log_flexbuffers_generated_data.h +27 -0
  10. xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_spectral_subtraction_flexbuffers_generated_data.h +26 -0
  11. xmos_ai_tools/runtime/include/signal/micro/kernels/framer_flexbuffers_generated_data.h +25 -0
  12. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/simple_features/no_simple_features_data.h → signal/micro/kernels/irfft.h} +15 -7
  13. xmos_ai_tools/runtime/include/signal/micro/kernels/overlap_add_flexbuffers_generated_data.h +25 -0
  14. xmos_ai_tools/runtime/include/signal/micro/kernels/pcan_flexbuffers_generated_data.h +7 -0
  15. xmos_ai_tools/runtime/include/signal/micro/kernels/rfft.h +31 -0
  16. xmos_ai_tools/runtime/include/signal/micro/kernels/stacker_flexbuffers_generated_data.h +25 -0
  17. xmos_ai_tools/runtime/include/signal/micro/kernels/window_flexbuffers_generated_data.h +25 -0
  18. xmos_ai_tools/runtime/include/signal/src/circular_buffer.h +118 -0
  19. xmos_ai_tools/runtime/include/signal/src/complex.h +29 -0
  20. xmos_ai_tools/runtime/include/signal/src/energy.h +38 -0
  21. xmos_ai_tools/runtime/include/signal/src/fft_auto_scale.h +35 -0
  22. xmos_ai_tools/runtime/include/signal/src/filter_bank.h +69 -0
  23. xmos_ai_tools/runtime/include/signal/src/filter_bank_log.h +38 -0
  24. xmos_ai_tools/runtime/include/signal/src/filter_bank_spectral_subtraction.h +73 -0
  25. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/main_functions.h → signal/src/filter_bank_square_root.h} +14 -17
  26. xmos_ai_tools/runtime/include/signal/src/irfft.h +84 -0
  27. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_common.h +49 -0
  28. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_float.h +31 -0
  29. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_int16.h +30 -0
  30. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_int32.h +31 -0
  31. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.h → signal/src/log.h} +13 -6
  32. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/python/interpreter/src/python_utils.h → signal/src/max_abs.h} +11 -11
  33. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.h → signal/src/msb.h} +15 -6
  34. xmos_ai_tools/runtime/include/signal/src/overlap_add.h +46 -0
  35. xmos_ai_tools/runtime/include/signal/src/pcan_argc_fixed.h +41 -0
  36. xmos_ai_tools/runtime/include/signal/src/rfft.h +85 -0
  37. xmos_ai_tools/runtime/include/signal/src/square_root.h +32 -0
  38. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/python/interpreter/src/numpy_utils.h → signal/src/window.h} +13 -15
  39. xmos_ai_tools/runtime/include/signal/testdata/fft_test_data.h +48 -0
  40. xmos_ai_tools/runtime/include/tensorflow/lite/array.h +156 -0
  41. xmos_ai_tools/runtime/include/tensorflow/lite/builtin_ops.h +44 -0
  42. xmos_ai_tools/runtime/include/tensorflow/lite/c/c_api_types.h +6 -0
  43. xmos_ai_tools/runtime/include/tensorflow/lite/c/common.h +8 -25
  44. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/error_reporter.h +3 -3
  45. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/flatbuffer_conversions.h +15 -0
  46. xmos_ai_tools/runtime/include/tensorflow/lite/core/c/builtin_op_data.h +92 -3
  47. xmos_ai_tools/runtime/include/tensorflow/lite/core/c/c_api_types.h +61 -51
  48. xmos_ai_tools/runtime/include/tensorflow/lite/core/c/common.h +302 -1
  49. xmos_ai_tools/runtime/include/tensorflow/lite/core/macros.h +78 -0
  50. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/common.h +129 -43
  51. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/cppmath.h +2 -2
  52. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/portable_tensor.h +23 -4
  53. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/add.h +210 -151
  54. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/comparisons.h +9 -18
  55. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/conv.h +2 -0
  56. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/add.h +103 -72
  57. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h +2 -0
  58. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mean.h +2 -63
  59. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mul.h +87 -26
  60. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/mul.h +129 -80
  61. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/reduce.h +42 -93
  62. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/resize_bilinear.h +5 -0
  63. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/sub.h +249 -263
  64. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/runtime_shape.h +11 -1
  65. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/strided_slice_logic.h +5 -1
  66. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/tensor_ctypes.h +5 -10
  67. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/types.h +4 -2
  68. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/kernel_util.h +25 -14
  69. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/op_macros.h +14 -3
  70. xmos_ai_tools/runtime/include/tensorflow/lite/micro/debug_log.h +10 -3
  71. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_model_settings.h +37 -0
  72. xmos_ai_tools/runtime/include/tensorflow/lite/micro/fake_micro_context.h +7 -0
  73. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/add.h +6 -5
  74. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/circular_buffer.h +0 -3
  75. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv.h +19 -20
  76. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv_test.h +8 -31
  77. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/depthwise_conv.h +8 -8
  78. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ethosu.h +1 -1
  79. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/fully_connected.h +9 -9
  80. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_runner.h +14 -9
  81. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_util.h +9 -4
  82. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/micro_ops.h +119 -100
  83. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/mul.h +4 -4
  84. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/pooling.h +8 -8
  85. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reduce.h +4 -4
  86. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reshape.h +26 -0
  87. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/softmax.h +12 -16
  88. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/strided_slice.h +40 -0
  89. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/svdf.h +8 -7
  90. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/unidirectional_sequence_lstm.h +5 -5
  91. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa.h +2 -2
  92. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_conv.h +26 -21
  93. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_depthwise_conv.h +4 -4
  94. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_reshape.h +2 -4
  95. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_softmax.h +2 -2
  96. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h +5 -0
  97. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/linear_memory_planner.h +4 -0
  98. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/micro_memory_planner.h +4 -0
  99. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/non_persistent_buffer_planner_shim.h +4 -0
  100. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_allocator.h +23 -8
  101. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_common.h +38 -0
  102. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_context.h +23 -65
  103. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_graph.h +15 -57
  104. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter.h +16 -5
  105. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_context.h +125 -0
  106. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_graph.h +110 -0
  107. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_log.h +6 -8
  108. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_mutable_op_resolver.h +114 -32
  109. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_op_resolver.h +6 -5
  110. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_profiler.h +1 -1
  111. xmos_ai_tools/runtime/include/tensorflow/lite/micro/mock_micro_graph.h +1 -1
  112. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/python_ops_resolver.h +21 -0
  113. xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helper_custom_ops.h +3 -4
  114. xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helpers.h +28 -12
  115. xmos_ai_tools/runtime/include/tensorflow/lite/micro/testing/micro_test.h +1 -0
  116. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/log_utils.h +273 -0
  117. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/metrics.h +41 -0
  118. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/op_resolver.h +127 -0
  119. xmos_ai_tools/runtime/include/tensorflow/lite/schema/schema_generated.h +9139 -5010
  120. xmos_ai_tools/runtime/lib/libhost_xtflitemicro.a +0 -0
  121. xmos_ai_tools/runtime/lib/libxtflitemicro.a +0 -0
  122. xmos_ai_tools/xinterpreters/libs/macos/xtflm_python.1.0.1.dylib +0 -0
  123. xmos_ai_tools/xinterpreters/libs/macos/xtflm_python.dylib +0 -0
  124. {xmos_ai_tools-1.1.2.dev216.data → xmos_ai_tools-1.1.2.dev236.data}/data/bin/xcore-opt +0 -0
  125. {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/METADATA +3 -4
  126. {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/RECORD +128 -105
  127. {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/WHEEL +1 -1
  128. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/op_resolver.h +0 -129
  129. xmos_ai_tools/runtime/include/tensorflow/lite/micro/all_ops_resolver.h +0 -38
  130. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/audio_provider.h +0 -44
  131. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/command_responder.h +0 -30
  132. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/feature_provider.h +0 -50
  133. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_features_generator.h +0 -30
  134. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h +0 -43
  135. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/no_feature_data_slice.h +0 -29
  136. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/yes_feature_data_slice.h +0 -29
  137. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/recognize_commands.h +0 -151
  138. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/no_power_spectrum_data.h +0 -29
  139. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_features_generator.h +0 -29
  140. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_model_settings.h +0 -43
  141. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_power_spectrum_data.h +0 -29
  142. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_simple_features_data.h +0 -23
  143. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_string.h +0 -33
  144. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/interpreter_wrapper.h +0 -51
  145. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/pybind11_lib.h +0 -64
  146. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/shared_library.h +0 -40
  147. {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/top_level.txt +0 -0
@@ -172,6 +172,22 @@ void pad_3_to_4_prepare(uint32_t * n_3,
172
172
  extern void pad_3_to_4_run(int8_t outputs[], int8_t inputs[], uint32_t N_3, uint32_t pad_val);
173
173
  extern void pad_3_to_4_ref(int8_t outputs[], int8_t inputs[], uint32_t N_3, uint32_t pad_val);
174
174
 
175
+ typedef struct nn_mul_params_t {
176
+ int8_t in1_zero_point;
177
+ int8_t in2_zero_point;
178
+ int16_t bias;
179
+ int16_t scalar;
180
+ int16_t vlashr_shr;
181
+ } nn_mul_params_t;
182
+
183
+ void mul_boggle(nn_mul_params_t * params,
184
+ double in1Scale,
185
+ double in2Scale,
186
+ double outputScale,
187
+ int8_t in1ZeroPoint,
188
+ int8_t in2ZeroPoint,
189
+ int8_t outputZeroPoint);
190
+ void mul_elementwise(int8_t* in1_data, int8_t* in2_data, int element_count, nn_mul_params_t * params, int8_t * out_data);
175
191
 
176
192
  // /**
177
193
  // * Describes the parameters needed for an @oper{add_elementwise} operator. @see add_elementwise().
@@ -0,0 +1,80 @@
1
+ #ifndef _quadratic_approximation_h_
2
+ #define _quadratic_approximation_h_
3
+
4
+ #ifdef __xcore__
5
+ #define ACTIVATION_FUNCTION __attribute__(( fptrgroup("activation_functions") ))
6
+ #else
7
+ #define ACTIVATION_FUNCTION /**/
8
+ #endif
9
+
10
+ #include <stdint.h>
11
+
12
+ #define QUADRATIC_APPROXIMATION_MAX_CHUNKS 2048
13
+
14
+ /** Type that stores an approximation table.
15
+ * Must be stored 64-bit aligned when presented to assembly code.
16
+ * Use:
17
+ * * ``quadratic_function_table_number_bytes()`` to query the size
18
+ * * ``quadratic_function_table_bytes()`` to obtain a pointer to the table
19
+ */
20
+ struct quadratic_function_table {
21
+ struct { // The order matters - this is how the assembly code expects them
22
+ int32_t c;
23
+ int8_t a;
24
+ int8_t padding;
25
+ int16_t b;
26
+ } coefficients[QUADRATIC_APPROXIMATION_MAX_CHUNKS];
27
+ int data_bytes;
28
+ };
29
+
30
+ typedef struct quadratic_function_table quadratic_function_table_t;
31
+
32
+ /* Function pointer type - any float -> float
33
+ */
34
+ typedef float (*float_function_t)(float x);
35
+
36
+ /** Function that builds a quadratic approximation table
37
+ * The function passed in must be monotinuous
38
+ * Any number of chunks will work but the assembly implementiaton assumes 128.
39
+ * The function returns a table pointer, and through two arguments the max error,
40
+ * and the sqrt of the sum of squared errors as a goodness metric.
41
+ *
42
+ * \param table interpolation table to be filled in
43
+ * \param av function to be interpolated
44
+ * \param input_scaler scale that is applied to the input, eg 8.0/32768.0
45
+ * \param outptu_scaler scale that is applied to the output, eg 32768.0
46
+ * \param chunks number of interpolations. Set to 128.
47
+ * \param max_error maximum error, ought to be 1
48
+ * \param error sqrt of sum of squared errors.
49
+ */
50
+ extern void quadratic_approximation_generator(
51
+ quadratic_function_table_t *table,
52
+ ACTIVATION_FUNCTION float_function_t av,
53
+ double input_scaler,
54
+ double output_scaler,
55
+ int chunks,
56
+ int *max_error,
57
+ double *error);
58
+
59
+ /** Function that returns the number of bytes in an approximation table
60
+ *
61
+ * \param x the table
62
+ * \returns The number of bytes in the table
63
+ */
64
+ extern uint32_t quadratic_function_table_number_bytes(quadratic_function_table_t *x);
65
+
66
+
67
+ /** Function that returns a pointer to the bytes in an approximation table
68
+ *
69
+ * \param x the table
70
+ * \returns Pointer to the bytes in the table
71
+ */
72
+ extern uint8_t *quadratic_function_table_bytes(quadratic_function_table_t *x);
73
+
74
+ /** Example functions that can be passed in
75
+ */
76
+ extern float approximation_function_tanh(float x);
77
+ extern float approximation_function_logistics(float x);
78
+ extern float approximation_function_elu(float x);
79
+
80
+ #endif
@@ -0,0 +1,23 @@
1
+ #ifndef _quadratic_interpolation_h_
2
+ #define _quadratic_interpolation_h_
3
+
4
+ #include <stdint.h>
5
+
6
+ /** Function that performs a quadratic interpolation on a vector of inputs given a table
7
+ * of coefficients
8
+ *
9
+ * \param outputs Output vector, 16-bit signed integers
10
+ *
11
+ * \param inputs Output vector, 16-bit signed integers
12
+ *
13
+ * \param coefficients The bytes comprising the table of coefficients produced with
14
+ * ``quadratic_approximation_generator()``.
15
+ * Must be 64-bit aligned.
16
+ *
17
+ * \param N Number of 16-bit elements in the vector
18
+ */
19
+ extern void quadratic_interpolation_128(int16_t *outputs, int16_t *inputs,
20
+ uint8_t *coeffs,
21
+ uint32_t N);
22
+
23
+ #endif
@@ -25,22 +25,22 @@ constexpr const char *XC_mul_OpCode = "XC_mul";
25
25
  // Binarized ops
26
26
  constexpr const char *XC_bsign_8_OpCode = "XC_bsign_8";
27
27
 
28
- TfLiteRegistration_V1 *Register_XC_beta_activationf32();
29
- TfLiteRegistration_V1 *Register_XC_beta_concatf32();
30
- TfLiteRegistration_V1 *Register_XC_beta_convf32();
31
- TfLiteRegistration_V1 *Register_XC_beta_transposeconvf32();
32
- TfLiteRegistration_V1 *Register_XC_beta_fcf32();
33
-
34
- TfLiteRegistration_V1 *Register_XC_conv2d_v2();
35
- TfLiteRegistration_V1 *Register_XC_ld_flash();
36
- TfLiteRegistration_V1 *Register_XC_add();
37
- TfLiteRegistration_V1 *Register_XC_strided_slice();
38
- TfLiteRegistration_V1 *Register_XC_lookup();
39
- TfLiteRegistration_V1 *Register_XC_pad();
40
- TfLiteRegistration_V1 *Register_XC_pad_3_to_4();
41
- TfLiteRegistration_V1 *Register_XC_mul();
28
+ TFLMRegistration *Register_XC_beta_activationf32();
29
+ TFLMRegistration *Register_XC_beta_concatf32();
30
+ TFLMRegistration *Register_XC_beta_convf32();
31
+ TFLMRegistration *Register_XC_beta_transposeconvf32();
32
+ TFLMRegistration *Register_XC_beta_fcf32();
33
+
34
+ TFLMRegistration *Register_XC_conv2d_v2();
35
+ TFLMRegistration *Register_XC_ld_flash();
36
+ TFLMRegistration *Register_XC_add();
37
+ TFLMRegistration *Register_XC_strided_slice();
38
+ TFLMRegistration *Register_XC_lookup();
39
+ TFLMRegistration *Register_XC_pad();
40
+ TFLMRegistration *Register_XC_pad_3_to_4();
41
+ TFLMRegistration *Register_XC_mul();
42
42
  // Binarized ops
43
- TfLiteRegistration_V1 *Register_XC_bsign_8();
43
+ TFLMRegistration *Register_XC_bsign_8();
44
44
 
45
45
  void RegisterXCOps(tflite::MicroOpResolver *res);
46
46
 
@@ -13,15 +13,13 @@ See the License for the specific language governing permissions and
13
13
  limitations under the License.
14
14
  ==============================================================================*/
15
15
 
16
- // This is a standard TensorFlow Lite FlatBuffer model file that has been
17
- // converted into a C data array, so it can be easily compiled into a binary
18
- // for devices that don't have a file system. It was created using the command:
19
- // xxd -i model.tflite > model.cc
16
+ #ifndef SIGNAL_MICRO_KERNELS_DELAY_FLEXBUFFERS_GENERATED_DATA_H_
17
+ #define SIGNAL_MICRO_KERNELS_DELAY_FLEXBUFFERS_GENERATED_DATA_H_
20
18
 
21
- #ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_MODEL_H_
22
- #define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_MODEL_H_
19
+ extern const int g_gen_data_size_3_delay;
20
+ extern const unsigned char g_gen_data_3_delay[];
23
21
 
24
- extern const unsigned char g_model[];
25
- extern const int g_model_len;
22
+ extern const int g_gen_data_size_5_delay;
23
+ extern const unsigned char g_gen_data_5_delay[];
26
24
 
27
- #endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_MODEL_H_
25
+ #endif // SIGNAL_MICRO_KERNELS_DELAY_FLEXBUFFERS_GENERATED_DATA_H_
@@ -0,0 +1,28 @@
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 SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_ENERGY_FLEXBUFFERS_DATA_H_
17
+ #define SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_ENERGY_FLEXBUFFERS_DATA_H_
18
+
19
+ extern const int g_gen_data_size_start_index_2_end_index_4;
20
+ extern const unsigned char g_gen_data_start_index_2_end_index_4[];
21
+
22
+ extern const int g_gen_data_size_start_index_0_end_index_4;
23
+ extern const unsigned char g_gen_data_start_index_0_end_index_4[];
24
+
25
+ extern const int g_gen_data_size_start_index_4_end_index_8;
26
+ extern const unsigned char g_gen_data_start_index_4_end_index_8[];
27
+
28
+ #endif // SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_ENERGY_FLEXBUFFERS_DATA_H_
@@ -0,0 +1,37 @@
1
+ /* Copyright 2023 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 SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FFT_FLEXBUFFERS_DATA_H_
17
+ #define SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FFT_FLEXBUFFERS_DATA_H_
18
+
19
+ extern const int g_gen_data_size_fft_length_64_float;
20
+ extern const unsigned char g_gen_data_fft_length_64_float[];
21
+
22
+ extern const int g_gen_data_size_fft_length_64_int16;
23
+ extern const unsigned char g_gen_data_fft_length_64_int16[];
24
+
25
+ extern const int g_gen_data_size_fft_length_64_int32;
26
+ extern const unsigned char g_gen_data_fft_length_64_int32[];
27
+
28
+ extern const int g_gen_data_size_fft_length_512_float;
29
+ extern const unsigned char g_gen_data_fft_length_512_float[];
30
+
31
+ extern const int g_gen_data_size_fft_length_512_int16;
32
+ extern const unsigned char g_gen_data_fft_length_512_int16[];
33
+
34
+ extern const int g_gen_data_size_fft_length_512_int32;
35
+ extern const unsigned char g_gen_data_fft_length_512_int32[];
36
+
37
+ #endif // SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FFT_FLEXBUFFERS_DATA_H_
@@ -0,0 +1,25 @@
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 SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FILTER_BANK_FLEXBUFFERS_DATA_H_
17
+ #define SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FILTER_BANK_FLEXBUFFERS_DATA_H_
18
+
19
+ extern const int g_gen_data_size_filter_bank_32_channel;
20
+ extern const unsigned char g_gen_data_filter_bank_32_channel[];
21
+
22
+ extern const int g_gen_data_size_filter_bank_16_channel;
23
+ extern const unsigned char g_gen_data_filter_bank_16_channel[];
24
+
25
+ #endif // SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FILTER_BANK_FLEXBUFFERS_DATA_H_
@@ -0,0 +1,27 @@
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 SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FILTER_BANK_LOG_FLEXBUFFERS_DATA_H_
17
+ #define SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FILTER_BANK_LOG_FLEXBUFFERS_DATA_H_
18
+
19
+ extern const int g_gen_data_size_filter_bank_log_scale_1600_correction_bits_3;
20
+ extern const unsigned char
21
+ g_gen_data_filter_bank_log_scale_1600_correction_bits_3[];
22
+
23
+ extern const int g_gen_data_size_filter_bank_log_scale_32768_correction_bits_5;
24
+ extern const unsigned char
25
+ g_gen_data_filter_bank_log_scale_32768_correction_bits_5[];
26
+
27
+ #endif // SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FILTER_BANK_LOG_FLEXBUFFERS_DATA_H_
@@ -0,0 +1,26 @@
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 SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FILTER_BANK_SPECTRAL_SUBTRACTION_FLEXBUFFERS_DATA_H_
17
+ #define SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FILTER_BANK_SPECTRAL_SUBTRACTION_FLEXBUFFERS_DATA_H_
18
+
19
+ extern const int g_gen_data_size_filter_bank_spectral_subtraction_32_channel;
20
+ extern const unsigned char
21
+ g_gen_data_filter_bank_spectral_subtraction_32_channel[];
22
+ extern const int g_gen_data_size_filter_bank_spectral_subtraction_16_channel;
23
+ extern const unsigned char
24
+ g_gen_data_filter_bank_spectral_subtraction_16_channel[];
25
+
26
+ #endif // SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FILTER_BANK_SPECTRAL_SUBTRACTION_FLEXBUFFERS_DATA_H_
@@ -0,0 +1,25 @@
1
+ /* Copyright 2021 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 SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FRAMER_FLEXBUFFERS_DATA_H_
17
+ #define SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FRAMER_FLEXBUFFERS_DATA_H_
18
+
19
+ extern const int g_gen_data_size_3_1_0_framer;
20
+ extern const unsigned char g_gen_data_3_1_0_framer[];
21
+
22
+ extern const int g_gen_data_size_5_2_1_framer;
23
+ extern const unsigned char g_gen_data_5_2_1_framer[];
24
+
25
+ #endif // SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_FRAMER_FLEXBUFFERS_DATA_H_
@@ -1,4 +1,4 @@
1
- /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -12,12 +12,20 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  See the License for the specific language governing permissions and
13
13
  limitations under the License.
14
14
  ==============================================================================*/
15
+ #ifndef SIGNAL_MICRO_KERNELS_IRFFT_H_
16
+ #define SIGNAL_MICRO_KERNELS_IRFFT_H_
15
17
 
16
- #ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_NO_SIMPLE_FEATURES_DATA_H_
17
- #define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_NO_SIMPLE_FEATURES_DATA_H_
18
+ #include "tensorflow/lite/micro/micro_common.h"
18
19
 
19
- extern const int g_no_simple_f9643d42_nohash_4_width;
20
- extern const int g_no_simple_f9643d42_nohash_4_height;
21
- extern const unsigned char g_no_simple_f9643d42_nohash_4_data[];
20
+ namespace tflite {
21
+ namespace tflm_signal {
22
22
 
23
- #endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_NO_SIMPLE_FEATURES_DATA_H_
23
+ TFLMRegistration* Register_IRFFT();
24
+ TFLMRegistration* Register_IRFFT_FLOAT();
25
+ TFLMRegistration* Register_IRFFT_INT16();
26
+ TFLMRegistration* Register_IRFFT_INT32();
27
+
28
+ } // namespace tflm_signal
29
+ } // namespace tflite
30
+
31
+ #endif // SIGNAL_MICRO_KERNELS_IRFFT_H_
@@ -0,0 +1,25 @@
1
+ /* Copyright 2021 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 SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_OVERLAP_ADD_FLEXBUFFERS_DATA_H_
17
+ #define SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_OVERLAP_ADD_FLEXBUFFERS_DATA_H_
18
+
19
+ extern const int g_gen_data_size_overlap_add_float;
20
+ extern const unsigned char g_gen_data_overlap_add_float[];
21
+
22
+ extern const int g_gen_data_size_overlap_add_int16;
23
+ extern const unsigned char g_gen_data_overlap_add_int16[];
24
+
25
+ #endif // SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_OVERLAP_ADD_FLEXBUFFERS_DATA_H_
@@ -0,0 +1,7 @@
1
+ #ifndef SIGNAL_MICRO_KERNELS_PCAN_FLEXBUFFERS_GENERATED_DATA_H_
2
+ #define SIGNAL_MICRO_KERNELS_PCAN_FLEXBUFFERS_GENERATED_DATA_H_
3
+
4
+ extern const int g_gen_data_size_snr_shift_6_test;
5
+ extern const unsigned char g_gen_data_snr_shift_6_test[];
6
+
7
+ #endif // SIGNAL_MICRO_KERNELS_PCAN_FLEXBUFFERS_GENERATED_DATA_H_
@@ -0,0 +1,31 @@
1
+ /* Copyright 2023 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 SIGNAL_MICRO_KERNELS_RFFT_H_
16
+ #define SIGNAL_MICRO_KERNELS_RFFT_H_
17
+
18
+ #include "tensorflow/lite/micro/micro_common.h"
19
+
20
+ namespace tflite {
21
+ namespace tflm_signal {
22
+
23
+ TFLMRegistration* Register_RFFT();
24
+ TFLMRegistration* Register_RFFT_FLOAT();
25
+ TFLMRegistration* Register_RFFT_INT16();
26
+ TFLMRegistration* Register_RFFT_INT32();
27
+
28
+ } // namespace tflm_signal
29
+ } // namespace tflite
30
+
31
+ #endif // SIGNAL_MICRO_KERNELS_RFFT_H_
@@ -0,0 +1,25 @@
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 SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_STACKER_FLEXBUFFERS_DATA_H_
17
+ #define SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_STACKER_FLEXBUFFERS_DATA_H_
18
+
19
+ extern const int g_gen_data_size_stacker_3_channels_step_1;
20
+ extern const unsigned char g_gen_data_stacker_3_channels_step_1[];
21
+
22
+ extern const int g_gen_data_size_stacker_10_channels_step_2;
23
+ extern const unsigned char g_gen_data_stacker_10_channels_step_2[];
24
+
25
+ #endif // SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_STACKER_FLEXBUFFERS_DATA_H_
@@ -0,0 +1,25 @@
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 SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_WINDOW_FLEXBUFFERS_DATA_H_
17
+ #define SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_WINDOW_FLEXBUFFERS_DATA_H_
18
+
19
+ extern const int g_gen_data_size_window_shift_12;
20
+ extern const unsigned char g_gen_data_window_shift_12[];
21
+
22
+ extern const int g_gen_data_size_window_shift_8;
23
+ extern const unsigned char g_gen_data_window_shift_8[];
24
+
25
+ #endif // SIGNAL_MICRO_KERNELS_TEST_DATA_GENERATION_GENERATE_WINDOW_FLEXBUFFERS_DATA_H_
@@ -0,0 +1,118 @@
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 SIGNAL_SRC_CIRCULAR_BUFFER_H_
17
+ #define SIGNAL_SRC_CIRCULAR_BUFFER_H_
18
+
19
+ #include <stddef.h>
20
+ #include <stdint.h>
21
+
22
+ namespace tflite {
23
+ namespace tflm_signal {
24
+ // TODO(b/286250473): remove namespace once de-duped libraries above
25
+ struct CircularBuffer {
26
+ // Max number of elements, value passed-in to CircularBufferAlloc.
27
+ size_t capacity;
28
+ // Next position to read.
29
+ size_t read;
30
+ // Next position to write.
31
+ size_t write;
32
+ // Flag to indicate emptiness.
33
+ int32_t empty;
34
+ // Auto-generated size variable
35
+ int32_t buffer_size;
36
+ // Array of the circular buffer elements (integers).
37
+ int16_t* buffer;
38
+ };
39
+
40
+ // Returns the size of the memory that the circular buffer needs
41
+ // in order to hold `capacity` items.
42
+ size_t CircularBufferGetNeededMemory(size_t capacity);
43
+
44
+ // Initialize an instance of the circular buffer that holds `capacity` items.
45
+ // `state` points to a memory allocation of size `state_size`. The size
46
+ // should be greater or equal to the value returned by
47
+ // CircularBufferGetNeededMemory(capacity). Fails if it isn't.
48
+ // On success, returns a pointer to the circular buffer's object.
49
+ CircularBuffer* CircularBufferInit(size_t capacity, void* state,
50
+ size_t state_size);
51
+
52
+ // Reset a circular buffer to its initial empty state
53
+ void CircularBufferReset(CircularBuffer* cb);
54
+
55
+ size_t CircularBufferCapacity(const CircularBuffer* cb);
56
+
57
+ bool CircularBufferFull(const CircularBuffer* cb);
58
+
59
+ bool CircularBufferEmpty(const CircularBuffer* cb);
60
+
61
+ // Returns the number of elements ready to read
62
+ size_t CircularBufferAvailable(const CircularBuffer* cb);
63
+
64
+ // Returns the number of elements available to write.
65
+ size_t CircularBufferCanWrite(const CircularBuffer* cb);
66
+
67
+ // Adds a single `value` to the buffer and advances the write pointer.
68
+ void CircularBufferAdd(CircularBuffer* cb, int16_t value);
69
+
70
+ // Writes `n` `values` into the buffer and advances the write pointer.
71
+ void CircularBufferWrite(CircularBuffer* cb, const int16_t* values, size_t n);
72
+
73
+ // Writes `n` zeros into the buffer and advances the write pointer.
74
+ void CircularBufferWriteZeros(CircularBuffer* cb, size_t n);
75
+
76
+ // Returns a pointer to a buffer where elements can be written, and
77
+ // advances the write pointer as though they have already been written.
78
+ // Fails if `n` elements are not available contiguously at the current
79
+ // write position.
80
+ int16_t* CircularBufferReserveForWrite(CircularBuffer* cb, size_t n);
81
+
82
+ // Copies the final region (`count` elements) of the buffer `n` times, to
83
+ // the end of the buffer.
84
+ void CircularBufferExtend(CircularBuffer* cb, size_t count, int32_t n);
85
+
86
+ // Reads a single value from the buffer and advances the read pointer
87
+ int16_t CircularBufferRemove(CircularBuffer* cb);
88
+
89
+ // Reads the value at the given `index`, does not modify the read pointer.
90
+ int16_t CircularBufferPeek(const CircularBuffer* cb, size_t index);
91
+
92
+ // Rewinds to restore the previous `n` values read
93
+ void CircularBufferRewind(CircularBuffer* cb, size_t n);
94
+
95
+ // Returns a pointer directly into the circular buffer at the given `index`.
96
+ // Caller is responsible for not reading past the end.
97
+ const int16_t* CircularBufferPeekDirect(const CircularBuffer* cb, size_t index);
98
+
99
+ // Returns a pointer into the circular buffer at the current read pointer,
100
+ // setting `n` to the number of values available to be read from here.
101
+ const int16_t* CircularBufferPeekMax(const CircularBuffer* cb, size_t* n);
102
+
103
+ // Copies `n` `values` from the buffer and does not advance the read
104
+ // pointer and does not update the empty flag.
105
+ void CircularBufferGet(CircularBuffer* cb, size_t n, int16_t* values);
106
+
107
+ // Discards the next `n` values by advancing the read index.
108
+ // Valid for n > 0.
109
+ void CircularBufferDiscard(CircularBuffer* cb, size_t n);
110
+
111
+ // Shifts the buffer with `n` values (`n` can be negative) by moving
112
+ // the read index.
113
+ void CircularBufferShift(CircularBuffer* cb, int n);
114
+
115
+ } // namespace tflm_signal
116
+ } // namespace tflite
117
+
118
+ #endif // SIGNAL_SRC_CIRCULAR_BUFFER_H_