1 /* 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_H_ 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_H_ 13 14 #include "typedefs.h" 15 16 typedef struct NsHandleT NsHandle; 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 /* 23 * This function returns the version number of the code. 24 * 25 * Input: 26 * - version : Pointer to a character array where the version 27 * info is stored. 28 * - length : Length of version. 29 * 30 * Return value : 0 - Ok 31 * -1 - Error (probably length is not sufficient) 32 */ 33 int WebRtcNs_get_version(char* version, short length); 34 35 36 /* 37 * This function creates an instance to the noise reduction structure 38 * 39 * Input: 40 * - NS_inst : Pointer to noise reduction instance that should be 41 * created 42 * 43 * Output: 44 * - NS_inst : Pointer to created noise reduction instance 45 * 46 * Return value : 0 - Ok 47 * -1 - Error 48 */ 49 int WebRtcNs_Create(NsHandle** NS_inst); 50 51 52 /* 53 * This function frees the dynamic memory of a specified Noise Reduction 54 * instance. 55 * 56 * Input: 57 * - NS_inst : Pointer to NS instance that should be freed 58 * 59 * Return value : 0 - Ok 60 * -1 - Error 61 */ 62 int WebRtcNs_Free(NsHandle* NS_inst); 63 64 65 /* 66 * This function initializes a NS instance 67 * 68 * Input: 69 * - NS_inst : Instance that should be initialized 70 * - fs : sampling frequency 71 * 72 * Output: 73 * - NS_inst : Initialized instance 74 * 75 * Return value : 0 - Ok 76 * -1 - Error 77 */ 78 int WebRtcNs_Init(NsHandle* NS_inst, WebRtc_UWord32 fs); 79 80 /* 81 * This changes the aggressiveness of the noise suppression method. 82 * 83 * Input: 84 * - NS_inst : Instance that should be initialized 85 * - mode : 0: Mild, 1: Medium , 2: Aggressive 86 * 87 * Output: 88 * - NS_inst : Initialized instance 89 * 90 * Return value : 0 - Ok 91 * -1 - Error 92 */ 93 int WebRtcNs_set_policy(NsHandle* NS_inst, int mode); 94 95 96 /* 97 * This functions does Noise Suppression for the inserted speech frame. The 98 * input and output signals should always be 10ms (80 or 160 samples). 99 * 100 * Input 101 * - NS_inst : NS Instance. Needs to be initiated before call. 102 * - spframe : Pointer to speech frame buffer for L band 103 * - spframe_H : Pointer to speech frame buffer for H band 104 * - fs : sampling frequency 105 * 106 * Output: 107 * - NS_inst : Updated NS instance 108 * - outframe : Pointer to output frame for L band 109 * - outframe_H : Pointer to output frame for H band 110 * 111 * Return value : 0 - OK 112 * -1 - Error 113 */ 114 int WebRtcNs_Process(NsHandle* NS_inst, 115 short* spframe, 116 short* spframe_H, 117 short* outframe, 118 short* outframe_H); 119 120 #ifdef __cplusplus 121 } 122 #endif 123 124 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_H_ 125