window_util.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_UTIL_H_
  13. #define TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_WINDOW_UTIL_H_
  14. #include "tensorflow/lite/experimental/microfrontend/lib/window.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. struct WindowConfig {
  19. // length of window frame in milliseconds
  20. size_t size_ms;
  21. // length of step for next frame in milliseconds
  22. size_t step_size_ms;
  23. };
  24. // Populates the WindowConfig with "sane" default values.
  25. void WindowFillConfigWithDefaults(struct WindowConfig* config);
  26. // Allocates any buffers.
  27. int WindowPopulateState(const struct WindowConfig* config,
  28. struct WindowState* state, int sample_rate);
  29. // Frees any allocated buffers.
  30. void WindowFreeStateContents(struct WindowState* state);
  31. #ifdef __cplusplus
  32. } // extern "C"
  33. #endif
  34. #endif // TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_WINDOW_UTIL_H_