window.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_EXPERIMENTAL_MICROFRONTEND_LIB_WINDOW_H_
  13. #define TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_WINDOW_H_
  14. #include <stdint.h>
  15. #include <stdlib.h>
  16. #define kFrontendWindowBits 12
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. struct WindowState {
  21. size_t size;
  22. int16_t* coefficients;
  23. size_t step;
  24. int16_t* input;
  25. size_t input_used;
  26. int16_t* output;
  27. int16_t max_abs_output_value;
  28. };
  29. // Applies a window to the samples coming in, stepping forward at the given
  30. // rate.
  31. int WindowProcessSamples(struct WindowState* state, const int16_t* samples,
  32. size_t num_samples, size_t* num_samples_read);
  33. void WindowReset(struct WindowState* state);
  34. #ifdef __cplusplus
  35. } // extern "C"
  36. #endif
  37. #endif // TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_WINDOW_H_