| 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.h" | 11 #include "webrtc/modules/audio_processing/ns/include/noise_suppression.h" |
| 12 | 12 |
| 13 #include <stdlib.h> | 13 #include <stdlib.h> |
| 14 #include <string.h> | 14 #include <string.h> |
| 15 | 15 |
| 16 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 16 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
| 17 #include "webrtc/modules/audio_processing/ns/defines.h" | 17 #include "webrtc/modules/audio_processing/ns/defines.h" |
| 18 #include "webrtc/modules/audio_processing/ns/ns_core.h" | 18 #include "webrtc/modules/audio_processing/ns/ns_core.h" |
| 19 | 19 |
| 20 int WebRtcNs_Create(NsHandle** NS_inst) { | 20 NsHandle* WebRtcNs_Create() { |
| 21 *NS_inst = (NsHandle*)malloc(sizeof(NoiseSuppressionC)); | 21 NoiseSuppressionC* self = malloc(sizeof(NoiseSuppressionC)); |
| 22 if (*NS_inst != NULL) { | 22 self->initFlag = 0; |
| 23 (*(NoiseSuppressionC**)NS_inst)->initFlag = 0; | 23 return (NsHandle*)self; |
| 24 return 0; | |
| 25 } else { | |
| 26 return -1; | |
| 27 } | |
| 28 | |
| 29 } | 24 } |
| 30 | 25 |
| 31 void WebRtcNs_Free(NsHandle* NS_inst) { | 26 void WebRtcNs_Free(NsHandle* NS_inst) { |
| 32 free(NS_inst); | 27 free(NS_inst); |
| 33 } | 28 } |
| 34 | 29 |
| 35 int WebRtcNs_Init(NsHandle* NS_inst, uint32_t fs) { | 30 int WebRtcNs_Init(NsHandle* NS_inst, uint32_t fs) { |
| 36 return WebRtcNs_InitCore((NoiseSuppressionC*)NS_inst, fs); | 31 return WebRtcNs_InitCore((NoiseSuppressionC*)NS_inst, fs); |
| 37 } | 32 } |
| 38 | 33 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 55 float WebRtcNs_prior_speech_probability(NsHandle* handle) { | 50 float WebRtcNs_prior_speech_probability(NsHandle* handle) { |
| 56 NoiseSuppressionC* self = (NoiseSuppressionC*)handle; | 51 NoiseSuppressionC* self = (NoiseSuppressionC*)handle; |
| 57 if (handle == NULL) { | 52 if (handle == NULL) { |
| 58 return -1; | 53 return -1; |
| 59 } | 54 } |
| 60 if (self->initFlag == 0) { | 55 if (self->initFlag == 0) { |
| 61 return -1; | 56 return -1; |
| 62 } | 57 } |
| 63 return self->priorSpeechProb; | 58 return self->priorSpeechProb; |
| 64 } | 59 } |
| OLD | NEW |