noise_suppression_x.h 3.1 KB

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