| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/modules/audio_processing/ns/include/noise_suppression_x.h" | 11 #include "webrtc/modules/audio_processing/ns/include/noise_suppression_x.h" |
| 12 | 12 |
| 13 #include <stdlib.h> | 13 #include <stdlib.h> |
| 14 | 14 |
| 15 #include "webrtc/common_audio/signal_processing/include/real_fft.h" | 15 #include "webrtc/common_audio/signal_processing/include/real_fft.h" |
| 16 #include "webrtc/modules/audio_processing/ns/nsx_core.h" | 16 #include "webrtc/modules/audio_processing/ns/nsx_core.h" |
| 17 #include "webrtc/modules/audio_processing/ns/nsx_defines.h" | 17 #include "webrtc/modules/audio_processing/ns/nsx_defines.h" |
| 18 | 18 |
| 19 int WebRtcNsx_Create(NsxHandle** nsxInst) { | 19 NsxHandle* WebRtcNsx_Create() { |
| 20 NoiseSuppressionFixedC* self = malloc(sizeof(NoiseSuppressionFixedC)); | 20 NoiseSuppressionFixedC* self = malloc(sizeof(NoiseSuppressionFixedC)); |
| 21 *nsxInst = (NsxHandle*)self; | 21 WebRtcSpl_Init(); |
| 22 | 22 self->real_fft = NULL; |
| 23 if (self != NULL) { | 23 self->initFlag = 0; |
| 24 WebRtcSpl_Init(); | 24 return (NsxHandle*)self; |
| 25 self->real_fft = NULL; | |
| 26 self->initFlag = 0; | |
| 27 return 0; | |
| 28 } else { | |
| 29 return -1; | |
| 30 } | |
| 31 | |
| 32 } | 25 } |
| 33 | 26 |
| 34 void WebRtcNsx_Free(NsxHandle* nsxInst) { | 27 void WebRtcNsx_Free(NsxHandle* nsxInst) { |
| 35 WebRtcSpl_FreeRealFFT(((NoiseSuppressionFixedC*)nsxInst)->real_fft); | 28 WebRtcSpl_FreeRealFFT(((NoiseSuppressionFixedC*)nsxInst)->real_fft); |
| 36 free(nsxInst); | 29 free(nsxInst); |
| 37 } | 30 } |
| 38 | 31 |
| 39 int WebRtcNsx_Init(NsxHandle* nsxInst, uint32_t fs) { | 32 int WebRtcNsx_Init(NsxHandle* nsxInst, uint32_t fs) { |
| 40 return WebRtcNsx_InitCore((NoiseSuppressionFixedC*)nsxInst, fs); | 33 return WebRtcNsx_InitCore((NoiseSuppressionFixedC*)nsxInst, fs); |
| 41 } | 34 } |
| 42 | 35 |
| 43 int WebRtcNsx_set_policy(NsxHandle* nsxInst, int mode) { | 36 int WebRtcNsx_set_policy(NsxHandle* nsxInst, int mode) { |
| 44 return WebRtcNsx_set_policy_core((NoiseSuppressionFixedC*)nsxInst, mode); | 37 return WebRtcNsx_set_policy_core((NoiseSuppressionFixedC*)nsxInst, mode); |
| 45 } | 38 } |
| 46 | 39 |
| 47 void WebRtcNsx_Process(NsxHandle* nsxInst, | 40 void WebRtcNsx_Process(NsxHandle* nsxInst, |
| 48 const short* const* speechFrame, | 41 const short* const* speechFrame, |
| 49 int num_bands, | 42 int num_bands, |
| 50 short* const* outFrame) { | 43 short* const* outFrame) { |
| 51 WebRtcNsx_ProcessCore((NoiseSuppressionFixedC*)nsxInst, speechFrame, | 44 WebRtcNsx_ProcessCore((NoiseSuppressionFixedC*)nsxInst, speechFrame, |
| 52 num_bands, outFrame); | 45 num_bands, outFrame); |
| 53 } | 46 } |
| OLD | NEW |