作者:乌龟北京飘 | 来源:互联网 | 2023-08-11 15:20
整体过程同webRTC降噪(NS)、自动增益控制(AGC)模块的编译与测试一样,只是在aec_rdft.c文件中可能会报错,局部变量ip跟全局变量冲突的问题,可以将局部变量重新命名一下,就可
整体过程同webRTC降噪(NS)、自动增益控制(AGC)模块的编译与测试一样,只是在aec_rdft.c文件中可能会报错,局部变量ip跟全局变量冲突的问题,可以将局部变量重新命名一下,就可以通过编译了。
修改后的代码如下
/*
* http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html
* Copyright Takuya OOURA, 1996-2001
*
* You may use, copy, modify and distribute this code for any purpose (include
* commercial use) and without fee. Please refer to this package when you modify
* this code.
*
* Changes by the WebRTC authors:
* - Trivial type modifications.
* - Minimal code subset to do rdft of length 128.
* - Optimizations because of known length.
*
* All changes are covered by the WebRTC license and IP grant:
* 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.
*/
#include "webrtc/modules/audio_processing/aec/aec_rdft.h"
#include
#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h"
#include "webrtc/typedefs.h"
// constants shared by all paths (C, SSE2).
float rdft_w[64];
// constants used by the C path.
float rdft_wk3ri_first[32];
float rdft_wk3ri_second[32];
// constants used by SSE2 but initialized in C path.
ALIGN16_BEG float ALIGN16_END rdft_wk1r[32];
ALIGN16_BEG float ALIGN16_END rdft_wk2r[32];
ALIGN16_BEG float ALIGN16_END rdft_wk3r[32];
ALIGN16_BEG float ALIGN16_END rdft_wk1i[32];
ALIGN16_BEG float ALIGN16_END rdft_wk2i[32];
ALIGN16_BEG float ALIGN16_END rdft_wk3i[32];
ALIGN16_BEG float ALIGN16_END cftmdl_wk1r[4];
static int ip[16];
static void bitrv2_32(int* ip1, float* a) {
const int n = 32;
int j, j1, k, k1, m, m2;
float xr, xi, yr, yi;
ip1[0] = 0;
{
int l = n;
m = 1;
while ((m <<3) >= 1;
for (j = 0; j >25) + ((k >> 1)<<5).
(e) Hard-coding of the offsets to completely eliminates index
calculations.
*/
unsigned int j, j1, k, k1;
float xr, xi, yr, yi;
static const int ip2[4] = {0, 64, 32, 96};
for (k = 0; k <4; k++) {
for (j = 0; j > 1;
delta = atanf(1.0f) / nwh;
rdft_w[0] = 1;
rdft_w[1] = 0;
rdft_w[nwh] = cosf(delta * nwh);
rdft_w[nwh + 1] = rdft_w[nwh];
for (j = 2; j > 1;
delta = atanf(1.0f) / nch;
c[0] = cosf(delta * nch);
c[nch] = 0.5f * c[0];
for (j = 1; j
测试效果如下
![](https://img1.php1.cn/3cd4a/24de0/1c8/abb7fa3ce1bc11f3.jpeg)