• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2018 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 TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_FRONTEND_UTIL_H_
16 #define TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_FRONTEND_UTIL_H_
17 
18 #include "tensorflow/lite/experimental/microfrontend/lib/fft_util.h"
19 #include "tensorflow/lite/experimental/microfrontend/lib/filterbank_util.h"
20 #include "tensorflow/lite/experimental/microfrontend/lib/frontend.h"
21 #include "tensorflow/lite/experimental/microfrontend/lib/log_scale_util.h"
22 #include "tensorflow/lite/experimental/microfrontend/lib/noise_reduction_util.h"
23 #include "tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_util.h"
24 #include "tensorflow/lite/experimental/microfrontend/lib/window_util.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 struct FrontendConfig {
31   struct WindowConfig window;
32   struct FilterbankConfig filterbank;
33   struct NoiseReductionConfig noise_reduction;
34   struct PcanGainControlConfig pcan_gain_control;
35   struct LogScaleConfig log_scale;
36 };
37 
38 // Fills the frontendConfig with "sane" defaults.
39 void FrontendFillConfigWithDefaults(struct FrontendConfig* config);
40 
41 // Allocates any buffers.
42 int FrontendPopulateState(const struct FrontendConfig* config,
43                           struct FrontendState* state, int sample_rate);
44 
45 // Frees any allocated buffers.
46 void FrontendFreeStateContents(struct FrontendState* state);
47 
48 #ifdef __cplusplus
49 }  // extern "C"
50 #endif
51 
52 #endif  // TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_FRONTEND_UTIL_H_
53