audio_processing: Create now returns a pointer to the object
Affects * NS * AGC * AEC BUG=441 TESTED=locally on Linux and trybots R=kwiberg@webrtc.org Review URL: https://codereview.webrtc.org/1175903002. Cr-Commit-Position: refs/heads/master@{#9411}
This commit is contained in:
parent
8a19f3dc62
commit
9345e86551
@ -1367,26 +1367,23 @@ static void ProcessBlock(AecCore* aec) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int WebRtcAec_CreateAec(AecCore** aecInst) {
|
AecCore* WebRtcAec_CreateAec() {
|
||||||
int i;
|
int i;
|
||||||
AecCore* aec = malloc(sizeof(AecCore));
|
AecCore* aec = malloc(sizeof(AecCore));
|
||||||
*aecInst = aec;
|
if (!aec) {
|
||||||
if (aec == NULL) {
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aec->nearFrBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(float));
|
aec->nearFrBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(float));
|
||||||
if (!aec->nearFrBuf) {
|
if (!aec->nearFrBuf) {
|
||||||
WebRtcAec_FreeAec(aec);
|
WebRtcAec_FreeAec(aec);
|
||||||
aec = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aec->outFrBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(float));
|
aec->outFrBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(float));
|
||||||
if (!aec->outFrBuf) {
|
if (!aec->outFrBuf) {
|
||||||
WebRtcAec_FreeAec(aec);
|
WebRtcAec_FreeAec(aec);
|
||||||
aec = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUM_HIGH_BANDS_MAX; ++i) {
|
for (i = 0; i < NUM_HIGH_BANDS_MAX; ++i) {
|
||||||
@ -1394,15 +1391,13 @@ int WebRtcAec_CreateAec(AecCore** aecInst) {
|
|||||||
sizeof(float));
|
sizeof(float));
|
||||||
if (!aec->nearFrBufH[i]) {
|
if (!aec->nearFrBufH[i]) {
|
||||||
WebRtcAec_FreeAec(aec);
|
WebRtcAec_FreeAec(aec);
|
||||||
aec = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
aec->outFrBufH[i] = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN,
|
aec->outFrBufH[i] = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN,
|
||||||
sizeof(float));
|
sizeof(float));
|
||||||
if (!aec->outFrBufH[i]) {
|
if (!aec->outFrBufH[i]) {
|
||||||
WebRtcAec_FreeAec(aec);
|
WebRtcAec_FreeAec(aec);
|
||||||
aec = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1411,15 +1406,13 @@ int WebRtcAec_CreateAec(AecCore** aecInst) {
|
|||||||
WebRtc_CreateBuffer(kBufSizePartitions, sizeof(float) * 2 * PART_LEN1);
|
WebRtc_CreateBuffer(kBufSizePartitions, sizeof(float) * 2 * PART_LEN1);
|
||||||
if (!aec->far_buf) {
|
if (!aec->far_buf) {
|
||||||
WebRtcAec_FreeAec(aec);
|
WebRtcAec_FreeAec(aec);
|
||||||
aec = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
aec->far_buf_windowed =
|
aec->far_buf_windowed =
|
||||||
WebRtc_CreateBuffer(kBufSizePartitions, sizeof(float) * 2 * PART_LEN1);
|
WebRtc_CreateBuffer(kBufSizePartitions, sizeof(float) * 2 * PART_LEN1);
|
||||||
if (!aec->far_buf_windowed) {
|
if (!aec->far_buf_windowed) {
|
||||||
WebRtcAec_FreeAec(aec);
|
WebRtcAec_FreeAec(aec);
|
||||||
aec = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
#ifdef WEBRTC_AEC_DEBUG_DUMP
|
#ifdef WEBRTC_AEC_DEBUG_DUMP
|
||||||
aec->instance_index = webrtc_aec_instance_count;
|
aec->instance_index = webrtc_aec_instance_count;
|
||||||
@ -1427,8 +1420,7 @@ int WebRtcAec_CreateAec(AecCore** aecInst) {
|
|||||||
WebRtc_CreateBuffer(kBufSizePartitions, sizeof(float) * PART_LEN);
|
WebRtc_CreateBuffer(kBufSizePartitions, sizeof(float) * PART_LEN);
|
||||||
if (!aec->far_time_buf) {
|
if (!aec->far_time_buf) {
|
||||||
WebRtcAec_FreeAec(aec);
|
WebRtcAec_FreeAec(aec);
|
||||||
aec = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
aec->farFile = aec->nearFile = aec->outFile = aec->outLinearFile = NULL;
|
aec->farFile = aec->nearFile = aec->outFile = aec->outLinearFile = NULL;
|
||||||
aec->debug_dump_count = 0;
|
aec->debug_dump_count = 0;
|
||||||
@ -1437,8 +1429,7 @@ int WebRtcAec_CreateAec(AecCore** aecInst) {
|
|||||||
WebRtc_CreateDelayEstimatorFarend(PART_LEN1, kHistorySizeBlocks);
|
WebRtc_CreateDelayEstimatorFarend(PART_LEN1, kHistorySizeBlocks);
|
||||||
if (aec->delay_estimator_farend == NULL) {
|
if (aec->delay_estimator_farend == NULL) {
|
||||||
WebRtcAec_FreeAec(aec);
|
WebRtcAec_FreeAec(aec);
|
||||||
aec = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
// We create the delay_estimator with the same amount of maximum lookahead as
|
// We create the delay_estimator with the same amount of maximum lookahead as
|
||||||
// the delay history size (kHistorySizeBlocks) for symmetry reasons.
|
// the delay history size (kHistorySizeBlocks) for symmetry reasons.
|
||||||
@ -1446,8 +1437,7 @@ int WebRtcAec_CreateAec(AecCore** aecInst) {
|
|||||||
aec->delay_estimator_farend, kHistorySizeBlocks);
|
aec->delay_estimator_farend, kHistorySizeBlocks);
|
||||||
if (aec->delay_estimator == NULL) {
|
if (aec->delay_estimator == NULL) {
|
||||||
WebRtcAec_FreeAec(aec);
|
WebRtcAec_FreeAec(aec);
|
||||||
aec = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
#ifdef WEBRTC_ANDROID
|
#ifdef WEBRTC_ANDROID
|
||||||
// DA-AEC assumes the system is causal from the beginning and will self adjust
|
// DA-AEC assumes the system is causal from the beginning and will self adjust
|
||||||
@ -1485,7 +1475,7 @@ int WebRtcAec_CreateAec(AecCore** aecInst) {
|
|||||||
|
|
||||||
aec_rdft_init();
|
aec_rdft_init();
|
||||||
|
|
||||||
return 0;
|
return aec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcAec_FreeAec(AecCore* aec) {
|
void WebRtcAec_FreeAec(AecCore* aec) {
|
||||||
|
@ -51,7 +51,7 @@ typedef struct Stats {
|
|||||||
|
|
||||||
typedef struct AecCore AecCore;
|
typedef struct AecCore AecCore;
|
||||||
|
|
||||||
int WebRtcAec_CreateAec(AecCore** aec);
|
AecCore* WebRtcAec_CreateAec(); // Returns NULL on error.
|
||||||
void WebRtcAec_FreeAec(AecCore* aec);
|
void WebRtcAec_FreeAec(AecCore* aec);
|
||||||
int WebRtcAec_InitAec(AecCore* aec, int sampFreq);
|
int WebRtcAec_InitAec(AecCore* aec, int sampFreq);
|
||||||
void WebRtcAec_InitAec_SSE2(void);
|
void WebRtcAec_InitAec_SSE2(void);
|
||||||
|
@ -40,14 +40,8 @@ static int EstimateSkew(const int* rawSkew,
|
|||||||
int absLimit,
|
int absLimit,
|
||||||
float* skewEst);
|
float* skewEst);
|
||||||
|
|
||||||
int WebRtcAec_CreateResampler(void** resampInst) {
|
void* WebRtcAec_CreateResampler() {
|
||||||
AecResampler* obj = malloc(sizeof(AecResampler));
|
return malloc(sizeof(AecResampler));
|
||||||
*resampInst = obj;
|
|
||||||
if (obj == NULL) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int WebRtcAec_InitResampler(void* resampInst, int deviceSampleRateHz) {
|
int WebRtcAec_InitResampler(void* resampInst, int deviceSampleRateHz) {
|
||||||
|
@ -20,8 +20,8 @@ enum {
|
|||||||
kResamplerBufferSize = FRAME_LEN * 4
|
kResamplerBufferSize = FRAME_LEN * 4
|
||||||
};
|
};
|
||||||
|
|
||||||
// Unless otherwise specified, functions return 0 on success and -1 on error
|
// Unless otherwise specified, functions return 0 on success and -1 on error.
|
||||||
int WebRtcAec_CreateResampler(void** resampInst);
|
void* WebRtcAec_CreateResampler(); // Returns NULL on error.
|
||||||
int WebRtcAec_InitResampler(void* resampInst, int deviceSampleRateHz);
|
int WebRtcAec_InitResampler(void* resampInst, int deviceSampleRateHz);
|
||||||
void WebRtcAec_FreeResampler(void* resampInst);
|
void WebRtcAec_FreeResampler(void* resampInst);
|
||||||
|
|
||||||
|
@ -118,28 +118,22 @@ static void ProcessExtended(Aec* self,
|
|||||||
int16_t reported_delay_ms,
|
int16_t reported_delay_ms,
|
||||||
int32_t skew);
|
int32_t skew);
|
||||||
|
|
||||||
int32_t WebRtcAec_Create(void** aecInst) {
|
void* WebRtcAec_Create() {
|
||||||
Aec* aecpc;
|
Aec* aecpc = malloc(sizeof(Aec));
|
||||||
if (aecInst == NULL) {
|
|
||||||
return -1;
|
if (!aecpc) {
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
aecpc = malloc(sizeof(Aec));
|
aecpc->aec = WebRtcAec_CreateAec();
|
||||||
*aecInst = aecpc;
|
if (!aecpc->aec) {
|
||||||
if (aecpc == NULL) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (WebRtcAec_CreateAec(&aecpc->aec) == -1) {
|
|
||||||
WebRtcAec_Free(aecpc);
|
WebRtcAec_Free(aecpc);
|
||||||
aecpc = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
aecpc->resampler = WebRtcAec_CreateResampler();
|
||||||
if (WebRtcAec_CreateResampler(&aecpc->resampler) == -1) {
|
if (!aecpc->resampler) {
|
||||||
WebRtcAec_Free(aecpc);
|
WebRtcAec_Free(aecpc);
|
||||||
aecpc = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
// Create far-end pre-buffer. The buffer size has to be large enough for
|
// Create far-end pre-buffer. The buffer size has to be large enough for
|
||||||
// largest possible drift compensation (kResamplerBufferSize) + "almost" an
|
// largest possible drift compensation (kResamplerBufferSize) + "almost" an
|
||||||
@ -148,8 +142,7 @@ int32_t WebRtcAec_Create(void** aecInst) {
|
|||||||
WebRtc_CreateBuffer(PART_LEN2 + kResamplerBufferSize, sizeof(float));
|
WebRtc_CreateBuffer(PART_LEN2 + kResamplerBufferSize, sizeof(float));
|
||||||
if (!aecpc->far_pre_buf) {
|
if (!aecpc->far_pre_buf) {
|
||||||
WebRtcAec_Free(aecpc);
|
WebRtcAec_Free(aecpc);
|
||||||
aecpc = NULL;
|
return NULL;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aecpc->initFlag = 0;
|
aecpc->initFlag = 0;
|
||||||
@ -168,7 +161,7 @@ int32_t WebRtcAec_Create(void** aecInst) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return aecpc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcAec_Free(void* aecInst) {
|
void WebRtcAec_Free(void* aecInst) {
|
||||||
|
@ -20,22 +20,20 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
#include "webrtc/base/checks.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
TEST(EchoCancellationTest, CreateAndFreeHasExpectedBehavior) {
|
TEST(EchoCancellationTest, CreateAndFreeHasExpectedBehavior) {
|
||||||
EXPECT_EQ(-1, WebRtcAec_Create(NULL));
|
void* handle = WebRtcAec_Create();
|
||||||
void* handle = NULL;
|
ASSERT_TRUE(handle);
|
||||||
ASSERT_EQ(0, WebRtcAec_Create(&handle));
|
|
||||||
EXPECT_TRUE(handle != NULL);
|
|
||||||
WebRtcAec_Free(nullptr);
|
WebRtcAec_Free(nullptr);
|
||||||
WebRtcAec_Free(handle);
|
WebRtcAec_Free(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(EchoCancellationTest, ApplyAecCoreHandle) {
|
TEST(EchoCancellationTest, ApplyAecCoreHandle) {
|
||||||
void* handle = NULL;
|
void* handle = WebRtcAec_Create();
|
||||||
ASSERT_EQ(0, WebRtcAec_Create(&handle));
|
ASSERT_TRUE(handle);
|
||||||
EXPECT_TRUE(handle != NULL);
|
|
||||||
EXPECT_TRUE(WebRtcAec_aec_core(NULL) == NULL);
|
EXPECT_TRUE(WebRtcAec_aec_core(NULL) == NULL);
|
||||||
AecCore* aec_core = WebRtcAec_aec_core(handle);
|
AecCore* aec_core = WebRtcAec_aec_core(handle);
|
||||||
EXPECT_TRUE(aec_core != NULL);
|
EXPECT_TRUE(aec_core != NULL);
|
||||||
|
@ -64,19 +64,10 @@ extern "C" {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocates the memory needed by the AEC. The memory needs to be initialized
|
* Allocates the memory needed by the AEC. The memory needs to be initialized
|
||||||
* separately using the WebRtcAec_Init() function.
|
* separately using the WebRtcAec_Init() function. Returns a pointer to the
|
||||||
*
|
* object or NULL on error.
|
||||||
* Inputs Description
|
|
||||||
* -------------------------------------------------------------------
|
|
||||||
* void** aecInst Pointer to the AEC instance to be created
|
|
||||||
* and initialized
|
|
||||||
*
|
|
||||||
* Outputs Description
|
|
||||||
* -------------------------------------------------------------------
|
|
||||||
* int32_t return 0: OK
|
|
||||||
* -1: error
|
|
||||||
*/
|
*/
|
||||||
int32_t WebRtcAec_Create(void** aecInst);
|
void* WebRtcAec_Create();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function releases the memory allocated by WebRtcAec_Create().
|
* This function releases the memory allocated by WebRtcAec_Create().
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
#include "webrtc/base/checks.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "webrtc/modules/audio_processing/aec/aec_core.h"
|
#include "webrtc/modules/audio_processing/aec/aec_core.h"
|
||||||
}
|
}
|
||||||
@ -67,7 +68,8 @@ SystemDelayTest::SystemDelayTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SystemDelayTest::SetUp() {
|
void SystemDelayTest::SetUp() {
|
||||||
ASSERT_EQ(0, WebRtcAec_Create(&handle_));
|
handle_ = WebRtcAec_Create();
|
||||||
|
ASSERT_TRUE(handle_);
|
||||||
self_ = reinterpret_cast<Aec*>(handle_);
|
self_ = reinterpret_cast<Aec*>(handle_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1313,20 +1313,8 @@ int WebRtcAgc_get_config(void* agcInst, WebRtcAgcConfig* config) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WebRtcAgc_Create(void **agcInst)
|
void* WebRtcAgc_Create() {
|
||||||
{
|
LegacyAgc* stt = malloc(sizeof(LegacyAgc));
|
||||||
LegacyAgc* stt;
|
|
||||||
if (agcInst == NULL)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
stt = (LegacyAgc*)malloc(sizeof(LegacyAgc));
|
|
||||||
|
|
||||||
*agcInst = stt;
|
|
||||||
if (stt == NULL)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WEBRTC_AGC_DEBUG_DUMP
|
#ifdef WEBRTC_AGC_DEBUG_DUMP
|
||||||
stt->fpt = fopen("./agc_test_log.txt", "wt");
|
stt->fpt = fopen("./agc_test_log.txt", "wt");
|
||||||
@ -1337,7 +1325,7 @@ int WebRtcAgc_Create(void **agcInst)
|
|||||||
stt->initFlag = 0;
|
stt->initFlag = 0;
|
||||||
stt->lastError = 0;
|
stt->lastError = 0;
|
||||||
|
|
||||||
return 0;
|
return stt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcAgc_Free(void *state) {
|
void WebRtcAgc_Free(void *state) {
|
||||||
|
@ -200,13 +200,10 @@ int WebRtcAgc_set_config(void* agcInst, WebRtcAgcConfig config);
|
|||||||
int WebRtcAgc_get_config(void* agcInst, WebRtcAgcConfig* config);
|
int WebRtcAgc_get_config(void* agcInst, WebRtcAgcConfig* config);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function creates an AGC instance, which will contain the state
|
* This function creates and returns an AGC instance, which will contain the
|
||||||
* information for one (duplex) channel.
|
* state information for one (duplex) channel.
|
||||||
*
|
|
||||||
* Return value : AGC instance if successful
|
|
||||||
* : 0 (i.e., a NULL pointer) if unsuccessful
|
|
||||||
*/
|
*/
|
||||||
int WebRtcAgc_Create(void **agcInst);
|
void* WebRtcAgc_Create();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function frees the AGC instance created at the beginning.
|
* This function frees the AGC instance created at the beginning.
|
||||||
|
@ -337,14 +337,7 @@ void EchoCancellationImpl::SetExtraOptions(const Config& config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* EchoCancellationImpl::CreateHandle() const {
|
void* EchoCancellationImpl::CreateHandle() const {
|
||||||
Handle* handle = NULL;
|
return WebRtcAec_Create();
|
||||||
if (WebRtcAec_Create(&handle) != apm_->kNoError) {
|
|
||||||
handle = NULL;
|
|
||||||
} else {
|
|
||||||
assert(handle != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EchoCancellationImpl::DestroyHandle(void* handle) const {
|
void EchoCancellationImpl::DestroyHandle(void* handle) const {
|
||||||
|
@ -301,14 +301,7 @@ int GainControlImpl::Initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* GainControlImpl::CreateHandle() const {
|
void* GainControlImpl::CreateHandle() const {
|
||||||
Handle* handle = NULL;
|
return WebRtcAgc_Create();
|
||||||
if (WebRtcAgc_Create(&handle) != apm_->kNoError) {
|
|
||||||
handle = NULL;
|
|
||||||
} else {
|
|
||||||
assert(handle != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GainControlImpl::DestroyHandle(void* handle) const {
|
void GainControlImpl::DestroyHandle(void* handle) const {
|
||||||
|
@ -134,19 +134,11 @@ float NoiseSuppressionImpl::speech_probability() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* NoiseSuppressionImpl::CreateHandle() const {
|
void* NoiseSuppressionImpl::CreateHandle() const {
|
||||||
Handle* handle = NULL;
|
|
||||||
#if defined(WEBRTC_NS_FLOAT)
|
#if defined(WEBRTC_NS_FLOAT)
|
||||||
if (WebRtcNs_Create(&handle) != apm_->kNoError)
|
return WebRtcNs_Create();
|
||||||
#elif defined(WEBRTC_NS_FIXED)
|
#elif defined(WEBRTC_NS_FIXED)
|
||||||
if (WebRtcNsx_Create(&handle) != apm_->kNoError)
|
return WebRtcNsx_Create();
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
handle = NULL;
|
|
||||||
} else {
|
|
||||||
assert(handle != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoiseSuppressionImpl::DestroyHandle(void* handle) const {
|
void NoiseSuppressionImpl::DestroyHandle(void* handle) const {
|
||||||
|
@ -20,20 +20,9 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function creates an instance to the noise suppression structure
|
* This function creates an instance of the floating point Noise Suppression.
|
||||||
*
|
|
||||||
* Input:
|
|
||||||
* - NS_inst : Pointer to noise suppression instance that should be
|
|
||||||
* created
|
|
||||||
*
|
|
||||||
* Output:
|
|
||||||
* - NS_inst : Pointer to created noise suppression instance
|
|
||||||
*
|
|
||||||
* Return value : 0 - Ok
|
|
||||||
* -1 - Error
|
|
||||||
*/
|
*/
|
||||||
int WebRtcNs_Create(NsHandle** NS_inst);
|
NsHandle* WebRtcNs_Create();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function frees the dynamic memory of a specified noise suppression
|
* This function frees the dynamic memory of a specified noise suppression
|
||||||
|
@ -20,20 +20,9 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function creates an instance to the noise reduction structure
|
* This function creates an instance of the fixed point Noise Suppression.
|
||||||
*
|
|
||||||
* Input:
|
|
||||||
* - nsxInst : Pointer to noise reduction instance that should be
|
|
||||||
* created
|
|
||||||
*
|
|
||||||
* Output:
|
|
||||||
* - nsxInst : Pointer to created noise reduction instance
|
|
||||||
*
|
|
||||||
* Return value : 0 - Ok
|
|
||||||
* -1 - Error
|
|
||||||
*/
|
*/
|
||||||
int WebRtcNsx_Create(NsxHandle** nsxInst);
|
NsxHandle* WebRtcNsx_Create();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function frees the dynamic memory of a specified Noise Suppression
|
* This function frees the dynamic memory of a specified Noise Suppression
|
||||||
|
@ -17,15 +17,10 @@
|
|||||||
#include "webrtc/modules/audio_processing/ns/defines.h"
|
#include "webrtc/modules/audio_processing/ns/defines.h"
|
||||||
#include "webrtc/modules/audio_processing/ns/ns_core.h"
|
#include "webrtc/modules/audio_processing/ns/ns_core.h"
|
||||||
|
|
||||||
int WebRtcNs_Create(NsHandle** NS_inst) {
|
NsHandle* WebRtcNs_Create() {
|
||||||
*NS_inst = (NsHandle*)malloc(sizeof(NoiseSuppressionC));
|
NoiseSuppressionC* self = malloc(sizeof(NoiseSuppressionC));
|
||||||
if (*NS_inst != NULL) {
|
self->initFlag = 0;
|
||||||
(*(NoiseSuppressionC**)NS_inst)->initFlag = 0;
|
return (NsHandle*)self;
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcNs_Free(NsHandle* NS_inst) {
|
void WebRtcNs_Free(NsHandle* NS_inst) {
|
||||||
|
@ -16,19 +16,12 @@
|
|||||||
#include "webrtc/modules/audio_processing/ns/nsx_core.h"
|
#include "webrtc/modules/audio_processing/ns/nsx_core.h"
|
||||||
#include "webrtc/modules/audio_processing/ns/nsx_defines.h"
|
#include "webrtc/modules/audio_processing/ns/nsx_defines.h"
|
||||||
|
|
||||||
int WebRtcNsx_Create(NsxHandle** nsxInst) {
|
NsxHandle* WebRtcNsx_Create() {
|
||||||
NoiseSuppressionFixedC* self = malloc(sizeof(NoiseSuppressionFixedC));
|
NoiseSuppressionFixedC* self = malloc(sizeof(NoiseSuppressionFixedC));
|
||||||
*nsxInst = (NsxHandle*)self;
|
|
||||||
|
|
||||||
if (self != NULL) {
|
|
||||||
WebRtcSpl_Init();
|
WebRtcSpl_Init();
|
||||||
self->real_fft = NULL;
|
self->real_fft = NULL;
|
||||||
self->initFlag = 0;
|
self->initFlag = 0;
|
||||||
return 0;
|
return (NsxHandle*)self;
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcNsx_Free(NsxHandle* nsxInst) {
|
void WebRtcNsx_Free(NsxHandle* nsxInst) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user