2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-01-30 09:39:08 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-05-28 08:11:59 +00:00
|
|
|
#include "webrtc/modules/audio_processing/ns/include/noise_suppression_x.h"
|
2012-09-21 18:51:12 +00:00
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
2013-05-28 08:11:59 +00:00
|
|
|
#include "webrtc/common_audio/signal_processing/include/real_fft.h"
|
|
|
|
|
#include "webrtc/modules/audio_processing/ns/nsx_core.h"
|
|
|
|
|
#include "webrtc/modules/audio_processing/ns/nsx_defines.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-10-05 23:36:01 +00:00
|
|
|
int WebRtcNsx_Create(NsxHandle** nsxInst) {
|
2014-12-18 09:11:33 +00:00
|
|
|
NoiseSuppressionFixedC* self = malloc(sizeof(NoiseSuppressionFixedC));
|
2012-09-21 18:51:12 +00:00
|
|
|
*nsxInst = (NsxHandle*)self;
|
|
|
|
|
|
|
|
|
|
if (self != NULL) {
|
2012-09-12 00:23:40 +00:00
|
|
|
WebRtcSpl_Init();
|
2012-09-21 18:51:12 +00:00
|
|
|
self->real_fft = NULL;
|
|
|
|
|
self->initFlag = 0;
|
2011-10-05 23:36:01 +00:00
|
|
|
return 0;
|
|
|
|
|
} else {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-05 23:36:01 +00:00
|
|
|
int WebRtcNsx_Free(NsxHandle* nsxInst) {
|
2014-12-18 09:11:33 +00:00
|
|
|
WebRtcSpl_FreeRealFFT(((NoiseSuppressionFixedC*)nsxInst)->real_fft);
|
2011-10-05 23:36:01 +00:00
|
|
|
free(nsxInst);
|
|
|
|
|
return 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2013-04-10 07:50:54 +00:00
|
|
|
int WebRtcNsx_Init(NsxHandle* nsxInst, uint32_t fs) {
|
2014-12-18 09:11:33 +00:00
|
|
|
return WebRtcNsx_InitCore((NoiseSuppressionFixedC*)nsxInst, fs);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2011-10-05 23:36:01 +00:00
|
|
|
int WebRtcNsx_set_policy(NsxHandle* nsxInst, int mode) {
|
2014-12-18 09:11:33 +00:00
|
|
|
return WebRtcNsx_set_policy_core((NoiseSuppressionFixedC*)nsxInst, mode);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-10 19:30:57 +00:00
|
|
|
void WebRtcNsx_Process(NsxHandle* nsxInst,
|
|
|
|
|
const short* const* speechFrame,
|
|
|
|
|
int num_bands,
|
|
|
|
|
short* const* outFrame) {
|
2014-12-18 09:11:33 +00:00
|
|
|
WebRtcNsx_ProcessCore((NoiseSuppressionFixedC*)nsxInst, speechFrame,
|
|
|
|
|
num_bands, outFrame);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|