frontend_util.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_FRONTEND_UTIL_H_
  13. #define TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_FRONTEND_UTIL_H_
  14. #include "tensorflow/lite/experimental/microfrontend/lib/fft_util.h"
  15. #include "tensorflow/lite/experimental/microfrontend/lib/filterbank_util.h"
  16. #include "tensorflow/lite/experimental/microfrontend/lib/frontend.h"
  17. #include "tensorflow/lite/experimental/microfrontend/lib/log_scale_util.h"
  18. #include "tensorflow/lite/experimental/microfrontend/lib/noise_reduction_util.h"
  19. #include "tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_util.h"
  20. #include "tensorflow/lite/experimental/microfrontend/lib/window_util.h"
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. struct FrontendConfig {
  25. struct WindowConfig window;
  26. struct FilterbankConfig filterbank;
  27. struct NoiseReductionConfig noise_reduction;
  28. struct PcanGainControlConfig pcan_gain_control;
  29. struct LogScaleConfig log_scale;
  30. };
  31. // Fills the frontendConfig with "sane" defaults.
  32. void FrontendFillConfigWithDefaults(struct FrontendConfig* config);
  33. // Allocates any buffers.
  34. int FrontendPopulateState(const struct FrontendConfig* config,
  35. struct FrontendState* state, int sample_rate);
  36. // Frees any allocated buffers.
  37. void FrontendFreeStateContents(struct FrontendState* state);
  38. #ifdef __cplusplus
  39. } // extern "C"
  40. #endif
  41. #endif // TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_FRONTEND_UTIL_H_