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_NOISE_REDUCTION_UTIL_H_ 16 #define TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_NOISE_REDUCTION_UTIL_H_ 17 18 #include "tensorflow/lite/experimental/microfrontend/lib/noise_reduction.h" 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 struct NoiseReductionConfig { 25 // scale the signal up by 2^(smoothing_bits) before reduction 26 int smoothing_bits; 27 // smoothing coefficient for even-numbered channels 28 float even_smoothing; 29 // smoothing coefficient for odd-numbered channels 30 float odd_smoothing; 31 // fraction of signal to preserve (1.0 disables this module) 32 float min_signal_remaining; 33 }; 34 35 // Populates the NoiseReductionConfig with "sane" default values. 36 void NoiseReductionFillConfigWithDefaults(struct NoiseReductionConfig* config); 37 38 // Allocates any buffers. 39 int NoiseReductionPopulateState(const struct NoiseReductionConfig* config, 40 struct NoiseReductionState* state, 41 int num_channels); 42 43 // Frees any allocated buffers. 44 void NoiseReductionFreeStateContents(struct NoiseReductionState* state); 45 46 #ifdef __cplusplus 47 } // extern "C" 48 #endif 49 50 #endif // TENSORFLOW_LITE_EXPERIMENTAL_MICROFRONTEND_LIB_NOISE_REDUCTION_UTIL_H_ 51