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_X_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_X_H_
13 
14 #include "typedefs.h"
15 
16 typedef struct NsxHandleT NsxHandle;
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 WebRtcNsx_get_version(char* version, short length);
34 
35 
36 /*
37  * This function creates an instance to the noise reduction structure
38  *
39  * Input:
40  *      - nsxInst       : Pointer to noise reduction instance that should be
41  *                       created
42  *
43  * Output:
44  *      - nsxInst       : Pointer to created noise reduction instance
45  *
46  * Return value         :  0 - Ok
47  *                        -1 - Error
48  */
49 int WebRtcNsx_Create(NsxHandle** nsxInst);
50 
51 
52 /*
53  * This function frees the dynamic memory of a specified Noise Suppression
54  * instance.
55  *
56  * Input:
57  *      - nsxInst       : Pointer to NS instance that should be freed
58  *
59  * Return value         :  0 - Ok
60  *                        -1 - Error
61  */
62 int WebRtcNsx_Free(NsxHandle* nsxInst);
63 
64 
65 /*
66  * This function initializes a NS instance
67  *
68  * Input:
69  *      - nsxInst       : Instance that should be initialized
70  *      - fs            : sampling frequency
71  *
72  * Output:
73  *      - nsxInst       : Initialized instance
74  *
75  * Return value         :  0 - Ok
76  *                        -1 - Error
77  */
78 int WebRtcNsx_Init(NsxHandle* nsxInst, WebRtc_UWord32 fs);
79 
80 /*
81  * This changes the aggressiveness of the noise suppression method.
82  *
83  * Input:
84  *      - nsxInst       : Instance that should be initialized
85  *      - mode          : 0: Mild, 1: Medium , 2: Aggressive
86  *
87  * Output:
88  *      - nsxInst       : Initialized instance
89  *
90  * Return value         :  0 - Ok
91  *                        -1 - Error
92  */
93 int WebRtcNsx_set_policy(NsxHandle* nsxInst, int mode);
94 
95 /*
96  * This functions does noise suppression for the inserted speech frame. The
97  * input and output signals should always be 10ms (80 or 160 samples).
98  *
99  * Input
100  *      - nsxInst       : NSx instance. Needs to be initiated before call.
101  *      - speechFrame   : Pointer to speech frame buffer for L band
102  *      - speechFrameHB : Pointer to speech frame buffer for H band
103  *      - fs            : sampling frequency
104  *
105  * Output:
106  *      - nsxInst       : Updated NSx instance
107  *      - outFrame      : Pointer to output frame for L band
108  *      - outFrameHB    : Pointer to output frame for H band
109  *
110  * Return value         :  0 - OK
111  *                        -1 - Error
112  */
113 int WebRtcNsx_Process(NsxHandle* nsxInst,
114                       short* speechFrame,
115                       short* speechFrameHB,
116                       short* outFrame,
117                       short* outFrameHB);
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_INTERFACE_NOISE_SUPPRESSION_X_H_
124