Home | History | Annotate | Download | only in include
      1 /*
      2  *  Copyright (c) 2012 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_INCLUDE_NOISE_SUPPRESSION_X_H_
     12 #define WEBRTC_MODULES_AUDIO_PROCESSING_NS_INCLUDE_NOISE_SUPPRESSION_X_H_
     13 
     14 #include "webrtc/typedefs.h"
     15 
     16 typedef struct NsxHandleT NsxHandle;
     17 
     18 #ifdef __cplusplus
     19 extern "C" {
     20 #endif
     21 
     22 /*
     23  * This function creates an instance to the noise reduction structure
     24  *
     25  * Input:
     26  *      - nsxInst       : Pointer to noise reduction instance that should be
     27  *                       created
     28  *
     29  * Output:
     30  *      - nsxInst       : Pointer to created noise reduction instance
     31  *
     32  * Return value         :  0 - Ok
     33  *                        -1 - Error
     34  */
     35 int WebRtcNsx_Create(NsxHandle** nsxInst);
     36 
     37 
     38 /*
     39  * This function frees the dynamic memory of a specified Noise Suppression
     40  * instance.
     41  *
     42  * Input:
     43  *      - nsxInst       : Pointer to NS instance that should be freed
     44  *
     45  * Return value         :  0 - Ok
     46  *                        -1 - Error
     47  */
     48 int WebRtcNsx_Free(NsxHandle* nsxInst);
     49 
     50 
     51 /*
     52  * This function initializes a NS instance
     53  *
     54  * Input:
     55  *      - nsxInst       : Instance that should be initialized
     56  *      - fs            : sampling frequency
     57  *
     58  * Output:
     59  *      - nsxInst       : Initialized instance
     60  *
     61  * Return value         :  0 - Ok
     62  *                        -1 - Error
     63  */
     64 int WebRtcNsx_Init(NsxHandle* nsxInst, uint32_t fs);
     65 
     66 /*
     67  * This changes the aggressiveness of the noise suppression method.
     68  *
     69  * Input:
     70  *      - nsxInst       : Instance that should be initialized
     71  *      - mode          : 0: Mild, 1: Medium , 2: Aggressive
     72  *
     73  * Output:
     74  *      - nsxInst       : Initialized instance
     75  *
     76  * Return value         :  0 - Ok
     77  *                        -1 - Error
     78  */
     79 int WebRtcNsx_set_policy(NsxHandle* nsxInst, int mode);
     80 
     81 /*
     82  * This functions does noise suppression for the inserted speech frame. The
     83  * input and output signals should always be 10ms (80 or 160 samples).
     84  *
     85  * Input
     86  *      - nsxInst       : NSx instance. Needs to be initiated before call.
     87  *      - speechFrame   : Pointer to speech frame buffer for L band
     88  *      - speechFrameHB : Pointer to speech frame buffer for H band
     89  *      - fs            : sampling frequency
     90  *
     91  * Output:
     92  *      - nsxInst       : Updated NSx instance
     93  *      - outFrame      : Pointer to output frame for L band
     94  *      - outFrameHB    : Pointer to output frame for H band
     95  *
     96  * Return value         :  0 - OK
     97  *                        -1 - Error
     98  */
     99 int WebRtcNsx_Process(NsxHandle* nsxInst,
    100                       short* speechFrame,
    101                       short* speechFrameHB,
    102                       short* outFrame,
    103                       short* outFrameHB);
    104 
    105 #ifdef __cplusplus
    106 }
    107 #endif
    108 
    109 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_NS_INCLUDE_NOISE_SUPPRESSION_X_H_
    110