/* Copyright (c) 2013 Julien Pommier ( pommier@modartt.com )
Based on original fortran 77 code from FFTPACKv4 from NETLIB
(http://www.netlib.org/fftpack), authored by Dr Paul Swarztrauber
of NCAR, in 1985.
As confirmed by the NCAR fftpack software curators, the following
FFTPACKv5 license applies to FFTPACKv4 sources. My changes are
released under the same terms.
FFTPACK license:
http://www.cisl.ucar.edu/css/software/fftpack5/ftpk.html
Copyright (c) 2004 the University Corporation for Atmospheric
Research ("UCAR"). All rights reserved. Developed by NCAR's
Computational and Information Systems Laboratory, UCAR,
www.cisl.ucar.edu.
Redistribution and use of the Software in source and binary forms,
with or without modification, is permitted provided that the
following conditions are met:
- Neither the names of NCAR's Computational and Information Systems
Laboratory, the University Corporation for Atmospheric Research,
nor the names of its sponsors or contributors may be used to
endorse or promote products derived from this Software without
specific prior written permission.
- Redistributions of source code must retain the above copyright
notices, this list of conditions, and the disclaimer below.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions, and the disclaimer below in the
documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
PFFFT : a Pretty Fast FFT.
This file is largerly based on the original FFTPACK implementation, modified in
order to take advantage of SIMD instructions of modern CPUs.
*/
/*
ChangeLog:
- 2011/10/02, version 1: This is the very first release of this file.
*/
// MSVC++ requires this to be set before any other includes to get M_PI.
#define _USE_MATH_DEFINES
#include "pffft.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <assert.h>
/* detect compiler flavour */
#if defined(_MSC_VER)
# define COMPILER_MSVC
#elif defined(__GNUC__)
# define COMPILER_GCC
#endif
#if defined(COMPILER_GCC)
# define ALWAYS_INLINE(return_type) inline return_type __attribute__ ((always_inline))
# define NEVER_INLINE(return_type) return_type __attribute__ ((noinline))
# define RESTRICT __restrict
# define VLA_ARRAY_ON_STACK(type__, varname__, size__) type__ varname__[size__];
#elif defined(COMPILER_MSVC)
# define ALWAYS_INLINE(return_type) __forceinline return_type
# define NEVER_INLINE(return_type) __declspec(noinline) return_type
# define RESTRICT __restrict
# define VLA_ARRAY_ON_STACK(type__, varname__, size__) type__ *varname__ = (type__*)_alloca(size__ * sizeof(type__))
#endif
/*
vector support macros: the rest of the code is independant of
SSE/Altivec/NEON -- adding support for other platforms with 4-element
vectors should be limited to these macros
*/
// define PFFFT_SIMD_DISABLE if you want to use scalar code instead of simd code
//#define PFFFT_SIMD_DISABLE
/*
Altivec support macros
*/
#if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
typedef vector float v4sf;
# define SIMD_SZ 4
# define VZERO() ((vector float) vec_splat_u8(0))
# define VMUL(a,b) vec_madd(a,b, VZERO())
# define VADD(a,b) vec_add(a,b)
# define VMADD(a,b,c) vec_madd(a,b,c)
# define VSUB(a,b) vec_sub(a,b)
inline v4sf ld_ps1(const float *p) { v4sf v=vec_lde(0,p); return vec_splat(vec_perm(v, v, vec_lvsl(0, p)), 0); }
# define LD_PS1(p) ld_ps1(&p)
# define INTERLEAVE2(in1, in2, out1, out2) { v4sf tmp__ = vec_mergeh(in1, in2); out2 = vec_mergel(in1, in2); out1 = tmp__; }
# define UNINTERLEAVE2(in1, in2, out1, out2) { \
vector unsigned char vperm1 = (vector unsigned char)(0,1,2,3,8,9,10,11,16,17,18,19,24,25,26,27); \
vector unsigned char vperm2 = (vector unsigned char)(4,5,6,7,12,13,14,15,20,21,22,23,28,29,30,31); \
v4sf tmp__ = vec_perm(in1, in2, vperm1); out2 = vec_perm(in1, in2, vperm2); out1 = tmp__; \
}
# define VTRANSPOSE4(x0,x1,x2,x3) { \
v4sf y0 = vec_mergeh(x0, x2); \
v4sf y1 = vec_mergel(x0, x2); \
v4sf y2 = vec_mergeh(x1, x3); \
v4sf y3 = vec_mergel(x1, x3); \
x0 = vec_mergeh(y0, y2); \
x1 = vec_mergel(y0, y2); \
x2 = vec_mergeh(y1, y3); \
x3 = vec_mergel(y1, y3); \
}
# define VSWAPHL(a,b) vec_perm(a,b, (vector unsigned char)(16,17,18,19,20,21,22,23,8,9,10,11,12,13,14,15))
# define VALIGNED(ptr) ((((long long)(ptr)) & 0xF) == 0)
/*
SSE1 support macros
*/
#elif !defined(PFFFT_SIMD_DISABLE) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(i386) || defined(_M_IX86))
#include <xmmintrin.h>
typedef __m128 v4sf;
# define SIMD_SZ 4 // 4 floats by simd vector -- this is pretty much hardcoded in the preprocess/finalize functions anyway so you will have to work if you want to enable AVX with its 256-bit vectors.
# define VZERO() _mm_setzero_ps()
# define VMUL(a,b) _mm_mul_ps(a,b)
# define VADD(a,b) _mm_add_ps(a,b)
# define VMADD(a,b,c) _mm_add_ps(_mm_mul_ps(a,b), c)
# define VSUB(a,b) _mm_sub_ps(a,b)
# define LD_PS1(p) _mm_set1_ps(p)
# define INTERLEAVE2(in1, in2, out1, out2) { v4sf tmp__ = _mm_unpacklo_ps(in1, in2); out2 = _mm_unpackhi_ps(in1, in2); out1 = tmp__; }
# define UNINTERLEAVE2(in1, in2, out1, out2) { v4sf tmp__ = _mm_shuffle_ps(in1, in2, _MM_SHUFFLE(2,0,2,0)); out2 = _mm_shuffle_ps(in1, in2, _MM_SHUFFLE(3,1,3,1)); out1 = tmp__; }
# define VTRANSPOSE4(x0,x1,x2,x3) _MM_TRANSPOSE4_PS(x0,x1,x2,x3)
# define VSWAPHL(a,b) _mm_shuffle_ps(b, a, _MM_SHUFFLE(3,2,1,0))
# define VALIGNED(ptr) ((((long long)(ptr)) & 0xF) == 0)
/*
ARM NEON support macros
*/
#elif !defined(PFFFT_SIMD_DISABLE) && (defined(__arm__) || defined(__aarch64__) || defined(__arm64__))
# include <arm_neon.h>
typedef float32x4_t v4sf;
# define SIMD_SZ 4
# define VZERO() vdupq_n_f32(0)
# define VMUL(a,b) vmulq_f32(a,b)
# define VADD(a,b) vaddq_f32(a,b)
# define VMADD(a,b,c) vmlaq_f32(c,a,b)
# define VSUB(a,b) vsubq_f32(a,b)
# define LD_PS1(p) vld1q_dup_f32(&(p))
# define INTERLEAVE2(in1, in2, out1, out2) { float32x4x2_t tmp__ = vzipq_f32(in1,in2); out1=tmp__.val[0]; out2=tmp__.val[1]; }
# define UNINTERLEAVE2(in1, in2, out1, out2) { float32x4x2_t tmp__ = vuzpq_f32(in1,in2); out1=tmp__.val[0]; out2=tmp__.val[1]; }
# define VTRANSPOSE4(x0,x1,x2,x3) { \
float32x4x2_t t0_ = vzipq_f32(x0, x2); \
float32x4x2_t t1_ = vzipq_f32(x1, x3); \
float32x4x2_t u0_ = vzipq_f32(t0_.val[0], t1_.val[0]); \
float32x4x2_t u1_ = vzipq_f32(t0_.val[1], t1_.val[1]); \
x0 = u0_.val[0]; x1 = u0_.val[1]; x2 = u1_.val[0]; x3 = u1_.val[1]; \
}
// marginally faster version
//# define VTRANSPOSE4(x0,x1,x2,x3) { asm("vtrn.32 %q0, %q1;\n vtrn.32 %q2,%q3\n vswp %f0,%e2\n vswp %f1,%e3" : "+w"(x0), "+w"(x1), "+w"(x2), "+w"(x3)::); }
# define VSWAPHL(a,b) vcombine_f32(vget_low_f32(b), vget_high_f32(a))
# define VALIGNED(ptr) ((((long long)(ptr)) & 0x3) == 0)
#else
# if !defined(PFFFT_SIMD_DISABLE)
# warning "building with simd disabled !\n";
# define PFFFT_SIMD_DISABLE // fallback to scalar code
# endif
#endif
// fallback mod
没有合适的资源?快使用搜索试试~ 我知道了~
Noise Suppresso(NS) and Voice Activity Detector(VAD)
共177个文件
h:94个
cc:51个
c:31个
需积分: 10 13 下载量 63 浏览量
2023-02-15
23:34:25
上传
评论 1
收藏 314KB ZIP 举报
温馨提示
基于webrtc 2022/12/10的更新版本,剥离的Noise Suppressor(NS噪音抑制)和Voice Activity Detector(VAD语音检测)。 最新版的VAD使用了RNNiose神经网络分频判断,实测基本可以做到语音自动分段。NS噪音抑制的性能也相当惊艳,默认等级能将背景底噪削弱大半。可广泛用于语音直播、优化增强语音效果等应用。 只支持Win32平台,根据vc2019编译器修改,不依赖任何第三方库,将所有代码文件添加到工程,编译过即可应用于自己的项目工程。 有需要其他系统平台编译或者webrtc中Audio Process内的其他过滤处理,可以邮件或者站内消息联系本人,有时间可以酌情考虑帮忙移植。 压缩包内附有从测试工程中剥离的调用演示代码(AudioProcessing_example.cpp),仅做调用流程参考。
资源推荐
资源详情
资源评论
收起资源包目录
Noise Suppresso(NS) and Voice Activity Detector(VAD) (177个子文件)
pffft.c 66KB
fft.c 27KB
vad_core.c 26KB
pitch_estimator.c 25KB
resample_by_2_internal.c 21KB
resample.c 17KB
pitch_filter.c 16KB
isac_vad.c 15KB
vad_filterbank.c 14KB
complex_fft.c 10KB
splitting_filter_c.c 9KB
resample_fractional.c 8KB
min_max_operations.c 6KB
resample_by_2.c 6KB
resample_48khz.c 6KB
vad_sp.c 6KB
filter_functions.c 6KB
vector_scaling_operations.c 5KB
complex_bit_reverse.c 4KB
division_operations.c 3KB
real_fft.c 3KB
spl_init.c 3KB
webrtc_vad.c 3KB
vad_gmm.c 3KB
downsample_fast.c 2KB
spl_sqrt_floor.c 2KB
copy_set_operations.c 2KB
get_scaling_square.c 1KB
cross_correlation.c 1KB
energy.c 1KB
spl_inl.c 1KB
resampler.cc 29KB
rnn_vad_weights.cc 28KB
fft4g.cc 24KB
pitch_search_internal.cc 22KB
NoiseSuppressor.cc 22KB
audio_buffer.cc 15KB
sinc_resampler.cc 14KB
three_band_filter_bank.cc 11KB
vad_audio_proc.cc 11KB
spectral_features.cc 9KB
rnn_gru.cc 8KB
spectral_features_internal.cc 8KB
noise_estimator.cc 8KB
signal_model_estimator.cc 6KB
splitting_filter.cc 6KB
prior_signal_model_estimator.cc 6KB
lp_residual.cc 5KB
pffft_wrapper.cc 4KB
wiener_filter.cc 4KB
pole_zero_filter.cc 4KB
push_resampler.cc 4KB
pitch_based_vad.cc 4KB
speech_probability_estimator.cc 4KB
VoiceActivityDetector2.cc 4KB
push_sinc_resampler.cc 4KB
auto_correlation.cc 4KB
rnn_fc.cc 4KB
features_extraction.cc 4KB
cpu_features.cc 3KB
aligned_malloc.cc 3KB
VoiceActivityDetector.cc 3KB
rnn.cc 3KB
vad_circular_buffer.cc 3KB
pitch_search.cc 3KB
quantile_noise_estimator.cc 3KB
sinc_resampler_avx2.cc 3KB
standalone_vad.cc 2KB
fast_math.cc 2KB
sinc_resampler_sse.cc 2KB
channel_buffer.cc 2KB
pitch_internal.cc 2KB
ns_fft.cc 2KB
vector_math_avx2.cc 2KB
gmm.cc 2KB
biquad_filter.cc 2KB
audio_util.cc 2KB
available_cpu_features.cc 2KB
histograms.cc 2KB
suppression_params.cc 2KB
signal_model.cc 714B
prior_signal_model.cc 604B
AudioProcessing_example.cpp 6KB
signal_processing_library.h 61KB
array_view.h 13KB
structs.h 12KB
complex_fft_tables.h 9KB
channel_buffer.h 8KB
safe_conversions_impl.h 7KB
sinc_resampler.h 7KB
audio_util.h 7KB
settings.h 7KB
safe_compare.h 7KB
pffft.h 7KB
audio_buffer.h 6KB
spl_inl.h 5KB
noise_gmm_tables.h 5KB
voice_gmm_tables.h 5KB
function_view.h 5KB
vad_audio_proc_internal.h 5KB
共 177 条
- 1
- 2
资源评论
裤子多多
- 粉丝: 4
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功