mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-09 19:10:28 +00:00
Support for Signal calls.
Merge in RedPhone // FREEBIE
This commit is contained in:
96
jni/webrtc/modules/audio_processing/ns/Android.mk
Normal file
96
jni/webrtc/modules/audio_processing/ns/Android.mk
Normal file
@@ -0,0 +1,96 @@
|
||||
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
#############################
|
||||
# Build the non-neon library.
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
include $(LOCAL_PATH)/../../../../android-webrtc.mk
|
||||
|
||||
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
|
||||
LOCAL_MODULE := libwebrtc_ns
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_GENERATED_SOURCES :=
|
||||
LOCAL_SRC_FILES := \
|
||||
noise_suppression_x.c \
|
||||
nsx_core.c \
|
||||
nsx_core_c.c
|
||||
|
||||
# Files for floating point.
|
||||
# noise_suppression.c ns_core.c
|
||||
|
||||
# Flags passed to both C and C++ files.
|
||||
LOCAL_CFLAGS := $(MY_WEBRTC_COMMON_DEFS)
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/include \
|
||||
$(LOCAL_PATH)/../utility \
|
||||
$(LOCAL_PATH)/../../.. \
|
||||
$(LOCAL_PATH)/../../../common_audio/signal_processing/include \
|
||||
$(LOCAL_PATH)/../../../system_wrappers/interface \
|
||||
$(LOCAL_PATH)/../../../..
|
||||
|
||||
LOCAL_STATIC_LIBRARIES += libwebrtc_system_wrappers
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libcutils \
|
||||
libdl \
|
||||
libstlport
|
||||
|
||||
ifndef NDK_ROOT
|
||||
include external/stlport/libstlport.mk
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
#############################
|
||||
# Build the neon library.
|
||||
ifeq ($(WEBRTC_BUILD_NEON_LIBS),true)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_ARM_MODE := arm
|
||||
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
|
||||
LOCAL_MODULE := libwebrtc_ns_neon
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
NS_ASM_HEADER := $(intermediates)/ns_core_neon_offsets.h
|
||||
NS_ASM_HEADER_DIR := $(intermediates)
|
||||
|
||||
# Generate a header file nsx_core_neon_offsets.h which will be included in
|
||||
# assembly file nsx_core_neon.S, from file nsx_core_neon_offsets.c.
|
||||
$(NS_ASM_HEADER): $(LOCAL_PATH)/../../../build/generate_asm_header.py \
|
||||
$(LOCAL_PATH)/nsx_core_neon_offsets.c
|
||||
@python $^ --compiler=$(TARGET_CC) --options="$(addprefix -I, \
|
||||
$(LOCAL_INCLUDES)) $(addprefix -isystem , $(TARGET_C_INCLUDES)) -S" \
|
||||
--dir=$(NS_ASM_HEADER_DIR)
|
||||
|
||||
LOCAL_GENERATED_SOURCES := $(NS_ASM_HEADER)
|
||||
LOCAL_SRC_FILES := nsx_core_neon.S
|
||||
|
||||
# Flags passed to both C and C++ files.
|
||||
LOCAL_CFLAGS := \
|
||||
$(MY_WEBRTC_COMMON_DEFS) \
|
||||
-mfpu=neon \
|
||||
-mfloat-abi=softfp \
|
||||
-flax-vector-conversions
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(NS_ASM_HEADER_DIR) \
|
||||
$(LOCAL_PATH)/include \
|
||||
$(LOCAL_PATH)/../../.. \
|
||||
$(LOCAL_PATH)/../../../common_audio/signal_processing/include \
|
||||
external/webrtc
|
||||
|
||||
LOCAL_INCLUDES := $(LOCAL_C_INCLUDES)
|
||||
|
||||
ifndef NDK_ROOT
|
||||
include external/stlport/libstlport.mk
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
endif # ifeq ($(WEBRTC_BUILD_NEON_LIBS),true)
|
53
jni/webrtc/modules/audio_processing/ns/defines.h
Normal file
53
jni/webrtc/modules/audio_processing/ns/defines.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_DEFINES_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_DEFINES_H_
|
||||
|
||||
//#define PROCESS_FLOW_0 // Use the traditional method.
|
||||
//#define PROCESS_FLOW_1 // Use traditional with DD estimate of prior SNR.
|
||||
#define PROCESS_FLOW_2 // Use the new method of speech/noise classification.
|
||||
|
||||
#define BLOCKL_MAX 160 // max processing block length: 160
|
||||
#define ANAL_BLOCKL_MAX 256 // max analysis block length: 256
|
||||
#define HALF_ANAL_BLOCKL 129 // half max analysis block length + 1
|
||||
|
||||
#define QUANTILE (float)0.25
|
||||
|
||||
#define SIMULT 3
|
||||
#define END_STARTUP_LONG 200
|
||||
#define END_STARTUP_SHORT 50
|
||||
#define FACTOR (float)40.0
|
||||
#define WIDTH (float)0.01
|
||||
|
||||
#define SMOOTH (float)0.75 // filter smoothing
|
||||
// Length of fft work arrays.
|
||||
#define IP_LENGTH (ANAL_BLOCKL_MAX >> 1) // must be at least ceil(2 + sqrt(ANAL_BLOCKL_MAX/2))
|
||||
#define W_LENGTH (ANAL_BLOCKL_MAX >> 1)
|
||||
|
||||
//PARAMETERS FOR NEW METHOD
|
||||
#define DD_PR_SNR (float)0.98 // DD update of prior SNR
|
||||
#define LRT_TAVG (float)0.50 // tavg parameter for LRT (previously 0.90)
|
||||
#define SPECT_FL_TAVG (float)0.30 // tavg parameter for spectral flatness measure
|
||||
#define SPECT_DIFF_TAVG (float)0.30 // tavg parameter for spectral difference measure
|
||||
#define PRIOR_UPDATE (float)0.10 // update parameter of prior model
|
||||
#define NOISE_UPDATE (float)0.90 // update parameter for noise
|
||||
#define SPEECH_UPDATE (float)0.99 // update parameter when likely speech
|
||||
#define WIDTH_PR_MAP (float)4.0 // width parameter in sigmoid map for prior model
|
||||
#define LRT_FEATURE_THR (float)0.5 // default threshold for LRT feature
|
||||
#define SF_FEATURE_THR (float)0.5 // default threshold for Spectral Flatness feature
|
||||
#define SD_FEATURE_THR (float)0.5 // default threshold for Spectral Difference feature
|
||||
#define PROB_RANGE (float)0.20 // probability threshold for noise state in
|
||||
// speech/noise likelihood
|
||||
#define HIST_PAR_EST 1000 // histogram size for estimation of parameters
|
||||
#define GAMMA_PAUSE (float)0.05 // update for conservative noise estimate
|
||||
//
|
||||
#define B_LIM (float)0.5 // threshold in final energy gain factor calculation
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_DEFINES_H_
|
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_INCLUDE_NOISE_SUPPRESSION_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_INCLUDE_NOISE_SUPPRESSION_H_
|
||||
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
typedef struct NsHandleT NsHandle;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function creates an instance to the noise suppression structure
|
||||
*
|
||||
* 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);
|
||||
|
||||
|
||||
/*
|
||||
* This function frees the dynamic memory of a specified noise suppression
|
||||
* instance.
|
||||
*
|
||||
* Input:
|
||||
* - NS_inst : Pointer to NS instance that should be freed
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNs_Free(NsHandle* NS_inst);
|
||||
|
||||
|
||||
/*
|
||||
* This function initializes a NS instance and has to be called before any other
|
||||
* processing is made.
|
||||
*
|
||||
* Input:
|
||||
* - NS_inst : Instance that should be initialized
|
||||
* - fs : sampling frequency
|
||||
*
|
||||
* Output:
|
||||
* - NS_inst : Initialized instance
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNs_Init(NsHandle* NS_inst, uint32_t fs);
|
||||
|
||||
/*
|
||||
* This changes the aggressiveness of the noise suppression method.
|
||||
*
|
||||
* Input:
|
||||
* - NS_inst : Noise suppression instance.
|
||||
* - mode : 0: Mild, 1: Medium , 2: Aggressive
|
||||
*
|
||||
* Output:
|
||||
* - NS_inst : Updated instance.
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNs_set_policy(NsHandle* NS_inst, int mode);
|
||||
|
||||
|
||||
/*
|
||||
* This functions does Noise Suppression for the inserted speech frame. The
|
||||
* input and output signals should always be 10ms (80 or 160 samples).
|
||||
*
|
||||
* Input
|
||||
* - NS_inst : Noise suppression instance.
|
||||
* - spframe : Pointer to speech frame buffer for L band
|
||||
* - spframe_H : Pointer to speech frame buffer for H band
|
||||
* - fs : sampling frequency
|
||||
*
|
||||
* Output:
|
||||
* - NS_inst : Updated NS instance
|
||||
* - outframe : Pointer to output frame for L band
|
||||
* - outframe_H : Pointer to output frame for H band
|
||||
*
|
||||
* Return value : 0 - OK
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNs_Process(NsHandle* NS_inst,
|
||||
float* spframe,
|
||||
float* spframe_H,
|
||||
float* outframe,
|
||||
float* outframe_H);
|
||||
|
||||
/* Returns the internally used prior speech probability of the current frame.
|
||||
* There is a frequency bin based one as well, with which this should not be
|
||||
* confused.
|
||||
*
|
||||
* Input
|
||||
* - handle : Noise suppression instance.
|
||||
*
|
||||
* Return value : Prior speech probability in interval [0.0, 1.0].
|
||||
* -1 - NULL pointer or uninitialized instance.
|
||||
*/
|
||||
float WebRtcNs_prior_speech_probability(NsHandle* handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_INCLUDE_NOISE_SUPPRESSION_H_
|
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_INCLUDE_NOISE_SUPPRESSION_X_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_INCLUDE_NOISE_SUPPRESSION_X_H_
|
||||
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
typedef struct NsxHandleT NsxHandle;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function creates an instance to the noise reduction structure
|
||||
*
|
||||
* 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);
|
||||
|
||||
|
||||
/*
|
||||
* This function frees the dynamic memory of a specified Noise Suppression
|
||||
* instance.
|
||||
*
|
||||
* Input:
|
||||
* - nsxInst : Pointer to NS instance that should be freed
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNsx_Free(NsxHandle* nsxInst);
|
||||
|
||||
|
||||
/*
|
||||
* This function initializes a NS instance
|
||||
*
|
||||
* Input:
|
||||
* - nsxInst : Instance that should be initialized
|
||||
* - fs : sampling frequency
|
||||
*
|
||||
* Output:
|
||||
* - nsxInst : Initialized instance
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNsx_Init(NsxHandle* nsxInst, uint32_t fs);
|
||||
|
||||
/*
|
||||
* This changes the aggressiveness of the noise suppression method.
|
||||
*
|
||||
* Input:
|
||||
* - nsxInst : Instance that should be initialized
|
||||
* - mode : 0: Mild, 1: Medium , 2: Aggressive
|
||||
*
|
||||
* Output:
|
||||
* - nsxInst : Initialized instance
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNsx_set_policy(NsxHandle* nsxInst, int mode);
|
||||
|
||||
/*
|
||||
* This functions does noise suppression for the inserted speech frame. The
|
||||
* input and output signals should always be 10ms (80 or 160 samples).
|
||||
*
|
||||
* Input
|
||||
* - nsxInst : NSx instance. Needs to be initiated before call.
|
||||
* - speechFrame : Pointer to speech frame buffer for L band
|
||||
* - speechFrameHB : Pointer to speech frame buffer for H band
|
||||
* - fs : sampling frequency
|
||||
*
|
||||
* Output:
|
||||
* - nsxInst : Updated NSx instance
|
||||
* - outFrame : Pointer to output frame for L band
|
||||
* - outFrameHB : Pointer to output frame for H band
|
||||
*
|
||||
* Return value : 0 - OK
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNsx_Process(NsxHandle* nsxInst,
|
||||
short* speechFrame,
|
||||
short* speechFrameHB,
|
||||
short* outFrame,
|
||||
short* outFrameHB);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_INCLUDE_NOISE_SUPPRESSION_X_H_
|
61
jni/webrtc/modules/audio_processing/ns/noise_suppression.c
Normal file
61
jni/webrtc/modules/audio_processing/ns/noise_suppression.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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/ns/include/noise_suppression.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
||||
#include "webrtc/modules/audio_processing/ns/defines.h"
|
||||
#include "webrtc/modules/audio_processing/ns/ns_core.h"
|
||||
|
||||
int WebRtcNs_Create(NsHandle** NS_inst) {
|
||||
*NS_inst = (NsHandle*) malloc(sizeof(NSinst_t));
|
||||
if (*NS_inst != NULL) {
|
||||
(*(NSinst_t**)NS_inst)->initFlag = 0;
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int WebRtcNs_Free(NsHandle* NS_inst) {
|
||||
free(NS_inst);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int WebRtcNs_Init(NsHandle* NS_inst, uint32_t fs) {
|
||||
return WebRtcNs_InitCore((NSinst_t*) NS_inst, fs);
|
||||
}
|
||||
|
||||
int WebRtcNs_set_policy(NsHandle* NS_inst, int mode) {
|
||||
return WebRtcNs_set_policy_core((NSinst_t*) NS_inst, mode);
|
||||
}
|
||||
|
||||
|
||||
int WebRtcNs_Process(NsHandle* NS_inst, float* spframe, float* spframe_H,
|
||||
float* outframe, float* outframe_H) {
|
||||
return WebRtcNs_ProcessCore(
|
||||
(NSinst_t*) NS_inst, spframe, spframe_H, outframe, outframe_H);
|
||||
}
|
||||
|
||||
float WebRtcNs_prior_speech_probability(NsHandle* handle) {
|
||||
NSinst_t* self = (NSinst_t*) handle;
|
||||
if (handle == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if (self->initFlag == 0) {
|
||||
return -1;
|
||||
}
|
||||
return self->priorSpeechProb;
|
||||
}
|
53
jni/webrtc/modules/audio_processing/ns/noise_suppression_x.c
Normal file
53
jni/webrtc/modules/audio_processing/ns/noise_suppression_x.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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/ns/include/noise_suppression_x.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#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"
|
||||
|
||||
int WebRtcNsx_Create(NsxHandle** nsxInst) {
|
||||
NsxInst_t* self = malloc(sizeof(NsxInst_t));
|
||||
*nsxInst = (NsxHandle*)self;
|
||||
|
||||
if (self != NULL) {
|
||||
WebRtcSpl_Init();
|
||||
self->real_fft = NULL;
|
||||
self->initFlag = 0;
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int WebRtcNsx_Free(NsxHandle* nsxInst) {
|
||||
WebRtcSpl_FreeRealFFT(((NsxInst_t*)nsxInst)->real_fft);
|
||||
free(nsxInst);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WebRtcNsx_Init(NsxHandle* nsxInst, uint32_t fs) {
|
||||
return WebRtcNsx_InitCore((NsxInst_t*)nsxInst, fs);
|
||||
}
|
||||
|
||||
int WebRtcNsx_set_policy(NsxHandle* nsxInst, int mode) {
|
||||
return WebRtcNsx_set_policy_core((NsxInst_t*)nsxInst, mode);
|
||||
}
|
||||
|
||||
int WebRtcNsx_Process(NsxHandle* nsxInst, short* speechFrame,
|
||||
short* speechFrameHB, short* outFrame,
|
||||
short* outFrameHB) {
|
||||
return WebRtcNsx_ProcessCore(
|
||||
(NsxInst_t*)nsxInst, speechFrame, speechFrameHB, outFrame, outFrameHB);
|
||||
}
|
1270
jni/webrtc/modules/audio_processing/ns/ns_core.c
Normal file
1270
jni/webrtc/modules/audio_processing/ns/ns_core.c
Normal file
File diff suppressed because it is too large
Load Diff
179
jni/webrtc/modules/audio_processing/ns/ns_core.h
Normal file
179
jni/webrtc/modules/audio_processing/ns/ns_core.h
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NS_CORE_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NS_CORE_H_
|
||||
|
||||
#include "webrtc/modules/audio_processing/ns/defines.h"
|
||||
|
||||
typedef struct NSParaExtract_t_ {
|
||||
|
||||
//bin size of histogram
|
||||
float binSizeLrt;
|
||||
float binSizeSpecFlat;
|
||||
float binSizeSpecDiff;
|
||||
//range of histogram over which lrt threshold is computed
|
||||
float rangeAvgHistLrt;
|
||||
//scale parameters: multiply dominant peaks of the histograms by scale factor to obtain
|
||||
//thresholds for prior model
|
||||
float factor1ModelPars; //for lrt and spectral difference
|
||||
float factor2ModelPars; //for spectral_flatness: used when noise is flatter than speech
|
||||
//peak limit for spectral flatness (varies between 0 and 1)
|
||||
float thresPosSpecFlat;
|
||||
//limit on spacing of two highest peaks in histogram: spacing determined by bin size
|
||||
float limitPeakSpacingSpecFlat;
|
||||
float limitPeakSpacingSpecDiff;
|
||||
//limit on relevance of second peak:
|
||||
float limitPeakWeightsSpecFlat;
|
||||
float limitPeakWeightsSpecDiff;
|
||||
//limit on fluctuation of lrt feature
|
||||
float thresFluctLrt;
|
||||
//limit on the max and min values for the feature thresholds
|
||||
float maxLrt;
|
||||
float minLrt;
|
||||
float maxSpecFlat;
|
||||
float minSpecFlat;
|
||||
float maxSpecDiff;
|
||||
float minSpecDiff;
|
||||
//criteria of weight of histogram peak to accept/reject feature
|
||||
int thresWeightSpecFlat;
|
||||
int thresWeightSpecDiff;
|
||||
|
||||
} NSParaExtract_t;
|
||||
|
||||
typedef struct NSinst_t_ {
|
||||
|
||||
uint32_t fs;
|
||||
int blockLen;
|
||||
int blockLen10ms;
|
||||
int windShift;
|
||||
int outLen;
|
||||
int anaLen;
|
||||
int magnLen;
|
||||
int aggrMode;
|
||||
const float* window;
|
||||
float dataBuf[ANAL_BLOCKL_MAX];
|
||||
float syntBuf[ANAL_BLOCKL_MAX];
|
||||
float outBuf[3 * BLOCKL_MAX];
|
||||
|
||||
int initFlag;
|
||||
// parameters for quantile noise estimation
|
||||
float density[SIMULT* HALF_ANAL_BLOCKL];
|
||||
float lquantile[SIMULT* HALF_ANAL_BLOCKL];
|
||||
float quantile[HALF_ANAL_BLOCKL];
|
||||
int counter[SIMULT];
|
||||
int updates;
|
||||
// parameters for Wiener filter
|
||||
float smooth[HALF_ANAL_BLOCKL];
|
||||
float overdrive;
|
||||
float denoiseBound;
|
||||
int gainmap;
|
||||
// fft work arrays.
|
||||
int ip[IP_LENGTH];
|
||||
float wfft[W_LENGTH];
|
||||
|
||||
// parameters for new method: some not needed, will reduce/cleanup later
|
||||
int32_t blockInd; //frame index counter
|
||||
int modelUpdatePars[4]; //parameters for updating or estimating
|
||||
// thresholds/weights for prior model
|
||||
float priorModelPars[7]; //parameters for prior model
|
||||
float noisePrev[HALF_ANAL_BLOCKL]; //noise spectrum from previous frame
|
||||
float magnPrev[HALF_ANAL_BLOCKL]; //magnitude spectrum of previous frame
|
||||
float logLrtTimeAvg[HALF_ANAL_BLOCKL]; //log lrt factor with time-smoothing
|
||||
float priorSpeechProb; //prior speech/noise probability
|
||||
float featureData[7]; //data for features
|
||||
float magnAvgPause[HALF_ANAL_BLOCKL]; //conservative noise spectrum estimate
|
||||
float signalEnergy; //energy of magn
|
||||
float sumMagn; //sum of magn
|
||||
float whiteNoiseLevel; //initial noise estimate
|
||||
float initMagnEst[HALF_ANAL_BLOCKL]; //initial magnitude spectrum estimate
|
||||
float pinkNoiseNumerator; //pink noise parameter: numerator
|
||||
float pinkNoiseExp; //pink noise parameter: power of freq
|
||||
NSParaExtract_t featureExtractionParams; //parameters for feature extraction
|
||||
//histograms for parameter estimation
|
||||
int histLrt[HIST_PAR_EST];
|
||||
int histSpecFlat[HIST_PAR_EST];
|
||||
int histSpecDiff[HIST_PAR_EST];
|
||||
//quantities for high band estimate
|
||||
float speechProbHB[HALF_ANAL_BLOCKL]; //final speech/noise prob: prior + LRT
|
||||
float dataBufHB[ANAL_BLOCKL_MAX]; //buffering data for HB
|
||||
|
||||
} NSinst_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcNs_InitCore(...)
|
||||
*
|
||||
* This function initializes a noise suppression instance
|
||||
*
|
||||
* Input:
|
||||
* - inst : Instance that should be initialized
|
||||
* - fs : Sampling frequency
|
||||
*
|
||||
* Output:
|
||||
* - inst : Initialized instance
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNs_InitCore(NSinst_t* inst, uint32_t fs);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcNs_set_policy_core(...)
|
||||
*
|
||||
* This changes the aggressiveness of the noise suppression method.
|
||||
*
|
||||
* Input:
|
||||
* - inst : Instance that should be initialized
|
||||
* - mode : 0: Mild (6 dB), 1: Medium (10 dB), 2: Aggressive (15 dB)
|
||||
*
|
||||
* Output:
|
||||
* - NS_inst : Initialized instance
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNs_set_policy_core(NSinst_t* inst, int mode);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcNs_ProcessCore
|
||||
*
|
||||
* Do noise suppression.
|
||||
*
|
||||
* Input:
|
||||
* - inst : Instance that should be initialized
|
||||
* - inFrameLow : Input speech frame for lower band
|
||||
* - inFrameHigh : Input speech frame for higher band
|
||||
*
|
||||
* Output:
|
||||
* - inst : Updated instance
|
||||
* - outFrameLow : Output speech frame for lower band
|
||||
* - outFrameHigh : Output speech frame for higher band
|
||||
*
|
||||
* Return value : 0 - OK
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
|
||||
int WebRtcNs_ProcessCore(NSinst_t* inst,
|
||||
float* inFrameLow,
|
||||
float* inFrameHigh,
|
||||
float* outFrameLow,
|
||||
float* outFrameHigh);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NS_CORE_H_
|
2127
jni/webrtc/modules/audio_processing/ns/nsx_core.c
Normal file
2127
jni/webrtc/modules/audio_processing/ns/nsx_core.c
Normal file
File diff suppressed because it is too large
Load Diff
262
jni/webrtc/modules/audio_processing/ns/nsx_core.h
Normal file
262
jni/webrtc/modules/audio_processing/ns/nsx_core.h
Normal file
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NSX_CORE_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NSX_CORE_H_
|
||||
|
||||
#ifdef NS_FILEDEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
||||
#include "webrtc/modules/audio_processing/ns/nsx_defines.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
typedef struct NsxInst_t_ {
|
||||
uint32_t fs;
|
||||
|
||||
const int16_t* window;
|
||||
int16_t analysisBuffer[ANAL_BLOCKL_MAX];
|
||||
int16_t synthesisBuffer[ANAL_BLOCKL_MAX];
|
||||
uint16_t noiseSupFilter[HALF_ANAL_BLOCKL];
|
||||
uint16_t overdrive; /* Q8 */
|
||||
uint16_t denoiseBound; /* Q14 */
|
||||
const int16_t* factor2Table;
|
||||
int16_t noiseEstLogQuantile[SIMULT* HALF_ANAL_BLOCKL];
|
||||
int16_t noiseEstDensity[SIMULT* HALF_ANAL_BLOCKL];
|
||||
int16_t noiseEstCounter[SIMULT];
|
||||
int16_t noiseEstQuantile[HALF_ANAL_BLOCKL];
|
||||
|
||||
int anaLen;
|
||||
int anaLen2;
|
||||
int magnLen;
|
||||
int aggrMode;
|
||||
int stages;
|
||||
int initFlag;
|
||||
int gainMap;
|
||||
|
||||
int32_t maxLrt;
|
||||
int32_t minLrt;
|
||||
// Log LRT factor with time-smoothing in Q8.
|
||||
int32_t logLrtTimeAvgW32[HALF_ANAL_BLOCKL];
|
||||
int32_t featureLogLrt;
|
||||
int32_t thresholdLogLrt;
|
||||
int16_t weightLogLrt;
|
||||
|
||||
uint32_t featureSpecDiff;
|
||||
uint32_t thresholdSpecDiff;
|
||||
int16_t weightSpecDiff;
|
||||
|
||||
uint32_t featureSpecFlat;
|
||||
uint32_t thresholdSpecFlat;
|
||||
int16_t weightSpecFlat;
|
||||
|
||||
// Conservative estimate of noise spectrum.
|
||||
int32_t avgMagnPause[HALF_ANAL_BLOCKL];
|
||||
uint32_t magnEnergy;
|
||||
uint32_t sumMagn;
|
||||
uint32_t curAvgMagnEnergy;
|
||||
uint32_t timeAvgMagnEnergy;
|
||||
uint32_t timeAvgMagnEnergyTmp;
|
||||
|
||||
uint32_t whiteNoiseLevel; // Initial noise estimate.
|
||||
// Initial magnitude spectrum estimate.
|
||||
uint32_t initMagnEst[HALF_ANAL_BLOCKL];
|
||||
// Pink noise parameters:
|
||||
int32_t pinkNoiseNumerator; // Numerator.
|
||||
int32_t pinkNoiseExp; // Power of freq.
|
||||
int minNorm; // Smallest normalization factor.
|
||||
int zeroInputSignal; // Zero input signal flag.
|
||||
|
||||
// Noise spectrum from previous frame.
|
||||
uint32_t prevNoiseU32[HALF_ANAL_BLOCKL];
|
||||
// Magnitude spectrum from previous frame.
|
||||
uint16_t prevMagnU16[HALF_ANAL_BLOCKL];
|
||||
// Prior speech/noise probability in Q14.
|
||||
int16_t priorNonSpeechProb;
|
||||
|
||||
int blockIndex; // Frame index counter.
|
||||
// Parameter for updating or estimating thresholds/weights for prior model.
|
||||
int modelUpdate;
|
||||
int cntThresUpdate;
|
||||
|
||||
// Histograms for parameter estimation.
|
||||
int16_t histLrt[HIST_PAR_EST];
|
||||
int16_t histSpecFlat[HIST_PAR_EST];
|
||||
int16_t histSpecDiff[HIST_PAR_EST];
|
||||
|
||||
// Quantities for high band estimate.
|
||||
int16_t dataBufHBFX[ANAL_BLOCKL_MAX]; // Q0
|
||||
|
||||
int qNoise;
|
||||
int prevQNoise;
|
||||
int prevQMagn;
|
||||
int blockLen10ms;
|
||||
|
||||
int16_t real[ANAL_BLOCKL_MAX];
|
||||
int16_t imag[ANAL_BLOCKL_MAX];
|
||||
int32_t energyIn;
|
||||
int scaleEnergyIn;
|
||||
int normData;
|
||||
|
||||
struct RealFFT* real_fft;
|
||||
} NsxInst_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcNsx_InitCore(...)
|
||||
*
|
||||
* This function initializes a noise suppression instance
|
||||
*
|
||||
* Input:
|
||||
* - inst : Instance that should be initialized
|
||||
* - fs : Sampling frequency
|
||||
*
|
||||
* Output:
|
||||
* - inst : Initialized instance
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int32_t WebRtcNsx_InitCore(NsxInst_t* inst, uint32_t fs);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcNsx_set_policy_core(...)
|
||||
*
|
||||
* This changes the aggressiveness of the noise suppression method.
|
||||
*
|
||||
* Input:
|
||||
* - inst : Instance that should be initialized
|
||||
* - mode : 0: Mild (6 dB), 1: Medium (10 dB), 2: Aggressive (15 dB)
|
||||
*
|
||||
* Output:
|
||||
* - inst : Initialized instance
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNsx_set_policy_core(NsxInst_t* inst, int mode);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcNsx_ProcessCore
|
||||
*
|
||||
* Do noise suppression.
|
||||
*
|
||||
* Input:
|
||||
* - inst : Instance that should be initialized
|
||||
* - inFrameLow : Input speech frame for lower band
|
||||
* - inFrameHigh : Input speech frame for higher band
|
||||
*
|
||||
* Output:
|
||||
* - inst : Updated instance
|
||||
* - outFrameLow : Output speech frame for lower band
|
||||
* - outFrameHigh : Output speech frame for higher band
|
||||
*
|
||||
* Return value : 0 - OK
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcNsx_ProcessCore(NsxInst_t* inst,
|
||||
short* inFrameLow,
|
||||
short* inFrameHigh,
|
||||
short* outFrameLow,
|
||||
short* outFrameHigh);
|
||||
|
||||
/****************************************************************************
|
||||
* Some function pointers, for internal functions shared by ARM NEON and
|
||||
* generic C code.
|
||||
*/
|
||||
// Noise Estimation.
|
||||
typedef void (*NoiseEstimation)(NsxInst_t* inst,
|
||||
uint16_t* magn,
|
||||
uint32_t* noise,
|
||||
int16_t* q_noise);
|
||||
extern NoiseEstimation WebRtcNsx_NoiseEstimation;
|
||||
|
||||
// Filter the data in the frequency domain, and create spectrum.
|
||||
typedef void (*PrepareSpectrum)(NsxInst_t* inst,
|
||||
int16_t* freq_buff);
|
||||
extern PrepareSpectrum WebRtcNsx_PrepareSpectrum;
|
||||
|
||||
// For the noise supression process, synthesis, read out fully processed
|
||||
// segment, and update synthesis buffer.
|
||||
typedef void (*SynthesisUpdate)(NsxInst_t* inst,
|
||||
int16_t* out_frame,
|
||||
int16_t gain_factor);
|
||||
extern SynthesisUpdate WebRtcNsx_SynthesisUpdate;
|
||||
|
||||
// Update analysis buffer for lower band, and window data before FFT.
|
||||
typedef void (*AnalysisUpdate)(NsxInst_t* inst,
|
||||
int16_t* out,
|
||||
int16_t* new_speech);
|
||||
extern AnalysisUpdate WebRtcNsx_AnalysisUpdate;
|
||||
|
||||
// Denormalize the real-valued signal |in|, the output from inverse FFT.
|
||||
typedef void (*Denormalize) (NsxInst_t* inst, int16_t* in, int factor);
|
||||
extern Denormalize WebRtcNsx_Denormalize;
|
||||
|
||||
// Normalize the real-valued signal |in|, the input to forward FFT.
|
||||
typedef void (*NormalizeRealBuffer) (NsxInst_t* inst,
|
||||
const int16_t* in,
|
||||
int16_t* out);
|
||||
extern NormalizeRealBuffer WebRtcNsx_NormalizeRealBuffer;
|
||||
|
||||
// Compute speech/noise probability.
|
||||
// Intended to be private.
|
||||
void WebRtcNsx_SpeechNoiseProb(NsxInst_t* inst,
|
||||
uint16_t* nonSpeechProbFinal,
|
||||
uint32_t* priorLocSnr,
|
||||
uint32_t* postLocSnr);
|
||||
|
||||
#if (defined WEBRTC_DETECT_ARM_NEON) || defined (WEBRTC_ARCH_ARM_NEON)
|
||||
// For the above function pointers, functions for generic platforms are declared
|
||||
// and defined as static in file nsx_core.c, while those for ARM Neon platforms
|
||||
// are declared below and defined in file nsx_core_neon.S.
|
||||
void WebRtcNsx_NoiseEstimationNeon(NsxInst_t* inst,
|
||||
uint16_t* magn,
|
||||
uint32_t* noise,
|
||||
int16_t* q_noise);
|
||||
void WebRtcNsx_SynthesisUpdateNeon(NsxInst_t* inst,
|
||||
int16_t* out_frame,
|
||||
int16_t gain_factor);
|
||||
void WebRtcNsx_AnalysisUpdateNeon(NsxInst_t* inst,
|
||||
int16_t* out,
|
||||
int16_t* new_speech);
|
||||
void WebRtcNsx_PrepareSpectrumNeon(NsxInst_t* inst, int16_t* freq_buff);
|
||||
#endif
|
||||
|
||||
#if defined(MIPS32_LE)
|
||||
// For the above function pointers, functions for generic platforms are declared
|
||||
// and defined as static in file nsx_core.c, while those for MIPS platforms
|
||||
// are declared below and defined in file nsx_core_mips.c.
|
||||
void WebRtcNsx_SynthesisUpdate_mips(NsxInst_t* inst,
|
||||
int16_t* out_frame,
|
||||
int16_t gain_factor);
|
||||
void WebRtcNsx_AnalysisUpdate_mips(NsxInst_t* inst,
|
||||
int16_t* out,
|
||||
int16_t* new_speech);
|
||||
void WebRtcNsx_PrepareSpectrum_mips(NsxInst_t* inst, int16_t* freq_buff);
|
||||
void WebRtcNsx_NormalizeRealBuffer_mips(NsxInst_t* inst,
|
||||
const int16_t* in,
|
||||
int16_t* out);
|
||||
#if defined(MIPS_DSP_R1_LE)
|
||||
void WebRtcNsx_Denormalize_mips(NsxInst_t* inst, int16_t* in, int factor);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NSX_CORE_H_
|
268
jni/webrtc/modules/audio_processing/ns/nsx_core_c.c
Normal file
268
jni/webrtc/modules/audio_processing/ns/nsx_core_c.c
Normal file
@@ -0,0 +1,268 @@
|
||||
/*
|
||||
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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/ns/include/noise_suppression_x.h"
|
||||
#include "webrtc/modules/audio_processing/ns/nsx_core.h"
|
||||
|
||||
static const int16_t kIndicatorTable[17] = {
|
||||
0, 2017, 3809, 5227, 6258, 6963, 7424, 7718,
|
||||
7901, 8014, 8084, 8126, 8152, 8168, 8177, 8183, 8187
|
||||
};
|
||||
|
||||
// Compute speech/noise probability
|
||||
// speech/noise probability is returned in: probSpeechFinal
|
||||
//snrLocPrior is the prior SNR for each frequency (in Q11)
|
||||
//snrLocPost is the post SNR for each frequency (in Q11)
|
||||
void WebRtcNsx_SpeechNoiseProb(NsxInst_t* inst,
|
||||
uint16_t* nonSpeechProbFinal,
|
||||
uint32_t* priorLocSnr,
|
||||
uint32_t* postLocSnr) {
|
||||
|
||||
uint32_t zeros, num, den, tmpU32no1, tmpU32no2, tmpU32no3;
|
||||
int32_t invLrtFX, indPriorFX, tmp32, tmp32no1, tmp32no2, besselTmpFX32;
|
||||
int32_t frac32, logTmp;
|
||||
int32_t logLrtTimeAvgKsumFX;
|
||||
int16_t indPriorFX16;
|
||||
int16_t tmp16, tmp16no1, tmp16no2, tmpIndFX, tableIndex, frac, intPart;
|
||||
int i, normTmp, normTmp2, nShifts;
|
||||
|
||||
// compute feature based on average LR factor
|
||||
// this is the average over all frequencies of the smooth log LRT
|
||||
logLrtTimeAvgKsumFX = 0;
|
||||
for (i = 0; i < inst->magnLen; i++) {
|
||||
besselTmpFX32 = (int32_t)postLocSnr[i]; // Q11
|
||||
normTmp = WebRtcSpl_NormU32(postLocSnr[i]);
|
||||
num = WEBRTC_SPL_LSHIFT_U32(postLocSnr[i], normTmp); // Q(11+normTmp)
|
||||
if (normTmp > 10) {
|
||||
den = WEBRTC_SPL_LSHIFT_U32(priorLocSnr[i], normTmp - 11); // Q(normTmp)
|
||||
} else {
|
||||
den = WEBRTC_SPL_RSHIFT_U32(priorLocSnr[i], 11 - normTmp); // Q(normTmp)
|
||||
}
|
||||
if (den > 0) {
|
||||
besselTmpFX32 -= num / den; // Q11
|
||||
} else {
|
||||
besselTmpFX32 -= num; // Q11
|
||||
}
|
||||
|
||||
// inst->logLrtTimeAvg[i] += LRT_TAVG * (besselTmp - log(snrLocPrior)
|
||||
// - inst->logLrtTimeAvg[i]);
|
||||
// Here, LRT_TAVG = 0.5
|
||||
zeros = WebRtcSpl_NormU32(priorLocSnr[i]);
|
||||
frac32 = (int32_t)(((priorLocSnr[i] << zeros) & 0x7FFFFFFF) >> 19);
|
||||
tmp32 = WEBRTC_SPL_MUL(frac32, frac32);
|
||||
tmp32 = WEBRTC_SPL_RSHIFT_W32(WEBRTC_SPL_MUL(tmp32, -43), 19);
|
||||
tmp32 += WEBRTC_SPL_MUL_16_16_RSFT((int16_t)frac32, 5412, 12);
|
||||
frac32 = tmp32 + 37;
|
||||
// tmp32 = log2(priorLocSnr[i])
|
||||
tmp32 = (int32_t)(((31 - zeros) << 12) + frac32) - (11 << 12); // Q12
|
||||
logTmp = (tmp32 * 178) >> 8; // log2(priorLocSnr[i])*log(2)
|
||||
tmp32no1 = WEBRTC_SPL_RSHIFT_W32(logTmp + inst->logLrtTimeAvgW32[i], 1);
|
||||
// Q12
|
||||
inst->logLrtTimeAvgW32[i] += (besselTmpFX32 - tmp32no1); // Q12
|
||||
|
||||
logLrtTimeAvgKsumFX += inst->logLrtTimeAvgW32[i]; // Q12
|
||||
}
|
||||
inst->featureLogLrt = WEBRTC_SPL_RSHIFT_W32(logLrtTimeAvgKsumFX * 5,
|
||||
inst->stages + 10);
|
||||
// 5 = BIN_SIZE_LRT / 2
|
||||
// done with computation of LR factor
|
||||
|
||||
//
|
||||
//compute the indicator functions
|
||||
//
|
||||
|
||||
// average LRT feature
|
||||
// FLOAT code
|
||||
// indicator0 = 0.5 * (tanh(widthPrior *
|
||||
// (logLrtTimeAvgKsum - threshPrior0)) + 1.0);
|
||||
tmpIndFX = 16384; // Q14(1.0)
|
||||
tmp32no1 = logLrtTimeAvgKsumFX - inst->thresholdLogLrt; // Q12
|
||||
nShifts = 7 - inst->stages; // WIDTH_PR_MAP_SHIFT - inst->stages + 5;
|
||||
//use larger width in tanh map for pause regions
|
||||
if (tmp32no1 < 0) {
|
||||
tmpIndFX = 0;
|
||||
tmp32no1 = -tmp32no1;
|
||||
//widthPrior = widthPrior * 2.0;
|
||||
nShifts++;
|
||||
}
|
||||
tmp32no1 = WEBRTC_SPL_SHIFT_W32(tmp32no1, nShifts); // Q14
|
||||
// compute indicator function: sigmoid map
|
||||
tableIndex = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32no1, 14);
|
||||
if ((tableIndex < 16) && (tableIndex >= 0)) {
|
||||
tmp16no2 = kIndicatorTable[tableIndex];
|
||||
tmp16no1 = kIndicatorTable[tableIndex + 1] - kIndicatorTable[tableIndex];
|
||||
frac = (int16_t)(tmp32no1 & 0x00003fff); // Q14
|
||||
tmp16no2 += (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(tmp16no1, frac, 14);
|
||||
if (tmpIndFX == 0) {
|
||||
tmpIndFX = 8192 - tmp16no2; // Q14
|
||||
} else {
|
||||
tmpIndFX = 8192 + tmp16no2; // Q14
|
||||
}
|
||||
}
|
||||
indPriorFX = WEBRTC_SPL_MUL_16_16(inst->weightLogLrt, tmpIndFX); // 6*Q14
|
||||
|
||||
//spectral flatness feature
|
||||
if (inst->weightSpecFlat) {
|
||||
tmpU32no1 = WEBRTC_SPL_UMUL(inst->featureSpecFlat, 400); // Q10
|
||||
tmpIndFX = 16384; // Q14(1.0)
|
||||
//use larger width in tanh map for pause regions
|
||||
tmpU32no2 = inst->thresholdSpecFlat - tmpU32no1; //Q10
|
||||
nShifts = 4;
|
||||
if (inst->thresholdSpecFlat < tmpU32no1) {
|
||||
tmpIndFX = 0;
|
||||
tmpU32no2 = tmpU32no1 - inst->thresholdSpecFlat;
|
||||
//widthPrior = widthPrior * 2.0;
|
||||
nShifts++;
|
||||
}
|
||||
tmp32no1 = (int32_t)WebRtcSpl_DivU32U16(WEBRTC_SPL_LSHIFT_U32(tmpU32no2,
|
||||
nShifts), 25);
|
||||
//Q14
|
||||
tmpU32no1 = WebRtcSpl_DivU32U16(WEBRTC_SPL_LSHIFT_U32(tmpU32no2, nShifts),
|
||||
25); //Q14
|
||||
// compute indicator function: sigmoid map
|
||||
// FLOAT code
|
||||
// indicator1 = 0.5 * (tanh(sgnMap * widthPrior *
|
||||
// (threshPrior1 - tmpFloat1)) + 1.0);
|
||||
tableIndex = (int16_t)WEBRTC_SPL_RSHIFT_U32(tmpU32no1, 14);
|
||||
if (tableIndex < 16) {
|
||||
tmp16no2 = kIndicatorTable[tableIndex];
|
||||
tmp16no1 = kIndicatorTable[tableIndex + 1] - kIndicatorTable[tableIndex];
|
||||
frac = (int16_t)(tmpU32no1 & 0x00003fff); // Q14
|
||||
tmp16no2 += (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(tmp16no1, frac, 14);
|
||||
if (tmpIndFX) {
|
||||
tmpIndFX = 8192 + tmp16no2; // Q14
|
||||
} else {
|
||||
tmpIndFX = 8192 - tmp16no2; // Q14
|
||||
}
|
||||
}
|
||||
indPriorFX += WEBRTC_SPL_MUL_16_16(inst->weightSpecFlat, tmpIndFX); // 6*Q14
|
||||
}
|
||||
|
||||
//for template spectral-difference
|
||||
if (inst->weightSpecDiff) {
|
||||
tmpU32no1 = 0;
|
||||
if (inst->featureSpecDiff) {
|
||||
normTmp = WEBRTC_SPL_MIN(20 - inst->stages,
|
||||
WebRtcSpl_NormU32(inst->featureSpecDiff));
|
||||
tmpU32no1 = WEBRTC_SPL_LSHIFT_U32(inst->featureSpecDiff, normTmp);
|
||||
// Q(normTmp-2*stages)
|
||||
tmpU32no2 = WEBRTC_SPL_RSHIFT_U32(inst->timeAvgMagnEnergy,
|
||||
20 - inst->stages - normTmp);
|
||||
if (tmpU32no2 > 0) {
|
||||
// Q(20 - inst->stages)
|
||||
tmpU32no1 /= tmpU32no2;
|
||||
} else {
|
||||
tmpU32no1 = (uint32_t)(0x7fffffff);
|
||||
}
|
||||
}
|
||||
tmpU32no3 = (inst->thresholdSpecDiff << 17) / 25;
|
||||
tmpU32no2 = tmpU32no1 - tmpU32no3;
|
||||
nShifts = 1;
|
||||
tmpIndFX = 16384; // Q14(1.0)
|
||||
//use larger width in tanh map for pause regions
|
||||
if (tmpU32no2 & 0x80000000) {
|
||||
tmpIndFX = 0;
|
||||
tmpU32no2 = tmpU32no3 - tmpU32no1;
|
||||
//widthPrior = widthPrior * 2.0;
|
||||
nShifts--;
|
||||
}
|
||||
tmpU32no1 = WEBRTC_SPL_RSHIFT_U32(tmpU32no2, nShifts);
|
||||
// compute indicator function: sigmoid map
|
||||
/* FLOAT code
|
||||
indicator2 = 0.5 * (tanh(widthPrior * (tmpFloat1 - threshPrior2)) + 1.0);
|
||||
*/
|
||||
tableIndex = (int16_t)WEBRTC_SPL_RSHIFT_U32(tmpU32no1, 14);
|
||||
if (tableIndex < 16) {
|
||||
tmp16no2 = kIndicatorTable[tableIndex];
|
||||
tmp16no1 = kIndicatorTable[tableIndex + 1] - kIndicatorTable[tableIndex];
|
||||
frac = (int16_t)(tmpU32no1 & 0x00003fff); // Q14
|
||||
tmp16no2 += (int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(
|
||||
tmp16no1, frac, 14);
|
||||
if (tmpIndFX) {
|
||||
tmpIndFX = 8192 + tmp16no2;
|
||||
} else {
|
||||
tmpIndFX = 8192 - tmp16no2;
|
||||
}
|
||||
}
|
||||
indPriorFX += WEBRTC_SPL_MUL_16_16(inst->weightSpecDiff, tmpIndFX); // 6*Q14
|
||||
}
|
||||
|
||||
//combine the indicator function with the feature weights
|
||||
// FLOAT code
|
||||
// indPrior = 1 - (weightIndPrior0 * indicator0 + weightIndPrior1 *
|
||||
// indicator1 + weightIndPrior2 * indicator2);
|
||||
indPriorFX16 = WebRtcSpl_DivW32W16ResW16(98307 - indPriorFX, 6); // Q14
|
||||
// done with computing indicator function
|
||||
|
||||
//compute the prior probability
|
||||
// FLOAT code
|
||||
// inst->priorNonSpeechProb += PRIOR_UPDATE *
|
||||
// (indPriorNonSpeech - inst->priorNonSpeechProb);
|
||||
tmp16 = indPriorFX16 - inst->priorNonSpeechProb; // Q14
|
||||
inst->priorNonSpeechProb += (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(
|
||||
PRIOR_UPDATE_Q14, tmp16, 14); // Q14
|
||||
|
||||
//final speech probability: combine prior model with LR factor:
|
||||
|
||||
memset(nonSpeechProbFinal, 0, sizeof(uint16_t) * inst->magnLen);
|
||||
|
||||
if (inst->priorNonSpeechProb > 0) {
|
||||
for (i = 0; i < inst->magnLen; i++) {
|
||||
// FLOAT code
|
||||
// invLrt = exp(inst->logLrtTimeAvg[i]);
|
||||
// invLrt = inst->priorSpeechProb * invLrt;
|
||||
// nonSpeechProbFinal[i] = (1.0 - inst->priorSpeechProb) /
|
||||
// (1.0 - inst->priorSpeechProb + invLrt);
|
||||
// invLrt = (1.0 - inst->priorNonSpeechProb) * invLrt;
|
||||
// nonSpeechProbFinal[i] = inst->priorNonSpeechProb /
|
||||
// (inst->priorNonSpeechProb + invLrt);
|
||||
if (inst->logLrtTimeAvgW32[i] < 65300) {
|
||||
tmp32no1 = WEBRTC_SPL_RSHIFT_W32(WEBRTC_SPL_MUL(
|
||||
inst->logLrtTimeAvgW32[i], 23637),
|
||||
14); // Q12
|
||||
intPart = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32no1, 12);
|
||||
if (intPart < -8) {
|
||||
intPart = -8;
|
||||
}
|
||||
frac = (int16_t)(tmp32no1 & 0x00000fff); // Q12
|
||||
|
||||
// Quadratic approximation of 2^frac
|
||||
tmp32no2 = WEBRTC_SPL_RSHIFT_W32(frac * frac * 44, 19); // Q12
|
||||
tmp32no2 += WEBRTC_SPL_MUL_16_16_RSFT(frac, 84, 7); // Q12
|
||||
invLrtFX = WEBRTC_SPL_LSHIFT_W32(1, 8 + intPart)
|
||||
+ WEBRTC_SPL_SHIFT_W32(tmp32no2, intPart - 4); // Q8
|
||||
|
||||
normTmp = WebRtcSpl_NormW32(invLrtFX);
|
||||
normTmp2 = WebRtcSpl_NormW16((16384 - inst->priorNonSpeechProb));
|
||||
if (normTmp + normTmp2 >= 7) {
|
||||
if (normTmp + normTmp2 < 15) {
|
||||
invLrtFX = WEBRTC_SPL_RSHIFT_W32(invLrtFX, 15 - normTmp2 - normTmp);
|
||||
// Q(normTmp+normTmp2-7)
|
||||
tmp32no1 = invLrtFX * (16384 - inst->priorNonSpeechProb);
|
||||
// Q(normTmp+normTmp2+7)
|
||||
invLrtFX = WEBRTC_SPL_SHIFT_W32(tmp32no1, 7 - normTmp - normTmp2);
|
||||
// Q14
|
||||
} else {
|
||||
tmp32no1 = invLrtFX * (16384 - inst->priorNonSpeechProb);
|
||||
// Q22
|
||||
invLrtFX = WEBRTC_SPL_RSHIFT_W32(tmp32no1, 8); // Q14
|
||||
}
|
||||
|
||||
tmp32no1 = WEBRTC_SPL_LSHIFT_W32((int32_t)inst->priorNonSpeechProb,
|
||||
8); // Q22
|
||||
|
||||
nonSpeechProbFinal[i] = (uint16_t)WEBRTC_SPL_DIV(tmp32no1,
|
||||
(int32_t)inst->priorNonSpeechProb + invLrtFX); // Q8
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1006
jni/webrtc/modules/audio_processing/ns/nsx_core_mips.c
Normal file
1006
jni/webrtc/modules/audio_processing/ns/nsx_core_mips.c
Normal file
File diff suppressed because it is too large
Load Diff
651
jni/webrtc/modules/audio_processing/ns/nsx_core_neon.S
Normal file
651
jni/webrtc/modules/audio_processing/ns/nsx_core_neon.S
Normal file
@@ -0,0 +1,651 @@
|
||||
@
|
||||
@ Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
@
|
||||
@ 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.
|
||||
@
|
||||
|
||||
@ nsx_core_neon.s
|
||||
@ This file contains some functions in NS, optimized for ARM Neon
|
||||
@ platforms. Reference C code is in file nsx_core.c. Bit-exact.
|
||||
|
||||
.syntax unified
|
||||
|
||||
#include "nsx_core_neon_offsets.h"
|
||||
#include "webrtc/modules/audio_processing/ns/nsx_defines.h"
|
||||
#include "webrtc/system_wrappers/interface/asm_defines.h"
|
||||
|
||||
GLOBAL_FUNCTION WebRtcNsx_NoiseEstimationNeon
|
||||
GLOBAL_FUNCTION WebRtcNsx_PrepareSpectrumNeon
|
||||
GLOBAL_FUNCTION WebRtcNsx_SynthesisUpdateNeon
|
||||
GLOBAL_FUNCTION WebRtcNsx_AnalysisUpdateNeon
|
||||
GLOBAL_LABEL WebRtcNsx_kLogTable
|
||||
GLOBAL_LABEL WebRtcNsx_kCounterDiv
|
||||
GLOBAL_LABEL WebRtcNsx_kLogTableFrac
|
||||
|
||||
.align 2
|
||||
WebRtcNsx_kLogTableFrac:
|
||||
_WebRtcNsx_kLogTableFrac:
|
||||
.short 0, 1, 3, 4, 6, 7, 9, 10, 11, 13, 14, 16, 17, 18, 20, 21, 22, 24, 25, 26
|
||||
.short 28, 29, 30, 32, 33, 34, 36, 37, 38, 40, 41, 42, 44, 45, 46, 47, 49, 50
|
||||
.short 51, 52, 54, 55, 56, 57, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 71, 72
|
||||
.short 73, 74, 75, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90, 92, 93
|
||||
.short 94, 95, 96, 97, 98, 99, 100, 102, 103, 104, 105, 106, 107, 108, 109, 110
|
||||
.short 111, 112, 113, 114, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126
|
||||
.short 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141
|
||||
.short 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 155
|
||||
.short 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 169
|
||||
.short 170, 171, 172, 173, 174, 175, 176, 177, 178, 178, 179, 180, 181, 182, 183
|
||||
.short 184, 185, 185, 186, 187, 188, 189, 190, 191, 192, 192, 193, 194, 195, 196
|
||||
.short 197, 198, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 208
|
||||
.short 209, 210, 211, 212, 212, 213, 214, 215, 216, 216, 217, 218, 219, 220, 220
|
||||
.short 221, 222, 223, 224, 224, 225, 226, 227, 228, 228, 229, 230, 231, 231, 232
|
||||
.short 233, 234, 234, 235, 236, 237, 238, 238, 239, 240, 241, 241, 242, 243, 244
|
||||
.short 244, 245, 246, 247, 247, 248, 249, 249, 250, 251, 252, 252, 253, 254, 255
|
||||
.short 255
|
||||
|
||||
.align 2
|
||||
WebRtcNsx_kCounterDiv:
|
||||
_WebRtcNsx_kCounterDiv:
|
||||
.short 32767, 16384, 10923, 8192, 6554, 5461, 4681, 4096, 3641, 3277, 2979
|
||||
.short 2731, 2521, 2341, 2185, 2048, 1928, 1820, 1725, 1638, 1560, 1489
|
||||
.short 1425, 1365, 1311, 1260, 1214, 1170, 1130, 1092, 1057, 1024, 993, 964
|
||||
.short 936, 910, 886, 862, 840, 819, 799, 780, 762, 745, 728, 712, 697, 683
|
||||
.short 669, 655, 643, 630, 618, 607, 596, 585, 575, 565, 555, 546, 537, 529
|
||||
.short 520, 512, 504, 496, 489, 482, 475, 468, 462, 455, 449, 443, 437, 431
|
||||
.short 426, 420, 415, 410, 405, 400, 395, 390, 386, 381, 377, 372, 368, 364
|
||||
.short 360, 356, 352, 349, 345, 341, 338, 334, 331, 328, 324, 321, 318, 315
|
||||
.short 312, 309, 306, 303, 301, 298, 295, 293, 290, 287, 285, 282, 280, 278
|
||||
.short 275, 273, 271, 269, 266, 264, 262, 260, 258, 256, 254, 252, 250, 248
|
||||
.short 246, 245, 243, 241, 239, 237, 236, 234, 232, 231, 229, 228, 226, 224
|
||||
.short 223, 221, 220, 218, 217, 216, 214, 213, 211, 210, 209, 207, 206, 205
|
||||
.short 204, 202, 201, 200, 199, 197, 196, 195, 194, 193, 192, 191, 189, 188
|
||||
.short 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174
|
||||
.short 173, 172, 172, 171, 170, 169, 168, 167, 166, 165, 165, 164, 163
|
||||
|
||||
.align 2
|
||||
WebRtcNsx_kLogTable:
|
||||
_WebRtcNsx_kLogTable:
|
||||
.short 0, 177, 355, 532, 710, 887, 1065, 1242, 1420
|
||||
|
||||
@ void NoiseEstimationNeon(NsxInst_t* inst,
|
||||
@ uint16_t* magn,
|
||||
@ uint32_t* noise,
|
||||
@ int16_t* q_noise);
|
||||
|
||||
@ Register usage (across major loops of NoiseEstimationNeon()):
|
||||
@ r0-r3: function arguments, and scratch registers.
|
||||
@ r4: &inst
|
||||
@ r5: &noiseEstLogQuantile[]
|
||||
@ r6: inst->magnLen
|
||||
@ r7: offset
|
||||
@ r8: s, the loop counter for the LOOP_SIMULT
|
||||
@ r9: &inst->noiseEstDensity[]
|
||||
@ r10: &inst->noiseEstCounter[]
|
||||
@ r11: countDiv
|
||||
@ r12: i, the loop counter for LOOP_NOISEESTIMATION_MAGNLEN_INNER
|
||||
|
||||
.align 2
|
||||
DEFINE_FUNCTION WebRtcNsx_NoiseEstimationNeon
|
||||
push {r4-r12, r14} @ Make sure 8-byte stack alignment.
|
||||
vpush {d8-d15}
|
||||
sub sp, #(16 + (HALF_ANAL_BLOCKL + 3) / 4 * 8)
|
||||
|
||||
@ [sp, #0]: logval
|
||||
@ [sp, #4]: noise
|
||||
@ [sp, #8]: q_noise
|
||||
@ [sp, #12]: factor
|
||||
@ [sp, #16 ~ #(16 + (HALF_ANAL_BLOCKL + 3) / 4 * 8)]: lmagn[HALF_ANAL_BLOCKL]
|
||||
|
||||
str r2, [sp, #4] @ noise
|
||||
str r3, [sp, #8] @ q_noise
|
||||
movw r4, #offset_nsx_normData
|
||||
ldr r2, [r0, #offset_nsx_stages] @ inst->stages
|
||||
ldr r4, [r0, r4] @ inst->normData
|
||||
adr r12, WebRtcNsx_kLogTable
|
||||
subs r3, r2, r4 @ tabind = inst->stages - inst->normData;
|
||||
ldr r5, [r0, #offset_nsx_magnLen] @ magnLen
|
||||
rsblt r3, #0
|
||||
lsl r3, #1
|
||||
ldrh r3, [r12, r3] @ logval = WebRtcNsx_kLogTable[tabind];
|
||||
add r12, sp, #16 @ lmagn[]
|
||||
rsblt r3, #0 @ logval = -WebRtcNsx_kLogTable[-tabind];
|
||||
str r3, [sp]
|
||||
vdup.16 q15, r3
|
||||
|
||||
adr r9, WebRtcNsx_kLogTableFrac
|
||||
|
||||
LOOP_SET_LMAGN:
|
||||
ldrh r2, [r1], #2 @ magn[i]
|
||||
cmp r2, #0
|
||||
strheq r3, [r12], #2 @ lmagn[i] = logval;
|
||||
beq CHECK_LMAGN_COUNTER
|
||||
|
||||
clz r6, r2
|
||||
mov r4, r6 @ zeros
|
||||
rsb r6, #31
|
||||
lsl r2, r4
|
||||
ubfx r4, r2, #23, #8
|
||||
mov r2, r4, lsl #1
|
||||
ldrh r4, [r9, r2] @ WebRtcNsx_kLogTableFrac[frac]
|
||||
add r7, r4, r6, lsl #8 @ log2
|
||||
movw r2, #22713 @ log2_const
|
||||
smulbb r2, r7, r2
|
||||
add r2, r3, r2, lsr #15
|
||||
strh r2, [r12], #2 @ lmagn[i]
|
||||
|
||||
CHECK_LMAGN_COUNTER:
|
||||
subs r5, #1
|
||||
bgt LOOP_SET_LMAGN
|
||||
|
||||
movw r3, #21845 @ width_factor
|
||||
vdup.16 q5, r3
|
||||
vmov.s16 q14, #WIDTH_Q8
|
||||
|
||||
movw r5, #offset_nsx_noiseEstLogQuantile
|
||||
movw r7, #offset_nsx_blockIndex
|
||||
movw r9, #offset_nsx_noiseEstDensity
|
||||
add r5, r0
|
||||
ldr r6, [r0, #offset_nsx_magnLen]
|
||||
ldr r7, [r0, r7]
|
||||
add r9, r0
|
||||
cmp r7, #END_STARTUP_LONG
|
||||
movw r10, #offset_nsx_noiseEstCounter
|
||||
add r10, r0
|
||||
movge r7, #FACTOR_Q7
|
||||
movlt r7, #FACTOR_Q7_STARTUP
|
||||
mov r4, r0
|
||||
str r7, [sp, #12] @ factor
|
||||
mov r8, #SIMULT
|
||||
mov r7, #0
|
||||
|
||||
LOOP_SIMULT:
|
||||
ldrsh r1, [r10] @ inst->noiseEstCounter[s]
|
||||
adr r3, WebRtcNsx_kCounterDiv
|
||||
mov r11, r1, lsl #1 @ counter
|
||||
ldrh r11, [r3, r11] @ countDiv = WebRtcNsx_kCounterDiv[counter];
|
||||
sub r12, r6, #1 @ Loop counter.
|
||||
smulbb r3, r1, r11 @ countProd
|
||||
vdup.16 q11, r11
|
||||
|
||||
vqrdmulh.s16 q11, q5, q11 @ WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(
|
||||
@ width_factor, countDiv, 15);
|
||||
vdup.16 d24, r11
|
||||
vdup.16 d25, r3
|
||||
|
||||
ldr r3, [sp, #12] @ factor
|
||||
add r1, sp, #16 @ &lmagn[0]
|
||||
vdup.16 q9, r3
|
||||
vmov.i16 q13, #512
|
||||
vmov.i16 q7, #15
|
||||
vmov.i32 q6, #FACTOR_Q16
|
||||
|
||||
LOOP_NOISEESTIMATION_MAGNLEN_INNER:
|
||||
vld1.16 {q0}, [r9] @ noiseEstDensity[offset + i]
|
||||
|
||||
@ Compute delta in the next two blocks.
|
||||
vclz.i16 q4, q0
|
||||
vsub.i16 q4, q4, q7 @ Value of the shift factors; likely negative.
|
||||
vmovl.s16 q3, d8
|
||||
vmovl.s16 q2, d9
|
||||
|
||||
vshl.s32 q1, q6, q3
|
||||
vmovn.i32 d8, q1 @ d8 holds shifted FACTOR_Q16.
|
||||
vshl.s32 q1, q6, q2
|
||||
vcgt.s16 q3, q0, q13 @ Compare noiseEstDensity to 512.
|
||||
vmovn.i32 d9, q1 @ d9 holds shifted FACTOR_Q16.
|
||||
vmov.i16 q1, q9
|
||||
vbit.s16 q1, q4, q3 @ If bigger than 512, delta = shifted FACTOR_Q16.
|
||||
|
||||
vmull.s16 q8, d3, d24
|
||||
vmull.s16 q4, d2, d24
|
||||
vshrn.i32 d2, q4, #14
|
||||
vshrn.i32 d3, q8, #14
|
||||
|
||||
vrshr.s16 q3, q1, #1
|
||||
vrshr.s16 q8, q1, #2
|
||||
vmull.s16 q4, d7, d28
|
||||
vmull.s16 q3, d6, d28
|
||||
vld1.16 {q10}, [r5] @ inst->noiseEstLogQuantile[offset + i]
|
||||
vshrn.i32 d4, q3, #1
|
||||
vshrn.i32 d5, q4, #1
|
||||
|
||||
vld1.16 {q3}, [r1]! @ lmagn[i]
|
||||
vsub.i16 q4, q10, q2
|
||||
vadd.i16 q8, q10, q8
|
||||
vsub.i16 q2, q3, q10
|
||||
vmax.s16 q4, q4, q15
|
||||
vcgt.s16 q1, q2, #0
|
||||
vbit q10, q8, q1
|
||||
vbif q10, q4, q1
|
||||
|
||||
vsub.i16 q1, q3, q10
|
||||
vst1.16 {q10}, [r5]! @ inst->noiseEstLogQuantile[offset + i]
|
||||
vabs.s16 q4, q1
|
||||
vqrdmulh.s16 d2, d0, d25
|
||||
vqrdmulh.s16 d3, d1, d25
|
||||
vcgt.s16 q4, q14, q4
|
||||
vadd.i16 q1, q1, q11
|
||||
vbit q0, q1, q4
|
||||
subs r12, #8
|
||||
vst1.16 {q0}, [r9]! @ noiseEstDensity[offset + i]
|
||||
bgt LOOP_NOISEESTIMATION_MAGNLEN_INNER
|
||||
|
||||
@
|
||||
@ Last iteration over magnitude spectrum.
|
||||
@
|
||||
|
||||
COMPUTE_DELTA:
|
||||
ldrsh r2, [r9] @ inst->noiseEstDensity[offset + i]
|
||||
cmp r2, #512
|
||||
bgt COMPUTE_DELTA_BIGGER_DENSITY
|
||||
|
||||
movw r2, #offset_nsx_blockIndex
|
||||
ldr r0, [r4, r2]
|
||||
cmp r0, #END_STARTUP_LONG
|
||||
movge r0, #FACTOR_Q7 @ delta
|
||||
movlt r0, #FACTOR_Q7_STARTUP @ delta
|
||||
b UPDATE_LOG_QUANTILE_ESTIMATE
|
||||
|
||||
COMPUTE_DELTA_BIGGER_DENSITY:
|
||||
clz r2, r2
|
||||
rsb r0, r2, #31 @ 14 - factor
|
||||
mov r2, #FACTOR_Q16
|
||||
mov r0, r2, lsr r0 @ FACTOR_Q16 >> (14 - factor)
|
||||
|
||||
UPDATE_LOG_QUANTILE_ESTIMATE:
|
||||
smulbb r12, r0, r11
|
||||
ldrsh r1, [r1] @ lmagn[i]
|
||||
ubfx r12, r12, #14, #16 @ tmp16
|
||||
ldrsh r2, [r5] @ inst->noiseEstLogQuantile[offset + i]
|
||||
cmp r1, r2
|
||||
bgt UPDATE_LOG_QUANTILE_ESTIMATE_BIGGER_LMAGN
|
||||
|
||||
add r12, #1
|
||||
ldr r3, [sp] @ logval
|
||||
mov r0, r12, lsr #1 @ tmp16no1
|
||||
mov r12, #3
|
||||
smulbb r12, r0, r12 @ tmp16no2
|
||||
sub r2, r2, r12, lsr #1
|
||||
cmp r3, r2
|
||||
ldrgt r2, [sp]
|
||||
ldrgt r3, [sp]
|
||||
b UPDATE_LOG_QUANTILE_ESTIMATE_STORE
|
||||
|
||||
UPDATE_LOG_QUANTILE_ESTIMATE_BIGGER_LMAGN:
|
||||
add r3, r12, #2
|
||||
add r2, r2, r3, lsr #2
|
||||
|
||||
UPDATE_LOG_QUANTILE_ESTIMATE_STORE:
|
||||
vmov.s16 r0, d25[0] @ countProd
|
||||
strh r2, [r5]
|
||||
add r5, #2 @ increment &noiseEstLogQuantile[offset + i]
|
||||
|
||||
UPDATE_DENSITY_ESTIMATE:
|
||||
subs r12, r1, r2
|
||||
rsblt r12, #0
|
||||
cmp r12, #WIDTH_Q8
|
||||
bge UPDATE_DENSITY_ESTIMATE_CHECK_COUNTER
|
||||
|
||||
movw r3, #21845 @ width_factor
|
||||
ldrh r12, [r9] @ inst->noiseEstDensity[offset + i]
|
||||
smulbb r2, r3, r11
|
||||
smulbb r1, r12, r0
|
||||
add r0, r2, #1 << 14 @ Rounding
|
||||
add r12, r1, #1 << 14
|
||||
mov r1, r12, lsr #15
|
||||
add r3, r1, r0, lsr #15
|
||||
strh r3, [r9] @ inst->noiseEstDensity[offset + i]
|
||||
|
||||
UPDATE_DENSITY_ESTIMATE_CHECK_COUNTER:
|
||||
add r9, #2 @ updata &noiseEstDensity[offset + i]
|
||||
ldrsh r3, [r10] @ inst->noiseEstCounter[s]
|
||||
cmp r3, #END_STARTUP_LONG
|
||||
blt POST_UPDATE_DENSITY_ESTIMATE
|
||||
|
||||
movw r2, #offset_nsx_blockIndex
|
||||
mov r12, #0
|
||||
ldr r2, [r4, r2]
|
||||
strh r12, [r10]
|
||||
cmp r2, #END_STARTUP_LONG
|
||||
blt POST_UPDATE_DENSITY_ESTIMATE
|
||||
|
||||
mov r0, r4
|
||||
mov r1, r7
|
||||
CALL_FUNCTION UpdateNoiseEstimateNeon
|
||||
|
||||
POST_UPDATE_DENSITY_ESTIMATE:
|
||||
ldrh r3, [r10]
|
||||
add r3, #1
|
||||
strh r3, [r10], #2
|
||||
subs r8, #1
|
||||
add r7, r6 @ offset += inst->magnLen;
|
||||
bgt LOOP_SIMULT
|
||||
|
||||
movw r2, #offset_nsx_blockIndex
|
||||
ldr r2, [r4, r2]
|
||||
cmp r2, #END_STARTUP_LONG
|
||||
bge UPDATE_NOISE
|
||||
|
||||
sub r1, r7, r6
|
||||
mov r0, r4
|
||||
CALL_FUNCTION UpdateNoiseEstimateNeon
|
||||
|
||||
UPDATE_NOISE:
|
||||
movw r1, #offset_nsx_noiseEstQuantile
|
||||
add r1, r4
|
||||
ldr r2, [sp, #4]
|
||||
|
||||
@ Initial value of loop counter r6 = inst->magnLen.
|
||||
LOOP_UPDATE_NOISE:
|
||||
ldrsh r0, [r1], #2
|
||||
subs r6, #1
|
||||
str r0, [r2], #4
|
||||
bgt LOOP_UPDATE_NOISE
|
||||
|
||||
UPDATE_Q_NOISE:
|
||||
movw r2, #offset_nsx_qNoise
|
||||
ldr r1, [sp, #8]
|
||||
ldrh r2, [r4, r2]
|
||||
strh r2, [r1]
|
||||
|
||||
add sp, #(16 + (HALF_ANAL_BLOCKL + 3) / 4 * 8)
|
||||
vpop {d8-d15}
|
||||
pop {r4-r12, pc}
|
||||
|
||||
@ static void UpdateNoiseEstimateNeon(NsxInst_t* inst, int offset);
|
||||
@ Neon registers touched: q0-q3, q8-q13.
|
||||
.align 2
|
||||
DEFINE_FUNCTION UpdateNoiseEstimateNeon
|
||||
push {r4, r5, r6, r14}
|
||||
mov r5, r0
|
||||
|
||||
vmov.i32 q10, #21
|
||||
vmov.i32 q11, #0x1FFFFF
|
||||
vmov.i32 q9, #0x200000
|
||||
|
||||
movw r0, #offset_nsx_noiseEstLogQuantile
|
||||
movw r6, #offset_nsx_magnLen
|
||||
add r0, r5 @ &inst->noiseEstLogQuantile
|
||||
add r4, r0, r1, lsl #1 @ &inst->noiseEstLogQuantile[offset]
|
||||
ldrsh r6, [r5, r6] @ &inst->magnLen
|
||||
|
||||
mov r0, r4
|
||||
mov r1, r6
|
||||
CALL_FUNCTION WebRtcSpl_MaxValueW16Neon
|
||||
|
||||
sub r12, r6, #1 @ Loop counter: inst->magnLen - 1.
|
||||
|
||||
movw r6, #11819 @ kExp2Const in Q13
|
||||
movw r2, #offset_nsx_noiseEstQuantile
|
||||
vdup.16 d16, r6
|
||||
smulbb r3, r6, r0
|
||||
add r0, r3, #1 << 20 @ Round
|
||||
movw r1, #offset_nsx_qNoise
|
||||
mov r0, r0, lsr #21
|
||||
rsb r0, r0, #14 @ 14 - (round(kExp2Const * tmp16) >> 21)
|
||||
add r2, r5 @ &inst->noiseEstQuantile
|
||||
vdup.32 q13, r0
|
||||
str r0, [r5, r1]
|
||||
|
||||
LOOP_UPDATE:
|
||||
vld1.16 {d0, d1}, [r4]! @ &inst->noiseEstLogQuantile[offset + i]
|
||||
vmull.s16 q1, d0, d16
|
||||
vmull.s16 q0, d1, d16
|
||||
vshr.s32 q3, q1, #21
|
||||
vshr.s32 q2, q0, #21
|
||||
vand q1, q1, q11
|
||||
vand q0, q0, q11
|
||||
vsub.i32 q3, q3, q10
|
||||
vsub.i32 q2, q2, q10
|
||||
vorr q1, q1, q9
|
||||
vorr q0, q0, q9
|
||||
vadd.i32 q3, q3, q13
|
||||
vadd.i32 q2, q2, q13
|
||||
vshl.s32 q1, q1, q3
|
||||
vshl.s32 q0, q0, q2
|
||||
vqmovn.s32 d1, q0
|
||||
vqmovn.s32 d0, q1
|
||||
subs r12, #8
|
||||
vst1.16 {d0, d1}, [r2]!
|
||||
bgt LOOP_UPDATE
|
||||
|
||||
POST_LOOP_MAGNLEN:
|
||||
ldrh r1, [r4]
|
||||
smulbb r3, r6, r1 @ kExp2Const * ptr_noiseEstLogQuantile[offset + i]
|
||||
mov r12, #0x00200000
|
||||
bfi r12, r3, #0, #21 @ tmp32no1 = 0x00200000 | (tmp32no2 & 0x001FFFFF);
|
||||
rsb r0, #21 @ 21 - &inst->qNoise
|
||||
sub r14, r0, r3, lsr #21 @ -tmp16
|
||||
mov r0, r12, lsr r14
|
||||
ssat r3, #16, r0
|
||||
strh r3, [r2]
|
||||
|
||||
pop {r4, r5, r6, pc}
|
||||
|
||||
@ void PrepareSpectrumNeon(NsxInst_t* inst, int16_t* freq_buf);
|
||||
.align 2
|
||||
DEFINE_FUNCTION WebRtcNsx_PrepareSpectrumNeon
|
||||
push {r4-r9}
|
||||
|
||||
movw r2, #offset_nsx_real
|
||||
movw r12, #offset_nsx_noiseSupFilter
|
||||
movw r4, #offset_nsx_imag
|
||||
movw r5, #offset_nsx_magnLen
|
||||
|
||||
add r2, r0 @ &inst->real[0]
|
||||
add r4, r0 @ &inst->image[0]
|
||||
mov r9, r4 @ &inst->image[0]
|
||||
mov r3, r2 @ &inst->real[0]
|
||||
ldr r5, [r0, r5] @ inst->magnLen
|
||||
add r6, r4, #2 @ &inst->image[1]
|
||||
sub r5, #1
|
||||
add r12, r0 @ &inst->noiseSupFilter[0]
|
||||
add r5, r2, r5, lsl #1 @ &inst->real[inst->magnLen - 1]
|
||||
|
||||
LOOP_MAGNLEN:
|
||||
@ Filter the elements.
|
||||
vld1.16 {d20, d21}, [r2] @ inst->real[]
|
||||
vld1.16 {d24, d25}, [r12]! @ inst->noiseSupFilter[]
|
||||
vld1.16 {d22, d23}, [r4] @ inst->imag[]
|
||||
vmull.s16 q0, d20, d24
|
||||
vmull.s16 q1, d21, d25
|
||||
vmull.s16 q2, d22, d24
|
||||
vmull.s16 q3, d23, d25
|
||||
vshrn.s32 d0, q0, #14
|
||||
vshrn.s32 d1, q1, #14
|
||||
vshrn.s32 d2, q2, #14
|
||||
vshrn.s32 d3, q3, #14
|
||||
vst1.16 {d0, d1}, [r2]!
|
||||
vst1.16 {d2, d3}, [r4]!
|
||||
cmp r2, r5
|
||||
bcc LOOP_MAGNLEN
|
||||
|
||||
@ Last two elements to filter:
|
||||
ldrh r7, [r2]
|
||||
ldrh r8, [r12]
|
||||
ldrh r5, [r4]
|
||||
smulbb r7, r7, r8
|
||||
smulbb r5, r5, r8
|
||||
mov r7, r7, lsr #14
|
||||
mov r8, r5, lsr #14
|
||||
strh r7, [r2]
|
||||
strh r8, [r4]
|
||||
|
||||
ldr r5, [r0, #offset_nsx_anaLen2] @ inst->anaLen2
|
||||
ldr r7, [r0, #offset_nsx_anaLen] @ inst->anaLen
|
||||
lsr r5, #3 @ inst->anaLen2 / 8
|
||||
sub r5, #1 @ Loop counter.
|
||||
|
||||
@ Process and write the first 2 samples into freq_buf[].
|
||||
ldrh r2, [r3], #2 @ inst->real[0]
|
||||
ldrh r0, [r9] @ inst->imag[0]
|
||||
strh r2, [r1], #2 @ Store to freq_buf[0]
|
||||
rsb r0, r0, #0
|
||||
strh r0, [r1], #2 @ Store to freq_buf[1]. Now r1 -> &freq_buf[2]
|
||||
|
||||
@ Process and write (inst->anaLen2 * 4 - 32) samples into freq_buf[].
|
||||
LOOP_ANALEN2:
|
||||
vld1.16 d5, [r6]! @ inst->imag[], starting from inst->imag[1]
|
||||
vld1.16 d7, [r6]!
|
||||
vneg.s16 d5, d5
|
||||
vld1.16 d4, [r3]! @ inst->real[], starting from inst->real[1]
|
||||
vneg.s16 d7, d7
|
||||
vld1.16 d6, [r3]!
|
||||
vzip.16 d4, d5
|
||||
vzip.16 d6, d7
|
||||
subs r5, #1
|
||||
vst1.16 {d4, d5, d6, d7}, [r1]!
|
||||
bgt LOOP_ANALEN2
|
||||
|
||||
@ Process and write 32 samples into freq_buf[]. We need to adjust the pointers
|
||||
@ to overwrite the 2 starting samples in the back half of the buffer.
|
||||
vld1.16 d5, [r6]! @ inst->imag[], starting from inst->imag[1]
|
||||
vld1.16 d7, [r6]!
|
||||
vneg.s16 d5, d5
|
||||
vld1.16 d4, [r3]! @ inst->real[], starting from inst->real[1]
|
||||
vneg.s16 d7, d7
|
||||
vld1.16 d6, [r3]!
|
||||
vzip.16 d4, d5
|
||||
vzip.16 d6, d7
|
||||
vst1.16 {d4, d5, d6, d7}, [r1]
|
||||
|
||||
pop {r4-r9}
|
||||
bx r14
|
||||
|
||||
@ void SynthesisUpdateNeon(NsxInst_t* inst,
|
||||
@ int16_t* out_frame,
|
||||
@ int16_t gain_factor);
|
||||
.align 2
|
||||
DEFINE_FUNCTION WebRtcNsx_SynthesisUpdateNeon
|
||||
push {r4, r5}
|
||||
|
||||
vdup.16 d31, r2
|
||||
|
||||
movw r2, #offset_nsx_anaLen
|
||||
movw r4, #offset_nsx_real
|
||||
movw r12, #offset_nsx_synthesisBuffer
|
||||
|
||||
ldrsh r5, [r0, r2] @ inst->anaLen
|
||||
add r12, r0 @ &inst->synthesisBuffer[0];
|
||||
ldr r3, [r0, #offset_nsx_window] @ &inst->window[0]
|
||||
add r4, r0 @ &inst->real[0]
|
||||
add r5, r12, r5, lsl #1 @ &inst->synthesisBuffer[inst->anaLen]
|
||||
|
||||
mov r2, r12 @ &inst->synthesisBuffer[0];
|
||||
|
||||
LOOP_SYNTHESIS:
|
||||
vld1.16 {d0, d1}, [r4]! @ inst->real[]
|
||||
vld1.16 {d2, d3}, [r3]! @ inst->window[]
|
||||
vld1.16 {d4, d5}, [r2] @ inst->synthesisBuffer[];
|
||||
vmull.s16 q3, d0, d2
|
||||
vmull.s16 q8, d1, d3
|
||||
vrshrn.i32 d0, q3, #14
|
||||
vrshrn.i32 d1, q8, #14
|
||||
vmull.s16 q3, d31, d0
|
||||
vmull.s16 q8, d31, d1
|
||||
vqrshrn.s32 d0, q3, #13
|
||||
vqrshrn.s32 d1, q8, #13
|
||||
vqadd.s16 d4, d0
|
||||
vqadd.s16 d5, d1
|
||||
vst1.16 {d4, d5}, [r2]!
|
||||
cmp r2, r5
|
||||
blt LOOP_SYNTHESIS
|
||||
|
||||
POST_LOOP_SYNTHESIS:
|
||||
movw r3, #offset_nsx_blockLen10ms
|
||||
ldr r2, [r0, r3]
|
||||
mov r3, r12 @ &inst->synthesisBuffer[0];
|
||||
add r0, r12, r2, lsl #1 @ &inst->synthesisBuffer[inst->blockLen10ms]
|
||||
|
||||
LOOP_BLOCKLEN10MS:
|
||||
vld1.16 {q0, q1}, [r3]! @ inst->synthesisBuffer[];
|
||||
cmp r3, r0
|
||||
vst1.16 {q0, q1}, [r1]! @ out_frame[]
|
||||
blt LOOP_BLOCKLEN10MS
|
||||
|
||||
cmp r0, r5
|
||||
bge POST_LOOP_MEMCPY
|
||||
|
||||
LOOP_MEMCPY:
|
||||
vld1.16 {q0, q1}, [r0]! @ inst->synthesisBuffer[i + inst->blockLen10ms]
|
||||
cmp r0, r5
|
||||
vst1.16 {q0, q1}, [r12]! @ inst->synthesisBuffer[i]
|
||||
blt LOOP_MEMCPY
|
||||
|
||||
POST_LOOP_MEMCPY:
|
||||
cmp r12, r5
|
||||
vmov.i16 q10, #0
|
||||
vmov.i16 q11, #0
|
||||
bge EXIT_SYNTHESISUPDATE
|
||||
|
||||
LOOP_ZEROSARRAY:
|
||||
vst1.16 {q10, q11}, [r12]! @ inst->synthesisBuffer[i + inst->anaLen]
|
||||
cmp r12, r5
|
||||
blt LOOP_ZEROSARRAY
|
||||
|
||||
EXIT_SYNTHESISUPDATE:
|
||||
pop {r4, r5}
|
||||
bx r14
|
||||
|
||||
@ void AnalysisUpdateNeon(NsxInst_t* inst, int16_t* out, int16_t* new_speech);
|
||||
.align 2
|
||||
DEFINE_FUNCTION WebRtcNsx_AnalysisUpdateNeon
|
||||
push {r4-r6}
|
||||
|
||||
movw r3, #offset_nsx_analysisBuffer
|
||||
movw r4, #offset_nsx_anaLen
|
||||
movw r12, #offset_nsx_blockLen10ms
|
||||
add r3, r0 @ &inst->analysisBuffer[0]
|
||||
ldrsh r4, [r0, r4] @ inst->anaLen
|
||||
ldr r12, [r0, r12] @ inst->blockLen10ms
|
||||
sub r6, r4, r12
|
||||
add r6, r3, r6, lsl #1 @ &inst->analysisBuffer[inst->anaLen
|
||||
@ - inst->blockLen10ms]
|
||||
cmp r3, r6
|
||||
mov r5, r3
|
||||
bge POST_LOOP_MEMCPY_1
|
||||
|
||||
add r12, r3, r12, lsl #1 @ &inst->analysisBuffer[inst->blockLen10ms]
|
||||
|
||||
LOOP_MEMCPY_1:
|
||||
vld1.16 {q10, q11}, [r12]! @ inst->analysisBuffer[i + inst->blockLen10ms]
|
||||
vst1.16 {q10, q11}, [r5]! @ inst->analysisBuffer[i]
|
||||
cmp r5, r6
|
||||
blt LOOP_MEMCPY_1
|
||||
|
||||
POST_LOOP_MEMCPY_1:
|
||||
add r12, r3, r4, lsl #1 @ &inst->analysisBuffer[inst->anaLen]
|
||||
cmp r5, r12
|
||||
bge POST_LOOP_MEMCPY_2
|
||||
|
||||
LOOP_MEMCPY_2:
|
||||
vld1.16 {q10, q11}, [r2]! @ new_speech[i]
|
||||
vst1.16 {q10, q11}, [r5]! @ inst->analysisBuffer[
|
||||
@ i + inst->anaLen - inst->blockLen10ms]
|
||||
cmp r5, r12
|
||||
blt LOOP_MEMCPY_2
|
||||
|
||||
POST_LOOP_MEMCPY_2:
|
||||
add r4, r1, r4, lsl #1 @ &out[inst->anaLen]
|
||||
cmp r1, r4
|
||||
ldr r2, [r0, #offset_nsx_window] @ &inst->window[0]
|
||||
bge POST_LOOP_WINDOW_DATA
|
||||
|
||||
LOOP_WINDOW_DATA:
|
||||
vld1.16 {d4, d5}, [r3]! @ inst->analysisBuffer[]
|
||||
vld1.16 {d6, d7}, [r2]! @ inst->window[]
|
||||
vmull.s16 q0, d4, d6
|
||||
vmull.s16 q1, d5, d7
|
||||
vrshrn.i32 d4, q0, #14
|
||||
vrshrn.i32 d5, q1, #14
|
||||
vst1.16 {d4, d5}, [r1]! @ out[]
|
||||
cmp r1, r4
|
||||
blt LOOP_WINDOW_DATA
|
||||
|
||||
POST_LOOP_WINDOW_DATA:
|
||||
pop {r4-r6}
|
||||
bx r14
|
720
jni/webrtc/modules/audio_processing/ns/nsx_core_neon.c
Normal file
720
jni/webrtc/modules/audio_processing/ns/nsx_core_neon.c
Normal file
@@ -0,0 +1,720 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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/ns/nsx_core.h"
|
||||
|
||||
#include <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
// Constants to compensate for shifting signal log(2^shifts).
|
||||
const int16_t WebRtcNsx_kLogTable[9] = {
|
||||
0, 177, 355, 532, 710, 887, 1065, 1242, 1420
|
||||
};
|
||||
|
||||
const int16_t WebRtcNsx_kCounterDiv[201] = {
|
||||
32767, 16384, 10923, 8192, 6554, 5461, 4681, 4096, 3641, 3277, 2979, 2731,
|
||||
2521, 2341, 2185, 2048, 1928, 1820, 1725, 1638, 1560, 1489, 1425, 1365, 1311,
|
||||
1260, 1214, 1170, 1130, 1092, 1057, 1024, 993, 964, 936, 910, 886, 862, 840,
|
||||
819, 799, 780, 762, 745, 728, 712, 697, 683, 669, 655, 643, 630, 618, 607,
|
||||
596, 585, 575, 565, 555, 546, 537, 529, 520, 512, 504, 496, 489, 482, 475,
|
||||
468, 462, 455, 449, 443, 437, 431, 426, 420, 415, 410, 405, 400, 395, 390,
|
||||
386, 381, 377, 372, 368, 364, 360, 356, 352, 349, 345, 341, 338, 334, 331,
|
||||
328, 324, 321, 318, 315, 312, 309, 306, 303, 301, 298, 295, 293, 290, 287,
|
||||
285, 282, 280, 278, 275, 273, 271, 269, 266, 264, 262, 260, 258, 256, 254,
|
||||
252, 250, 248, 246, 245, 243, 241, 239, 237, 236, 234, 232, 231, 229, 228,
|
||||
226, 224, 223, 221, 220, 218, 217, 216, 214, 213, 211, 210, 209, 207, 206,
|
||||
205, 204, 202, 201, 200, 199, 197, 196, 195, 194, 193, 192, 191, 189, 188,
|
||||
187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173,
|
||||
172, 172, 171, 170, 169, 168, 167, 166, 165, 165, 164, 163
|
||||
};
|
||||
|
||||
const int16_t WebRtcNsx_kLogTableFrac[256] = {
|
||||
0, 1, 3, 4, 6, 7, 9, 10, 11, 13, 14, 16, 17, 18, 20, 21,
|
||||
22, 24, 25, 26, 28, 29, 30, 32, 33, 34, 36, 37, 38, 40, 41, 42,
|
||||
44, 45, 46, 47, 49, 50, 51, 52, 54, 55, 56, 57, 59, 60, 61, 62,
|
||||
63, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81,
|
||||
82, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99,
|
||||
100, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 116,
|
||||
117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
|
||||
132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
|
||||
147, 148, 149, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 160,
|
||||
161, 162, 163, 164, 165, 166, 167, 168, 169, 169, 170, 171, 172, 173, 174,
|
||||
175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 184, 185, 185, 186, 187,
|
||||
188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200,
|
||||
201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 212,
|
||||
213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 224,
|
||||
225, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, 234, 234, 235, 236,
|
||||
237, 238, 238, 239, 240, 241, 241, 242, 243, 244, 244, 245, 246, 247, 247,
|
||||
248, 249, 249, 250, 251, 252, 252, 253, 254, 255, 255
|
||||
};
|
||||
|
||||
// Update the noise estimation information.
|
||||
static void UpdateNoiseEstimateNeon(NsxInst_t* inst, int offset) {
|
||||
const int16_t kExp2Const = 11819; // Q13
|
||||
int16_t* ptr_noiseEstLogQuantile = NULL;
|
||||
int16_t* ptr_noiseEstQuantile = NULL;
|
||||
int16x4_t kExp2Const16x4 = vdup_n_s16(kExp2Const);
|
||||
int32x4_t twentyOne32x4 = vdupq_n_s32(21);
|
||||
int32x4_t constA32x4 = vdupq_n_s32(0x1fffff);
|
||||
int32x4_t constB32x4 = vdupq_n_s32(0x200000);
|
||||
|
||||
int16_t tmp16 = WebRtcSpl_MaxValueW16(inst->noiseEstLogQuantile + offset,
|
||||
inst->magnLen);
|
||||
|
||||
// Guarantee a Q-domain as high as possible and still fit in int16
|
||||
inst->qNoise = 14 - (int) WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(kExp2Const,
|
||||
tmp16,
|
||||
21);
|
||||
|
||||
int32x4_t qNoise32x4 = vdupq_n_s32(inst->qNoise);
|
||||
|
||||
for (ptr_noiseEstLogQuantile = &inst->noiseEstLogQuantile[offset],
|
||||
ptr_noiseEstQuantile = &inst->noiseEstQuantile[0];
|
||||
ptr_noiseEstQuantile < &inst->noiseEstQuantile[inst->magnLen - 3];
|
||||
ptr_noiseEstQuantile += 4, ptr_noiseEstLogQuantile += 4) {
|
||||
|
||||
// tmp32no2 = WEBRTC_SPL_MUL_16_16(kExp2Const,
|
||||
// inst->noiseEstLogQuantile[offset + i]);
|
||||
int16x4_t v16x4 = vld1_s16(ptr_noiseEstLogQuantile);
|
||||
int32x4_t v32x4B = vmull_s16(v16x4, kExp2Const16x4);
|
||||
|
||||
// tmp32no1 = (0x00200000 | (tmp32no2 & 0x001FFFFF)); // 2^21 + frac
|
||||
int32x4_t v32x4A = vandq_s32(v32x4B, constA32x4);
|
||||
v32x4A = vorrq_s32(v32x4A, constB32x4);
|
||||
|
||||
// tmp16 = (int16_t) WEBRTC_SPL_RSHIFT_W32(tmp32no2, 21);
|
||||
v32x4B = vshrq_n_s32(v32x4B, 21);
|
||||
|
||||
// tmp16 -= 21;// shift 21 to get result in Q0
|
||||
v32x4B = vsubq_s32(v32x4B, twentyOne32x4);
|
||||
|
||||
// tmp16 += (int16_t) inst->qNoise;
|
||||
// shift to get result in Q(qNoise)
|
||||
v32x4B = vaddq_s32(v32x4B, qNoise32x4);
|
||||
|
||||
// if (tmp16 < 0) {
|
||||
// tmp32no1 = WEBRTC_SPL_RSHIFT_W32(tmp32no1, -tmp16);
|
||||
// } else {
|
||||
// tmp32no1 = WEBRTC_SPL_LSHIFT_W32(tmp32no1, tmp16);
|
||||
// }
|
||||
v32x4B = vshlq_s32(v32x4A, v32x4B);
|
||||
|
||||
// tmp16 = WebRtcSpl_SatW32ToW16(tmp32no1);
|
||||
v16x4 = vqmovn_s32(v32x4B);
|
||||
|
||||
//inst->noiseEstQuantile[i] = tmp16;
|
||||
vst1_s16(ptr_noiseEstQuantile, v16x4);
|
||||
}
|
||||
|
||||
// Last iteration:
|
||||
|
||||
// inst->quantile[i]=exp(inst->lquantile[offset+i]);
|
||||
// in Q21
|
||||
int32_t tmp32no2 = WEBRTC_SPL_MUL_16_16(kExp2Const,
|
||||
*ptr_noiseEstLogQuantile);
|
||||
int32_t tmp32no1 = (0x00200000 | (tmp32no2 & 0x001FFFFF)); // 2^21 + frac
|
||||
|
||||
tmp16 = (int16_t) WEBRTC_SPL_RSHIFT_W32(tmp32no2, 21);
|
||||
tmp16 -= 21;// shift 21 to get result in Q0
|
||||
tmp16 += (int16_t) inst->qNoise; //shift to get result in Q(qNoise)
|
||||
if (tmp16 < 0) {
|
||||
tmp32no1 = WEBRTC_SPL_RSHIFT_W32(tmp32no1, -tmp16);
|
||||
} else {
|
||||
tmp32no1 = WEBRTC_SPL_LSHIFT_W32(tmp32no1, tmp16);
|
||||
}
|
||||
*ptr_noiseEstQuantile = WebRtcSpl_SatW32ToW16(tmp32no1);
|
||||
}
|
||||
|
||||
// Noise Estimation
|
||||
void WebRtcNsx_NoiseEstimationNeon(NsxInst_t* inst,
|
||||
uint16_t* magn,
|
||||
uint32_t* noise,
|
||||
int16_t* q_noise) {
|
||||
int16_t lmagn[HALF_ANAL_BLOCKL], counter, countDiv;
|
||||
int16_t countProd, delta, zeros, frac;
|
||||
int16_t log2, tabind, logval, tmp16, tmp16no1, tmp16no2;
|
||||
const int16_t log2_const = 22713;
|
||||
const int16_t width_factor = 21845;
|
||||
|
||||
int i, s, offset;
|
||||
|
||||
tabind = inst->stages - inst->normData;
|
||||
assert(tabind < 9);
|
||||
assert(tabind > -9);
|
||||
if (tabind < 0) {
|
||||
logval = -WebRtcNsx_kLogTable[-tabind];
|
||||
} else {
|
||||
logval = WebRtcNsx_kLogTable[tabind];
|
||||
}
|
||||
|
||||
int16x8_t logval_16x8 = vdupq_n_s16(logval);
|
||||
|
||||
// lmagn(i)=log(magn(i))=log(2)*log2(magn(i))
|
||||
// magn is in Q(-stages), and the real lmagn values are:
|
||||
// real_lmagn(i)=log(magn(i)*2^stages)=log(magn(i))+log(2^stages)
|
||||
// lmagn in Q8
|
||||
for (i = 0; i < inst->magnLen; i++) {
|
||||
if (magn[i]) {
|
||||
zeros = WebRtcSpl_NormU32((uint32_t)magn[i]);
|
||||
frac = (int16_t)((((uint32_t)magn[i] << zeros)
|
||||
& 0x7FFFFFFF) >> 23);
|
||||
assert(frac < 256);
|
||||
// log2(magn(i))
|
||||
log2 = (int16_t)(((31 - zeros) << 8)
|
||||
+ WebRtcNsx_kLogTableFrac[frac]);
|
||||
// log2(magn(i))*log(2)
|
||||
lmagn[i] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(log2, log2_const, 15);
|
||||
// + log(2^stages)
|
||||
lmagn[i] += logval;
|
||||
} else {
|
||||
lmagn[i] = logval;
|
||||
}
|
||||
}
|
||||
|
||||
int16x4_t Q3_16x4 = vdup_n_s16(3);
|
||||
int16x8_t WIDTHQ8_16x8 = vdupq_n_s16(WIDTH_Q8);
|
||||
int16x8_t WIDTHFACTOR_16x8 = vdupq_n_s16(width_factor);
|
||||
|
||||
int16_t factor = FACTOR_Q7;
|
||||
if (inst->blockIndex < END_STARTUP_LONG)
|
||||
factor = FACTOR_Q7_STARTUP;
|
||||
|
||||
// Loop over simultaneous estimates
|
||||
for (s = 0; s < SIMULT; s++) {
|
||||
offset = s * inst->magnLen;
|
||||
|
||||
// Get counter values from state
|
||||
counter = inst->noiseEstCounter[s];
|
||||
assert(counter < 201);
|
||||
countDiv = WebRtcNsx_kCounterDiv[counter];
|
||||
countProd = (int16_t)WEBRTC_SPL_MUL_16_16(counter, countDiv);
|
||||
|
||||
// quant_est(...)
|
||||
int16_t deltaBuff[8];
|
||||
int16x4_t tmp16x4_0;
|
||||
int16x4_t tmp16x4_1;
|
||||
int16x4_t countDiv_16x4 = vdup_n_s16(countDiv);
|
||||
int16x8_t countProd_16x8 = vdupq_n_s16(countProd);
|
||||
int16x8_t tmp16x8_0 = vdupq_n_s16(countDiv);
|
||||
int16x8_t prod16x8 = vqrdmulhq_s16(WIDTHFACTOR_16x8, tmp16x8_0);
|
||||
int16x8_t tmp16x8_1;
|
||||
int16x8_t tmp16x8_2;
|
||||
int16x8_t tmp16x8_3;
|
||||
// Initialize tmp16x8_4 to zero to avoid compilaton error.
|
||||
int16x8_t tmp16x8_4 = vdupq_n_s16(0);
|
||||
int16x8_t tmp16x8_5;
|
||||
int32x4_t tmp32x4;
|
||||
|
||||
for (i = 0; i < inst->magnLen - 7; i += 8) {
|
||||
// Compute delta.
|
||||
// Smaller step size during startup. This prevents from using
|
||||
// unrealistic values causing overflow.
|
||||
tmp16x8_0 = vdupq_n_s16(factor);
|
||||
vst1q_s16(deltaBuff, tmp16x8_0);
|
||||
|
||||
int j;
|
||||
for (j = 0; j < 8; j++) {
|
||||
if (inst->noiseEstDensity[offset + i + j] > 512) {
|
||||
// Get values for deltaBuff by shifting intead of dividing.
|
||||
int factor = WebRtcSpl_NormW16(inst->noiseEstDensity[offset + i + j]);
|
||||
deltaBuff[j] = (int16_t)(FACTOR_Q16 >> (14 - factor));
|
||||
}
|
||||
}
|
||||
|
||||
// Update log quantile estimate
|
||||
|
||||
// tmp16 = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(delta, countDiv, 14);
|
||||
tmp32x4 = vmull_s16(vld1_s16(&deltaBuff[0]), countDiv_16x4);
|
||||
tmp16x4_1 = vshrn_n_s32(tmp32x4, 14);
|
||||
tmp32x4 = vmull_s16(vld1_s16(&deltaBuff[4]), countDiv_16x4);
|
||||
tmp16x4_0 = vshrn_n_s32(tmp32x4, 14);
|
||||
tmp16x8_0 = vcombine_s16(tmp16x4_1, tmp16x4_0); // Keep for several lines.
|
||||
|
||||
// prepare for the "if" branch
|
||||
// tmp16 += 2;
|
||||
// tmp16_1 = (Word16)(tmp16>>2);
|
||||
tmp16x8_1 = vrshrq_n_s16(tmp16x8_0, 2);
|
||||
|
||||
// inst->noiseEstLogQuantile[offset+i] + tmp16_1;
|
||||
tmp16x8_2 = vld1q_s16(&inst->noiseEstLogQuantile[offset + i]); // Keep
|
||||
tmp16x8_1 = vaddq_s16(tmp16x8_2, tmp16x8_1); // Keep for several lines
|
||||
|
||||
// Prepare for the "else" branch
|
||||
// tmp16 += 1;
|
||||
// tmp16_1 = (Word16)(tmp16>>1);
|
||||
tmp16x8_0 = vrshrq_n_s16(tmp16x8_0, 1);
|
||||
|
||||
// tmp16_2 = (Word16)WEBRTC_SPL_MUL_16_16_RSFT(tmp16_1,3,1);
|
||||
tmp32x4 = vmull_s16(vget_low_s16(tmp16x8_0), Q3_16x4);
|
||||
tmp16x4_1 = vshrn_n_s32(tmp32x4, 1);
|
||||
|
||||
// tmp16_2 = (Word16)WEBRTC_SPL_MUL_16_16_RSFT(tmp16_1,3,1);
|
||||
tmp32x4 = vmull_s16(vget_high_s16(tmp16x8_0), Q3_16x4);
|
||||
tmp16x4_0 = vshrn_n_s32(tmp32x4, 1);
|
||||
|
||||
// inst->noiseEstLogQuantile[offset + i] - tmp16_2;
|
||||
tmp16x8_0 = vcombine_s16(tmp16x4_1, tmp16x4_0); // keep
|
||||
tmp16x8_0 = vsubq_s16(tmp16x8_2, tmp16x8_0);
|
||||
|
||||
// logval is the smallest fixed point representation we can have. Values
|
||||
// below that will correspond to values in the interval [0, 1], which
|
||||
// can't possibly occur.
|
||||
tmp16x8_0 = vmaxq_s16(tmp16x8_0, logval_16x8);
|
||||
|
||||
// Do the if-else branches:
|
||||
tmp16x8_3 = vld1q_s16(&lmagn[i]); // keep for several lines
|
||||
tmp16x8_5 = vsubq_s16(tmp16x8_3, tmp16x8_2);
|
||||
__asm__("vcgt.s16 %q0, %q1, #0"::"w"(tmp16x8_4), "w"(tmp16x8_5));
|
||||
__asm__("vbit %q0, %q1, %q2"::
|
||||
"w"(tmp16x8_2), "w"(tmp16x8_1), "w"(tmp16x8_4));
|
||||
__asm__("vbif %q0, %q1, %q2"::
|
||||
"w"(tmp16x8_2), "w"(tmp16x8_0), "w"(tmp16x8_4));
|
||||
vst1q_s16(&inst->noiseEstLogQuantile[offset + i], tmp16x8_2);
|
||||
|
||||
// Update density estimate
|
||||
// tmp16_1 + tmp16_2
|
||||
tmp16x8_1 = vld1q_s16(&inst->noiseEstDensity[offset + i]);
|
||||
tmp16x8_0 = vqrdmulhq_s16(tmp16x8_1, countProd_16x8);
|
||||
tmp16x8_0 = vaddq_s16(tmp16x8_0, prod16x8);
|
||||
|
||||
// lmagn[i] - inst->noiseEstLogQuantile[offset + i]
|
||||
tmp16x8_3 = vsubq_s16(tmp16x8_3, tmp16x8_2);
|
||||
tmp16x8_3 = vabsq_s16(tmp16x8_3);
|
||||
tmp16x8_4 = vcgtq_s16(WIDTHQ8_16x8, tmp16x8_3);
|
||||
__asm__("vbit %q0, %q1, %q2"::
|
||||
"w"(tmp16x8_1), "w"(tmp16x8_0), "w"(tmp16x8_4));
|
||||
vst1q_s16(&inst->noiseEstDensity[offset + i], tmp16x8_1);
|
||||
} // End loop over magnitude spectrum
|
||||
|
||||
// Last iteration over magnitude spectrum:
|
||||
// compute delta
|
||||
if (inst->noiseEstDensity[offset + i] > 512) {
|
||||
// Get values for deltaBuff by shifting intead of dividing.
|
||||
int factor = WebRtcSpl_NormW16(inst->noiseEstDensity[offset + i]);
|
||||
delta = (int16_t)(FACTOR_Q16 >> (14 - factor));
|
||||
} else {
|
||||
delta = FACTOR_Q7;
|
||||
if (inst->blockIndex < END_STARTUP_LONG) {
|
||||
// Smaller step size during startup. This prevents from using
|
||||
// unrealistic values causing overflow.
|
||||
delta = FACTOR_Q7_STARTUP;
|
||||
}
|
||||
}
|
||||
// update log quantile estimate
|
||||
tmp16 = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(delta, countDiv, 14);
|
||||
if (lmagn[i] > inst->noiseEstLogQuantile[offset + i]) {
|
||||
// +=QUANTILE*delta/(inst->counter[s]+1) QUANTILE=0.25, =1 in Q2
|
||||
// CounterDiv=1/(inst->counter[s]+1) in Q15
|
||||
tmp16 += 2;
|
||||
tmp16no1 = WEBRTC_SPL_RSHIFT_W16(tmp16, 2);
|
||||
inst->noiseEstLogQuantile[offset + i] += tmp16no1;
|
||||
} else {
|
||||
tmp16 += 1;
|
||||
tmp16no1 = WEBRTC_SPL_RSHIFT_W16(tmp16, 1);
|
||||
// *(1-QUANTILE), in Q2 QUANTILE=0.25, 1-0.25=0.75=3 in Q2
|
||||
tmp16no2 = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(tmp16no1, 3, 1);
|
||||
inst->noiseEstLogQuantile[offset + i] -= tmp16no2;
|
||||
if (inst->noiseEstLogQuantile[offset + i] < logval) {
|
||||
// logval is the smallest fixed point representation we can have.
|
||||
// Values below that will correspond to values in the interval
|
||||
// [0, 1], which can't possibly occur.
|
||||
inst->noiseEstLogQuantile[offset + i] = logval;
|
||||
}
|
||||
}
|
||||
|
||||
// update density estimate
|
||||
if (WEBRTC_SPL_ABS_W16(lmagn[i] - inst->noiseEstLogQuantile[offset + i])
|
||||
< WIDTH_Q8) {
|
||||
tmp16no1 = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(
|
||||
inst->noiseEstDensity[offset + i], countProd, 15);
|
||||
tmp16no2 = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(
|
||||
width_factor, countDiv, 15);
|
||||
inst->noiseEstDensity[offset + i] = tmp16no1 + tmp16no2;
|
||||
}
|
||||
|
||||
|
||||
if (counter >= END_STARTUP_LONG) {
|
||||
inst->noiseEstCounter[s] = 0;
|
||||
if (inst->blockIndex >= END_STARTUP_LONG) {
|
||||
UpdateNoiseEstimateNeon(inst, offset);
|
||||
}
|
||||
}
|
||||
inst->noiseEstCounter[s]++;
|
||||
|
||||
} // end loop over simultaneous estimates
|
||||
|
||||
// Sequentially update the noise during startup
|
||||
if (inst->blockIndex < END_STARTUP_LONG) {
|
||||
UpdateNoiseEstimateNeon(inst, offset);
|
||||
}
|
||||
|
||||
for (i = 0; i < inst->magnLen; i++) {
|
||||
noise[i] = (uint32_t)(inst->noiseEstQuantile[i]); // Q(qNoise)
|
||||
}
|
||||
(*q_noise) = (int16_t)inst->qNoise;
|
||||
}
|
||||
|
||||
// Filter the data in the frequency domain, and create spectrum.
|
||||
void WebRtcNsx_PrepareSpectrumNeon(NsxInst_t* inst, int16_t* freq_buf) {
|
||||
assert(inst->magnLen % 8 == 1);
|
||||
assert(inst->anaLen2 % 16 == 0);
|
||||
|
||||
// (1) Filtering.
|
||||
|
||||
// Fixed point C code for the next block is as follows:
|
||||
// for (i = 0; i < inst->magnLen; i++) {
|
||||
// inst->real[i] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(inst->real[i],
|
||||
// (int16_t)(inst->noiseSupFilter[i]), 14); // Q(normData-stages)
|
||||
// inst->imag[i] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(inst->imag[i],
|
||||
// (int16_t)(inst->noiseSupFilter[i]), 14); // Q(normData-stages)
|
||||
// }
|
||||
|
||||
int16_t* preal = &inst->real[0];
|
||||
int16_t* pimag = &inst->imag[0];
|
||||
int16_t* pns_filter = (int16_t*)&inst->noiseSupFilter[0];
|
||||
int16_t* pimag_end = pimag + inst->magnLen - 4;
|
||||
|
||||
while (pimag < pimag_end) {
|
||||
int16x8_t real = vld1q_s16(preal);
|
||||
int16x8_t imag = vld1q_s16(pimag);
|
||||
int16x8_t ns_filter = vld1q_s16(pns_filter);
|
||||
|
||||
int32x4_t tmp_r_0 = vmull_s16(vget_low_s16(real), vget_low_s16(ns_filter));
|
||||
int32x4_t tmp_i_0 = vmull_s16(vget_low_s16(imag), vget_low_s16(ns_filter));
|
||||
int32x4_t tmp_r_1 = vmull_s16(vget_high_s16(real),
|
||||
vget_high_s16(ns_filter));
|
||||
int32x4_t tmp_i_1 = vmull_s16(vget_high_s16(imag),
|
||||
vget_high_s16(ns_filter));
|
||||
|
||||
int16x4_t result_r_0 = vshrn_n_s32(tmp_r_0, 14);
|
||||
int16x4_t result_i_0 = vshrn_n_s32(tmp_i_0, 14);
|
||||
int16x4_t result_r_1 = vshrn_n_s32(tmp_r_1, 14);
|
||||
int16x4_t result_i_1 = vshrn_n_s32(tmp_i_1, 14);
|
||||
|
||||
vst1q_s16(preal, vcombine_s16(result_r_0, result_r_1));
|
||||
vst1q_s16(pimag, vcombine_s16(result_i_0, result_i_1));
|
||||
preal += 8;
|
||||
pimag += 8;
|
||||
pns_filter += 8;
|
||||
}
|
||||
|
||||
// Filter the last element
|
||||
*preal = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(*preal, *pns_filter, 14);
|
||||
*pimag = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(*pimag, *pns_filter, 14);
|
||||
|
||||
// (2) Create spectrum.
|
||||
|
||||
// Fixed point C code for the rest of the function is as follows:
|
||||
// freq_buf[0] = inst->real[0];
|
||||
// freq_buf[1] = -inst->imag[0];
|
||||
// for (i = 1, j = 2; i < inst->anaLen2; i += 1, j += 2) {
|
||||
// freq_buf[j] = inst->real[i];
|
||||
// freq_buf[j + 1] = -inst->imag[i];
|
||||
// }
|
||||
// freq_buf[inst->anaLen] = inst->real[inst->anaLen2];
|
||||
// freq_buf[inst->anaLen + 1] = -inst->imag[inst->anaLen2];
|
||||
|
||||
preal = &inst->real[0];
|
||||
pimag = &inst->imag[0];
|
||||
pimag_end = pimag + inst->anaLen2;
|
||||
int16_t * freq_buf_start = freq_buf;
|
||||
while (pimag < pimag_end) {
|
||||
// loop unroll
|
||||
int16x8x2_t real_imag_0;
|
||||
int16x8x2_t real_imag_1;
|
||||
real_imag_0.val[1] = vld1q_s16(pimag);
|
||||
real_imag_0.val[0] = vld1q_s16(preal);
|
||||
preal += 8;
|
||||
pimag += 8;
|
||||
real_imag_1.val[1] = vld1q_s16(pimag);
|
||||
real_imag_1.val[0] = vld1q_s16(preal);
|
||||
preal += 8;
|
||||
pimag += 8;
|
||||
|
||||
real_imag_0.val[1] = vnegq_s16(real_imag_0.val[1]);
|
||||
real_imag_1.val[1] = vnegq_s16(real_imag_1.val[1]);
|
||||
vst2q_s16(freq_buf_start, real_imag_0);
|
||||
freq_buf_start += 16;
|
||||
vst2q_s16(freq_buf_start, real_imag_1);
|
||||
freq_buf_start += 16;
|
||||
}
|
||||
freq_buf[inst->anaLen] = inst->real[inst->anaLen2];
|
||||
freq_buf[inst->anaLen + 1] = -inst->imag[inst->anaLen2];
|
||||
}
|
||||
|
||||
// Denormalize the input buffer.
|
||||
void WebRtcNsx_DenormalizeNeon(NsxInst_t* inst, int16_t* in, int factor) {
|
||||
int16_t* ptr_real = &inst->real[0];
|
||||
int16_t* ptr_in = &in[0];
|
||||
|
||||
__asm__ __volatile__("vdup.32 q10, %0" ::
|
||||
"r"((int32_t)(factor - inst->normData)) : "q10");
|
||||
for (; ptr_real < &inst->real[inst->anaLen];) {
|
||||
|
||||
// Loop unrolled once. Both pointers are incremented.
|
||||
__asm__ __volatile__(
|
||||
// tmp32 = WEBRTC_SPL_SHIFT_W32((int32_t)in[j],
|
||||
// factor - inst->normData);
|
||||
"vld2.16 {d24, d25}, [%[ptr_in]]!\n\t"
|
||||
"vmovl.s16 q12, d24\n\t"
|
||||
"vshl.s32 q12, q10\n\t"
|
||||
// inst->real[i] = WebRtcSpl_SatW32ToW16(tmp32); // Q0
|
||||
"vqmovn.s32 d24, q12\n\t"
|
||||
"vst1.16 d24, [%[ptr_real]]!\n\t"
|
||||
|
||||
// tmp32 = WEBRTC_SPL_SHIFT_W32((int32_t)in[j],
|
||||
// factor - inst->normData);
|
||||
"vld2.16 {d22, d23}, [%[ptr_in]]!\n\t"
|
||||
"vmovl.s16 q11, d22\n\t"
|
||||
"vshl.s32 q11, q10\n\t"
|
||||
// inst->real[i] = WebRtcSpl_SatW32ToW16(tmp32); // Q0
|
||||
"vqmovn.s32 d22, q11\n\t"
|
||||
"vst1.16 d22, [%[ptr_real]]!\n\t"
|
||||
|
||||
// Specify constraints.
|
||||
:[ptr_in]"+r"(ptr_in),
|
||||
[ptr_real]"+r"(ptr_real)
|
||||
:
|
||||
:"d22", "d23", "d24", "d25"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// For the noise supress process, synthesis, read out fully processed segment,
|
||||
// and update synthesis buffer.
|
||||
void WebRtcNsx_SynthesisUpdateNeon(NsxInst_t* inst,
|
||||
int16_t* out_frame,
|
||||
int16_t gain_factor) {
|
||||
int16_t* ptr_real = &inst->real[0];
|
||||
int16_t* ptr_syn = &inst->synthesisBuffer[0];
|
||||
const int16_t* ptr_window = &inst->window[0];
|
||||
|
||||
// synthesis
|
||||
__asm__ __volatile__("vdup.16 d24, %0" : : "r"(gain_factor) : "d24");
|
||||
// Loop unrolled once. All pointers are incremented in the assembly code.
|
||||
for (; ptr_syn < &inst->synthesisBuffer[inst->anaLen];) {
|
||||
__asm__ __volatile__(
|
||||
// Load variables.
|
||||
"vld1.16 d22, [%[ptr_real]]!\n\t"
|
||||
"vld1.16 d23, [%[ptr_window]]!\n\t"
|
||||
"vld1.16 d25, [%[ptr_syn]]\n\t"
|
||||
// tmp16a = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(
|
||||
// inst->window[i], inst->real[i], 14); // Q0, window in Q14
|
||||
"vmull.s16 q11, d22, d23\n\t"
|
||||
"vrshrn.i32 d22, q11, #14\n\t"
|
||||
// tmp32 = WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(tmp16a, gain_factor, 13);
|
||||
"vmull.s16 q11, d24, d22\n\t"
|
||||
// tmp16b = WebRtcSpl_SatW32ToW16(tmp32); // Q0
|
||||
"vqrshrn.s32 d22, q11, #13\n\t"
|
||||
// inst->synthesisBuffer[i] = WebRtcSpl_AddSatW16(
|
||||
// inst->synthesisBuffer[i], tmp16b); // Q0
|
||||
"vqadd.s16 d25, d22\n\t"
|
||||
"vst1.16 d25, [%[ptr_syn]]!\n\t"
|
||||
|
||||
// Load variables.
|
||||
"vld1.16 d26, [%[ptr_real]]!\n\t"
|
||||
"vld1.16 d27, [%[ptr_window]]!\n\t"
|
||||
"vld1.16 d28, [%[ptr_syn]]\n\t"
|
||||
// tmp16a = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(
|
||||
// inst->window[i], inst->real[i], 14); // Q0, window in Q14
|
||||
"vmull.s16 q13, d26, d27\n\t"
|
||||
"vrshrn.i32 d26, q13, #14\n\t"
|
||||
// tmp32 = WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(tmp16a, gain_factor, 13);
|
||||
"vmull.s16 q13, d24, d26\n\t"
|
||||
// tmp16b = WebRtcSpl_SatW32ToW16(tmp32); // Q0
|
||||
"vqrshrn.s32 d26, q13, #13\n\t"
|
||||
// inst->synthesisBuffer[i] = WebRtcSpl_AddSatW16(
|
||||
// inst->synthesisBuffer[i], tmp16b); // Q0
|
||||
"vqadd.s16 d28, d26\n\t"
|
||||
"vst1.16 d28, [%[ptr_syn]]!\n\t"
|
||||
|
||||
// Specify constraints.
|
||||
:[ptr_real]"+r"(ptr_real),
|
||||
[ptr_window]"+r"(ptr_window),
|
||||
[ptr_syn]"+r"(ptr_syn)
|
||||
:
|
||||
:"d22", "d23", "d24", "d25", "d26", "d27", "d28", "q11", "q12", "q13"
|
||||
);
|
||||
}
|
||||
|
||||
int16_t* ptr_out = &out_frame[0];
|
||||
ptr_syn = &inst->synthesisBuffer[0];
|
||||
// read out fully processed segment
|
||||
for (; ptr_syn < &inst->synthesisBuffer[inst->blockLen10ms];) {
|
||||
// Loop unrolled once. Both pointers are incremented in the assembly code.
|
||||
__asm__ __volatile__(
|
||||
// out_frame[i] = inst->synthesisBuffer[i]; // Q0
|
||||
"vld1.16 {d22, d23}, [%[ptr_syn]]!\n\t"
|
||||
"vld1.16 {d24, d25}, [%[ptr_syn]]!\n\t"
|
||||
"vst1.16 {d22, d23}, [%[ptr_out]]!\n\t"
|
||||
"vst1.16 {d24, d25}, [%[ptr_out]]!\n\t"
|
||||
:[ptr_syn]"+r"(ptr_syn),
|
||||
[ptr_out]"+r"(ptr_out)
|
||||
:
|
||||
:"d22", "d23", "d24", "d25"
|
||||
);
|
||||
}
|
||||
|
||||
// Update synthesis buffer.
|
||||
// C code:
|
||||
// WEBRTC_SPL_MEMCPY_W16(inst->synthesisBuffer,
|
||||
// inst->synthesisBuffer + inst->blockLen10ms,
|
||||
// inst->anaLen - inst->blockLen10ms);
|
||||
ptr_out = &inst->synthesisBuffer[0],
|
||||
ptr_syn = &inst->synthesisBuffer[inst->blockLen10ms];
|
||||
for (; ptr_syn < &inst->synthesisBuffer[inst->anaLen];) {
|
||||
// Loop unrolled once. Both pointers are incremented in the assembly code.
|
||||
__asm__ __volatile__(
|
||||
"vld1.16 {d22, d23}, [%[ptr_syn]]!\n\t"
|
||||
"vld1.16 {d24, d25}, [%[ptr_syn]]!\n\t"
|
||||
"vst1.16 {d22, d23}, [%[ptr_out]]!\n\t"
|
||||
"vst1.16 {d24, d25}, [%[ptr_out]]!\n\t"
|
||||
:[ptr_syn]"+r"(ptr_syn),
|
||||
[ptr_out]"+r"(ptr_out)
|
||||
:
|
||||
:"d22", "d23", "d24", "d25"
|
||||
);
|
||||
}
|
||||
|
||||
// C code:
|
||||
// WebRtcSpl_ZerosArrayW16(inst->synthesisBuffer
|
||||
// + inst->anaLen - inst->blockLen10ms, inst->blockLen10ms);
|
||||
__asm__ __volatile__("vdup.16 q10, %0" : : "r"(0) : "q10");
|
||||
for (; ptr_out < &inst->synthesisBuffer[inst->anaLen];) {
|
||||
// Loop unrolled once. Pointer is incremented in the assembly code.
|
||||
__asm__ __volatile__(
|
||||
"vst1.16 {d20, d21}, [%[ptr_out]]!\n\t"
|
||||
"vst1.16 {d20, d21}, [%[ptr_out]]!\n\t"
|
||||
:[ptr_out]"+r"(ptr_out)
|
||||
:
|
||||
:"d20", "d21"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Update analysis buffer for lower band, and window data before FFT.
|
||||
void WebRtcNsx_AnalysisUpdateNeon(NsxInst_t* inst,
|
||||
int16_t* out,
|
||||
int16_t* new_speech) {
|
||||
|
||||
int16_t* ptr_ana = &inst->analysisBuffer[inst->blockLen10ms];
|
||||
int16_t* ptr_out = &inst->analysisBuffer[0];
|
||||
|
||||
// For lower band update analysis buffer.
|
||||
// WEBRTC_SPL_MEMCPY_W16(inst->analysisBuffer,
|
||||
// inst->analysisBuffer + inst->blockLen10ms,
|
||||
// inst->anaLen - inst->blockLen10ms);
|
||||
for (; ptr_out < &inst->analysisBuffer[inst->anaLen - inst->blockLen10ms];) {
|
||||
// Loop unrolled once, so both pointers are incremented by 8 twice.
|
||||
__asm__ __volatile__(
|
||||
"vld1.16 {d20, d21}, [%[ptr_ana]]!\n\t"
|
||||
"vst1.16 {d20, d21}, [%[ptr_out]]!\n\t"
|
||||
"vld1.16 {d22, d23}, [%[ptr_ana]]!\n\t"
|
||||
"vst1.16 {d22, d23}, [%[ptr_out]]!\n\t"
|
||||
:[ptr_ana]"+r"(ptr_ana),
|
||||
[ptr_out]"+r"(ptr_out)
|
||||
:
|
||||
:"d20", "d21", "d22", "d23"
|
||||
);
|
||||
}
|
||||
|
||||
// WEBRTC_SPL_MEMCPY_W16(inst->analysisBuffer
|
||||
// + inst->anaLen - inst->blockLen10ms, new_speech, inst->blockLen10ms);
|
||||
for (ptr_ana = new_speech; ptr_out < &inst->analysisBuffer[inst->anaLen];) {
|
||||
// Loop unrolled once, so both pointers are incremented by 8 twice.
|
||||
__asm__ __volatile__(
|
||||
"vld1.16 {d20, d21}, [%[ptr_ana]]!\n\t"
|
||||
"vst1.16 {d20, d21}, [%[ptr_out]]!\n\t"
|
||||
"vld1.16 {d22, d23}, [%[ptr_ana]]!\n\t"
|
||||
"vst1.16 {d22, d23}, [%[ptr_out]]!\n\t"
|
||||
:[ptr_ana]"+r"(ptr_ana),
|
||||
[ptr_out]"+r"(ptr_out)
|
||||
:
|
||||
:"d20", "d21", "d22", "d23"
|
||||
);
|
||||
}
|
||||
|
||||
// Window data before FFT
|
||||
const int16_t* ptr_window = &inst->window[0];
|
||||
ptr_out = &out[0];
|
||||
ptr_ana = &inst->analysisBuffer[0];
|
||||
for (; ptr_out < &out[inst->anaLen];) {
|
||||
|
||||
// Loop unrolled once, so all pointers are incremented by 4 twice.
|
||||
__asm__ __volatile__(
|
||||
"vld1.16 d20, [%[ptr_ana]]!\n\t"
|
||||
"vld1.16 d21, [%[ptr_window]]!\n\t"
|
||||
// out[i] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(
|
||||
// inst->window[i], inst->analysisBuffer[i], 14); // Q0
|
||||
"vmull.s16 q10, d20, d21\n\t"
|
||||
"vrshrn.i32 d20, q10, #14\n\t"
|
||||
"vst1.16 d20, [%[ptr_out]]!\n\t"
|
||||
|
||||
"vld1.16 d22, [%[ptr_ana]]!\n\t"
|
||||
"vld1.16 d23, [%[ptr_window]]!\n\t"
|
||||
// out[i] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(
|
||||
// inst->window[i], inst->analysisBuffer[i], 14); // Q0
|
||||
"vmull.s16 q11, d22, d23\n\t"
|
||||
"vrshrn.i32 d22, q11, #14\n\t"
|
||||
"vst1.16 d22, [%[ptr_out]]!\n\t"
|
||||
|
||||
// Specify constraints.
|
||||
:[ptr_ana]"+r"(ptr_ana),
|
||||
[ptr_window]"+r"(ptr_window),
|
||||
[ptr_out]"+r"(ptr_out)
|
||||
:
|
||||
:"d20", "d21", "d22", "d23", "q10", "q11"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a complex number buffer (out[]) as the intput (in[]) interleaved with
|
||||
// zeros, and normalize it.
|
||||
void WebRtcNsx_CreateComplexBufferNeon(NsxInst_t* inst,
|
||||
int16_t* in,
|
||||
int16_t* out) {
|
||||
int16_t* ptr_out = &out[0];
|
||||
int16_t* ptr_in = &in[0];
|
||||
|
||||
__asm__ __volatile__("vdup.16 d25, %0" : : "r"(0) : "d25");
|
||||
__asm__ __volatile__("vdup.16 q10, %0" : : "r"(inst->normData) : "q10");
|
||||
for (; ptr_in < &in[inst->anaLen];) {
|
||||
|
||||
// Loop unrolled once, so ptr_in is incremented by 8 twice,
|
||||
// and ptr_out is incremented by 8 four times.
|
||||
__asm__ __volatile__(
|
||||
// out[j] = WEBRTC_SPL_LSHIFT_W16(in[i], inst->normData); // Q(normData)
|
||||
"vld1.16 {d22, d23}, [%[ptr_in]]!\n\t"
|
||||
"vshl.s16 q11, q10\n\t"
|
||||
"vmov d24, d23\n\t"
|
||||
|
||||
// out[j + 1] = 0; // Insert zeros in imaginary part
|
||||
"vmov d23, d25\n\t"
|
||||
"vst2.16 {d22, d23}, [%[ptr_out]]!\n\t"
|
||||
"vst2.16 {d24, d25}, [%[ptr_out]]!\n\t"
|
||||
|
||||
// out[j] = WEBRTC_SPL_LSHIFT_W16(in[i], inst->normData); // Q(normData)
|
||||
"vld1.16 {d22, d23}, [%[ptr_in]]!\n\t"
|
||||
"vshl.s16 q11, q10\n\t"
|
||||
"vmov d24, d23\n\t"
|
||||
|
||||
// out[j + 1] = 0; // Insert zeros in imaginary part
|
||||
"vmov d23, d25\n\t"
|
||||
"vst2.16 {d22, d23}, [%[ptr_out]]!\n\t"
|
||||
"vst2.16 {d24, d25}, [%[ptr_out]]!\n\t"
|
||||
|
||||
// Specify constraints.
|
||||
:[ptr_in]"+r"(ptr_in),
|
||||
[ptr_out]"+r"(ptr_out)
|
||||
:
|
||||
:"d22", "d23", "d24", "d25", "q10", "q11"
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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/ns/nsx_core.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// Define offset variables that will be compiled and abstracted to constant
|
||||
// defines, which will then only be used in ARM assembly code.
|
||||
int offset_nsx_anaLen = offsetof(NsxInst_t, anaLen);
|
||||
int offset_nsx_anaLen2 = offsetof(NsxInst_t, anaLen2);
|
||||
int offset_nsx_normData = offsetof(NsxInst_t, normData);
|
||||
int offset_nsx_analysisBuffer = offsetof(NsxInst_t, analysisBuffer);
|
||||
int offset_nsx_synthesisBuffer = offsetof(NsxInst_t, synthesisBuffer);
|
||||
int offset_nsx_blockLen10ms = offsetof(NsxInst_t, blockLen10ms);
|
||||
int offset_nsx_window = offsetof(NsxInst_t, window);
|
||||
int offset_nsx_real = offsetof(NsxInst_t, real);
|
||||
int offset_nsx_imag = offsetof(NsxInst_t, imag);
|
||||
int offset_nsx_noiseSupFilter = offsetof(NsxInst_t, noiseSupFilter);
|
||||
int offset_nsx_magnLen = offsetof(NsxInst_t, magnLen);
|
||||
int offset_nsx_noiseEstLogQuantile = offsetof(NsxInst_t, noiseEstLogQuantile);
|
||||
int offset_nsx_noiseEstQuantile = offsetof(NsxInst_t, noiseEstQuantile);
|
||||
int offset_nsx_qNoise = offsetof(NsxInst_t, qNoise);
|
||||
int offset_nsx_stages = offsetof(NsxInst_t, stages);
|
||||
int offset_nsx_blockIndex = offsetof(NsxInst_t, blockIndex);
|
||||
int offset_nsx_noiseEstCounter = offsetof(NsxInst_t, noiseEstCounter);
|
||||
int offset_nsx_noiseEstDensity = offsetof(NsxInst_t, noiseEstDensity);
|
63
jni/webrtc/modules/audio_processing/ns/nsx_defines.h
Normal file
63
jni/webrtc/modules/audio_processing/ns/nsx_defines.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NSX_DEFINES_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NSX_DEFINES_H_
|
||||
|
||||
#define ANAL_BLOCKL_MAX 256 /* Max analysis block length */
|
||||
#define HALF_ANAL_BLOCKL 129 /* Half max analysis block length + 1 */
|
||||
#define SIMULT 3
|
||||
#define END_STARTUP_LONG 200
|
||||
#define END_STARTUP_SHORT 50
|
||||
#define FACTOR_Q16 2621440 /* 40 in Q16 */
|
||||
#define FACTOR_Q7 5120 /* 40 in Q7 */
|
||||
#define FACTOR_Q7_STARTUP 1024 /* 8 in Q7 */
|
||||
#define WIDTH_Q8 3 /* 0.01 in Q8 (or 25 ) */
|
||||
|
||||
/* PARAMETERS FOR NEW METHOD */
|
||||
#define DD_PR_SNR_Q11 2007 /* ~= Q11(0.98) DD update of prior SNR */
|
||||
#define ONE_MINUS_DD_PR_SNR_Q11 41 /* DD update of prior SNR */
|
||||
#define SPECT_FLAT_TAVG_Q14 4915 /* (0.30) tavg parameter for spectral flatness measure */
|
||||
#define SPECT_DIFF_TAVG_Q8 77 /* (0.30) tavg parameter for spectral flatness measure */
|
||||
#define PRIOR_UPDATE_Q14 1638 /* Q14(0.1) Update parameter of prior model */
|
||||
#define NOISE_UPDATE_Q8 26 /* 26 ~= Q8(0.1) Update parameter for noise */
|
||||
|
||||
/* Probability threshold for noise state in speech/noise likelihood. */
|
||||
#define ONE_MINUS_PROB_RANGE_Q8 205 /* 205 ~= Q8(0.8) */
|
||||
#define HIST_PAR_EST 1000 /* Histogram size for estimation of parameters */
|
||||
|
||||
/* FEATURE EXTRACTION CONFIG */
|
||||
/* Bin size of histogram */
|
||||
#define BIN_SIZE_LRT 10
|
||||
/* Scale parameters: multiply dominant peaks of the histograms by scale factor to obtain. */
|
||||
/* Thresholds for prior model */
|
||||
#define FACTOR_1_LRT_DIFF 6 /* For LRT and spectral difference (5 times bigger) */
|
||||
/* For spectral_flatness: used when noise is flatter than speech (10 times bigger). */
|
||||
#define FACTOR_2_FLAT_Q10 922
|
||||
/* Peak limit for spectral flatness (varies between 0 and 1) */
|
||||
#define THRES_PEAK_FLAT 24 /* * 2 * BIN_SIZE_FLAT_FX */
|
||||
/* Limit on spacing of two highest peaks in histogram: spacing determined by bin size. */
|
||||
#define LIM_PEAK_SPACE_FLAT_DIFF 4 /* * 2 * BIN_SIZE_DIFF_FX */
|
||||
/* Limit on relevance of second peak */
|
||||
#define LIM_PEAK_WEIGHT_FLAT_DIFF 2
|
||||
#define THRES_FLUCT_LRT 10240 /* = 20 * inst->modelUpdate; fluctuation limit of LRT feat. */
|
||||
/* Limit on the max and min values for the feature thresholds */
|
||||
#define MAX_FLAT_Q10 38912 /* * 2 * BIN_SIZE_FLAT_FX */
|
||||
#define MIN_FLAT_Q10 4096 /* * 2 * BIN_SIZE_FLAT_FX */
|
||||
#define MAX_DIFF 100 /* * 2 * BIN_SIZE_DIFF_FX */
|
||||
#define MIN_DIFF 16 /* * 2 * BIN_SIZE_DIFF_FX */
|
||||
/* Criteria of weight of histogram peak to accept/reject feature */
|
||||
#define THRES_WEIGHT_FLAT_DIFF 154 /*(int)(0.3*(inst->modelUpdate)) for flatness and difference */
|
||||
|
||||
#define STAT_UPDATES 9 /* Update every 512 = 1 << 9 block */
|
||||
#define ONE_MINUS_GAMMA_PAUSE_Q8 13 /* ~= Q8(0.05) Update for conservative noise estimate */
|
||||
#define GAMMA_NOISE_TRANS_AND_SPEECH_Q8 3 /* ~= Q8(0.01) Update for transition and noise region */
|
||||
|
||||
#endif /* WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NSX_DEFINES_H_ */
|
574
jni/webrtc/modules/audio_processing/ns/windows_private.h
Normal file
574
jni/webrtc/modules/audio_processing/ns/windows_private.h
Normal file
@@ -0,0 +1,574 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_WINDOWS_PRIVATE_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_WINDOWS_PRIVATE_H_
|
||||
|
||||
// Hanning window for 4ms 16kHz
|
||||
static const float kHanning64w128[128] = {
|
||||
0.00000000000000f, 0.02454122852291f, 0.04906767432742f,
|
||||
0.07356456359967f, 0.09801714032956f, 0.12241067519922f,
|
||||
0.14673047445536f, 0.17096188876030f, 0.19509032201613f,
|
||||
0.21910124015687f, 0.24298017990326f, 0.26671275747490f,
|
||||
0.29028467725446f, 0.31368174039889f, 0.33688985339222f,
|
||||
0.35989503653499f, 0.38268343236509f, 0.40524131400499f,
|
||||
0.42755509343028f, 0.44961132965461f, 0.47139673682600f,
|
||||
0.49289819222978f, 0.51410274419322f, 0.53499761988710f,
|
||||
0.55557023301960f, 0.57580819141785f, 0.59569930449243f,
|
||||
0.61523159058063f, 0.63439328416365f, 0.65317284295378f,
|
||||
0.67155895484702f, 0.68954054473707f, 0.70710678118655f,
|
||||
0.72424708295147f, 0.74095112535496f, 0.75720884650648f,
|
||||
0.77301045336274f, 0.78834642762661f, 0.80320753148064f,
|
||||
0.81758481315158f, 0.83146961230255f, 0.84485356524971f,
|
||||
0.85772861000027f, 0.87008699110871f, 0.88192126434835f,
|
||||
0.89322430119552f, 0.90398929312344f, 0.91420975570353f,
|
||||
0.92387953251129f, 0.93299279883474f, 0.94154406518302f,
|
||||
0.94952818059304f, 0.95694033573221f, 0.96377606579544f,
|
||||
0.97003125319454f, 0.97570213003853f, 0.98078528040323f,
|
||||
0.98527764238894f, 0.98917650996478f, 0.99247953459871f,
|
||||
0.99518472667220f, 0.99729045667869f, 0.99879545620517f,
|
||||
0.99969881869620f, 1.00000000000000f,
|
||||
0.99969881869620f, 0.99879545620517f, 0.99729045667869f,
|
||||
0.99518472667220f, 0.99247953459871f, 0.98917650996478f,
|
||||
0.98527764238894f, 0.98078528040323f, 0.97570213003853f,
|
||||
0.97003125319454f, 0.96377606579544f, 0.95694033573221f,
|
||||
0.94952818059304f, 0.94154406518302f, 0.93299279883474f,
|
||||
0.92387953251129f, 0.91420975570353f, 0.90398929312344f,
|
||||
0.89322430119552f, 0.88192126434835f, 0.87008699110871f,
|
||||
0.85772861000027f, 0.84485356524971f, 0.83146961230255f,
|
||||
0.81758481315158f, 0.80320753148064f, 0.78834642762661f,
|
||||
0.77301045336274f, 0.75720884650648f, 0.74095112535496f,
|
||||
0.72424708295147f, 0.70710678118655f, 0.68954054473707f,
|
||||
0.67155895484702f, 0.65317284295378f, 0.63439328416365f,
|
||||
0.61523159058063f, 0.59569930449243f, 0.57580819141785f,
|
||||
0.55557023301960f, 0.53499761988710f, 0.51410274419322f,
|
||||
0.49289819222978f, 0.47139673682600f, 0.44961132965461f,
|
||||
0.42755509343028f, 0.40524131400499f, 0.38268343236509f,
|
||||
0.35989503653499f, 0.33688985339222f, 0.31368174039889f,
|
||||
0.29028467725446f, 0.26671275747490f, 0.24298017990326f,
|
||||
0.21910124015687f, 0.19509032201613f, 0.17096188876030f,
|
||||
0.14673047445536f, 0.12241067519922f, 0.09801714032956f,
|
||||
0.07356456359967f, 0.04906767432742f, 0.02454122852291f
|
||||
};
|
||||
|
||||
|
||||
|
||||
// hybrib Hanning & flat window
|
||||
static const float kBlocks80w128[128] = {
|
||||
(float)0.00000000, (float)0.03271908, (float)0.06540313, (float)0.09801714, (float)0.13052619,
|
||||
(float)0.16289547, (float)0.19509032, (float)0.22707626, (float)0.25881905, (float)0.29028468,
|
||||
(float)0.32143947, (float)0.35225005, (float)0.38268343, (float)0.41270703, (float)0.44228869,
|
||||
(float)0.47139674, (float)0.50000000, (float)0.52806785, (float)0.55557023, (float)0.58247770,
|
||||
(float)0.60876143, (float)0.63439328, (float)0.65934582, (float)0.68359230, (float)0.70710678,
|
||||
(float)0.72986407, (float)0.75183981, (float)0.77301045, (float)0.79335334, (float)0.81284668,
|
||||
(float)0.83146961, (float)0.84920218, (float)0.86602540, (float)0.88192126, (float)0.89687274,
|
||||
(float)0.91086382, (float)0.92387953, (float)0.93590593, (float)0.94693013, (float)0.95694034,
|
||||
(float)0.96592583, (float)0.97387698, (float)0.98078528, (float)0.98664333, (float)0.99144486,
|
||||
(float)0.99518473, (float)0.99785892, (float)0.99946459, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)0.99946459, (float)0.99785892, (float)0.99518473, (float)0.99144486,
|
||||
(float)0.98664333, (float)0.98078528, (float)0.97387698, (float)0.96592583, (float)0.95694034,
|
||||
(float)0.94693013, (float)0.93590593, (float)0.92387953, (float)0.91086382, (float)0.89687274,
|
||||
(float)0.88192126, (float)0.86602540, (float)0.84920218, (float)0.83146961, (float)0.81284668,
|
||||
(float)0.79335334, (float)0.77301045, (float)0.75183981, (float)0.72986407, (float)0.70710678,
|
||||
(float)0.68359230, (float)0.65934582, (float)0.63439328, (float)0.60876143, (float)0.58247770,
|
||||
(float)0.55557023, (float)0.52806785, (float)0.50000000, (float)0.47139674, (float)0.44228869,
|
||||
(float)0.41270703, (float)0.38268343, (float)0.35225005, (float)0.32143947, (float)0.29028468,
|
||||
(float)0.25881905, (float)0.22707626, (float)0.19509032, (float)0.16289547, (float)0.13052619,
|
||||
(float)0.09801714, (float)0.06540313, (float)0.03271908
|
||||
};
|
||||
|
||||
// hybrib Hanning & flat window
|
||||
static const float kBlocks160w256[256] = {
|
||||
(float)0.00000000, (float)0.01636173, (float)0.03271908, (float)0.04906767, (float)0.06540313,
|
||||
(float)0.08172107, (float)0.09801714, (float)0.11428696, (float)0.13052619, (float)0.14673047,
|
||||
(float)0.16289547, (float)0.17901686, (float)0.19509032, (float)0.21111155, (float)0.22707626,
|
||||
(float)0.24298018, (float)0.25881905, (float)0.27458862, (float)0.29028468, (float)0.30590302,
|
||||
(float)0.32143947, (float)0.33688985, (float)0.35225005, (float)0.36751594, (float)0.38268343,
|
||||
(float)0.39774847, (float)0.41270703, (float)0.42755509, (float)0.44228869, (float)0.45690388,
|
||||
(float)0.47139674, (float)0.48576339, (float)0.50000000, (float)0.51410274, (float)0.52806785,
|
||||
(float)0.54189158, (float)0.55557023, (float)0.56910015, (float)0.58247770, (float)0.59569930,
|
||||
(float)0.60876143, (float)0.62166057, (float)0.63439328, (float)0.64695615, (float)0.65934582,
|
||||
(float)0.67155895, (float)0.68359230, (float)0.69544264, (float)0.70710678, (float)0.71858162,
|
||||
(float)0.72986407, (float)0.74095113, (float)0.75183981, (float)0.76252720, (float)0.77301045,
|
||||
(float)0.78328675, (float)0.79335334, (float)0.80320753, (float)0.81284668, (float)0.82226822,
|
||||
(float)0.83146961, (float)0.84044840, (float)0.84920218, (float)0.85772861, (float)0.86602540,
|
||||
(float)0.87409034, (float)0.88192126, (float)0.88951608, (float)0.89687274, (float)0.90398929,
|
||||
(float)0.91086382, (float)0.91749450, (float)0.92387953, (float)0.93001722, (float)0.93590593,
|
||||
(float)0.94154407, (float)0.94693013, (float)0.95206268, (float)0.95694034, (float)0.96156180,
|
||||
(float)0.96592583, (float)0.97003125, (float)0.97387698, (float)0.97746197, (float)0.98078528,
|
||||
(float)0.98384601, (float)0.98664333, (float)0.98917651, (float)0.99144486, (float)0.99344778,
|
||||
(float)0.99518473, (float)0.99665524, (float)0.99785892, (float)0.99879546, (float)0.99946459,
|
||||
(float)0.99986614, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)0.99986614, (float)0.99946459, (float)0.99879546, (float)0.99785892,
|
||||
(float)0.99665524, (float)0.99518473, (float)0.99344778, (float)0.99144486, (float)0.98917651,
|
||||
(float)0.98664333, (float)0.98384601, (float)0.98078528, (float)0.97746197, (float)0.97387698,
|
||||
(float)0.97003125, (float)0.96592583, (float)0.96156180, (float)0.95694034, (float)0.95206268,
|
||||
(float)0.94693013, (float)0.94154407, (float)0.93590593, (float)0.93001722, (float)0.92387953,
|
||||
(float)0.91749450, (float)0.91086382, (float)0.90398929, (float)0.89687274, (float)0.88951608,
|
||||
(float)0.88192126, (float)0.87409034, (float)0.86602540, (float)0.85772861, (float)0.84920218,
|
||||
(float)0.84044840, (float)0.83146961, (float)0.82226822, (float)0.81284668, (float)0.80320753,
|
||||
(float)0.79335334, (float)0.78328675, (float)0.77301045, (float)0.76252720, (float)0.75183981,
|
||||
(float)0.74095113, (float)0.72986407, (float)0.71858162, (float)0.70710678, (float)0.69544264,
|
||||
(float)0.68359230, (float)0.67155895, (float)0.65934582, (float)0.64695615, (float)0.63439328,
|
||||
(float)0.62166057, (float)0.60876143, (float)0.59569930, (float)0.58247770, (float)0.56910015,
|
||||
(float)0.55557023, (float)0.54189158, (float)0.52806785, (float)0.51410274, (float)0.50000000,
|
||||
(float)0.48576339, (float)0.47139674, (float)0.45690388, (float)0.44228869, (float)0.42755509,
|
||||
(float)0.41270703, (float)0.39774847, (float)0.38268343, (float)0.36751594, (float)0.35225005,
|
||||
(float)0.33688985, (float)0.32143947, (float)0.30590302, (float)0.29028468, (float)0.27458862,
|
||||
(float)0.25881905, (float)0.24298018, (float)0.22707626, (float)0.21111155, (float)0.19509032,
|
||||
(float)0.17901686, (float)0.16289547, (float)0.14673047, (float)0.13052619, (float)0.11428696,
|
||||
(float)0.09801714, (float)0.08172107, (float)0.06540313, (float)0.04906767, (float)0.03271908,
|
||||
(float)0.01636173
|
||||
};
|
||||
|
||||
// hybrib Hanning & flat window: for 20ms
|
||||
static const float kBlocks320w512[512] = {
|
||||
(float)0.00000000, (float)0.00818114, (float)0.01636173, (float)0.02454123, (float)0.03271908,
|
||||
(float)0.04089475, (float)0.04906767, (float)0.05723732, (float)0.06540313, (float)0.07356456,
|
||||
(float)0.08172107, (float)0.08987211, (float)0.09801714, (float)0.10615561, (float)0.11428696,
|
||||
(float)0.12241068, (float)0.13052619, (float)0.13863297, (float)0.14673047, (float)0.15481816,
|
||||
(float)0.16289547, (float)0.17096189, (float)0.17901686, (float)0.18705985, (float)0.19509032,
|
||||
(float)0.20310773, (float)0.21111155, (float)0.21910124, (float)0.22707626, (float)0.23503609,
|
||||
(float)0.24298018, (float)0.25090801, (float)0.25881905, (float)0.26671276, (float)0.27458862,
|
||||
(float)0.28244610, (float)0.29028468, (float)0.29810383, (float)0.30590302, (float)0.31368174,
|
||||
(float)0.32143947, (float)0.32917568, (float)0.33688985, (float)0.34458148, (float)0.35225005,
|
||||
(float)0.35989504, (float)0.36751594, (float)0.37511224, (float)0.38268343, (float)0.39022901,
|
||||
(float)0.39774847, (float)0.40524131, (float)0.41270703, (float)0.42014512, (float)0.42755509,
|
||||
(float)0.43493645, (float)0.44228869, (float)0.44961133, (float)0.45690388, (float)0.46416584,
|
||||
(float)0.47139674, (float)0.47859608, (float)0.48576339, (float)0.49289819, (float)0.50000000,
|
||||
(float)0.50706834, (float)0.51410274, (float)0.52110274, (float)0.52806785, (float)0.53499762,
|
||||
(float)0.54189158, (float)0.54874927, (float)0.55557023, (float)0.56235401, (float)0.56910015,
|
||||
(float)0.57580819, (float)0.58247770, (float)0.58910822, (float)0.59569930, (float)0.60225052,
|
||||
(float)0.60876143, (float)0.61523159, (float)0.62166057, (float)0.62804795, (float)0.63439328,
|
||||
(float)0.64069616, (float)0.64695615, (float)0.65317284, (float)0.65934582, (float)0.66547466,
|
||||
(float)0.67155895, (float)0.67759830, (float)0.68359230, (float)0.68954054, (float)0.69544264,
|
||||
(float)0.70129818, (float)0.70710678, (float)0.71286806, (float)0.71858162, (float)0.72424708,
|
||||
(float)0.72986407, (float)0.73543221, (float)0.74095113, (float)0.74642045, (float)0.75183981,
|
||||
(float)0.75720885, (float)0.76252720, (float)0.76779452, (float)0.77301045, (float)0.77817464,
|
||||
(float)0.78328675, (float)0.78834643, (float)0.79335334, (float)0.79830715, (float)0.80320753,
|
||||
(float)0.80805415, (float)0.81284668, (float)0.81758481, (float)0.82226822, (float)0.82689659,
|
||||
(float)0.83146961, (float)0.83598698, (float)0.84044840, (float)0.84485357, (float)0.84920218,
|
||||
(float)0.85349396, (float)0.85772861, (float)0.86190585, (float)0.86602540, (float)0.87008699,
|
||||
(float)0.87409034, (float)0.87803519, (float)0.88192126, (float)0.88574831, (float)0.88951608,
|
||||
(float)0.89322430, (float)0.89687274, (float)0.90046115, (float)0.90398929, (float)0.90745693,
|
||||
(float)0.91086382, (float)0.91420976, (float)0.91749450, (float)0.92071783, (float)0.92387953,
|
||||
(float)0.92697940, (float)0.93001722, (float)0.93299280, (float)0.93590593, (float)0.93875641,
|
||||
(float)0.94154407, (float)0.94426870, (float)0.94693013, (float)0.94952818, (float)0.95206268,
|
||||
(float)0.95453345, (float)0.95694034, (float)0.95928317, (float)0.96156180, (float)0.96377607,
|
||||
(float)0.96592583, (float)0.96801094, (float)0.97003125, (float)0.97198664, (float)0.97387698,
|
||||
(float)0.97570213, (float)0.97746197, (float)0.97915640, (float)0.98078528, (float)0.98234852,
|
||||
(float)0.98384601, (float)0.98527764, (float)0.98664333, (float)0.98794298, (float)0.98917651,
|
||||
(float)0.99034383, (float)0.99144486, (float)0.99247953, (float)0.99344778, (float)0.99434953,
|
||||
(float)0.99518473, (float)0.99595331, (float)0.99665524, (float)0.99729046, (float)0.99785892,
|
||||
(float)0.99836060, (float)0.99879546, (float)0.99916346, (float)0.99946459, (float)0.99969882,
|
||||
(float)0.99986614, (float)0.99996653, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000, (float)1.00000000,
|
||||
(float)1.00000000, (float)0.99996653, (float)0.99986614, (float)0.99969882, (float)0.99946459,
|
||||
(float)0.99916346, (float)0.99879546, (float)0.99836060, (float)0.99785892, (float)0.99729046,
|
||||
(float)0.99665524, (float)0.99595331, (float)0.99518473, (float)0.99434953, (float)0.99344778,
|
||||
(float)0.99247953, (float)0.99144486, (float)0.99034383, (float)0.98917651, (float)0.98794298,
|
||||
(float)0.98664333, (float)0.98527764, (float)0.98384601, (float)0.98234852, (float)0.98078528,
|
||||
(float)0.97915640, (float)0.97746197, (float)0.97570213, (float)0.97387698, (float)0.97198664,
|
||||
(float)0.97003125, (float)0.96801094, (float)0.96592583, (float)0.96377607, (float)0.96156180,
|
||||
(float)0.95928317, (float)0.95694034, (float)0.95453345, (float)0.95206268, (float)0.94952818,
|
||||
(float)0.94693013, (float)0.94426870, (float)0.94154407, (float)0.93875641, (float)0.93590593,
|
||||
(float)0.93299280, (float)0.93001722, (float)0.92697940, (float)0.92387953, (float)0.92071783,
|
||||
(float)0.91749450, (float)0.91420976, (float)0.91086382, (float)0.90745693, (float)0.90398929,
|
||||
(float)0.90046115, (float)0.89687274, (float)0.89322430, (float)0.88951608, (float)0.88574831,
|
||||
(float)0.88192126, (float)0.87803519, (float)0.87409034, (float)0.87008699, (float)0.86602540,
|
||||
(float)0.86190585, (float)0.85772861, (float)0.85349396, (float)0.84920218, (float)0.84485357,
|
||||
(float)0.84044840, (float)0.83598698, (float)0.83146961, (float)0.82689659, (float)0.82226822,
|
||||
(float)0.81758481, (float)0.81284668, (float)0.80805415, (float)0.80320753, (float)0.79830715,
|
||||
(float)0.79335334, (float)0.78834643, (float)0.78328675, (float)0.77817464, (float)0.77301045,
|
||||
(float)0.76779452, (float)0.76252720, (float)0.75720885, (float)0.75183981, (float)0.74642045,
|
||||
(float)0.74095113, (float)0.73543221, (float)0.72986407, (float)0.72424708, (float)0.71858162,
|
||||
(float)0.71286806, (float)0.70710678, (float)0.70129818, (float)0.69544264, (float)0.68954054,
|
||||
(float)0.68359230, (float)0.67759830, (float)0.67155895, (float)0.66547466, (float)0.65934582,
|
||||
(float)0.65317284, (float)0.64695615, (float)0.64069616, (float)0.63439328, (float)0.62804795,
|
||||
(float)0.62166057, (float)0.61523159, (float)0.60876143, (float)0.60225052, (float)0.59569930,
|
||||
(float)0.58910822, (float)0.58247770, (float)0.57580819, (float)0.56910015, (float)0.56235401,
|
||||
(float)0.55557023, (float)0.54874927, (float)0.54189158, (float)0.53499762, (float)0.52806785,
|
||||
(float)0.52110274, (float)0.51410274, (float)0.50706834, (float)0.50000000, (float)0.49289819,
|
||||
(float)0.48576339, (float)0.47859608, (float)0.47139674, (float)0.46416584, (float)0.45690388,
|
||||
(float)0.44961133, (float)0.44228869, (float)0.43493645, (float)0.42755509, (float)0.42014512,
|
||||
(float)0.41270703, (float)0.40524131, (float)0.39774847, (float)0.39022901, (float)0.38268343,
|
||||
(float)0.37511224, (float)0.36751594, (float)0.35989504, (float)0.35225005, (float)0.34458148,
|
||||
(float)0.33688985, (float)0.32917568, (float)0.32143947, (float)0.31368174, (float)0.30590302,
|
||||
(float)0.29810383, (float)0.29028468, (float)0.28244610, (float)0.27458862, (float)0.26671276,
|
||||
(float)0.25881905, (float)0.25090801, (float)0.24298018, (float)0.23503609, (float)0.22707626,
|
||||
(float)0.21910124, (float)0.21111155, (float)0.20310773, (float)0.19509032, (float)0.18705985,
|
||||
(float)0.17901686, (float)0.17096189, (float)0.16289547, (float)0.15481816, (float)0.14673047,
|
||||
(float)0.13863297, (float)0.13052619, (float)0.12241068, (float)0.11428696, (float)0.10615561,
|
||||
(float)0.09801714, (float)0.08987211, (float)0.08172107, (float)0.07356456, (float)0.06540313,
|
||||
(float)0.05723732, (float)0.04906767, (float)0.04089475, (float)0.03271908, (float)0.02454123,
|
||||
(float)0.01636173, (float)0.00818114
|
||||
};
|
||||
|
||||
|
||||
// Hanning window: for 15ms at 16kHz with symmetric zeros
|
||||
static const float kBlocks240w512[512] = {
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00654494, (float)0.01308960, (float)0.01963369,
|
||||
(float)0.02617695, (float)0.03271908, (float)0.03925982, (float)0.04579887, (float)0.05233596,
|
||||
(float)0.05887080, (float)0.06540313, (float)0.07193266, (float)0.07845910, (float)0.08498218,
|
||||
(float)0.09150162, (float)0.09801714, (float)0.10452846, (float)0.11103531, (float)0.11753740,
|
||||
(float)0.12403446, (float)0.13052620, (float)0.13701233, (float)0.14349262, (float)0.14996676,
|
||||
(float)0.15643448, (float)0.16289547, (float)0.16934951, (float)0.17579629, (float)0.18223552,
|
||||
(float)0.18866697, (float)0.19509032, (float)0.20150533, (float)0.20791170, (float)0.21430916,
|
||||
(float)0.22069745, (float)0.22707628, (float)0.23344538, (float)0.23980446, (float)0.24615330,
|
||||
(float)0.25249159, (float)0.25881904, (float)0.26513544, (float)0.27144045, (float)0.27773386,
|
||||
(float)0.28401536, (float)0.29028466, (float)0.29654160, (float)0.30278578, (float)0.30901700,
|
||||
(float)0.31523499, (float)0.32143945, (float)0.32763019, (float)0.33380687, (float)0.33996925,
|
||||
(float)0.34611708, (float)0.35225007, (float)0.35836795, (float)0.36447051, (float)0.37055743,
|
||||
(float)0.37662852, (float)0.38268346, (float)0.38872197, (float)0.39474389, (float)0.40074885,
|
||||
(float)0.40673664, (float)0.41270703, (float)0.41865975, (float)0.42459452, (float)0.43051112,
|
||||
(float)0.43640924, (float)0.44228873, (float)0.44814920, (float)0.45399052, (float)0.45981237,
|
||||
(float)0.46561453, (float)0.47139674, (float)0.47715878, (float)0.48290035, (float)0.48862126,
|
||||
(float)0.49432120, (float)0.50000000, (float)0.50565743, (float)0.51129311, (float)0.51690692,
|
||||
(float)0.52249855, (float)0.52806789, (float)0.53361452, (float)0.53913832, (float)0.54463905,
|
||||
(float)0.55011642, (float)0.55557024, (float)0.56100029, (float)0.56640625, (float)0.57178795,
|
||||
(float)0.57714522, (float)0.58247769, (float)0.58778524, (float)0.59306765, (float)0.59832460,
|
||||
(float)0.60355598, (float)0.60876143, (float)0.61394083, (float)0.61909395, (float)0.62422055,
|
||||
(float)0.62932038, (float)0.63439333, (float)0.63943899, (float)0.64445734, (float)0.64944810,
|
||||
(float)0.65441096, (float)0.65934587, (float)0.66425246, (float)0.66913062, (float)0.67398012,
|
||||
(float)0.67880076, (float)0.68359232, (float)0.68835455, (float)0.69308740, (float)0.69779050,
|
||||
(float)0.70246369, (float)0.70710677, (float)0.71171963, (float)0.71630198, (float)0.72085363,
|
||||
(float)0.72537440, (float)0.72986406, (float)0.73432255, (float)0.73874950, (float)0.74314487,
|
||||
(float)0.74750835, (float)0.75183982, (float)0.75613910, (float)0.76040596, (float)0.76464027,
|
||||
(float)0.76884186, (float)0.77301043, (float)0.77714598, (float)0.78124821, (float)0.78531694,
|
||||
(float)0.78935206, (float)0.79335338, (float)0.79732066, (float)0.80125386, (float)0.80515265,
|
||||
(float)0.80901700, (float)0.81284672, (float)0.81664157, (float)0.82040149, (float)0.82412618,
|
||||
(float)0.82781565, (float)0.83146966, (float)0.83508795, (float)0.83867061, (float)0.84221727,
|
||||
(float)0.84572780, (float)0.84920216, (float)0.85264021, (float)0.85604161, (float)0.85940641,
|
||||
(float)0.86273444, (float)0.86602545, (float)0.86927933, (float)0.87249607, (float)0.87567532,
|
||||
(float)0.87881714, (float)0.88192129, (float)0.88498765, (float)0.88801610, (float)0.89100653,
|
||||
(float)0.89395881, (float)0.89687276, (float)0.89974827, (float)0.90258533, (float)0.90538365,
|
||||
(float)0.90814316, (float)0.91086388, (float)0.91354549, (float)0.91618794, (float)0.91879123,
|
||||
(float)0.92135513, (float)0.92387950, (float)0.92636442, (float)0.92880958, (float)0.93121493,
|
||||
(float)0.93358046, (float)0.93590593, (float)0.93819135, (float)0.94043654, (float)0.94264150,
|
||||
(float)0.94480604, (float)0.94693011, (float)0.94901365, (float)0.95105654, (float)0.95305866,
|
||||
(float)0.95501995, (float)0.95694035, (float)0.95881975, (float)0.96065807, (float)0.96245527,
|
||||
(float)0.96421117, (float)0.96592581, (float)0.96759909, (float)0.96923089, (float)0.97082120,
|
||||
(float)0.97236991, (float)0.97387701, (float)0.97534233, (float)0.97676587, (float)0.97814763,
|
||||
(float)0.97948742, (float)0.98078531, (float)0.98204112, (float)0.98325491, (float)0.98442656,
|
||||
(float)0.98555607, (float)0.98664331, (float)0.98768836, (float)0.98869103, (float)0.98965138,
|
||||
(float)0.99056935, (float)0.99144489, (float)0.99227792, (float)0.99306846, (float)0.99381649,
|
||||
(float)0.99452192, (float)0.99518472, (float)0.99580491, (float)0.99638247, (float)0.99691731,
|
||||
(float)0.99740952, (float)0.99785894, (float)0.99826562, (float)0.99862951, (float)0.99895066,
|
||||
(float)0.99922901, (float)0.99946457, (float)0.99965733, (float)0.99980724, (float)0.99991435,
|
||||
(float)0.99997860, (float)1.00000000, (float)0.99997860, (float)0.99991435, (float)0.99980724,
|
||||
(float)0.99965733, (float)0.99946457, (float)0.99922901, (float)0.99895066, (float)0.99862951,
|
||||
(float)0.99826562, (float)0.99785894, (float)0.99740946, (float)0.99691731, (float)0.99638247,
|
||||
(float)0.99580491, (float)0.99518472, (float)0.99452192, (float)0.99381644, (float)0.99306846,
|
||||
(float)0.99227792, (float)0.99144489, (float)0.99056935, (float)0.98965138, (float)0.98869103,
|
||||
(float)0.98768836, (float)0.98664331, (float)0.98555607, (float)0.98442656, (float)0.98325491,
|
||||
(float)0.98204112, (float)0.98078525, (float)0.97948742, (float)0.97814757, (float)0.97676587,
|
||||
(float)0.97534227, (float)0.97387695, (float)0.97236991, (float)0.97082120, (float)0.96923089,
|
||||
(float)0.96759909, (float)0.96592581, (float)0.96421117, (float)0.96245521, (float)0.96065807,
|
||||
(float)0.95881969, (float)0.95694029, (float)0.95501995, (float)0.95305860, (float)0.95105648,
|
||||
(float)0.94901365, (float)0.94693011, (float)0.94480604, (float)0.94264150, (float)0.94043654,
|
||||
(float)0.93819129, (float)0.93590593, (float)0.93358046, (float)0.93121493, (float)0.92880952,
|
||||
(float)0.92636436, (float)0.92387950, (float)0.92135507, (float)0.91879123, (float)0.91618794,
|
||||
(float)0.91354543, (float)0.91086382, (float)0.90814310, (float)0.90538365, (float)0.90258527,
|
||||
(float)0.89974827, (float)0.89687276, (float)0.89395875, (float)0.89100647, (float)0.88801610,
|
||||
(float)0.88498759, (float)0.88192123, (float)0.87881714, (float)0.87567532, (float)0.87249595,
|
||||
(float)0.86927933, (float)0.86602539, (float)0.86273432, (float)0.85940641, (float)0.85604161,
|
||||
(float)0.85264009, (float)0.84920216, (float)0.84572780, (float)0.84221715, (float)0.83867055,
|
||||
(float)0.83508795, (float)0.83146954, (float)0.82781565, (float)0.82412612, (float)0.82040137,
|
||||
(float)0.81664157, (float)0.81284660, (float)0.80901700, (float)0.80515265, (float)0.80125374,
|
||||
(float)0.79732066, (float)0.79335332, (float)0.78935200, (float)0.78531694, (float)0.78124815,
|
||||
(float)0.77714586, (float)0.77301049, (float)0.76884180, (float)0.76464021, (float)0.76040596,
|
||||
(float)0.75613904, (float)0.75183970, (float)0.74750835, (float)0.74314481, (float)0.73874938,
|
||||
(float)0.73432249, (float)0.72986400, (float)0.72537428, (float)0.72085363, (float)0.71630186,
|
||||
(float)0.71171951, (float)0.70710677, (float)0.70246363, (float)0.69779032, (float)0.69308734,
|
||||
(float)0.68835449, (float)0.68359220, (float)0.67880070, (float)0.67398006, (float)0.66913044,
|
||||
(float)0.66425240, (float)0.65934575, (float)0.65441096, (float)0.64944804, (float)0.64445722,
|
||||
(float)0.63943905, (float)0.63439327, (float)0.62932026, (float)0.62422055, (float)0.61909389,
|
||||
(float)0.61394072, (float)0.60876143, (float)0.60355592, (float)0.59832448, (float)0.59306765,
|
||||
(float)0.58778518, (float)0.58247757, (float)0.57714522, (float)0.57178789, (float)0.56640613,
|
||||
(float)0.56100023, (float)0.55557019, (float)0.55011630, (float)0.54463905, (float)0.53913826,
|
||||
(float)0.53361434, (float)0.52806783, (float)0.52249849, (float)0.51690674, (float)0.51129305,
|
||||
(float)0.50565726, (float)0.50000006, (float)0.49432117, (float)0.48862115, (float)0.48290038,
|
||||
(float)0.47715873, (float)0.47139663, (float)0.46561456, (float)0.45981231, (float)0.45399037,
|
||||
(float)0.44814920, (float)0.44228864, (float)0.43640912, (float)0.43051112, (float)0.42459446,
|
||||
(float)0.41865960, (float)0.41270703, (float)0.40673658, (float)0.40074870, (float)0.39474386,
|
||||
(float)0.38872188, (float)0.38268328, (float)0.37662849, (float)0.37055734, (float)0.36447033,
|
||||
(float)0.35836792, (float)0.35224995, (float)0.34611690, (float)0.33996922, (float)0.33380675,
|
||||
(float)0.32763001, (float)0.32143945, (float)0.31523487, (float)0.30901679, (float)0.30278572,
|
||||
(float)0.29654145, (float)0.29028472, (float)0.28401530, (float)0.27773371, (float)0.27144048,
|
||||
(float)0.26513538, (float)0.25881892, (float)0.25249159, (float)0.24615324, (float)0.23980433,
|
||||
(float)0.23344538, (float)0.22707619, (float)0.22069728, (float)0.21430916, (float)0.20791161,
|
||||
(float)0.20150517, (float)0.19509031, (float)0.18866688, (float)0.18223536, (float)0.17579627,
|
||||
(float)0.16934940, (float)0.16289529, (float)0.15643445, (float)0.14996666, (float)0.14349243,
|
||||
(float)0.13701232, (float)0.13052608, (float)0.12403426, (float)0.11753736, (float)0.11103519,
|
||||
(float)0.10452849, (float)0.09801710, (float)0.09150149, (float)0.08498220, (float)0.07845904,
|
||||
(float)0.07193252, (float)0.06540315, (float)0.05887074, (float)0.05233581, (float)0.04579888,
|
||||
(float)0.03925974, (float)0.03271893, (float)0.02617695, (float)0.01963361, (float)0.01308943,
|
||||
(float)0.00654493, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000
|
||||
};
|
||||
|
||||
|
||||
// Hanning window: for 30ms with 1024 fft with symmetric zeros at 16kHz
|
||||
static const float kBlocks480w1024[1024] = {
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00327249, (float)0.00654494,
|
||||
(float)0.00981732, (float)0.01308960, (float)0.01636173, (float)0.01963369, (float)0.02290544,
|
||||
(float)0.02617695, (float)0.02944817, (float)0.03271908, (float)0.03598964, (float)0.03925982,
|
||||
(float)0.04252957, (float)0.04579887, (float)0.04906768, (float)0.05233596, (float)0.05560368,
|
||||
(float)0.05887080, (float)0.06213730, (float)0.06540313, (float)0.06866825, (float)0.07193266,
|
||||
(float)0.07519628, (float)0.07845910, (float)0.08172107, (float)0.08498218, (float)0.08824237,
|
||||
(float)0.09150162, (float)0.09475989, (float)0.09801714, (float)0.10127335, (float)0.10452846,
|
||||
(float)0.10778246, (float)0.11103531, (float)0.11428697, (float)0.11753740, (float)0.12078657,
|
||||
(float)0.12403446, (float)0.12728101, (float)0.13052620, (float)0.13376999, (float)0.13701233,
|
||||
(float)0.14025325, (float)0.14349262, (float)0.14673047, (float)0.14996676, (float)0.15320145,
|
||||
(float)0.15643448, (float)0.15966582, (float)0.16289547, (float)0.16612339, (float)0.16934951,
|
||||
(float)0.17257382, (float)0.17579629, (float)0.17901687, (float)0.18223552, (float)0.18545224,
|
||||
(float)0.18866697, (float)0.19187967, (float)0.19509032, (float)0.19829889, (float)0.20150533,
|
||||
(float)0.20470962, (float)0.20791170, (float)0.21111156, (float)0.21430916, (float)0.21750447,
|
||||
(float)0.22069745, (float)0.22388805, (float)0.22707628, (float)0.23026206, (float)0.23344538,
|
||||
(float)0.23662618, (float)0.23980446, (float)0.24298020, (float)0.24615330, (float)0.24932377,
|
||||
(float)0.25249159, (float)0.25565669, (float)0.25881904, (float)0.26197866, (float)0.26513544,
|
||||
(float)0.26828939, (float)0.27144045, (float)0.27458861, (float)0.27773386, (float)0.28087610,
|
||||
(float)0.28401536, (float)0.28715158, (float)0.29028466, (float)0.29341471, (float)0.29654160,
|
||||
(float)0.29966527, (float)0.30278578, (float)0.30590302, (float)0.30901700, (float)0.31212768,
|
||||
(float)0.31523499, (float)0.31833893, (float)0.32143945, (float)0.32453656, (float)0.32763019,
|
||||
(float)0.33072028, (float)0.33380687, (float)0.33688986, (float)0.33996925, (float)0.34304500,
|
||||
(float)0.34611708, (float)0.34918544, (float)0.35225007, (float)0.35531089, (float)0.35836795,
|
||||
(float)0.36142117, (float)0.36447051, (float)0.36751595, (float)0.37055743, (float)0.37359497,
|
||||
(float)0.37662852, (float)0.37965801, (float)0.38268346, (float)0.38570479, (float)0.38872197,
|
||||
(float)0.39173502, (float)0.39474389, (float)0.39774847, (float)0.40074885, (float)0.40374491,
|
||||
(float)0.40673664, (float)0.40972406, (float)0.41270703, (float)0.41568562, (float)0.41865975,
|
||||
(float)0.42162940, (float)0.42459452, (float)0.42755508, (float)0.43051112, (float)0.43346250,
|
||||
(float)0.43640924, (float)0.43935132, (float)0.44228873, (float)0.44522133, (float)0.44814920,
|
||||
(float)0.45107228, (float)0.45399052, (float)0.45690390, (float)0.45981237, (float)0.46271592,
|
||||
(float)0.46561453, (float)0.46850815, (float)0.47139674, (float)0.47428030, (float)0.47715878,
|
||||
(float)0.48003215, (float)0.48290035, (float)0.48576337, (float)0.48862126, (float)0.49147385,
|
||||
(float)0.49432120, (float)0.49716330, (float)0.50000000, (float)0.50283140, (float)0.50565743,
|
||||
(float)0.50847799, (float)0.51129311, (float)0.51410276, (float)0.51690692, (float)0.51970553,
|
||||
(float)0.52249855, (float)0.52528602, (float)0.52806789, (float)0.53084403, (float)0.53361452,
|
||||
(float)0.53637928, (float)0.53913832, (float)0.54189163, (float)0.54463905, (float)0.54738063,
|
||||
(float)0.55011642, (float)0.55284631, (float)0.55557024, (float)0.55828828, (float)0.56100029,
|
||||
(float)0.56370628, (float)0.56640625, (float)0.56910014, (float)0.57178795, (float)0.57446963,
|
||||
(float)0.57714522, (float)0.57981455, (float)0.58247769, (float)0.58513463, (float)0.58778524,
|
||||
(float)0.59042960, (float)0.59306765, (float)0.59569931, (float)0.59832460, (float)0.60094351,
|
||||
(float)0.60355598, (float)0.60616195, (float)0.60876143, (float)0.61135441, (float)0.61394083,
|
||||
(float)0.61652070, (float)0.61909395, (float)0.62166059, (float)0.62422055, (float)0.62677383,
|
||||
(float)0.62932038, (float)0.63186020, (float)0.63439333, (float)0.63691956, (float)0.63943899,
|
||||
(float)0.64195162, (float)0.64445734, (float)0.64695615, (float)0.64944810, (float)0.65193301,
|
||||
(float)0.65441096, (float)0.65688187, (float)0.65934587, (float)0.66180271, (float)0.66425246,
|
||||
(float)0.66669512, (float)0.66913062, (float)0.67155898, (float)0.67398012, (float)0.67639405,
|
||||
(float)0.67880076, (float)0.68120021, (float)0.68359232, (float)0.68597710, (float)0.68835455,
|
||||
(float)0.69072467, (float)0.69308740, (float)0.69544262, (float)0.69779050, (float)0.70013082,
|
||||
(float)0.70246369, (float)0.70478904, (float)0.70710677, (float)0.70941699, (float)0.71171963,
|
||||
(float)0.71401459, (float)0.71630198, (float)0.71858168, (float)0.72085363, (float)0.72311789,
|
||||
(float)0.72537440, (float)0.72762316, (float)0.72986406, (float)0.73209721, (float)0.73432255,
|
||||
(float)0.73653996, (float)0.73874950, (float)0.74095118, (float)0.74314487, (float)0.74533057,
|
||||
(float)0.74750835, (float)0.74967808, (float)0.75183982, (float)0.75399351, (float)0.75613910,
|
||||
(float)0.75827658, (float)0.76040596, (float)0.76252723, (float)0.76464027, (float)0.76674515,
|
||||
(float)0.76884186, (float)0.77093029, (float)0.77301043, (float)0.77508241, (float)0.77714598,
|
||||
(float)0.77920127, (float)0.78124821, (float)0.78328675, (float)0.78531694, (float)0.78733873,
|
||||
(float)0.78935206, (float)0.79135692, (float)0.79335338, (float)0.79534125, (float)0.79732066,
|
||||
(float)0.79929149, (float)0.80125386, (float)0.80320752, (float)0.80515265, (float)0.80708915,
|
||||
(float)0.80901700, (float)0.81093621, (float)0.81284672, (float)0.81474853, (float)0.81664157,
|
||||
(float)0.81852591, (float)0.82040149, (float)0.82226825, (float)0.82412618, (float)0.82597536,
|
||||
(float)0.82781565, (float)0.82964706, (float)0.83146966, (float)0.83328325, (float)0.83508795,
|
||||
(float)0.83688378, (float)0.83867061, (float)0.84044838, (float)0.84221727, (float)0.84397703,
|
||||
(float)0.84572780, (float)0.84746957, (float)0.84920216, (float)0.85092574, (float)0.85264021,
|
||||
(float)0.85434544, (float)0.85604161, (float)0.85772866, (float)0.85940641, (float)0.86107504,
|
||||
(float)0.86273444, (float)0.86438453, (float)0.86602545, (float)0.86765707, (float)0.86927933,
|
||||
(float)0.87089235, (float)0.87249607, (float)0.87409031, (float)0.87567532, (float)0.87725097,
|
||||
(float)0.87881714, (float)0.88037390, (float)0.88192129, (float)0.88345921, (float)0.88498765,
|
||||
(float)0.88650668, (float)0.88801610, (float)0.88951612, (float)0.89100653, (float)0.89248741,
|
||||
(float)0.89395881, (float)0.89542055, (float)0.89687276, (float)0.89831537, (float)0.89974827,
|
||||
(float)0.90117162, (float)0.90258533, (float)0.90398932, (float)0.90538365, (float)0.90676826,
|
||||
(float)0.90814316, (float)0.90950841, (float)0.91086388, (float)0.91220951, (float)0.91354549,
|
||||
(float)0.91487163, (float)0.91618794, (float)0.91749454, (float)0.91879123, (float)0.92007810,
|
||||
(float)0.92135513, (float)0.92262226, (float)0.92387950, (float)0.92512691, (float)0.92636442,
|
||||
(float)0.92759192, (float)0.92880958, (float)0.93001723, (float)0.93121493, (float)0.93240267,
|
||||
(float)0.93358046, (float)0.93474817, (float)0.93590593, (float)0.93705362, (float)0.93819135,
|
||||
(float)0.93931901, (float)0.94043654, (float)0.94154406, (float)0.94264150, (float)0.94372880,
|
||||
(float)0.94480604, (float)0.94587320, (float)0.94693011, (float)0.94797695, (float)0.94901365,
|
||||
(float)0.95004016, (float)0.95105654, (float)0.95206273, (float)0.95305866, (float)0.95404440,
|
||||
(float)0.95501995, (float)0.95598525, (float)0.95694035, (float)0.95788521, (float)0.95881975,
|
||||
(float)0.95974404, (float)0.96065807, (float)0.96156180, (float)0.96245527, (float)0.96333838,
|
||||
(float)0.96421117, (float)0.96507370, (float)0.96592581, (float)0.96676767, (float)0.96759909,
|
||||
(float)0.96842021, (float)0.96923089, (float)0.97003126, (float)0.97082120, (float)0.97160077,
|
||||
(float)0.97236991, (float)0.97312868, (float)0.97387701, (float)0.97461486, (float)0.97534233,
|
||||
(float)0.97605932, (float)0.97676587, (float)0.97746199, (float)0.97814763, (float)0.97882277,
|
||||
(float)0.97948742, (float)0.98014158, (float)0.98078531, (float)0.98141843, (float)0.98204112,
|
||||
(float)0.98265332, (float)0.98325491, (float)0.98384601, (float)0.98442656, (float)0.98499662,
|
||||
(float)0.98555607, (float)0.98610497, (float)0.98664331, (float)0.98717111, (float)0.98768836,
|
||||
(float)0.98819500, (float)0.98869103, (float)0.98917651, (float)0.98965138, (float)0.99011570,
|
||||
(float)0.99056935, (float)0.99101239, (float)0.99144489, (float)0.99186671, (float)0.99227792,
|
||||
(float)0.99267852, (float)0.99306846, (float)0.99344778, (float)0.99381649, (float)0.99417448,
|
||||
(float)0.99452192, (float)0.99485862, (float)0.99518472, (float)0.99550015, (float)0.99580491,
|
||||
(float)0.99609905, (float)0.99638247, (float)0.99665523, (float)0.99691731, (float)0.99716878,
|
||||
(float)0.99740952, (float)0.99763954, (float)0.99785894, (float)0.99806762, (float)0.99826562,
|
||||
(float)0.99845290, (float)0.99862951, (float)0.99879545, (float)0.99895066, (float)0.99909520,
|
||||
(float)0.99922901, (float)0.99935216, (float)0.99946457, (float)0.99956632, (float)0.99965733,
|
||||
(float)0.99973762, (float)0.99980724, (float)0.99986613, (float)0.99991435, (float)0.99995178,
|
||||
(float)0.99997860, (float)0.99999464, (float)1.00000000, (float)0.99999464, (float)0.99997860,
|
||||
(float)0.99995178, (float)0.99991435, (float)0.99986613, (float)0.99980724, (float)0.99973762,
|
||||
(float)0.99965733, (float)0.99956632, (float)0.99946457, (float)0.99935216, (float)0.99922901,
|
||||
(float)0.99909520, (float)0.99895066, (float)0.99879545, (float)0.99862951, (float)0.99845290,
|
||||
(float)0.99826562, (float)0.99806762, (float)0.99785894, (float)0.99763954, (float)0.99740946,
|
||||
(float)0.99716872, (float)0.99691731, (float)0.99665523, (float)0.99638247, (float)0.99609905,
|
||||
(float)0.99580491, (float)0.99550015, (float)0.99518472, (float)0.99485862, (float)0.99452192,
|
||||
(float)0.99417448, (float)0.99381644, (float)0.99344778, (float)0.99306846, (float)0.99267852,
|
||||
(float)0.99227792, (float)0.99186671, (float)0.99144489, (float)0.99101239, (float)0.99056935,
|
||||
(float)0.99011564, (float)0.98965138, (float)0.98917651, (float)0.98869103, (float)0.98819494,
|
||||
(float)0.98768836, (float)0.98717111, (float)0.98664331, (float)0.98610497, (float)0.98555607,
|
||||
(float)0.98499656, (float)0.98442656, (float)0.98384601, (float)0.98325491, (float)0.98265326,
|
||||
(float)0.98204112, (float)0.98141843, (float)0.98078525, (float)0.98014158, (float)0.97948742,
|
||||
(float)0.97882277, (float)0.97814757, (float)0.97746193, (float)0.97676587, (float)0.97605932,
|
||||
(float)0.97534227, (float)0.97461486, (float)0.97387695, (float)0.97312862, (float)0.97236991,
|
||||
(float)0.97160077, (float)0.97082120, (float)0.97003126, (float)0.96923089, (float)0.96842015,
|
||||
(float)0.96759909, (float)0.96676761, (float)0.96592581, (float)0.96507365, (float)0.96421117,
|
||||
(float)0.96333838, (float)0.96245521, (float)0.96156180, (float)0.96065807, (float)0.95974404,
|
||||
(float)0.95881969, (float)0.95788515, (float)0.95694029, (float)0.95598525, (float)0.95501995,
|
||||
(float)0.95404440, (float)0.95305860, (float)0.95206267, (float)0.95105648, (float)0.95004016,
|
||||
(float)0.94901365, (float)0.94797695, (float)0.94693011, (float)0.94587314, (float)0.94480604,
|
||||
(float)0.94372880, (float)0.94264150, (float)0.94154406, (float)0.94043654, (float)0.93931895,
|
||||
(float)0.93819129, (float)0.93705362, (float)0.93590593, (float)0.93474817, (float)0.93358046,
|
||||
(float)0.93240267, (float)0.93121493, (float)0.93001723, (float)0.92880952, (float)0.92759192,
|
||||
(float)0.92636436, (float)0.92512691, (float)0.92387950, (float)0.92262226, (float)0.92135507,
|
||||
(float)0.92007804, (float)0.91879123, (float)0.91749448, (float)0.91618794, (float)0.91487157,
|
||||
(float)0.91354543, (float)0.91220951, (float)0.91086382, (float)0.90950835, (float)0.90814310,
|
||||
(float)0.90676820, (float)0.90538365, (float)0.90398932, (float)0.90258527, (float)0.90117157,
|
||||
(float)0.89974827, (float)0.89831525, (float)0.89687276, (float)0.89542055, (float)0.89395875,
|
||||
(float)0.89248741, (float)0.89100647, (float)0.88951600, (float)0.88801610, (float)0.88650662,
|
||||
(float)0.88498759, (float)0.88345915, (float)0.88192123, (float)0.88037384, (float)0.87881714,
|
||||
(float)0.87725091, (float)0.87567532, (float)0.87409031, (float)0.87249595, (float)0.87089223,
|
||||
(float)0.86927933, (float)0.86765701, (float)0.86602539, (float)0.86438447, (float)0.86273432,
|
||||
(float)0.86107504, (float)0.85940641, (float)0.85772860, (float)0.85604161, (float)0.85434544,
|
||||
(float)0.85264009, (float)0.85092574, (float)0.84920216, (float)0.84746951, (float)0.84572780,
|
||||
(float)0.84397697, (float)0.84221715, (float)0.84044844, (float)0.83867055, (float)0.83688372,
|
||||
(float)0.83508795, (float)0.83328319, (float)0.83146954, (float)0.82964706, (float)0.82781565,
|
||||
(float)0.82597530, (float)0.82412612, (float)0.82226813, (float)0.82040137, (float)0.81852591,
|
||||
(float)0.81664157, (float)0.81474847, (float)0.81284660, (float)0.81093609, (float)0.80901700,
|
||||
(float)0.80708915, (float)0.80515265, (float)0.80320752, (float)0.80125374, (float)0.79929143,
|
||||
(float)0.79732066, (float)0.79534125, (float)0.79335332, (float)0.79135686, (float)0.78935200,
|
||||
(float)0.78733861, (float)0.78531694, (float)0.78328675, (float)0.78124815, (float)0.77920121,
|
||||
(float)0.77714586, (float)0.77508223, (float)0.77301049, (float)0.77093029, (float)0.76884180,
|
||||
(float)0.76674509, (float)0.76464021, (float)0.76252711, (float)0.76040596, (float)0.75827658,
|
||||
(float)0.75613904, (float)0.75399339, (float)0.75183970, (float)0.74967796, (float)0.74750835,
|
||||
(float)0.74533057, (float)0.74314481, (float)0.74095106, (float)0.73874938, (float)0.73653996,
|
||||
(float)0.73432249, (float)0.73209721, (float)0.72986400, (float)0.72762305, (float)0.72537428,
|
||||
(float)0.72311789, (float)0.72085363, (float)0.71858162, (float)0.71630186, (float)0.71401453,
|
||||
(float)0.71171951, (float)0.70941705, (float)0.70710677, (float)0.70478898, (float)0.70246363,
|
||||
(float)0.70013070, (float)0.69779032, (float)0.69544268, (float)0.69308734, (float)0.69072461,
|
||||
(float)0.68835449, (float)0.68597704, (float)0.68359220, (float)0.68120021, (float)0.67880070,
|
||||
(float)0.67639399, (float)0.67398006, (float)0.67155886, (float)0.66913044, (float)0.66669512,
|
||||
(float)0.66425240, (float)0.66180259, (float)0.65934575, (float)0.65688181, (float)0.65441096,
|
||||
(float)0.65193301, (float)0.64944804, (float)0.64695609, (float)0.64445722, (float)0.64195150,
|
||||
(float)0.63943905, (float)0.63691956, (float)0.63439327, (float)0.63186014, (float)0.62932026,
|
||||
(float)0.62677372, (float)0.62422055, (float)0.62166059, (float)0.61909389, (float)0.61652064,
|
||||
(float)0.61394072, (float)0.61135429, (float)0.60876143, (float)0.60616189, (float)0.60355592,
|
||||
(float)0.60094339, (float)0.59832448, (float)0.59569913, (float)0.59306765, (float)0.59042960,
|
||||
(float)0.58778518, (float)0.58513451, (float)0.58247757, (float)0.57981461, (float)0.57714522,
|
||||
(float)0.57446963, (float)0.57178789, (float)0.56910002, (float)0.56640613, (float)0.56370628,
|
||||
(float)0.56100023, (float)0.55828822, (float)0.55557019, (float)0.55284619, (float)0.55011630,
|
||||
(float)0.54738069, (float)0.54463905, (float)0.54189152, (float)0.53913826, (float)0.53637916,
|
||||
(float)0.53361434, (float)0.53084403, (float)0.52806783, (float)0.52528596, (float)0.52249849,
|
||||
(float)0.51970541, (float)0.51690674, (float)0.51410276, (float)0.51129305, (float)0.50847787,
|
||||
(float)0.50565726, (float)0.50283122, (float)0.50000006, (float)0.49716327, (float)0.49432117,
|
||||
(float)0.49147379, (float)0.48862115, (float)0.48576325, (float)0.48290038, (float)0.48003212,
|
||||
(float)0.47715873, (float)0.47428021, (float)0.47139663, (float)0.46850798, (float)0.46561456,
|
||||
(float)0.46271589, (float)0.45981231, (float)0.45690379, (float)0.45399037, (float)0.45107210,
|
||||
(float)0.44814920, (float)0.44522130, (float)0.44228864, (float)0.43935123, (float)0.43640912,
|
||||
(float)0.43346232, (float)0.43051112, (float)0.42755505, (float)0.42459446, (float)0.42162928,
|
||||
(float)0.41865960, (float)0.41568545, (float)0.41270703, (float)0.40972400, (float)0.40673658,
|
||||
(float)0.40374479, (float)0.40074870, (float)0.39774850, (float)0.39474386, (float)0.39173496,
|
||||
(float)0.38872188, (float)0.38570464, (float)0.38268328, (float)0.37965804, (float)0.37662849,
|
||||
(float)0.37359491, (float)0.37055734, (float)0.36751580, (float)0.36447033, (float)0.36142117,
|
||||
(float)0.35836792, (float)0.35531086, (float)0.35224995, (float)0.34918529, (float)0.34611690,
|
||||
(float)0.34304500, (float)0.33996922, (float)0.33688980, (float)0.33380675, (float)0.33072016,
|
||||
(float)0.32763001, (float)0.32453656, (float)0.32143945, (float)0.31833887, (float)0.31523487,
|
||||
(float)0.31212750, (float)0.30901679, (float)0.30590302, (float)0.30278572, (float)0.29966521,
|
||||
(float)0.29654145, (float)0.29341453, (float)0.29028472, (float)0.28715155, (float)0.28401530,
|
||||
(float)0.28087601, (float)0.27773371, (float)0.27458847, (float)0.27144048, (float)0.26828936,
|
||||
(float)0.26513538, (float)0.26197854, (float)0.25881892, (float)0.25565651, (float)0.25249159,
|
||||
(float)0.24932374, (float)0.24615324, (float)0.24298008, (float)0.23980433, (float)0.23662600,
|
||||
(float)0.23344538, (float)0.23026201, (float)0.22707619, (float)0.22388794, (float)0.22069728,
|
||||
(float)0.21750426, (float)0.21430916, (float)0.21111152, (float)0.20791161, (float)0.20470949,
|
||||
(float)0.20150517, (float)0.19829892, (float)0.19509031, (float)0.19187963, (float)0.18866688,
|
||||
(float)0.18545210, (float)0.18223536, (float)0.17901689, (float)0.17579627, (float)0.17257376,
|
||||
(float)0.16934940, (float)0.16612324, (float)0.16289529, (float)0.15966584, (float)0.15643445,
|
||||
(float)0.15320137, (float)0.14996666, (float)0.14673033, (float)0.14349243, (float)0.14025325,
|
||||
(float)0.13701232, (float)0.13376991, (float)0.13052608, (float)0.12728085, (float)0.12403426,
|
||||
(float)0.12078657, (float)0.11753736, (float)0.11428688, (float)0.11103519, (float)0.10778230,
|
||||
(float)0.10452849, (float)0.10127334, (float)0.09801710, (float)0.09475980, (float)0.09150149,
|
||||
(float)0.08824220, (float)0.08498220, (float)0.08172106, (float)0.07845904, (float)0.07519618,
|
||||
(float)0.07193252, (float)0.06866808, (float)0.06540315, (float)0.06213728, (float)0.05887074,
|
||||
(float)0.05560357, (float)0.05233581, (float)0.04906749, (float)0.04579888, (float)0.04252954,
|
||||
(float)0.03925974, (float)0.03598953, (float)0.03271893, (float)0.02944798, (float)0.02617695,
|
||||
(float)0.02290541, (float)0.01963361, (float)0.01636161, (float)0.01308943, (float)0.00981712,
|
||||
(float)0.00654493, (float)0.00327244, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000,
|
||||
(float)0.00000000, (float)0.00000000, (float)0.00000000, (float)0.00000000
|
||||
};
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_WINDOWS_PRIVATE_H_
|
Reference in New Issue
Block a user