Reformat the WebRTC code base
Running clang-format with chromium's style guide.
The goal is n-fold:
* providing consistency and readability (that's what code guidelines are for)
* preventing noise with presubmit checks and git cl format
* building on the previous point: making it easier to automatically fix format issues
* you name it
Please consider using git-hyper-blame to ignore this commit.
Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
diff --git a/modules/audio_processing/aec/aec_core.cc b/modules/audio_processing/aec/aec_core.cc
index 4394929..95ed595 100644
--- a/modules/audio_processing/aec/aec_core.cc
+++ b/modules/audio_processing/aec/aec_core.cc
@@ -14,11 +14,11 @@
#include "modules/audio_processing/aec/aec_core.h"
-#include <algorithm>
#include <math.h>
#include <stddef.h> // size_t
#include <stdlib.h>
#include <string.h>
+#include <algorithm>
#include "rtc_base/checks.h"
extern "C" {
@@ -178,9 +178,7 @@
// window, of which the length is 1 unit longer than indicated. Remove "+1" when
// the code is refactored.
PowerLevel::PowerLevel()
- : framelevel(kSubCountLen + 1),
- averagelevel(kCountLen + 1) {
-}
+ : framelevel(kSubCountLen + 1), averagelevel(kCountLen + 1) {}
BlockBuffer::BlockBuffer() {
buffer_ = WebRtc_CreateBuffer(kBufferSizeBlocks, sizeof(float) * PART_LEN);
@@ -238,10 +236,7 @@
}
DivergentFilterFraction::DivergentFilterFraction()
- : count_(0),
- occurrence_(0),
- fraction_(-1.0) {
-}
+ : count_(0), occurrence_(0), fraction_(-1.0) {}
void DivergentFilterFraction::Reset() {
Clear();
@@ -254,19 +249,18 @@
const float near_level = nearlevel.framelevel.GetLatestMean();
const float level_increase =
linoutlevel.framelevel.GetLatestMean() - near_level;
- const bool output_signal_active = nlpoutlevel.framelevel.GetLatestMean() >
- 40.0 * nlpoutlevel.minlevel;
+ const bool output_signal_active =
+ nlpoutlevel.framelevel.GetLatestMean() > 40.0 * nlpoutlevel.minlevel;
// Level increase should be, in principle, negative, when the filter
// does not diverge. Here we allow some margin (0.01 * near end level) and
// numerical error (1.0). We count divergence only when the AEC output
// signal is active.
- if (output_signal_active &&
- level_increase > std::max(0.01 * near_level, 1.0))
+ if (output_signal_active && level_increase > std::max(0.01 * near_level, 1.0))
occurrence_++;
++count_;
if (count_ == kDivergentFilterFractionAggregationWindowSize) {
fraction_ = static_cast<float>(occurrence_) /
- kDivergentFilterFractionAggregationWindowSize;
+ kDivergentFilterFractionAggregationWindowSize;
Clear();
}
}
@@ -416,9 +410,9 @@
}
}
-static int PartitionDelay(int num_partitions,
- float h_fft_buf[2]
- [kExtendedNumPartitions * PART_LEN1]) {
+static int PartitionDelay(
+ int num_partitions,
+ float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1]) {
// Measures the energy in each filter partition and returns the partition with
// highest energy.
// TODO(bjornv): Spread computational cost by computing one partition per
@@ -445,7 +439,8 @@
}
// Update metric with 10 * log10(numerator / denominator).
-static void UpdateLogRatioMetric(Stats* metric, float numerator,
+static void UpdateLogRatioMetric(Stats* metric,
+ float numerator,
float denominator) {
RTC_DCHECK(metric);
RTC_CHECK(numerator >= 0);
@@ -736,9 +731,8 @@
}
if (aec->linoutlevel.framelevel.EndOfBlock()) {
- aec->divergent_filter_fraction.AddObservation(aec->nearlevel,
- aec->linoutlevel,
- aec->nlpoutlevel);
+ aec->divergent_filter_fraction.AddObservation(
+ aec->nearlevel, aec->linoutlevel, aec->nlpoutlevel);
}
if (aec->farlevel.averagelevel.EndOfBlock()) {
@@ -755,7 +749,6 @@
if ((aec->stateCounter > (0.5f * kCountLen * kSubCountLen)) &&
(aec->farlevel.framelevel.EndOfBlock()) &&
(far_average_level > (actThreshold * aec->farlevel.minlevel))) {
-
// ERL: error return loss.
const float near_average_level =
aec->nearlevel.averagelevel.GetLatestMean();
@@ -815,9 +808,9 @@
for (i = 0; i < kHistorySizeBlocks; i++) {
l1_norm += abs(i - median) * self->delay_histogram[i];
}
- self->delay_std =
- static_cast<int>((l1_norm + self->num_delay_values / 2) /
- self->num_delay_values) * kMsPerBlock;
+ self->delay_std = static_cast<int>((l1_norm + self->num_delay_values / 2) /
+ self->num_delay_values) *
+ kMsPerBlock;
// Determine fraction of delays that are out of bounds, that is, either
// negative (anti-causal system) or larger than the AEC filter length.
@@ -949,11 +942,11 @@
return delay_correction;
}
-static void RegressorPower(int num_partitions,
- int latest_added_partition,
- float x_fft_buf[2]
- [kExtendedNumPartitions * PART_LEN1],
- float x_pow[PART_LEN1]) {
+static void RegressorPower(
+ int num_partitions,
+ int latest_added_partition,
+ float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1],
+ float x_pow[PART_LEN1]) {
RTC_DCHECK_LT(latest_added_partition, num_partitions);
memset(x_pow, 0, PART_LEN1 * sizeof(x_pow[0]));
@@ -976,21 +969,20 @@
}
}
-static void EchoSubtraction(const OouraFft& ooura_fft,
- int num_partitions,
- int extended_filter_enabled,
- int* extreme_filter_divergence,
- float filter_step_size,
- float error_threshold,
- float* x_fft,
- int* x_fft_buf_block_pos,
- float x_fft_buf[2]
- [kExtendedNumPartitions * PART_LEN1],
- float* const y,
- float x_pow[PART_LEN1],
- float h_fft_buf[2]
- [kExtendedNumPartitions * PART_LEN1],
- float echo_subtractor_output[PART_LEN]) {
+static void EchoSubtraction(
+ const OouraFft& ooura_fft,
+ int num_partitions,
+ int extended_filter_enabled,
+ int* extreme_filter_divergence,
+ float filter_step_size,
+ float error_threshold,
+ float* x_fft,
+ int* x_fft_buf_block_pos,
+ float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1],
+ float* const y,
+ float x_pow[PART_LEN1],
+ float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1],
+ float echo_subtractor_output[PART_LEN]) {
float s_fft[2][PART_LEN1];
float e_extended[PART_LEN2];
float s_extended[PART_LEN2];
@@ -1118,10 +1110,10 @@
// preferred.
memcpy(hNlPref, &hNl[minPrefBand], sizeof(float) * prefBandSize);
qsort(hNlPref, prefBandSize, sizeof(float), CmpFloat);
- hNlFb = hNlPref[static_cast<int>(floor(prefBandQuant *
- (prefBandSize - 1)))];
- hNlFbLow = hNlPref[static_cast<int>(floor(prefBandQuantLow *
- (prefBandSize - 1)))];
+ hNlFb =
+ hNlPref[static_cast<int>(floor(prefBandQuant * (prefBandSize - 1)))];
+ hNlFbLow = hNlPref[static_cast<int>(
+ floor(prefBandQuantLow * (prefBandSize - 1)))];
}
}
@@ -1142,10 +1134,10 @@
if (aec->hNlMinCtr == 2) {
aec->hNlNewMin = 0;
aec->hNlMinCtr = 0;
- aec->overDrive =
- WEBRTC_SPL_MAX(kTargetSupp[aec->nlp_mode] /
- static_cast<float>(log(aec->hNlFbMin + 1e-10f) + 1e-10f),
- min_overdrive[aec->nlp_mode]);
+ aec->overDrive = WEBRTC_SPL_MAX(
+ kTargetSupp[aec->nlp_mode] /
+ static_cast<float>(log(aec->hNlFbMin + 1e-10f) + 1e-10f),
+ min_overdrive[aec->nlp_mode]);
}
// Smooth the overdrive.
@@ -1773,20 +1765,18 @@
float nearend_buffer[NUM_HIGH_BANDS_MAX + 1]
[PART_LEN - (FRAME_LEN - PART_LEN)]) {
for (size_t i = 0; i < num_bands; ++i) {
- memcpy(
- &nearend_buffer[i][0],
- &nearend_frame[i]
- [nearend_start_index + FRAME_LEN - num_samples_to_buffer],
- num_samples_to_buffer * sizeof(float));
+ memcpy(&nearend_buffer[i][0],
+ &nearend_frame[i][nearend_start_index + FRAME_LEN -
+ num_samples_to_buffer],
+ num_samples_to_buffer * sizeof(float));
}
}
-void BufferOutputBlock(size_t num_bands,
- const float output_block[NUM_HIGH_BANDS_MAX + 1]
- [PART_LEN],
- size_t* output_buffer_size,
- float output_buffer[NUM_HIGH_BANDS_MAX + 1]
- [2 * PART_LEN]) {
+void BufferOutputBlock(
+ size_t num_bands,
+ const float output_block[NUM_HIGH_BANDS_MAX + 1][PART_LEN],
+ size_t* output_buffer_size,
+ float output_buffer[NUM_HIGH_BANDS_MAX + 1][2 * PART_LEN]) {
for (size_t i = 0; i < num_bands; ++i) {
memcpy(&output_buffer[i][*output_buffer_size], &output_block[i][0],
PART_LEN * sizeof(float));
diff --git a/modules/audio_processing/aec/aec_core_mips.cc b/modules/audio_processing/aec/aec_core_mips.cc
index ebe6349..bf89cfa 100644
--- a/modules/audio_processing/aec/aec_core_mips.cc
+++ b/modules/audio_processing/aec/aec_core_mips.cc
@@ -51,95 +51,94 @@
int len = PART_LEN1 >> 1;
__asm __volatile(
- ".set push \n\t"
- ".set noreorder \n\t"
- "1: \n\t"
- "lwc1 %[f0], 0(%[aRe]) \n\t"
- "lwc1 %[f1], 0(%[bRe]) \n\t"
- "lwc1 %[f2], 0(%[bIm]) \n\t"
- "lwc1 %[f3], 0(%[aIm]) \n\t"
- "lwc1 %[f4], 4(%[aRe]) \n\t"
- "lwc1 %[f5], 4(%[bRe]) \n\t"
- "lwc1 %[f6], 4(%[bIm]) \n\t"
- "mul.s %[f8], %[f0], %[f1] \n\t"
- "mul.s %[f0], %[f0], %[f2] \n\t"
- "mul.s %[f9], %[f4], %[f5] \n\t"
- "mul.s %[f4], %[f4], %[f6] \n\t"
- "lwc1 %[f7], 4(%[aIm]) \n\t"
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "1: \n\t"
+ "lwc1 %[f0], 0(%[aRe]) \n\t"
+ "lwc1 %[f1], 0(%[bRe]) \n\t"
+ "lwc1 %[f2], 0(%[bIm]) \n\t"
+ "lwc1 %[f3], 0(%[aIm]) \n\t"
+ "lwc1 %[f4], 4(%[aRe]) \n\t"
+ "lwc1 %[f5], 4(%[bRe]) \n\t"
+ "lwc1 %[f6], 4(%[bIm]) \n\t"
+ "mul.s %[f8], %[f0], %[f1] \n\t"
+ "mul.s %[f0], %[f0], %[f2] \n\t"
+ "mul.s %[f9], %[f4], %[f5] \n\t"
+ "mul.s %[f4], %[f4], %[f6] \n\t"
+ "lwc1 %[f7], 4(%[aIm]) \n\t"
#if !defined(MIPS32_R2_LE)
- "mul.s %[f12], %[f2], %[f3] \n\t"
- "mul.s %[f1], %[f3], %[f1] \n\t"
- "mul.s %[f11], %[f6], %[f7] \n\t"
- "addiu %[aRe], %[aRe], 8 \n\t"
- "addiu %[aIm], %[aIm], 8 \n\t"
- "addiu %[len], %[len], -1 \n\t"
- "sub.s %[f8], %[f8], %[f12] \n\t"
- "mul.s %[f12], %[f7], %[f5] \n\t"
- "lwc1 %[f2], 0(%[yf0]) \n\t"
- "add.s %[f1], %[f0], %[f1] \n\t"
- "lwc1 %[f3], 0(%[yf1]) \n\t"
- "sub.s %[f9], %[f9], %[f11] \n\t"
- "lwc1 %[f6], 4(%[yf0]) \n\t"
- "add.s %[f4], %[f4], %[f12] \n\t"
-#else // #if !defined(MIPS32_R2_LE)
- "addiu %[aRe], %[aRe], 8 \n\t"
- "addiu %[aIm], %[aIm], 8 \n\t"
- "addiu %[len], %[len], -1 \n\t"
- "nmsub.s %[f8], %[f8], %[f2], %[f3] \n\t"
- "lwc1 %[f2], 0(%[yf0]) \n\t"
- "madd.s %[f1], %[f0], %[f3], %[f1] \n\t"
- "lwc1 %[f3], 0(%[yf1]) \n\t"
- "nmsub.s %[f9], %[f9], %[f6], %[f7] \n\t"
- "lwc1 %[f6], 4(%[yf0]) \n\t"
- "madd.s %[f4], %[f4], %[f7], %[f5] \n\t"
+ "mul.s %[f12], %[f2], %[f3] \n\t"
+ "mul.s %[f1], %[f3], %[f1] \n\t"
+ "mul.s %[f11], %[f6], %[f7] \n\t"
+ "addiu %[aRe], %[aRe], 8 \n\t"
+ "addiu %[aIm], %[aIm], 8 \n\t"
+ "addiu %[len], %[len], -1 \n\t"
+ "sub.s %[f8], %[f8], %[f12] \n\t"
+ "mul.s %[f12], %[f7], %[f5] \n\t"
+ "lwc1 %[f2], 0(%[yf0]) \n\t"
+ "add.s %[f1], %[f0], %[f1] \n\t"
+ "lwc1 %[f3], 0(%[yf1]) \n\t"
+ "sub.s %[f9], %[f9], %[f11] \n\t"
+ "lwc1 %[f6], 4(%[yf0]) \n\t"
+ "add.s %[f4], %[f4], %[f12] \n\t"
+#else // #if !defined(MIPS32_R2_LE)
+ "addiu %[aRe], %[aRe], 8 \n\t"
+ "addiu %[aIm], %[aIm], 8 \n\t"
+ "addiu %[len], %[len], -1 \n\t"
+ "nmsub.s %[f8], %[f8], %[f2], %[f3] \n\t"
+ "lwc1 %[f2], 0(%[yf0]) \n\t"
+ "madd.s %[f1], %[f0], %[f3], %[f1] \n\t"
+ "lwc1 %[f3], 0(%[yf1]) \n\t"
+ "nmsub.s %[f9], %[f9], %[f6], %[f7] \n\t"
+ "lwc1 %[f6], 4(%[yf0]) \n\t"
+ "madd.s %[f4], %[f4], %[f7], %[f5] \n\t"
#endif // #if !defined(MIPS32_R2_LE)
- "lwc1 %[f5], 4(%[yf1]) \n\t"
- "add.s %[f2], %[f2], %[f8] \n\t"
- "addiu %[bRe], %[bRe], 8 \n\t"
- "addiu %[bIm], %[bIm], 8 \n\t"
- "add.s %[f3], %[f3], %[f1] \n\t"
- "add.s %[f6], %[f6], %[f9] \n\t"
- "add.s %[f5], %[f5], %[f4] \n\t"
- "swc1 %[f2], 0(%[yf0]) \n\t"
- "swc1 %[f3], 0(%[yf1]) \n\t"
- "swc1 %[f6], 4(%[yf0]) \n\t"
- "swc1 %[f5], 4(%[yf1]) \n\t"
- "addiu %[yf0], %[yf0], 8 \n\t"
- "bgtz %[len], 1b \n\t"
- " addiu %[yf1], %[yf1], 8 \n\t"
- "lwc1 %[f0], 0(%[aRe]) \n\t"
- "lwc1 %[f1], 0(%[bRe]) \n\t"
- "lwc1 %[f2], 0(%[bIm]) \n\t"
- "lwc1 %[f3], 0(%[aIm]) \n\t"
- "mul.s %[f8], %[f0], %[f1] \n\t"
- "mul.s %[f0], %[f0], %[f2] \n\t"
+ "lwc1 %[f5], 4(%[yf1]) \n\t"
+ "add.s %[f2], %[f2], %[f8] \n\t"
+ "addiu %[bRe], %[bRe], 8 \n\t"
+ "addiu %[bIm], %[bIm], 8 \n\t"
+ "add.s %[f3], %[f3], %[f1] \n\t"
+ "add.s %[f6], %[f6], %[f9] \n\t"
+ "add.s %[f5], %[f5], %[f4] \n\t"
+ "swc1 %[f2], 0(%[yf0]) \n\t"
+ "swc1 %[f3], 0(%[yf1]) \n\t"
+ "swc1 %[f6], 4(%[yf0]) \n\t"
+ "swc1 %[f5], 4(%[yf1]) \n\t"
+ "addiu %[yf0], %[yf0], 8 \n\t"
+ "bgtz %[len], 1b \n\t"
+ " addiu %[yf1], %[yf1], 8 \n\t"
+ "lwc1 %[f0], 0(%[aRe]) \n\t"
+ "lwc1 %[f1], 0(%[bRe]) \n\t"
+ "lwc1 %[f2], 0(%[bIm]) \n\t"
+ "lwc1 %[f3], 0(%[aIm]) \n\t"
+ "mul.s %[f8], %[f0], %[f1] \n\t"
+ "mul.s %[f0], %[f0], %[f2] \n\t"
#if !defined(MIPS32_R2_LE)
- "mul.s %[f12], %[f2], %[f3] \n\t"
- "mul.s %[f1], %[f3], %[f1] \n\t"
- "sub.s %[f8], %[f8], %[f12] \n\t"
- "lwc1 %[f2], 0(%[yf0]) \n\t"
- "add.s %[f1], %[f0], %[f1] \n\t"
- "lwc1 %[f3], 0(%[yf1]) \n\t"
-#else // #if !defined(MIPS32_R2_LE)
- "nmsub.s %[f8], %[f8], %[f2], %[f3] \n\t"
- "lwc1 %[f2], 0(%[yf0]) \n\t"
- "madd.s %[f1], %[f0], %[f3], %[f1] \n\t"
- "lwc1 %[f3], 0(%[yf1]) \n\t"
+ "mul.s %[f12], %[f2], %[f3] \n\t"
+ "mul.s %[f1], %[f3], %[f1] \n\t"
+ "sub.s %[f8], %[f8], %[f12] \n\t"
+ "lwc1 %[f2], 0(%[yf0]) \n\t"
+ "add.s %[f1], %[f0], %[f1] \n\t"
+ "lwc1 %[f3], 0(%[yf1]) \n\t"
+#else // #if !defined(MIPS32_R2_LE)
+ "nmsub.s %[f8], %[f8], %[f2], %[f3] \n\t"
+ "lwc1 %[f2], 0(%[yf0]) \n\t"
+ "madd.s %[f1], %[f0], %[f3], %[f1] \n\t"
+ "lwc1 %[f3], 0(%[yf1]) \n\t"
#endif // #if !defined(MIPS32_R2_LE)
- "add.s %[f2], %[f2], %[f8] \n\t"
- "add.s %[f3], %[f3], %[f1] \n\t"
- "swc1 %[f2], 0(%[yf0]) \n\t"
- "swc1 %[f3], 0(%[yf1]) \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2),
- [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5),
- [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8),
- [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11),
- [f12] "=&f" (f12), [f13] "=&f" (f13), [aRe] "+r" (aRe),
- [aIm] "+r" (aIm), [bRe] "+r" (bRe), [bIm] "+r" (bIm),
- [yf0] "+r" (yf0), [yf1] "+r" (yf1), [len] "+r" (len)
- :
- : "memory");
+ "add.s %[f2], %[f2], %[f8] \n\t"
+ "add.s %[f3], %[f3], %[f1] \n\t"
+ "swc1 %[f2], 0(%[yf0]) \n\t"
+ "swc1 %[f3], 0(%[yf1]) \n\t"
+ ".set pop \n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3),
+ [f4] "=&f"(f4), [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7),
+ [f8] "=&f"(f8), [f9] "=&f"(f9), [f10] "=&f"(f10), [f11] "=&f"(f11),
+ [f12] "=&f"(f12), [f13] "=&f"(f13), [aRe] "+r"(aRe), [aIm] "+r"(aIm),
+ [bRe] "+r"(bRe), [bIm] "+r"(bIm), [yf0] "+r"(yf0), [yf1] "+r"(yf1),
+ [len] "+r"(len)
+ :
+ : "memory");
}
}
@@ -171,73 +170,71 @@
int len = PART_LEN >> 1;
__asm __volatile(
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[fft_tmp], %[fft], 0 \n\t"
- "1: \n\t"
- "lwc1 %[f0], 0(%[aRe]) \n\t"
- "lwc1 %[f1], 0(%[bRe]) \n\t"
- "lwc1 %[f2], 0(%[bIm]) \n\t"
- "lwc1 %[f4], 4(%[aRe]) \n\t"
- "lwc1 %[f5], 4(%[bRe]) \n\t"
- "lwc1 %[f6], 4(%[bIm]) \n\t"
- "addiu %[aRe], %[aRe], 8 \n\t"
- "addiu %[bRe], %[bRe], 8 \n\t"
- "mul.s %[f8], %[f0], %[f1] \n\t"
- "mul.s %[f0], %[f0], %[f2] \n\t"
- "lwc1 %[f3], 0(%[aIm]) \n\t"
- "mul.s %[f9], %[f4], %[f5] \n\t"
- "lwc1 %[f7], 4(%[aIm]) \n\t"
- "mul.s %[f4], %[f4], %[f6] \n\t"
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "addiu %[fft_tmp], %[fft], 0 \n\t"
+ "1: \n\t"
+ "lwc1 %[f0], 0(%[aRe]) \n\t"
+ "lwc1 %[f1], 0(%[bRe]) \n\t"
+ "lwc1 %[f2], 0(%[bIm]) \n\t"
+ "lwc1 %[f4], 4(%[aRe]) \n\t"
+ "lwc1 %[f5], 4(%[bRe]) \n\t"
+ "lwc1 %[f6], 4(%[bIm]) \n\t"
+ "addiu %[aRe], %[aRe], 8 \n\t"
+ "addiu %[bRe], %[bRe], 8 \n\t"
+ "mul.s %[f8], %[f0], %[f1] \n\t"
+ "mul.s %[f0], %[f0], %[f2] \n\t"
+ "lwc1 %[f3], 0(%[aIm]) \n\t"
+ "mul.s %[f9], %[f4], %[f5] \n\t"
+ "lwc1 %[f7], 4(%[aIm]) \n\t"
+ "mul.s %[f4], %[f4], %[f6] \n\t"
#if !defined(MIPS32_R2_LE)
- "mul.s %[f10], %[f3], %[f2] \n\t"
- "mul.s %[f1], %[f3], %[f1] \n\t"
- "mul.s %[f11], %[f7], %[f6] \n\t"
- "mul.s %[f5], %[f7], %[f5] \n\t"
- "addiu %[aIm], %[aIm], 8 \n\t"
- "addiu %[bIm], %[bIm], 8 \n\t"
- "addiu %[len], %[len], -1 \n\t"
- "add.s %[f8], %[f8], %[f10] \n\t"
- "sub.s %[f1], %[f0], %[f1] \n\t"
- "add.s %[f9], %[f9], %[f11] \n\t"
- "sub.s %[f5], %[f4], %[f5] \n\t"
-#else // #if !defined(MIPS32_R2_LE)
- "addiu %[aIm], %[aIm], 8 \n\t"
- "addiu %[bIm], %[bIm], 8 \n\t"
- "addiu %[len], %[len], -1 \n\t"
- "madd.s %[f8], %[f8], %[f3], %[f2] \n\t"
- "nmsub.s %[f1], %[f0], %[f3], %[f1] \n\t"
- "madd.s %[f9], %[f9], %[f7], %[f6] \n\t"
- "nmsub.s %[f5], %[f4], %[f7], %[f5] \n\t"
+ "mul.s %[f10], %[f3], %[f2] \n\t"
+ "mul.s %[f1], %[f3], %[f1] \n\t"
+ "mul.s %[f11], %[f7], %[f6] \n\t"
+ "mul.s %[f5], %[f7], %[f5] \n\t"
+ "addiu %[aIm], %[aIm], 8 \n\t"
+ "addiu %[bIm], %[bIm], 8 \n\t"
+ "addiu %[len], %[len], -1 \n\t"
+ "add.s %[f8], %[f8], %[f10] \n\t"
+ "sub.s %[f1], %[f0], %[f1] \n\t"
+ "add.s %[f9], %[f9], %[f11] \n\t"
+ "sub.s %[f5], %[f4], %[f5] \n\t"
+#else // #if !defined(MIPS32_R2_LE)
+ "addiu %[aIm], %[aIm], 8 \n\t"
+ "addiu %[bIm], %[bIm], 8 \n\t"
+ "addiu %[len], %[len], -1 \n\t"
+ "madd.s %[f8], %[f8], %[f3], %[f2] \n\t"
+ "nmsub.s %[f1], %[f0], %[f3], %[f1] \n\t"
+ "madd.s %[f9], %[f9], %[f7], %[f6] \n\t"
+ "nmsub.s %[f5], %[f4], %[f7], %[f5] \n\t"
#endif // #if !defined(MIPS32_R2_LE)
- "swc1 %[f8], 0(%[fft_tmp]) \n\t"
- "swc1 %[f1], 4(%[fft_tmp]) \n\t"
- "swc1 %[f9], 8(%[fft_tmp]) \n\t"
- "swc1 %[f5], 12(%[fft_tmp]) \n\t"
- "bgtz %[len], 1b \n\t"
- " addiu %[fft_tmp], %[fft_tmp], 16 \n\t"
- "lwc1 %[f0], 0(%[aRe]) \n\t"
- "lwc1 %[f1], 0(%[bRe]) \n\t"
- "lwc1 %[f2], 0(%[bIm]) \n\t"
- "lwc1 %[f3], 0(%[aIm]) \n\t"
- "mul.s %[f8], %[f0], %[f1] \n\t"
+ "swc1 %[f8], 0(%[fft_tmp]) \n\t"
+ "swc1 %[f1], 4(%[fft_tmp]) \n\t"
+ "swc1 %[f9], 8(%[fft_tmp]) \n\t"
+ "swc1 %[f5], 12(%[fft_tmp]) \n\t"
+ "bgtz %[len], 1b \n\t"
+ " addiu %[fft_tmp], %[fft_tmp], 16 \n\t"
+ "lwc1 %[f0], 0(%[aRe]) \n\t"
+ "lwc1 %[f1], 0(%[bRe]) \n\t"
+ "lwc1 %[f2], 0(%[bIm]) \n\t"
+ "lwc1 %[f3], 0(%[aIm]) \n\t"
+ "mul.s %[f8], %[f0], %[f1] \n\t"
#if !defined(MIPS32_R2_LE)
- "mul.s %[f10], %[f3], %[f2] \n\t"
- "add.s %[f8], %[f8], %[f10] \n\t"
-#else // #if !defined(MIPS32_R2_LE)
- "madd.s %[f8], %[f8], %[f3], %[f2] \n\t"
+ "mul.s %[f10], %[f3], %[f2] \n\t"
+ "add.s %[f8], %[f8], %[f10] \n\t"
+#else // #if !defined(MIPS32_R2_LE)
+ "madd.s %[f8], %[f8], %[f3], %[f2] \n\t"
#endif // #if !defined(MIPS32_R2_LE)
- "swc1 %[f8], 4(%[fft]) \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2),
- [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5),
- [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8),
- [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11),
- [f12] "=&f" (f12), [aRe] "+r" (aRe), [aIm] "+r" (aIm),
- [bRe] "+r" (bRe), [bIm] "+r" (bIm), [fft_tmp] "=&r" (fft_tmp),
- [len] "+r" (len)
- : [fft] "r" (fft)
- : "memory");
+ "swc1 %[f8], 4(%[fft]) \n\t"
+ ".set pop \n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3),
+ [f4] "=&f"(f4), [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7),
+ [f8] "=&f"(f8), [f9] "=&f"(f9), [f10] "=&f"(f10), [f11] "=&f"(f11),
+ [f12] "=&f"(f12), [aRe] "+r"(aRe), [aIm] "+r"(aIm), [bRe] "+r"(bRe),
+ [bIm] "+r"(bIm), [fft_tmp] "=&r"(fft_tmp), [len] "+r"(len)
+ : [fft] "r"(fft)
+ : "memory");
ooura_fft.InverseFft(fft);
memset(fft + PART_LEN, 0, sizeof(float) * PART_LEN);
@@ -246,102 +243,101 @@
{
float scale = 2.0f / PART_LEN2;
__asm __volatile(
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[fft_tmp], %[fft], 0 \n\t"
- "addiu %[len], $zero, 8 \n\t"
- "1: \n\t"
- "addiu %[len], %[len], -1 \n\t"
- "lwc1 %[f0], 0(%[fft_tmp]) \n\t"
- "lwc1 %[f1], 4(%[fft_tmp]) \n\t"
- "lwc1 %[f2], 8(%[fft_tmp]) \n\t"
- "lwc1 %[f3], 12(%[fft_tmp]) \n\t"
- "mul.s %[f0], %[f0], %[scale] \n\t"
- "mul.s %[f1], %[f1], %[scale] \n\t"
- "mul.s %[f2], %[f2], %[scale] \n\t"
- "mul.s %[f3], %[f3], %[scale] \n\t"
- "lwc1 %[f4], 16(%[fft_tmp]) \n\t"
- "lwc1 %[f5], 20(%[fft_tmp]) \n\t"
- "lwc1 %[f6], 24(%[fft_tmp]) \n\t"
- "lwc1 %[f7], 28(%[fft_tmp]) \n\t"
- "mul.s %[f4], %[f4], %[scale] \n\t"
- "mul.s %[f5], %[f5], %[scale] \n\t"
- "mul.s %[f6], %[f6], %[scale] \n\t"
- "mul.s %[f7], %[f7], %[scale] \n\t"
- "swc1 %[f0], 0(%[fft_tmp]) \n\t"
- "swc1 %[f1], 4(%[fft_tmp]) \n\t"
- "swc1 %[f2], 8(%[fft_tmp]) \n\t"
- "swc1 %[f3], 12(%[fft_tmp]) \n\t"
- "swc1 %[f4], 16(%[fft_tmp]) \n\t"
- "swc1 %[f5], 20(%[fft_tmp]) \n\t"
- "swc1 %[f6], 24(%[fft_tmp]) \n\t"
- "swc1 %[f7], 28(%[fft_tmp]) \n\t"
- "bgtz %[len], 1b \n\t"
- " addiu %[fft_tmp], %[fft_tmp], 32 \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2),
- [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5),
- [f6] "=&f" (f6), [f7] "=&f" (f7), [len] "=&r" (len),
- [fft_tmp] "=&r" (fft_tmp)
- : [scale] "f" (scale), [fft] "r" (fft)
- : "memory");
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "addiu %[fft_tmp], %[fft], 0 \n\t"
+ "addiu %[len], $zero, 8 \n\t"
+ "1: \n\t"
+ "addiu %[len], %[len], -1 \n\t"
+ "lwc1 %[f0], 0(%[fft_tmp]) \n\t"
+ "lwc1 %[f1], 4(%[fft_tmp]) \n\t"
+ "lwc1 %[f2], 8(%[fft_tmp]) \n\t"
+ "lwc1 %[f3], 12(%[fft_tmp]) \n\t"
+ "mul.s %[f0], %[f0], %[scale] \n\t"
+ "mul.s %[f1], %[f1], %[scale] \n\t"
+ "mul.s %[f2], %[f2], %[scale] \n\t"
+ "mul.s %[f3], %[f3], %[scale] \n\t"
+ "lwc1 %[f4], 16(%[fft_tmp]) \n\t"
+ "lwc1 %[f5], 20(%[fft_tmp]) \n\t"
+ "lwc1 %[f6], 24(%[fft_tmp]) \n\t"
+ "lwc1 %[f7], 28(%[fft_tmp]) \n\t"
+ "mul.s %[f4], %[f4], %[scale] \n\t"
+ "mul.s %[f5], %[f5], %[scale] \n\t"
+ "mul.s %[f6], %[f6], %[scale] \n\t"
+ "mul.s %[f7], %[f7], %[scale] \n\t"
+ "swc1 %[f0], 0(%[fft_tmp]) \n\t"
+ "swc1 %[f1], 4(%[fft_tmp]) \n\t"
+ "swc1 %[f2], 8(%[fft_tmp]) \n\t"
+ "swc1 %[f3], 12(%[fft_tmp]) \n\t"
+ "swc1 %[f4], 16(%[fft_tmp]) \n\t"
+ "swc1 %[f5], 20(%[fft_tmp]) \n\t"
+ "swc1 %[f6], 24(%[fft_tmp]) \n\t"
+ "swc1 %[f7], 28(%[fft_tmp]) \n\t"
+ "bgtz %[len], 1b \n\t"
+ " addiu %[fft_tmp], %[fft_tmp], 32 \n\t"
+ ".set pop \n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3),
+ [f4] "=&f"(f4), [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7),
+ [len] "=&r"(len), [fft_tmp] "=&r"(fft_tmp)
+ : [scale] "f"(scale), [fft] "r"(fft)
+ : "memory");
}
ooura_fft.Fft(fft);
aRe = h_fft_buf[0] + pos;
aIm = h_fft_buf[1] + pos;
__asm __volatile(
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[fft_tmp], %[fft], 0 \n\t"
- "addiu %[len], $zero, 31 \n\t"
- "lwc1 %[f0], 0(%[aRe]) \n\t"
- "lwc1 %[f1], 0(%[fft_tmp]) \n\t"
- "lwc1 %[f2], 256(%[aRe]) \n\t"
- "lwc1 %[f3], 4(%[fft_tmp]) \n\t"
- "lwc1 %[f4], 4(%[aRe]) \n\t"
- "lwc1 %[f5], 8(%[fft_tmp]) \n\t"
- "lwc1 %[f6], 4(%[aIm]) \n\t"
- "lwc1 %[f7], 12(%[fft_tmp]) \n\t"
- "add.s %[f0], %[f0], %[f1] \n\t"
- "add.s %[f2], %[f2], %[f3] \n\t"
- "add.s %[f4], %[f4], %[f5] \n\t"
- "add.s %[f6], %[f6], %[f7] \n\t"
- "addiu %[fft_tmp], %[fft_tmp], 16 \n\t"
- "swc1 %[f0], 0(%[aRe]) \n\t"
- "swc1 %[f2], 256(%[aRe]) \n\t"
- "swc1 %[f4], 4(%[aRe]) \n\t"
- "addiu %[aRe], %[aRe], 8 \n\t"
- "swc1 %[f6], 4(%[aIm]) \n\t"
- "addiu %[aIm], %[aIm], 8 \n\t"
- "1: \n\t"
- "lwc1 %[f0], 0(%[aRe]) \n\t"
- "lwc1 %[f1], 0(%[fft_tmp]) \n\t"
- "lwc1 %[f2], 0(%[aIm]) \n\t"
- "lwc1 %[f3], 4(%[fft_tmp]) \n\t"
- "lwc1 %[f4], 4(%[aRe]) \n\t"
- "lwc1 %[f5], 8(%[fft_tmp]) \n\t"
- "lwc1 %[f6], 4(%[aIm]) \n\t"
- "lwc1 %[f7], 12(%[fft_tmp]) \n\t"
- "add.s %[f0], %[f0], %[f1] \n\t"
- "add.s %[f2], %[f2], %[f3] \n\t"
- "add.s %[f4], %[f4], %[f5] \n\t"
- "add.s %[f6], %[f6], %[f7] \n\t"
- "addiu %[len], %[len], -1 \n\t"
- "addiu %[fft_tmp], %[fft_tmp], 16 \n\t"
- "swc1 %[f0], 0(%[aRe]) \n\t"
- "swc1 %[f2], 0(%[aIm]) \n\t"
- "swc1 %[f4], 4(%[aRe]) \n\t"
- "addiu %[aRe], %[aRe], 8 \n\t"
- "swc1 %[f6], 4(%[aIm]) \n\t"
- "bgtz %[len], 1b \n\t"
- " addiu %[aIm], %[aIm], 8 \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2),
- [f3] "=&f" (f3), [f4] "=&f" (f4), [f5] "=&f" (f5),
- [f6] "=&f" (f6), [f7] "=&f" (f7), [len] "=&r" (len),
- [fft_tmp] "=&r" (fft_tmp), [aRe] "+r" (aRe), [aIm] "+r" (aIm)
- : [fft] "r" (fft)
- : "memory");
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "addiu %[fft_tmp], %[fft], 0 \n\t"
+ "addiu %[len], $zero, 31 \n\t"
+ "lwc1 %[f0], 0(%[aRe]) \n\t"
+ "lwc1 %[f1], 0(%[fft_tmp]) \n\t"
+ "lwc1 %[f2], 256(%[aRe]) \n\t"
+ "lwc1 %[f3], 4(%[fft_tmp]) \n\t"
+ "lwc1 %[f4], 4(%[aRe]) \n\t"
+ "lwc1 %[f5], 8(%[fft_tmp]) \n\t"
+ "lwc1 %[f6], 4(%[aIm]) \n\t"
+ "lwc1 %[f7], 12(%[fft_tmp]) \n\t"
+ "add.s %[f0], %[f0], %[f1] \n\t"
+ "add.s %[f2], %[f2], %[f3] \n\t"
+ "add.s %[f4], %[f4], %[f5] \n\t"
+ "add.s %[f6], %[f6], %[f7] \n\t"
+ "addiu %[fft_tmp], %[fft_tmp], 16 \n\t"
+ "swc1 %[f0], 0(%[aRe]) \n\t"
+ "swc1 %[f2], 256(%[aRe]) \n\t"
+ "swc1 %[f4], 4(%[aRe]) \n\t"
+ "addiu %[aRe], %[aRe], 8 \n\t"
+ "swc1 %[f6], 4(%[aIm]) \n\t"
+ "addiu %[aIm], %[aIm], 8 \n\t"
+ "1: \n\t"
+ "lwc1 %[f0], 0(%[aRe]) \n\t"
+ "lwc1 %[f1], 0(%[fft_tmp]) \n\t"
+ "lwc1 %[f2], 0(%[aIm]) \n\t"
+ "lwc1 %[f3], 4(%[fft_tmp]) \n\t"
+ "lwc1 %[f4], 4(%[aRe]) \n\t"
+ "lwc1 %[f5], 8(%[fft_tmp]) \n\t"
+ "lwc1 %[f6], 4(%[aIm]) \n\t"
+ "lwc1 %[f7], 12(%[fft_tmp]) \n\t"
+ "add.s %[f0], %[f0], %[f1] \n\t"
+ "add.s %[f2], %[f2], %[f3] \n\t"
+ "add.s %[f4], %[f4], %[f5] \n\t"
+ "add.s %[f6], %[f6], %[f7] \n\t"
+ "addiu %[len], %[len], -1 \n\t"
+ "addiu %[fft_tmp], %[fft_tmp], 16 \n\t"
+ "swc1 %[f0], 0(%[aRe]) \n\t"
+ "swc1 %[f2], 0(%[aIm]) \n\t"
+ "swc1 %[f4], 4(%[aRe]) \n\t"
+ "addiu %[aRe], %[aRe], 8 \n\t"
+ "swc1 %[f6], 4(%[aIm]) \n\t"
+ "bgtz %[len], 1b \n\t"
+ " addiu %[aIm], %[aIm], 8 \n\t"
+ ".set pop \n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3),
+ [f4] "=&f"(f4), [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7),
+ [len] "=&r"(len), [fft_tmp] "=&r"(fft_tmp), [aRe] "+r"(aRe),
+ [aIm] "+r"(aIm)
+ : [fft] "r"(fft)
+ : "memory");
}
}
@@ -359,28 +355,28 @@
for (int i = 0; i < PART_LEN1; ++i) {
// Weight subbands
__asm __volatile(
- ".set push \n\t"
- ".set noreorder \n\t"
- "lwc1 %[temp1], 0(%[p_hNl]) \n\t"
- "lwc1 %[temp2], 0(%[p_wC]) \n\t"
- "c.lt.s %[hNlFb], %[temp1] \n\t"
- "bc1f 1f \n\t"
- " mul.s %[temp3], %[temp2], %[hNlFb] \n\t"
- "sub.s %[temp4], %[one], %[temp2] \n\t"
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "lwc1 %[temp1], 0(%[p_hNl]) \n\t"
+ "lwc1 %[temp2], 0(%[p_wC]) \n\t"
+ "c.lt.s %[hNlFb], %[temp1] \n\t"
+ "bc1f 1f \n\t"
+ " mul.s %[temp3], %[temp2], %[hNlFb] \n\t"
+ "sub.s %[temp4], %[one], %[temp2] \n\t"
#if !defined(MIPS32_R2_LE)
- "mul.s %[temp1], %[temp1], %[temp4] \n\t"
- "add.s %[temp1], %[temp3], %[temp1] \n\t"
-#else // #if !defined(MIPS32_R2_LE)
- "madd.s %[temp1], %[temp3], %[temp1], %[temp4] \n\t"
+ "mul.s %[temp1], %[temp1], %[temp4] \n\t"
+ "add.s %[temp1], %[temp3], %[temp1] \n\t"
+#else // #if !defined(MIPS32_R2_LE)
+ "madd.s %[temp1], %[temp3], %[temp1], %[temp4] \n\t"
#endif // #if !defined(MIPS32_R2_LE)
- "swc1 %[temp1], 0(%[p_hNl]) \n\t"
- "1: \n\t"
- "addiu %[p_wC], %[p_wC], 4 \n\t"
- ".set pop \n\t"
- : [temp1] "=&f" (temp1), [temp2] "=&f" (temp2), [temp3] "=&f" (temp3),
- [temp4] "=&f" (temp4), [p_wC] "+r" (p_WebRtcAec_wC)
- : [hNlFb] "f" (hNlFb), [one] "f" (one), [p_hNl] "r" (p_hNl)
- : "memory");
+ "swc1 %[temp1], 0(%[p_hNl]) \n\t"
+ "1: \n\t"
+ "addiu %[p_wC], %[p_wC], 4 \n\t"
+ ".set pop \n\t"
+ : [temp1] "=&f"(temp1), [temp2] "=&f"(temp2), [temp3] "=&f"(temp3),
+ [temp4] "=&f"(temp4), [p_wC] "+r"(p_WebRtcAec_wC)
+ : [hNlFb] "f"(hNlFb), [one] "f"(one), [p_hNl] "r"(p_hNl)
+ : "memory");
hNl[i] = powf(hNl[i], overdrive_scaling * WebRtcAec_overDriveCurve[i]);
}
@@ -399,22 +395,22 @@
for (int i = 0; i < PART_LEN1; ++i) {
__asm __volatile(
- "lwc1 %[temp1], 0(%[p_hNl]) \n\t"
- "lwc1 %[temp3], 0(%[p_efw1]) \n\t"
- "lwc1 %[temp2], 0(%[p_efw0]) \n\t"
- "addiu %[p_hNl], %[p_hNl], 4 \n\t"
- "mul.s %[temp3], %[temp3], %[temp1] \n\t"
- "mul.s %[temp2], %[temp2], %[temp1] \n\t"
- "addiu %[p_efw0], %[p_efw0], 4 \n\t"
- "addiu %[p_efw1], %[p_efw1], 4 \n\t"
- "neg.s %[temp4], %[temp3] \n\t"
- "swc1 %[temp2], -4(%[p_efw0]) \n\t"
- "swc1 %[temp4], -4(%[p_efw1]) \n\t"
- : [temp1] "=&f" (temp1), [temp2] "=&f" (temp2), [temp3] "=&f" (temp3),
- [temp4] "=&f" (temp4), [p_efw0] "+r" (p_efw0), [p_efw1] "+r" (p_efw1),
- [p_hNl] "+r" (p_hNl)
- :
- : "memory");
+ "lwc1 %[temp1], 0(%[p_hNl]) \n\t"
+ "lwc1 %[temp3], 0(%[p_efw1]) \n\t"
+ "lwc1 %[temp2], 0(%[p_efw0]) \n\t"
+ "addiu %[p_hNl], %[p_hNl], 4 \n\t"
+ "mul.s %[temp3], %[temp3], %[temp1] \n\t"
+ "mul.s %[temp2], %[temp2], %[temp1] \n\t"
+ "addiu %[p_efw0], %[p_efw0], 4 \n\t"
+ "addiu %[p_efw1], %[p_efw1], 4 \n\t"
+ "neg.s %[temp4], %[temp3] \n\t"
+ "swc1 %[temp2], -4(%[p_efw0]) \n\t"
+ "swc1 %[temp4], -4(%[p_efw1]) \n\t"
+ : [temp1] "=&f"(temp1), [temp2] "=&f"(temp2), [temp3] "=&f"(temp3),
+ [temp4] "=&f"(temp4), [p_efw0] "+r"(p_efw0), [p_efw1] "+r"(p_efw1),
+ [p_hNl] "+r"(p_hNl)
+ :
+ : "memory");
}
}
@@ -433,51 +429,50 @@
#endif
__asm __volatile(
- ".set push \n\t"
- ".set noreorder \n\t"
- "1: \n\t"
- "lwc1 %[f0], 0(%[x_pow]) \n\t"
- "lwc1 %[f1], 0(%[ef0]) \n\t"
- "lwc1 %[f2], 0(%[ef1]) \n\t"
- "add.s %[f0], %[f0], %[fac1] \n\t"
- "div.s %[f1], %[f1], %[f0] \n\t"
- "div.s %[f2], %[f2], %[f0] \n\t"
- "mul.s %[f0], %[f1], %[f1] \n\t"
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "1: \n\t"
+ "lwc1 %[f0], 0(%[x_pow]) \n\t"
+ "lwc1 %[f1], 0(%[ef0]) \n\t"
+ "lwc1 %[f2], 0(%[ef1]) \n\t"
+ "add.s %[f0], %[f0], %[fac1] \n\t"
+ "div.s %[f1], %[f1], %[f0] \n\t"
+ "div.s %[f2], %[f2], %[f0] \n\t"
+ "mul.s %[f0], %[f1], %[f1] \n\t"
#if defined(MIPS32_R2_LE)
- "madd.s %[f0], %[f0], %[f2], %[f2] \n\t"
+ "madd.s %[f0], %[f0], %[f2], %[f2] \n\t"
#else
- "mul.s %[f3], %[f2], %[f2] \n\t"
- "add.s %[f0], %[f0], %[f3] \n\t"
+ "mul.s %[f3], %[f2], %[f2] \n\t"
+ "add.s %[f0], %[f0], %[f3] \n\t"
#endif
- "c.le.s %[f0], %[err_th2] \n\t"
- "nop \n\t"
- "bc1t 2f \n\t"
- " nop \n\t"
- "sqrt.s %[f0], %[f0] \n\t"
- "add.s %[f0], %[f0], %[fac1] \n\t"
- "div.s %[f0], %[err_th], %[f0] \n\t"
- "mul.s %[f1], %[f1], %[f0] \n\t"
- "mul.s %[f2], %[f2], %[f0] \n\t"
- "2: \n\t"
- "mul.s %[f1], %[f1], %[mu] \n\t"
- "mul.s %[f2], %[f2], %[mu] \n\t"
- "swc1 %[f1], 0(%[ef0]) \n\t"
- "swc1 %[f2], 0(%[ef1]) \n\t"
- "addiu %[len], %[len], -1 \n\t"
- "addiu %[x_pow], %[x_pow], 4 \n\t"
- "addiu %[ef0], %[ef0], 4 \n\t"
- "bgtz %[len], 1b \n\t"
- " addiu %[ef1], %[ef1], 4 \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2),
+ "c.le.s %[f0], %[err_th2] \n\t"
+ "nop \n\t"
+ "bc1t 2f \n\t"
+ " nop \n\t"
+ "sqrt.s %[f0], %[f0] \n\t"
+ "add.s %[f0], %[f0], %[fac1] \n\t"
+ "div.s %[f0], %[err_th], %[f0] \n\t"
+ "mul.s %[f1], %[f1], %[f0] \n\t"
+ "mul.s %[f2], %[f2], %[f0] \n\t"
+ "2: \n\t"
+ "mul.s %[f1], %[f1], %[mu] \n\t"
+ "mul.s %[f2], %[f2], %[mu] \n\t"
+ "swc1 %[f1], 0(%[ef0]) \n\t"
+ "swc1 %[f2], 0(%[ef1]) \n\t"
+ "addiu %[len], %[len], -1 \n\t"
+ "addiu %[x_pow], %[x_pow], 4 \n\t"
+ "addiu %[ef0], %[ef0], 4 \n\t"
+ "bgtz %[len], 1b \n\t"
+ " addiu %[ef1], %[ef1], 4 \n\t"
+ ".set pop \n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2),
#if !defined(MIPS32_R2_LE)
- [f3] "=&f" (f3),
+ [f3] "=&f"(f3),
#endif
- [x_pow] "+r" (x_pow), [ef0] "+r" (ef0), [ef1] "+r" (ef1),
- [len] "+r" (len)
- : [fac1] "f" (fac1), [err_th2] "f" (err_th2), [mu] "f" (mu),
- [err_th] "f" (error_threshold)
- : "memory");
+ [x_pow] "+r"(x_pow), [ef0] "+r"(ef0), [ef1] "+r"(ef1), [len] "+r"(len)
+ : [fac1] "f"(fac1), [err_th2] "f"(err_th2), [mu] "f"(mu),
+ [err_th] "f"(error_threshold)
+ : "memory");
}
void WebRtcAec_InitAec_mips(void) {
diff --git a/modules/audio_processing/aec/aec_core_neon.cc b/modules/audio_processing/aec/aec_core_neon.cc
index 1fbf56b..072bd17 100644
--- a/modules/audio_processing/aec/aec_core_neon.cc
+++ b/modules/audio_processing/aec/aec_core_neon.cc
@@ -38,13 +38,12 @@
return aRe * bIm + aIm * bRe;
}
-static void FilterFarNEON(int num_partitions,
- int x_fft_buf_block_pos,
- float x_fft_buf[2]
- [kExtendedNumPartitions * PART_LEN1],
- float h_fft_buf[2]
- [kExtendedNumPartitions * PART_LEN1],
- float y_fft[2][PART_LEN1]) {
+static void FilterFarNEON(
+ int num_partitions,
+ int x_fft_buf_block_pos,
+ float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1],
+ float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1],
+ float y_fft[2][PART_LEN1]) {
int i;
for (i = 0; i < num_partitions; i++) {
int j;
diff --git a/modules/audio_processing/aec/aec_core_sse2.cc b/modules/audio_processing/aec/aec_core_sse2.cc
index 0532662..ede04dd 100644
--- a/modules/audio_processing/aec/aec_core_sse2.cc
+++ b/modules/audio_processing/aec/aec_core_sse2.cc
@@ -33,13 +33,12 @@
return aRe * bIm + aIm * bRe;
}
-static void FilterFarSSE2(int num_partitions,
- int x_fft_buf_block_pos,
- float x_fft_buf[2]
- [kExtendedNumPartitions * PART_LEN1],
- float h_fft_buf[2]
- [kExtendedNumPartitions * PART_LEN1],
- float y_fft[2][PART_LEN1]) {
+static void FilterFarSSE2(
+ int num_partitions,
+ int x_fft_buf_block_pos,
+ float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1],
+ float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1],
+ float y_fft[2][PART_LEN1]) {
int i;
for (i = 0; i < num_partitions; i++) {
int j;
@@ -257,10 +256,10 @@
_mm_and_ps(a, *(reinterpret_cast<const __m128*>(float_exponent_mask)));
const __m128 n_1 = _mm_castsi128_ps(_mm_srli_epi32(
_mm_castps_si128(two_n), shift_exponent_into_top_mantissa));
- const __m128 n_0 =
- _mm_or_ps(n_1, *(reinterpret_cast<const __m128*>(eight_biased_exponent)));
- const __m128 n =
- _mm_sub_ps(n_0, *(reinterpret_cast<const __m128*>(implicit_leading_one)));
+ const __m128 n_0 = _mm_or_ps(
+ n_1, *(reinterpret_cast<const __m128*>(eight_biased_exponent)));
+ const __m128 n = _mm_sub_ps(
+ n_0, *(reinterpret_cast<const __m128*>(implicit_leading_one)));
// Compute y.
static const ALIGN16_BEG int mantissa_mask[4] ALIGN16_END = {
@@ -269,9 +268,9 @@
0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000};
const __m128 mantissa =
_mm_and_ps(a, *(reinterpret_cast<const __m128*>(mantissa_mask)));
- const __m128 y =
- _mm_or_ps(mantissa,
- *(reinterpret_cast<const __m128*>(zero_biased_exponent_is_one)));
+ const __m128 y = _mm_or_ps(
+ mantissa,
+ *(reinterpret_cast<const __m128*>(zero_biased_exponent_is_one)));
// Approximate log2(y) ~= (y - 1) * pol5(y).
// pol5(y) = C5 * y^5 + C4 * y^4 + C3 * y^3 + C2 * y^2 + C1 * y + C0
@@ -303,9 +302,8 @@
const __m128 pol5_y_8 = _mm_mul_ps(pol5_y_7, y);
const __m128 pol5_y =
_mm_add_ps(pol5_y_8, *(reinterpret_cast<const __m128*>(C0)));
- const __m128 y_minus_one =
- _mm_sub_ps(y,
- *(reinterpret_cast<const __m128*>(zero_biased_exponent_is_one)));
+ const __m128 y_minus_one = _mm_sub_ps(
+ y, *(reinterpret_cast<const __m128*>(zero_biased_exponent_is_one)));
const __m128 log2_y = _mm_mul_ps(y_minus_one, pol5_y);
// Combine parts.
diff --git a/modules/audio_processing/aec/echo_cancellation.cc b/modules/audio_processing/aec/echo_cancellation.cc
index 1633068..c8382ec 100644
--- a/modules/audio_processing/aec/echo_cancellation.cc
+++ b/modules/audio_processing/aec/echo_cancellation.cc
@@ -291,7 +291,7 @@
aecpc->farend_started = 1;
WebRtcAec_SetSystemDelay(aecpc->aec, WebRtcAec_system_delay(aecpc->aec) +
- static_cast<int>(newNrOfSamples));
+ static_cast<int>(newNrOfSamples));
// Write the time-domain data to |far_pre_buf|.
WebRtc_WriteBuffer(aecpc->far_pre_buf, farend_ptr, newNrOfSamples);
@@ -302,8 +302,8 @@
{
float* ptmp = NULL;
float tmp[PART_LEN2];
- WebRtc_ReadBuffer(aecpc->far_pre_buf,
- reinterpret_cast<void**>(&ptmp), tmp, PART_LEN2);
+ WebRtc_ReadBuffer(aecpc->far_pre_buf, reinterpret_cast<void**>(&ptmp),
+ tmp, PART_LEN2);
WebRtcAec_BufferFarendBlock(aecpc->aec, &ptmp[PART_LEN]);
}
@@ -545,9 +545,9 @@
const float minSkewEst = -0.5f;
const float maxSkewEst = 1.0f;
- reported_delay_ms =
- reported_delay_ms > kMaxTrustedDelayMs ? kMaxTrustedDelayMs :
- reported_delay_ms;
+ reported_delay_ms = reported_delay_ms > kMaxTrustedDelayMs
+ ? kMaxTrustedDelayMs
+ : reported_delay_ms;
// TODO(andrew): we need to investigate if this +10 is really wanted.
reported_delay_ms += 10;
aecInst->msInSndCardBuf = reported_delay_ms;
@@ -642,9 +642,8 @@
// for too long). When the far-end buffer is filled with
// approximately the same amount of data as reported by the system
// we end the startup phase.
- int overhead_elements =
- WebRtcAec_system_delay(aecInst->aec) / PART_LEN -
- aecInst->bufSizeStart;
+ int overhead_elements = WebRtcAec_system_delay(aecInst->aec) / PART_LEN -
+ aecInst->bufSizeStart;
if (overhead_elements == 0) {
// Enable the AEC
aecInst->startup_phase = 0;
@@ -780,10 +779,8 @@
// We use -1 to signal an initialized state in the "extended" implementation;
// compensate for that.
aecInst->filtDelay = aecInst->filtDelay < 0 ? 0 : aecInst->filtDelay;
- aecInst->filtDelay =
- WEBRTC_SPL_MAX(0, static_cast<int16_t>(0.8 *
- aecInst->filtDelay +
- 0.2 * current_delay));
+ aecInst->filtDelay = WEBRTC_SPL_MAX(
+ 0, static_cast<int16_t>(0.8 * aecInst->filtDelay + 0.2 * current_delay));
delay_difference = aecInst->filtDelay - aecInst->knownDelay;
if (delay_difference > 224) {
@@ -809,8 +806,8 @@
}
static void EstBufDelayExtended(Aec* aecInst) {
- int reported_delay = aecInst->msInSndCardBuf * sampMsNb *
- aecInst->rate_factor;
+ int reported_delay =
+ aecInst->msInSndCardBuf * sampMsNb * aecInst->rate_factor;
int current_delay = reported_delay - WebRtcAec_system_delay(aecInst->aec);
int delay_difference = 0;
@@ -839,8 +836,8 @@
aecInst->filtDelay = WEBRTC_SPL_MAX(0, 0.5 * current_delay);
} else {
aecInst->filtDelay = WEBRTC_SPL_MAX(
- 0, static_cast<int16_t>(0.95 * aecInst->filtDelay + 0.05 *
- current_delay));
+ 0,
+ static_cast<int16_t>(0.95 * aecInst->filtDelay + 0.05 * current_delay));
}
delay_difference = aecInst->filtDelay - aecInst->knownDelay;
diff --git a/modules/audio_processing/aec/system_delay_unittest.cc b/modules/audio_processing/aec/system_delay_unittest.cc
index fc57af8..e7e79fe 100644
--- a/modules/audio_processing/aec/system_delay_unittest.cc
+++ b/modules/audio_processing/aec/system_delay_unittest.cc
@@ -104,14 +104,8 @@
void SystemDelayTest::RenderAndCapture(int device_buffer_ms) {
EXPECT_EQ(0, WebRtcAec_BufferFarend(handle_, far_, samples_per_frame_));
- EXPECT_EQ(0,
- WebRtcAec_Process(handle_,
- &near_ptr_,
- 1,
- &out_ptr_,
- samples_per_frame_,
- device_buffer_ms,
- 0));
+ EXPECT_EQ(0, WebRtcAec_Process(handle_, &near_ptr_, 1, &out_ptr_,
+ samples_per_frame_, device_buffer_ms, 0));
}
size_t SystemDelayTest::BufferFillUp() {
@@ -157,16 +151,15 @@
EXPECT_GT(kStableConvergenceMs, process_time_ms);
}
// Verify that the buffer has been flushed.
- EXPECT_GE(static_cast<int>(buffer_size),
- WebRtcAec_system_delay(self_->aec));
+ EXPECT_GE(static_cast<int>(buffer_size), WebRtcAec_system_delay(self_->aec));
}
- int SystemDelayTest::MapBufferSizeToSamples(int size_in_ms,
- bool extended_filter) {
+int SystemDelayTest::MapBufferSizeToSamples(int size_in_ms,
+ bool extended_filter) {
// If extended_filter is disabled we add an extra 10 ms for the unprocessed
// frame. That is simply how the algorithm is constructed.
- return static_cast<int>(
- (size_in_ms + (extended_filter ? 0 : 10)) * samples_per_frame_ / 10);
+ return static_cast<int>((size_in_ms + (extended_filter ? 0 : 10)) *
+ samples_per_frame_ / 10);
}
// The tests should meet basic requirements and not be adjusted to what is
@@ -241,9 +234,9 @@
static_cast<int>(kDeviceBufMs * samples_per_frame_ / 10);
EXPECT_GE(average_reported_delay, WebRtcAec_system_delay(self_->aec));
int lower_bound = WebRtcAec_extended_filter_enabled(self_->aec)
- ? (average_reported_delay / 2 -
- rtc::checked_cast<int>(samples_per_frame_))
- : average_reported_delay * 3 / 4;
+ ? (average_reported_delay / 2 -
+ rtc::checked_cast<int>(samples_per_frame_))
+ : average_reported_delay * 3 / 4;
EXPECT_LE(lower_bound, WebRtcAec_system_delay(self_->aec));
}
}
@@ -322,14 +315,8 @@
// can make that assumption since we have a separate stability test.
int process_time_ms = 0;
for (; process_time_ms < kStableConvergenceMs; process_time_ms += 10) {
- EXPECT_EQ(0,
- WebRtcAec_Process(handle_,
- &near_ptr_,
- 1,
- &out_ptr_,
- samples_per_frame_,
- kDeviceBufMs,
- 0));
+ EXPECT_EQ(0, WebRtcAec_Process(handle_, &near_ptr_, 1, &out_ptr_,
+ samples_per_frame_, kDeviceBufMs, 0));
}
// Verify that a buffer size has been established.
EXPECT_EQ(0, self_->checkBuffSize);
@@ -414,8 +401,8 @@
for (int j = 0; j < 1000; j++) {
// Drift = -1 ms per 100 ms of data.
int device_buf_ms = kDeviceBufMs - (j / 10) + jump;
- int device_buf = MapBufferSizeToSamples(device_buf_ms,
- extended_filter == 1);
+ int device_buf =
+ MapBufferSizeToSamples(device_buf_ms, extended_filter == 1);
if (device_buf_ms < 30) {
// Add 10 ms data, taking affect next frame.
@@ -452,8 +439,8 @@
for (size_t i = 0; i < kNumSampleRates; i++) {
Init(kSampleRateHz[i]);
RunStableStartup();
- int device_buf = MapBufferSizeToSamples(kDeviceBufMs,
- extended_filter == 1);
+ int device_buf =
+ MapBufferSizeToSamples(kDeviceBufMs, extended_filter == 1);
// Glitch state.
for (int j = 0; j < 20; j++) {
EXPECT_EQ(0,
@@ -513,8 +500,8 @@
for (size_t i = 0; i < kNumSampleRates; i++) {
Init(kSampleRateHz[i]);
RunStableStartup();
- int device_buf = MapBufferSizeToSamples(kDeviceBufMs,
- extended_filter == 1);
+ int device_buf =
+ MapBufferSizeToSamples(kDeviceBufMs, extended_filter == 1);
// Normal state. We are currently not in a non-causal state.
bool non_causal = false;
@@ -566,8 +553,8 @@
for (size_t i = 0; i < kNumSampleRates; i++) {
Init(kSampleRateHz[i]);
RunStableStartup();
- const int device_buf = MapBufferSizeToSamples(kDeviceBufMs,
- extended_filter == 1);
+ const int device_buf =
+ MapBufferSizeToSamples(kDeviceBufMs, extended_filter == 1);
// Normal state. We are currently not in a non-causal state.
bool non_causal = false;
diff --git a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
index b075ff5..15717d1 100644
--- a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
+++ b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
@@ -357,9 +357,8 @@
RandomizeSampleVector(&random_generator, n);
static constexpr float kNoiseScaling = 1.f / 100.f;
- std::transform(
- y.begin(), y.end(), n.begin(), y.begin(),
- [](float a, float b) { return a + b * kNoiseScaling; });
+ std::transform(y.begin(), y.end(), n.begin(), y.begin(),
+ [](float a, float b) { return a + b * kNoiseScaling; });
x_hp_filter.Process(x[0]);
y_hp_filter.Process(y);
diff --git a/modules/audio_processing/aec3/aec3_common.cc b/modules/audio_processing/aec3/aec3_common.cc
index 7becce4..8e13055 100644
--- a/modules/audio_processing/aec3/aec3_common.cc
+++ b/modules/audio_processing/aec3/aec3_common.cc
@@ -10,8 +10,8 @@
#include "modules/audio_processing/aec3/aec3_common.h"
-#include "typedefs.h" // NOLINT(build/include)
#include "system_wrappers/include/cpu_features_wrapper.h"
+#include "typedefs.h" // NOLINT(build/include)
namespace webrtc {
diff --git a/modules/audio_processing/aec3/aec_state.cc b/modules/audio_processing/aec3/aec_state.cc
index b32ae3c..20b0580 100644
--- a/modules/audio_processing/aec3/aec_state.cc
+++ b/modules/audio_processing/aec3/aec_state.cc
@@ -387,7 +387,7 @@
} x = {in};
float out = x.a;
out *= 1.1920929e-7f; // 1/2^23
- out -= 126.942695f; // Remove bias.
+ out -= 126.942695f; // Remove bias.
return out;
};
RTC_DCHECK_GT(matching_data.size(), start_index + i);
diff --git a/modules/audio_processing/aec3/block_processor_metrics_unittest.cc b/modules/audio_processing/aec3/block_processor_metrics_unittest.cc
index 7ce8573..73f7689 100644
--- a/modules/audio_processing/aec3/block_processor_metrics_unittest.cc
+++ b/modules/audio_processing/aec3/block_processor_metrics_unittest.cc
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "modules/audio_processing/aec3/aec3_common.h"
#include "modules/audio_processing/aec3/block_processor_metrics.h"
+#include "modules/audio_processing/aec3/aec3_common.h"
#include "test/gtest.h"
diff --git a/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc b/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc
index 841cdfa..0e237a5 100644
--- a/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc
+++ b/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc
@@ -104,9 +104,9 @@
} else {
ADD_FAILURE();
}
+ }
}
}
-}
// Verifies that the delay estimator does not produce delay estimates for render
// signals of low level.
diff --git a/modules/audio_processing/aec3/echo_remover.cc b/modules/audio_processing/aec3/echo_remover.cc
index e264d30..deae3a3 100644
--- a/modules/audio_processing/aec3/echo_remover.cc
+++ b/modules/audio_processing/aec3/echo_remover.cc
@@ -243,8 +243,6 @@
// Estimate the comfort noise.
cng_.Compute(aec_state_, Y2, &comfort_noise, &high_band_comfort_noise);
-
-
// Compute and apply the suppression gain.
suppression_gain_.GetGain(E2, R2, cng_.NoiseSpectrum(), E, X, Y,
render_signal_analyzer_, aec_state_, x,
diff --git a/modules/audio_processing/aec3/echo_remover_metrics_unittest.cc b/modules/audio_processing/aec3/echo_remover_metrics_unittest.cc
index fbd30d1..fb9f151 100644
--- a/modules/audio_processing/aec3/echo_remover_metrics_unittest.cc
+++ b/modules/audio_processing/aec3/echo_remover_metrics_unittest.cc
@@ -12,8 +12,8 @@
#include <math.h>
-#include "modules/audio_processing/aec3/aec_state.h"
#include "modules/audio_processing/aec3/aec3_fft.h"
+#include "modules/audio_processing/aec3/aec_state.h"
#include "test/gtest.h"
namespace webrtc {
@@ -78,23 +78,19 @@
// Verifies that the TransformDbMetricForReporting method is able to properly
// limit the output.
TEST(TransformDbMetricForReporting, Limits) {
- EXPECT_EQ(
- 0,
- aec3::TransformDbMetricForReporting(false, 0.f, 10.f, 0.f, 1.f, 0.001f));
- EXPECT_EQ(
- 10,
- aec3::TransformDbMetricForReporting(false, 0.f, 10.f, 0.f, 1.f, 100.f));
+ EXPECT_EQ(0, aec3::TransformDbMetricForReporting(false, 0.f, 10.f, 0.f, 1.f,
+ 0.001f));
+ EXPECT_EQ(10, aec3::TransformDbMetricForReporting(false, 0.f, 10.f, 0.f, 1.f,
+ 100.f));
}
// Verifies that the TransformDbMetricForReporting method is able to properly
// negate output.
TEST(TransformDbMetricForReporting, Negate) {
- EXPECT_EQ(
- 10,
- aec3::TransformDbMetricForReporting(true, -20.f, 20.f, 0.f, 1.f, 0.1f));
- EXPECT_EQ(
- -10,
- aec3::TransformDbMetricForReporting(true, -20.f, 20.f, 0.f, 1.f, 10.f));
+ EXPECT_EQ(10, aec3::TransformDbMetricForReporting(true, -20.f, 20.f, 0.f, 1.f,
+ 0.1f));
+ EXPECT_EQ(-10, aec3::TransformDbMetricForReporting(true, -20.f, 20.f, 0.f,
+ 1.f, 10.f));
}
// Verify the Update functionality of DbMetric.
diff --git a/modules/audio_processing/aec3/erle_estimator.cc b/modules/audio_processing/aec3/erle_estimator.cc
index 1f0429a..ab6c1c7 100644
--- a/modules/audio_processing/aec3/erle_estimator.cc
+++ b/modules/audio_processing/aec3/erle_estimator.cc
@@ -132,8 +132,8 @@
}
--hold_counter_time_domain_;
erle_time_domain_ = (hold_counter_time_domain_ > 0)
- ? erle_time_domain_
- : std::max(min_erle_, 0.97f * erle_time_domain_);
+ ? erle_time_domain_
+ : std::max(min_erle_, 0.97f * erle_time_domain_);
}
} // namespace webrtc
diff --git a/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc b/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc
index f398b84..ed30799 100644
--- a/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc
+++ b/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc
@@ -241,34 +241,34 @@
// Verifies that the magnitude of the gain on average decreases for a
// persistently exciting signal.
TEST(MainFilterUpdateGain, DecreasingGain) {
- std::vector<int> blocks_with_echo_path_changes;
- std::vector<int> blocks_with_saturation;
+ std::vector<int> blocks_with_echo_path_changes;
+ std::vector<int> blocks_with_saturation;
- std::array<float, kBlockSize> e;
- std::array<float, kBlockSize> y;
- FftData G_a;
- FftData G_b;
- FftData G_c;
- std::array<float, kFftLengthBy2Plus1> G_a_power;
- std::array<float, kFftLengthBy2Plus1> G_b_power;
- std::array<float, kFftLengthBy2Plus1> G_c_power;
+ std::array<float, kBlockSize> e;
+ std::array<float, kBlockSize> y;
+ FftData G_a;
+ FftData G_b;
+ FftData G_c;
+ std::array<float, kFftLengthBy2Plus1> G_a_power;
+ std::array<float, kFftLengthBy2Plus1> G_b_power;
+ std::array<float, kFftLengthBy2Plus1> G_c_power;
- RunFilterUpdateTest(100, 65, 12, blocks_with_echo_path_changes,
- blocks_with_saturation, false, &e, &y, &G_a);
- RunFilterUpdateTest(300, 65, 12, blocks_with_echo_path_changes,
- blocks_with_saturation, false, &e, &y, &G_b);
- RunFilterUpdateTest(600, 65, 12, blocks_with_echo_path_changes,
- blocks_with_saturation, false, &e, &y, &G_c);
+ RunFilterUpdateTest(100, 65, 12, blocks_with_echo_path_changes,
+ blocks_with_saturation, false, &e, &y, &G_a);
+ RunFilterUpdateTest(300, 65, 12, blocks_with_echo_path_changes,
+ blocks_with_saturation, false, &e, &y, &G_b);
+ RunFilterUpdateTest(600, 65, 12, blocks_with_echo_path_changes,
+ blocks_with_saturation, false, &e, &y, &G_c);
- G_a.Spectrum(Aec3Optimization::kNone, G_a_power);
- G_b.Spectrum(Aec3Optimization::kNone, G_b_power);
- G_c.Spectrum(Aec3Optimization::kNone, G_c_power);
+ G_a.Spectrum(Aec3Optimization::kNone, G_a_power);
+ G_b.Spectrum(Aec3Optimization::kNone, G_b_power);
+ G_c.Spectrum(Aec3Optimization::kNone, G_c_power);
- EXPECT_GT(std::accumulate(G_a_power.begin(), G_a_power.end(), 0.),
- std::accumulate(G_b_power.begin(), G_b_power.end(), 0.));
+ EXPECT_GT(std::accumulate(G_a_power.begin(), G_a_power.end(), 0.),
+ std::accumulate(G_b_power.begin(), G_b_power.end(), 0.));
- EXPECT_GT(std::accumulate(G_b_power.begin(), G_b_power.end(), 0.),
- std::accumulate(G_c_power.begin(), G_c_power.end(), 0.));
+ EXPECT_GT(std::accumulate(G_b_power.begin(), G_b_power.end(), 0.),
+ std::accumulate(G_c_power.begin(), G_c_power.end(), 0.));
}
// Verifies that the gain is zero when there is saturation and that the internal
diff --git a/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc b/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc
index 97c7f5b..cea5f13 100644
--- a/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc
+++ b/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc
@@ -6,7 +6,7 @@
* 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 "modules/audio_processing/aec3/matched_filter_lag_aggregator.h"
diff --git a/modules/audio_processing/aec3/matched_filter_unittest.cc b/modules/audio_processing/aec3/matched_filter_unittest.cc
index c3c3a0d..fd878ff 100644
--- a/modules/audio_processing/aec3/matched_filter_unittest.cc
+++ b/modules/audio_processing/aec3/matched_filter_unittest.cc
@@ -6,7 +6,7 @@
* 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 "modules/audio_processing/aec3/matched_filter.h"
diff --git a/modules/audio_processing/aec3/render_buffer.h b/modules/audio_processing/aec3/render_buffer.h
index 9419b30..34e7edf 100644
--- a/modules/audio_processing/aec3/render_buffer.h
+++ b/modules/audio_processing/aec3/render_buffer.h
@@ -82,7 +82,6 @@
return headroom;
}
-
// Returns a reference to the spectrum buffer.
const VectorBuffer& GetSpectrumBuffer() const { return *spectrum_buffer_; }
diff --git a/modules/audio_processing/aec3/residual_echo_estimator.cc b/modules/audio_processing/aec3/residual_echo_estimator.cc
index 85a15e1..ea787a4 100644
--- a/modules/audio_processing/aec3/residual_echo_estimator.cc
+++ b/modules/audio_processing/aec3/residual_echo_estimator.cc
@@ -216,7 +216,6 @@
const std::array<float, kFftLengthBy2Plus1>& X2,
const std::array<float, kFftLengthBy2Plus1>& Y2,
std::array<float, kFftLengthBy2Plus1>* R2) {
-
// Compute preliminary residual echo.
std::transform(X2.begin(), X2.end(), R2->begin(), [echo_path_gain](float a) {
return a * echo_path_gain * echo_path_gain;
diff --git a/modules/audio_processing/aec3/stationarity_estimator.cc b/modules/audio_processing/aec3/stationarity_estimator.cc
index d4e32f5..be04002 100644
--- a/modules/audio_processing/aec3/stationarity_estimator.cc
+++ b/modules/audio_processing/aec3/stationarity_estimator.cc
@@ -86,7 +86,6 @@
}
UpdateHangover();
SmoothStationaryPerFreq();
-
}
bool StationarityEstimator::EstimateBandStationarity(
diff --git a/modules/audio_processing/aec3/subtractor.h b/modules/audio_processing/aec3/subtractor.h
index 38fc3c6..33fdde5 100644
--- a/modules/audio_processing/aec3/subtractor.h
+++ b/modules/audio_processing/aec3/subtractor.h
@@ -11,8 +11,8 @@
#ifndef MODULES_AUDIO_PROCESSING_AEC3_SUBTRACTOR_H_
#define MODULES_AUDIO_PROCESSING_AEC3_SUBTRACTOR_H_
-#include <array>
#include <algorithm>
+#include <array>
#include <vector>
#include "modules/audio_processing/aec3/adaptive_fir_filter.h"
diff --git a/modules/audio_processing/aec3/suppression_gain_unittest.cc b/modules/audio_processing/aec3/suppression_gain_unittest.cc
index 7e5ee9f..4670178 100644
--- a/modules/audio_processing/aec3/suppression_gain_unittest.cc
+++ b/modules/audio_processing/aec3/suppression_gain_unittest.cc
@@ -144,7 +144,6 @@
}
std::for_each(g.begin(), g.end(),
[](float a) { EXPECT_NEAR(0.f, a, 0.001); });
-
}
} // namespace aec3
diff --git a/modules/audio_processing/aec_dump/mock_aec_dump.cc b/modules/audio_processing/aec_dump/mock_aec_dump.cc
index aa89e45..fe35d81 100644
--- a/modules/audio_processing/aec_dump/mock_aec_dump.cc
+++ b/modules/audio_processing/aec_dump/mock_aec_dump.cc
@@ -15,5 +15,5 @@
MockAecDump::MockAecDump() = default;
MockAecDump::~MockAecDump() = default;
-}
-}
+} // namespace test
+} // namespace webrtc
diff --git a/modules/audio_processing/aecm/aecm_core.cc b/modules/audio_processing/aecm/aecm_core.cc
index 3d9faca..21a2ba1 100644
--- a/modules/audio_processing/aecm/aecm_core.cc
+++ b/modules/audio_processing/aecm/aecm_core.cc
@@ -28,126 +28,97 @@
#include "typedefs.h" // NOLINT(build/include)
#ifdef AEC_DEBUG
-FILE *dfile;
-FILE *testfile;
+FILE* dfile;
+FILE* testfile;
#endif
const int16_t WebRtcAecm_kCosTable[] = {
- 8192, 8190, 8187, 8180, 8172, 8160, 8147, 8130, 8112,
- 8091, 8067, 8041, 8012, 7982, 7948, 7912, 7874, 7834,
- 7791, 7745, 7697, 7647, 7595, 7540, 7483, 7424, 7362,
- 7299, 7233, 7164, 7094, 7021, 6947, 6870, 6791, 6710,
- 6627, 6542, 6455, 6366, 6275, 6182, 6087, 5991, 5892,
- 5792, 5690, 5586, 5481, 5374, 5265, 5155, 5043, 4930,
- 4815, 4698, 4580, 4461, 4341, 4219, 4096, 3971, 3845,
- 3719, 3591, 3462, 3331, 3200, 3068, 2935, 2801, 2667,
- 2531, 2395, 2258, 2120, 1981, 1842, 1703, 1563, 1422,
- 1281, 1140, 998, 856, 713, 571, 428, 285, 142,
- 0, -142, -285, -428, -571, -713, -856, -998, -1140,
- -1281, -1422, -1563, -1703, -1842, -1981, -2120, -2258, -2395,
- -2531, -2667, -2801, -2935, -3068, -3200, -3331, -3462, -3591,
- -3719, -3845, -3971, -4095, -4219, -4341, -4461, -4580, -4698,
- -4815, -4930, -5043, -5155, -5265, -5374, -5481, -5586, -5690,
- -5792, -5892, -5991, -6087, -6182, -6275, -6366, -6455, -6542,
- -6627, -6710, -6791, -6870, -6947, -7021, -7094, -7164, -7233,
- -7299, -7362, -7424, -7483, -7540, -7595, -7647, -7697, -7745,
- -7791, -7834, -7874, -7912, -7948, -7982, -8012, -8041, -8067,
- -8091, -8112, -8130, -8147, -8160, -8172, -8180, -8187, -8190,
- -8191, -8190, -8187, -8180, -8172, -8160, -8147, -8130, -8112,
- -8091, -8067, -8041, -8012, -7982, -7948, -7912, -7874, -7834,
- -7791, -7745, -7697, -7647, -7595, -7540, -7483, -7424, -7362,
- -7299, -7233, -7164, -7094, -7021, -6947, -6870, -6791, -6710,
- -6627, -6542, -6455, -6366, -6275, -6182, -6087, -5991, -5892,
- -5792, -5690, -5586, -5481, -5374, -5265, -5155, -5043, -4930,
- -4815, -4698, -4580, -4461, -4341, -4219, -4096, -3971, -3845,
- -3719, -3591, -3462, -3331, -3200, -3068, -2935, -2801, -2667,
- -2531, -2395, -2258, -2120, -1981, -1842, -1703, -1563, -1422,
- -1281, -1140, -998, -856, -713, -571, -428, -285, -142,
- 0, 142, 285, 428, 571, 713, 856, 998, 1140,
- 1281, 1422, 1563, 1703, 1842, 1981, 2120, 2258, 2395,
- 2531, 2667, 2801, 2935, 3068, 3200, 3331, 3462, 3591,
- 3719, 3845, 3971, 4095, 4219, 4341, 4461, 4580, 4698,
- 4815, 4930, 5043, 5155, 5265, 5374, 5481, 5586, 5690,
- 5792, 5892, 5991, 6087, 6182, 6275, 6366, 6455, 6542,
- 6627, 6710, 6791, 6870, 6947, 7021, 7094, 7164, 7233,
- 7299, 7362, 7424, 7483, 7540, 7595, 7647, 7697, 7745,
- 7791, 7834, 7874, 7912, 7948, 7982, 8012, 8041, 8067,
- 8091, 8112, 8130, 8147, 8160, 8172, 8180, 8187, 8190
-};
+ 8192, 8190, 8187, 8180, 8172, 8160, 8147, 8130, 8112, 8091, 8067,
+ 8041, 8012, 7982, 7948, 7912, 7874, 7834, 7791, 7745, 7697, 7647,
+ 7595, 7540, 7483, 7424, 7362, 7299, 7233, 7164, 7094, 7021, 6947,
+ 6870, 6791, 6710, 6627, 6542, 6455, 6366, 6275, 6182, 6087, 5991,
+ 5892, 5792, 5690, 5586, 5481, 5374, 5265, 5155, 5043, 4930, 4815,
+ 4698, 4580, 4461, 4341, 4219, 4096, 3971, 3845, 3719, 3591, 3462,
+ 3331, 3200, 3068, 2935, 2801, 2667, 2531, 2395, 2258, 2120, 1981,
+ 1842, 1703, 1563, 1422, 1281, 1140, 998, 856, 713, 571, 428,
+ 285, 142, 0, -142, -285, -428, -571, -713, -856, -998, -1140,
+ -1281, -1422, -1563, -1703, -1842, -1981, -2120, -2258, -2395, -2531, -2667,
+ -2801, -2935, -3068, -3200, -3331, -3462, -3591, -3719, -3845, -3971, -4095,
+ -4219, -4341, -4461, -4580, -4698, -4815, -4930, -5043, -5155, -5265, -5374,
+ -5481, -5586, -5690, -5792, -5892, -5991, -6087, -6182, -6275, -6366, -6455,
+ -6542, -6627, -6710, -6791, -6870, -6947, -7021, -7094, -7164, -7233, -7299,
+ -7362, -7424, -7483, -7540, -7595, -7647, -7697, -7745, -7791, -7834, -7874,
+ -7912, -7948, -7982, -8012, -8041, -8067, -8091, -8112, -8130, -8147, -8160,
+ -8172, -8180, -8187, -8190, -8191, -8190, -8187, -8180, -8172, -8160, -8147,
+ -8130, -8112, -8091, -8067, -8041, -8012, -7982, -7948, -7912, -7874, -7834,
+ -7791, -7745, -7697, -7647, -7595, -7540, -7483, -7424, -7362, -7299, -7233,
+ -7164, -7094, -7021, -6947, -6870, -6791, -6710, -6627, -6542, -6455, -6366,
+ -6275, -6182, -6087, -5991, -5892, -5792, -5690, -5586, -5481, -5374, -5265,
+ -5155, -5043, -4930, -4815, -4698, -4580, -4461, -4341, -4219, -4096, -3971,
+ -3845, -3719, -3591, -3462, -3331, -3200, -3068, -2935, -2801, -2667, -2531,
+ -2395, -2258, -2120, -1981, -1842, -1703, -1563, -1422, -1281, -1140, -998,
+ -856, -713, -571, -428, -285, -142, 0, 142, 285, 428, 571,
+ 713, 856, 998, 1140, 1281, 1422, 1563, 1703, 1842, 1981, 2120,
+ 2258, 2395, 2531, 2667, 2801, 2935, 3068, 3200, 3331, 3462, 3591,
+ 3719, 3845, 3971, 4095, 4219, 4341, 4461, 4580, 4698, 4815, 4930,
+ 5043, 5155, 5265, 5374, 5481, 5586, 5690, 5792, 5892, 5991, 6087,
+ 6182, 6275, 6366, 6455, 6542, 6627, 6710, 6791, 6870, 6947, 7021,
+ 7094, 7164, 7233, 7299, 7362, 7424, 7483, 7540, 7595, 7647, 7697,
+ 7745, 7791, 7834, 7874, 7912, 7948, 7982, 8012, 8041, 8067, 8091,
+ 8112, 8130, 8147, 8160, 8172, 8180, 8187, 8190};
const int16_t WebRtcAecm_kSinTable[] = {
- 0, 142, 285, 428, 571, 713, 856, 998,
- 1140, 1281, 1422, 1563, 1703, 1842, 1981, 2120,
- 2258, 2395, 2531, 2667, 2801, 2935, 3068, 3200,
- 3331, 3462, 3591, 3719, 3845, 3971, 4095, 4219,
- 4341, 4461, 4580, 4698, 4815, 4930, 5043, 5155,
- 5265, 5374, 5481, 5586, 5690, 5792, 5892, 5991,
- 6087, 6182, 6275, 6366, 6455, 6542, 6627, 6710,
- 6791, 6870, 6947, 7021, 7094, 7164, 7233, 7299,
- 7362, 7424, 7483, 7540, 7595, 7647, 7697, 7745,
- 7791, 7834, 7874, 7912, 7948, 7982, 8012, 8041,
- 8067, 8091, 8112, 8130, 8147, 8160, 8172, 8180,
- 8187, 8190, 8191, 8190, 8187, 8180, 8172, 8160,
- 8147, 8130, 8112, 8091, 8067, 8041, 8012, 7982,
- 7948, 7912, 7874, 7834, 7791, 7745, 7697, 7647,
- 7595, 7540, 7483, 7424, 7362, 7299, 7233, 7164,
- 7094, 7021, 6947, 6870, 6791, 6710, 6627, 6542,
- 6455, 6366, 6275, 6182, 6087, 5991, 5892, 5792,
- 5690, 5586, 5481, 5374, 5265, 5155, 5043, 4930,
- 4815, 4698, 4580, 4461, 4341, 4219, 4096, 3971,
- 3845, 3719, 3591, 3462, 3331, 3200, 3068, 2935,
- 2801, 2667, 2531, 2395, 2258, 2120, 1981, 1842,
- 1703, 1563, 1422, 1281, 1140, 998, 856, 713,
- 571, 428, 285, 142, 0, -142, -285, -428,
- -571, -713, -856, -998, -1140, -1281, -1422, -1563,
- -1703, -1842, -1981, -2120, -2258, -2395, -2531, -2667,
- -2801, -2935, -3068, -3200, -3331, -3462, -3591, -3719,
- -3845, -3971, -4095, -4219, -4341, -4461, -4580, -4698,
- -4815, -4930, -5043, -5155, -5265, -5374, -5481, -5586,
- -5690, -5792, -5892, -5991, -6087, -6182, -6275, -6366,
- -6455, -6542, -6627, -6710, -6791, -6870, -6947, -7021,
- -7094, -7164, -7233, -7299, -7362, -7424, -7483, -7540,
- -7595, -7647, -7697, -7745, -7791, -7834, -7874, -7912,
- -7948, -7982, -8012, -8041, -8067, -8091, -8112, -8130,
- -8147, -8160, -8172, -8180, -8187, -8190, -8191, -8190,
- -8187, -8180, -8172, -8160, -8147, -8130, -8112, -8091,
- -8067, -8041, -8012, -7982, -7948, -7912, -7874, -7834,
- -7791, -7745, -7697, -7647, -7595, -7540, -7483, -7424,
- -7362, -7299, -7233, -7164, -7094, -7021, -6947, -6870,
- -6791, -6710, -6627, -6542, -6455, -6366, -6275, -6182,
- -6087, -5991, -5892, -5792, -5690, -5586, -5481, -5374,
- -5265, -5155, -5043, -4930, -4815, -4698, -4580, -4461,
- -4341, -4219, -4096, -3971, -3845, -3719, -3591, -3462,
- -3331, -3200, -3068, -2935, -2801, -2667, -2531, -2395,
- -2258, -2120, -1981, -1842, -1703, -1563, -1422, -1281,
- -1140, -998, -856, -713, -571, -428, -285, -142
-};
+ 0, 142, 285, 428, 571, 713, 856, 998, 1140, 1281, 1422,
+ 1563, 1703, 1842, 1981, 2120, 2258, 2395, 2531, 2667, 2801, 2935,
+ 3068, 3200, 3331, 3462, 3591, 3719, 3845, 3971, 4095, 4219, 4341,
+ 4461, 4580, 4698, 4815, 4930, 5043, 5155, 5265, 5374, 5481, 5586,
+ 5690, 5792, 5892, 5991, 6087, 6182, 6275, 6366, 6455, 6542, 6627,
+ 6710, 6791, 6870, 6947, 7021, 7094, 7164, 7233, 7299, 7362, 7424,
+ 7483, 7540, 7595, 7647, 7697, 7745, 7791, 7834, 7874, 7912, 7948,
+ 7982, 8012, 8041, 8067, 8091, 8112, 8130, 8147, 8160, 8172, 8180,
+ 8187, 8190, 8191, 8190, 8187, 8180, 8172, 8160, 8147, 8130, 8112,
+ 8091, 8067, 8041, 8012, 7982, 7948, 7912, 7874, 7834, 7791, 7745,
+ 7697, 7647, 7595, 7540, 7483, 7424, 7362, 7299, 7233, 7164, 7094,
+ 7021, 6947, 6870, 6791, 6710, 6627, 6542, 6455, 6366, 6275, 6182,
+ 6087, 5991, 5892, 5792, 5690, 5586, 5481, 5374, 5265, 5155, 5043,
+ 4930, 4815, 4698, 4580, 4461, 4341, 4219, 4096, 3971, 3845, 3719,
+ 3591, 3462, 3331, 3200, 3068, 2935, 2801, 2667, 2531, 2395, 2258,
+ 2120, 1981, 1842, 1703, 1563, 1422, 1281, 1140, 998, 856, 713,
+ 571, 428, 285, 142, 0, -142, -285, -428, -571, -713, -856,
+ -998, -1140, -1281, -1422, -1563, -1703, -1842, -1981, -2120, -2258, -2395,
+ -2531, -2667, -2801, -2935, -3068, -3200, -3331, -3462, -3591, -3719, -3845,
+ -3971, -4095, -4219, -4341, -4461, -4580, -4698, -4815, -4930, -5043, -5155,
+ -5265, -5374, -5481, -5586, -5690, -5792, -5892, -5991, -6087, -6182, -6275,
+ -6366, -6455, -6542, -6627, -6710, -6791, -6870, -6947, -7021, -7094, -7164,
+ -7233, -7299, -7362, -7424, -7483, -7540, -7595, -7647, -7697, -7745, -7791,
+ -7834, -7874, -7912, -7948, -7982, -8012, -8041, -8067, -8091, -8112, -8130,
+ -8147, -8160, -8172, -8180, -8187, -8190, -8191, -8190, -8187, -8180, -8172,
+ -8160, -8147, -8130, -8112, -8091, -8067, -8041, -8012, -7982, -7948, -7912,
+ -7874, -7834, -7791, -7745, -7697, -7647, -7595, -7540, -7483, -7424, -7362,
+ -7299, -7233, -7164, -7094, -7021, -6947, -6870, -6791, -6710, -6627, -6542,
+ -6455, -6366, -6275, -6182, -6087, -5991, -5892, -5792, -5690, -5586, -5481,
+ -5374, -5265, -5155, -5043, -4930, -4815, -4698, -4580, -4461, -4341, -4219,
+ -4096, -3971, -3845, -3719, -3591, -3462, -3331, -3200, -3068, -2935, -2801,
+ -2667, -2531, -2395, -2258, -2120, -1981, -1842, -1703, -1563, -1422, -1281,
+ -1140, -998, -856, -713, -571, -428, -285, -142};
// Initialization table for echo channel in 8 kHz
static const int16_t kChannelStored8kHz[PART_LEN1] = {
- 2040, 1815, 1590, 1498, 1405, 1395, 1385, 1418,
- 1451, 1506, 1562, 1644, 1726, 1804, 1882, 1918,
- 1953, 1982, 2010, 2025, 2040, 2034, 2027, 2021,
- 2014, 1997, 1980, 1925, 1869, 1800, 1732, 1683,
- 1635, 1604, 1572, 1545, 1517, 1481, 1444, 1405,
- 1367, 1331, 1294, 1270, 1245, 1239, 1233, 1247,
- 1260, 1282, 1303, 1338, 1373, 1407, 1441, 1470,
- 1499, 1524, 1549, 1565, 1582, 1601, 1621, 1649,
- 1676
-};
+ 2040, 1815, 1590, 1498, 1405, 1395, 1385, 1418, 1451, 1506, 1562,
+ 1644, 1726, 1804, 1882, 1918, 1953, 1982, 2010, 2025, 2040, 2034,
+ 2027, 2021, 2014, 1997, 1980, 1925, 1869, 1800, 1732, 1683, 1635,
+ 1604, 1572, 1545, 1517, 1481, 1444, 1405, 1367, 1331, 1294, 1270,
+ 1245, 1239, 1233, 1247, 1260, 1282, 1303, 1338, 1373, 1407, 1441,
+ 1470, 1499, 1524, 1549, 1565, 1582, 1601, 1621, 1649, 1676};
// Initialization table for echo channel in 16 kHz
static const int16_t kChannelStored16kHz[PART_LEN1] = {
- 2040, 1590, 1405, 1385, 1451, 1562, 1726, 1882,
- 1953, 2010, 2040, 2027, 2014, 1980, 1869, 1732,
- 1635, 1572, 1517, 1444, 1367, 1294, 1245, 1233,
- 1260, 1303, 1373, 1441, 1499, 1549, 1582, 1621,
- 1676, 1741, 1802, 1861, 1921, 1983, 2040, 2102,
- 2170, 2265, 2375, 2515, 2651, 2781, 2922, 3075,
- 3253, 3471, 3738, 3976, 4151, 4258, 4308, 4288,
- 4270, 4253, 4237, 4179, 4086, 3947, 3757, 3484,
- 3153
-};
+ 2040, 1590, 1405, 1385, 1451, 1562, 1726, 1882, 1953, 2010, 2040,
+ 2027, 2014, 1980, 1869, 1732, 1635, 1572, 1517, 1444, 1367, 1294,
+ 1245, 1233, 1260, 1303, 1373, 1441, 1499, 1549, 1582, 1621, 1676,
+ 1741, 1802, 1861, 1921, 1983, 2040, 2102, 2170, 2265, 2375, 2515,
+ 2651, 2781, 2922, 3075, 3253, 3471, 3738, 3976, 4151, 4258, 4308,
+ 4288, 4270, 4253, 4237, 4179, 4086, 3947, 3757, 3484, 3153};
// Moves the pointer to the next entry and inserts |far_spectrum| and
// corresponding Q-domain in its buffer.
@@ -168,8 +139,7 @@
// Update Q-domain buffer
self->far_q_domains[self->far_history_pos] = far_q;
// Update far end spectrum buffer
- memcpy(&(self->far_history[self->far_history_pos * PART_LEN1]),
- far_spectrum,
+ memcpy(&(self->far_history[self->far_history_pos * PART_LEN1]), far_spectrum,
sizeof(uint16_t) * PART_LEN1);
}
@@ -213,95 +183,90 @@
ResetAdaptiveChannel WebRtcAecm_ResetAdaptiveChannel;
AecmCore* WebRtcAecm_CreateCore() {
- AecmCore* aecm = static_cast<AecmCore*>(malloc(sizeof(AecmCore)));
+ AecmCore* aecm = static_cast<AecmCore*>(malloc(sizeof(AecmCore)));
- aecm->farFrameBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN,
- sizeof(int16_t));
- if (!aecm->farFrameBuf)
- {
- WebRtcAecm_FreeCore(aecm);
- return NULL;
- }
+ aecm->farFrameBuf =
+ WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(int16_t));
+ if (!aecm->farFrameBuf) {
+ WebRtcAecm_FreeCore(aecm);
+ return NULL;
+ }
- aecm->nearNoisyFrameBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN,
- sizeof(int16_t));
- if (!aecm->nearNoisyFrameBuf)
- {
- WebRtcAecm_FreeCore(aecm);
- return NULL;
- }
+ aecm->nearNoisyFrameBuf =
+ WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(int16_t));
+ if (!aecm->nearNoisyFrameBuf) {
+ WebRtcAecm_FreeCore(aecm);
+ return NULL;
+ }
- aecm->nearCleanFrameBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN,
- sizeof(int16_t));
- if (!aecm->nearCleanFrameBuf)
- {
- WebRtcAecm_FreeCore(aecm);
- return NULL;
- }
+ aecm->nearCleanFrameBuf =
+ WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(int16_t));
+ if (!aecm->nearCleanFrameBuf) {
+ WebRtcAecm_FreeCore(aecm);
+ return NULL;
+ }
- aecm->outFrameBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN,
- sizeof(int16_t));
- if (!aecm->outFrameBuf)
- {
- WebRtcAecm_FreeCore(aecm);
- return NULL;
- }
+ aecm->outFrameBuf =
+ WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(int16_t));
+ if (!aecm->outFrameBuf) {
+ WebRtcAecm_FreeCore(aecm);
+ return NULL;
+ }
- aecm->delay_estimator_farend = WebRtc_CreateDelayEstimatorFarend(PART_LEN1,
- MAX_DELAY);
- if (aecm->delay_estimator_farend == NULL) {
- WebRtcAecm_FreeCore(aecm);
- return NULL;
- }
- aecm->delay_estimator =
- WebRtc_CreateDelayEstimator(aecm->delay_estimator_farend, 0);
- if (aecm->delay_estimator == NULL) {
- WebRtcAecm_FreeCore(aecm);
- return NULL;
- }
- // TODO(bjornv): Explicitly disable robust delay validation until no
- // performance regression has been established. Then remove the line.
- WebRtc_enable_robust_validation(aecm->delay_estimator, 0);
+ aecm->delay_estimator_farend =
+ WebRtc_CreateDelayEstimatorFarend(PART_LEN1, MAX_DELAY);
+ if (aecm->delay_estimator_farend == NULL) {
+ WebRtcAecm_FreeCore(aecm);
+ return NULL;
+ }
+ aecm->delay_estimator =
+ WebRtc_CreateDelayEstimator(aecm->delay_estimator_farend, 0);
+ if (aecm->delay_estimator == NULL) {
+ WebRtcAecm_FreeCore(aecm);
+ return NULL;
+ }
+ // TODO(bjornv): Explicitly disable robust delay validation until no
+ // performance regression has been established. Then remove the line.
+ WebRtc_enable_robust_validation(aecm->delay_estimator, 0);
- aecm->real_fft = WebRtcSpl_CreateRealFFT(PART_LEN_SHIFT);
- if (aecm->real_fft == NULL) {
- WebRtcAecm_FreeCore(aecm);
- return NULL;
- }
+ aecm->real_fft = WebRtcSpl_CreateRealFFT(PART_LEN_SHIFT);
+ if (aecm->real_fft == NULL) {
+ WebRtcAecm_FreeCore(aecm);
+ return NULL;
+ }
- // Init some aecm pointers. 16 and 32 byte alignment is only necessary
- // for Neon code currently.
- aecm->xBuf = (int16_t*) (((uintptr_t)aecm->xBuf_buf + 31) & ~ 31);
- aecm->dBufClean = (int16_t*) (((uintptr_t)aecm->dBufClean_buf + 31) & ~ 31);
- aecm->dBufNoisy = (int16_t*) (((uintptr_t)aecm->dBufNoisy_buf + 31) & ~ 31);
- aecm->outBuf = (int16_t*) (((uintptr_t)aecm->outBuf_buf + 15) & ~ 15);
- aecm->channelStored = (int16_t*) (((uintptr_t)
- aecm->channelStored_buf + 15) & ~ 15);
- aecm->channelAdapt16 = (int16_t*) (((uintptr_t)
- aecm->channelAdapt16_buf + 15) & ~ 15);
- aecm->channelAdapt32 = (int32_t*) (((uintptr_t)
- aecm->channelAdapt32_buf + 31) & ~ 31);
+ // Init some aecm pointers. 16 and 32 byte alignment is only necessary
+ // for Neon code currently.
+ aecm->xBuf = (int16_t*)(((uintptr_t)aecm->xBuf_buf + 31) & ~31);
+ aecm->dBufClean = (int16_t*)(((uintptr_t)aecm->dBufClean_buf + 31) & ~31);
+ aecm->dBufNoisy = (int16_t*)(((uintptr_t)aecm->dBufNoisy_buf + 31) & ~31);
+ aecm->outBuf = (int16_t*)(((uintptr_t)aecm->outBuf_buf + 15) & ~15);
+ aecm->channelStored =
+ (int16_t*)(((uintptr_t)aecm->channelStored_buf + 15) & ~15);
+ aecm->channelAdapt16 =
+ (int16_t*)(((uintptr_t)aecm->channelAdapt16_buf + 15) & ~15);
+ aecm->channelAdapt32 =
+ (int32_t*)(((uintptr_t)aecm->channelAdapt32_buf + 31) & ~31);
- return aecm;
+ return aecm;
}
void WebRtcAecm_InitEchoPathCore(AecmCore* aecm, const int16_t* echo_path) {
- int i = 0;
+ int i = 0;
- // Reset the stored channel
- memcpy(aecm->channelStored, echo_path, sizeof(int16_t) * PART_LEN1);
- // Reset the adapted channels
- memcpy(aecm->channelAdapt16, echo_path, sizeof(int16_t) * PART_LEN1);
- for (i = 0; i < PART_LEN1; i++)
- {
- aecm->channelAdapt32[i] = (int32_t)aecm->channelAdapt16[i] << 16;
- }
+ // Reset the stored channel
+ memcpy(aecm->channelStored, echo_path, sizeof(int16_t) * PART_LEN1);
+ // Reset the adapted channels
+ memcpy(aecm->channelAdapt16, echo_path, sizeof(int16_t) * PART_LEN1);
+ for (i = 0; i < PART_LEN1; i++) {
+ aecm->channelAdapt32[i] = (int32_t)aecm->channelAdapt16[i] << 16;
+ }
- // Reset channel storing variables
- aecm->mseAdaptOld = 1000;
- aecm->mseStoredOld = 1000;
- aecm->mseThreshold = WEBRTC_SPL_WORD32_MAX;
- aecm->mseChannelCount = 0;
+ // Reset channel storing variables
+ aecm->mseAdaptOld = 1000;
+ aecm->mseStoredOld = 1000;
+ aecm->mseThreshold = WEBRTC_SPL_WORD32_MAX;
+ aecm->mseChannelCount = 0;
}
static void CalcLinearEnergiesC(AecmCore* aecm,
@@ -310,65 +275,61 @@
uint32_t* far_energy,
uint32_t* echo_energy_adapt,
uint32_t* echo_energy_stored) {
- int i;
+ int i;
- // Get energy for the delayed far end signal and estimated
- // echo using both stored and adapted channels.
- for (i = 0; i < PART_LEN1; i++)
- {
- echo_est[i] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i],
- far_spectrum[i]);
- (*far_energy) += (uint32_t)(far_spectrum[i]);
- *echo_energy_adapt += aecm->channelAdapt16[i] * far_spectrum[i];
- (*echo_energy_stored) += (uint32_t)echo_est[i];
- }
+ // Get energy for the delayed far end signal and estimated
+ // echo using both stored and adapted channels.
+ for (i = 0; i < PART_LEN1; i++) {
+ echo_est[i] =
+ WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i], far_spectrum[i]);
+ (*far_energy) += (uint32_t)(far_spectrum[i]);
+ *echo_energy_adapt += aecm->channelAdapt16[i] * far_spectrum[i];
+ (*echo_energy_stored) += (uint32_t)echo_est[i];
+ }
}
static void StoreAdaptiveChannelC(AecmCore* aecm,
const uint16_t* far_spectrum,
int32_t* echo_est) {
- int i;
+ int i;
- // During startup we store the channel every block.
- memcpy(aecm->channelStored, aecm->channelAdapt16, sizeof(int16_t) * PART_LEN1);
- // Recalculate echo estimate
- for (i = 0; i < PART_LEN; i += 4)
- {
- echo_est[i] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i],
- far_spectrum[i]);
- echo_est[i + 1] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i + 1],
- far_spectrum[i + 1]);
- echo_est[i + 2] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i + 2],
- far_spectrum[i + 2]);
- echo_est[i + 3] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i + 3],
- far_spectrum[i + 3]);
- }
- echo_est[i] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i],
- far_spectrum[i]);
+ // During startup we store the channel every block.
+ memcpy(aecm->channelStored, aecm->channelAdapt16,
+ sizeof(int16_t) * PART_LEN1);
+ // Recalculate echo estimate
+ for (i = 0; i < PART_LEN; i += 4) {
+ echo_est[i] =
+ WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i], far_spectrum[i]);
+ echo_est[i + 1] =
+ WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i + 1], far_spectrum[i + 1]);
+ echo_est[i + 2] =
+ WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i + 2], far_spectrum[i + 2]);
+ echo_est[i + 3] =
+ WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i + 3], far_spectrum[i + 3]);
+ }
+ echo_est[i] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i], far_spectrum[i]);
}
static void ResetAdaptiveChannelC(AecmCore* aecm) {
- int i;
+ int i;
- // The stored channel has a significantly lower MSE than the adaptive one for
- // two consecutive calculations. Reset the adaptive channel.
- memcpy(aecm->channelAdapt16, aecm->channelStored,
- sizeof(int16_t) * PART_LEN1);
- // Restore the W32 channel
- for (i = 0; i < PART_LEN; i += 4)
- {
- aecm->channelAdapt32[i] = (int32_t)aecm->channelStored[i] << 16;
- aecm->channelAdapt32[i + 1] = (int32_t)aecm->channelStored[i + 1] << 16;
- aecm->channelAdapt32[i + 2] = (int32_t)aecm->channelStored[i + 2] << 16;
- aecm->channelAdapt32[i + 3] = (int32_t)aecm->channelStored[i + 3] << 16;
- }
+ // The stored channel has a significantly lower MSE than the adaptive one for
+ // two consecutive calculations. Reset the adaptive channel.
+ memcpy(aecm->channelAdapt16, aecm->channelStored,
+ sizeof(int16_t) * PART_LEN1);
+ // Restore the W32 channel
+ for (i = 0; i < PART_LEN; i += 4) {
aecm->channelAdapt32[i] = (int32_t)aecm->channelStored[i] << 16;
+ aecm->channelAdapt32[i + 1] = (int32_t)aecm->channelStored[i + 1] << 16;
+ aecm->channelAdapt32[i + 2] = (int32_t)aecm->channelStored[i + 2] << 16;
+ aecm->channelAdapt32[i + 3] = (int32_t)aecm->channelStored[i + 3] << 16;
+ }
+ aecm->channelAdapt32[i] = (int32_t)aecm->channelStored[i] << 16;
}
// Initialize function pointers for ARM Neon platform.
#if defined(WEBRTC_HAS_NEON)
-static void WebRtcAecm_InitNeon(void)
-{
+static void WebRtcAecm_InitNeon(void) {
WebRtcAecm_StoreAdaptiveChannel = WebRtcAecm_StoreAdaptiveChannelNeon;
WebRtcAecm_ResetAdaptiveChannel = WebRtcAecm_ResetAdaptiveChannelNeon;
WebRtcAecm_CalcLinearEnergies = WebRtcAecm_CalcLinearEnergiesNeon;
@@ -377,8 +338,7 @@
// Initialize function pointers for MIPS platform.
#if defined(MIPS32_LE)
-static void WebRtcAecm_InitMips(void)
-{
+static void WebRtcAecm_InitMips(void) {
#if defined(MIPS_DSP_R1_LE)
WebRtcAecm_StoreAdaptiveChannel = WebRtcAecm_StoreAdaptiveChannel_mips;
WebRtcAecm_ResetAdaptiveChannel = WebRtcAecm_ResetAdaptiveChannel_mips;
@@ -389,8 +349,8 @@
// WebRtcAecm_InitCore(...)
//
-// This function initializes the AECM instant created with WebRtcAecm_CreateCore(...)
-// Input:
+// This function initializes the AECM instant created with
+// WebRtcAecm_CreateCore(...) Input:
// - aecm : Pointer to the Echo Suppression instance
// - samplingFreq : Sampling Frequency
//
@@ -401,152 +361,147 @@
// -1 - Error
//
int WebRtcAecm_InitCore(AecmCore* const aecm, int samplingFreq) {
- int i = 0;
- int32_t tmp32 = PART_LEN1 * PART_LEN1;
- int16_t tmp16 = PART_LEN1;
+ int i = 0;
+ int32_t tmp32 = PART_LEN1 * PART_LEN1;
+ int16_t tmp16 = PART_LEN1;
- if (samplingFreq != 8000 && samplingFreq != 16000)
- {
- samplingFreq = 8000;
- return -1;
- }
- // sanity check of sampling frequency
- aecm->mult = (int16_t)samplingFreq / 8000;
+ if (samplingFreq != 8000 && samplingFreq != 16000) {
+ samplingFreq = 8000;
+ return -1;
+ }
+ // sanity check of sampling frequency
+ aecm->mult = (int16_t)samplingFreq / 8000;
- aecm->farBufWritePos = 0;
- aecm->farBufReadPos = 0;
- aecm->knownDelay = 0;
- aecm->lastKnownDelay = 0;
+ aecm->farBufWritePos = 0;
+ aecm->farBufReadPos = 0;
+ aecm->knownDelay = 0;
+ aecm->lastKnownDelay = 0;
- WebRtc_InitBuffer(aecm->farFrameBuf);
- WebRtc_InitBuffer(aecm->nearNoisyFrameBuf);
- WebRtc_InitBuffer(aecm->nearCleanFrameBuf);
- WebRtc_InitBuffer(aecm->outFrameBuf);
+ WebRtc_InitBuffer(aecm->farFrameBuf);
+ WebRtc_InitBuffer(aecm->nearNoisyFrameBuf);
+ WebRtc_InitBuffer(aecm->nearCleanFrameBuf);
+ WebRtc_InitBuffer(aecm->outFrameBuf);
- memset(aecm->xBuf_buf, 0, sizeof(aecm->xBuf_buf));
- memset(aecm->dBufClean_buf, 0, sizeof(aecm->dBufClean_buf));
- memset(aecm->dBufNoisy_buf, 0, sizeof(aecm->dBufNoisy_buf));
- memset(aecm->outBuf_buf, 0, sizeof(aecm->outBuf_buf));
+ memset(aecm->xBuf_buf, 0, sizeof(aecm->xBuf_buf));
+ memset(aecm->dBufClean_buf, 0, sizeof(aecm->dBufClean_buf));
+ memset(aecm->dBufNoisy_buf, 0, sizeof(aecm->dBufNoisy_buf));
+ memset(aecm->outBuf_buf, 0, sizeof(aecm->outBuf_buf));
- aecm->seed = 666;
- aecm->totCount = 0;
+ aecm->seed = 666;
+ aecm->totCount = 0;
- if (WebRtc_InitDelayEstimatorFarend(aecm->delay_estimator_farend) != 0) {
- return -1;
- }
- if (WebRtc_InitDelayEstimator(aecm->delay_estimator) != 0) {
- return -1;
- }
- // Set far end histories to zero
- memset(aecm->far_history, 0, sizeof(uint16_t) * PART_LEN1 * MAX_DELAY);
- memset(aecm->far_q_domains, 0, sizeof(int) * MAX_DELAY);
- aecm->far_history_pos = MAX_DELAY;
+ if (WebRtc_InitDelayEstimatorFarend(aecm->delay_estimator_farend) != 0) {
+ return -1;
+ }
+ if (WebRtc_InitDelayEstimator(aecm->delay_estimator) != 0) {
+ return -1;
+ }
+ // Set far end histories to zero
+ memset(aecm->far_history, 0, sizeof(uint16_t) * PART_LEN1 * MAX_DELAY);
+ memset(aecm->far_q_domains, 0, sizeof(int) * MAX_DELAY);
+ aecm->far_history_pos = MAX_DELAY;
- aecm->nlpFlag = 1;
- aecm->fixedDelay = -1;
+ aecm->nlpFlag = 1;
+ aecm->fixedDelay = -1;
- aecm->dfaCleanQDomain = 0;
- aecm->dfaCleanQDomainOld = 0;
- aecm->dfaNoisyQDomain = 0;
- aecm->dfaNoisyQDomainOld = 0;
+ aecm->dfaCleanQDomain = 0;
+ aecm->dfaCleanQDomainOld = 0;
+ aecm->dfaNoisyQDomain = 0;
+ aecm->dfaNoisyQDomainOld = 0;
- memset(aecm->nearLogEnergy, 0, sizeof(aecm->nearLogEnergy));
- aecm->farLogEnergy = 0;
- memset(aecm->echoAdaptLogEnergy, 0, sizeof(aecm->echoAdaptLogEnergy));
- memset(aecm->echoStoredLogEnergy, 0, sizeof(aecm->echoStoredLogEnergy));
+ memset(aecm->nearLogEnergy, 0, sizeof(aecm->nearLogEnergy));
+ aecm->farLogEnergy = 0;
+ memset(aecm->echoAdaptLogEnergy, 0, sizeof(aecm->echoAdaptLogEnergy));
+ memset(aecm->echoStoredLogEnergy, 0, sizeof(aecm->echoStoredLogEnergy));
- // Initialize the echo channels with a stored shape.
- if (samplingFreq == 8000)
- {
- WebRtcAecm_InitEchoPathCore(aecm, kChannelStored8kHz);
- }
- else
- {
- WebRtcAecm_InitEchoPathCore(aecm, kChannelStored16kHz);
- }
+ // Initialize the echo channels with a stored shape.
+ if (samplingFreq == 8000) {
+ WebRtcAecm_InitEchoPathCore(aecm, kChannelStored8kHz);
+ } else {
+ WebRtcAecm_InitEchoPathCore(aecm, kChannelStored16kHz);
+ }
- memset(aecm->echoFilt, 0, sizeof(aecm->echoFilt));
- memset(aecm->nearFilt, 0, sizeof(aecm->nearFilt));
- aecm->noiseEstCtr = 0;
+ memset(aecm->echoFilt, 0, sizeof(aecm->echoFilt));
+ memset(aecm->nearFilt, 0, sizeof(aecm->nearFilt));
+ aecm->noiseEstCtr = 0;
- aecm->cngMode = AecmTrue;
+ aecm->cngMode = AecmTrue;
- memset(aecm->noiseEstTooLowCtr, 0, sizeof(aecm->noiseEstTooLowCtr));
- memset(aecm->noiseEstTooHighCtr, 0, sizeof(aecm->noiseEstTooHighCtr));
- // Shape the initial noise level to an approximate pink noise.
- for (i = 0; i < (PART_LEN1 >> 1) - 1; i++)
- {
- aecm->noiseEst[i] = (tmp32 << 8);
- tmp16--;
- tmp32 -= (int32_t)((tmp16 << 1) + 1);
- }
- for (; i < PART_LEN1; i++)
- {
- aecm->noiseEst[i] = (tmp32 << 8);
- }
+ memset(aecm->noiseEstTooLowCtr, 0, sizeof(aecm->noiseEstTooLowCtr));
+ memset(aecm->noiseEstTooHighCtr, 0, sizeof(aecm->noiseEstTooHighCtr));
+ // Shape the initial noise level to an approximate pink noise.
+ for (i = 0; i < (PART_LEN1 >> 1) - 1; i++) {
+ aecm->noiseEst[i] = (tmp32 << 8);
+ tmp16--;
+ tmp32 -= (int32_t)((tmp16 << 1) + 1);
+ }
+ for (; i < PART_LEN1; i++) {
+ aecm->noiseEst[i] = (tmp32 << 8);
+ }
- aecm->farEnergyMin = WEBRTC_SPL_WORD16_MAX;
- aecm->farEnergyMax = WEBRTC_SPL_WORD16_MIN;
- aecm->farEnergyMaxMin = 0;
- aecm->farEnergyVAD = FAR_ENERGY_MIN; // This prevents false speech detection at the
- // beginning.
- aecm->farEnergyMSE = 0;
- aecm->currentVADValue = 0;
- aecm->vadUpdateCount = 0;
- aecm->firstVAD = 1;
+ aecm->farEnergyMin = WEBRTC_SPL_WORD16_MAX;
+ aecm->farEnergyMax = WEBRTC_SPL_WORD16_MIN;
+ aecm->farEnergyMaxMin = 0;
+ aecm->farEnergyVAD =
+ FAR_ENERGY_MIN; // This prevents false speech detection at the
+ // beginning.
+ aecm->farEnergyMSE = 0;
+ aecm->currentVADValue = 0;
+ aecm->vadUpdateCount = 0;
+ aecm->firstVAD = 1;
- aecm->startupState = 0;
- aecm->supGain = SUPGAIN_DEFAULT;
- aecm->supGainOld = SUPGAIN_DEFAULT;
+ aecm->startupState = 0;
+ aecm->supGain = SUPGAIN_DEFAULT;
+ aecm->supGainOld = SUPGAIN_DEFAULT;
- aecm->supGainErrParamA = SUPGAIN_ERROR_PARAM_A;
- aecm->supGainErrParamD = SUPGAIN_ERROR_PARAM_D;
- aecm->supGainErrParamDiffAB = SUPGAIN_ERROR_PARAM_A - SUPGAIN_ERROR_PARAM_B;
- aecm->supGainErrParamDiffBD = SUPGAIN_ERROR_PARAM_B - SUPGAIN_ERROR_PARAM_D;
+ aecm->supGainErrParamA = SUPGAIN_ERROR_PARAM_A;
+ aecm->supGainErrParamD = SUPGAIN_ERROR_PARAM_D;
+ aecm->supGainErrParamDiffAB = SUPGAIN_ERROR_PARAM_A - SUPGAIN_ERROR_PARAM_B;
+ aecm->supGainErrParamDiffBD = SUPGAIN_ERROR_PARAM_B - SUPGAIN_ERROR_PARAM_D;
- // Assert a preprocessor definition at compile-time. It's an assumption
- // used in assembly code, so check the assembly files before any change.
- static_assert(PART_LEN % 16 == 0, "PART_LEN is not a multiple of 16");
+ // Assert a preprocessor definition at compile-time. It's an assumption
+ // used in assembly code, so check the assembly files before any change.
+ static_assert(PART_LEN % 16 == 0, "PART_LEN is not a multiple of 16");
- // Initialize function pointers.
- WebRtcAecm_CalcLinearEnergies = CalcLinearEnergiesC;
- WebRtcAecm_StoreAdaptiveChannel = StoreAdaptiveChannelC;
- WebRtcAecm_ResetAdaptiveChannel = ResetAdaptiveChannelC;
+ // Initialize function pointers.
+ WebRtcAecm_CalcLinearEnergies = CalcLinearEnergiesC;
+ WebRtcAecm_StoreAdaptiveChannel = StoreAdaptiveChannelC;
+ WebRtcAecm_ResetAdaptiveChannel = ResetAdaptiveChannelC;
#if defined(WEBRTC_HAS_NEON)
- WebRtcAecm_InitNeon();
+ WebRtcAecm_InitNeon();
#endif
#if defined(MIPS32_LE)
- WebRtcAecm_InitMips();
+ WebRtcAecm_InitMips();
#endif
- return 0;
+ return 0;
}
// TODO(bjornv): This function is currently not used. Add support for these
// parameters from a higher level
int WebRtcAecm_Control(AecmCore* aecm, int delay, int nlpFlag) {
- aecm->nlpFlag = nlpFlag;
- aecm->fixedDelay = delay;
+ aecm->nlpFlag = nlpFlag;
+ aecm->fixedDelay = delay;
- return 0;
+ return 0;
}
void WebRtcAecm_FreeCore(AecmCore* aecm) {
- if (aecm == NULL) {
- return;
- }
+ if (aecm == NULL) {
+ return;
+ }
- WebRtc_FreeBuffer(aecm->farFrameBuf);
- WebRtc_FreeBuffer(aecm->nearNoisyFrameBuf);
- WebRtc_FreeBuffer(aecm->nearCleanFrameBuf);
- WebRtc_FreeBuffer(aecm->outFrameBuf);
+ WebRtc_FreeBuffer(aecm->farFrameBuf);
+ WebRtc_FreeBuffer(aecm->nearNoisyFrameBuf);
+ WebRtc_FreeBuffer(aecm->nearCleanFrameBuf);
+ WebRtc_FreeBuffer(aecm->outFrameBuf);
- WebRtc_FreeDelayEstimator(aecm->delay_estimator);
- WebRtc_FreeDelayEstimatorFarend(aecm->delay_estimator_farend);
- WebRtcSpl_FreeRealFFT(aecm->real_fft);
+ WebRtc_FreeDelayEstimator(aecm->delay_estimator);
+ WebRtc_FreeDelayEstimatorFarend(aecm->delay_estimator_farend);
+ WebRtcSpl_FreeRealFFT(aecm->real_fft);
- free(aecm);
+ free(aecm);
}
int WebRtcAecm_ProcessFrame(AecmCore* aecm,
@@ -554,89 +509,72 @@
const int16_t* nearendNoisy,
const int16_t* nearendClean,
int16_t* out) {
- int16_t outBlock_buf[PART_LEN + 8]; // Align buffer to 8-byte boundary.
- int16_t* outBlock = (int16_t*) (((uintptr_t) outBlock_buf + 15) & ~ 15);
+ int16_t outBlock_buf[PART_LEN + 8]; // Align buffer to 8-byte boundary.
+ int16_t* outBlock = (int16_t*)(((uintptr_t)outBlock_buf + 15) & ~15);
- int16_t farFrame[FRAME_LEN];
- const int16_t* out_ptr = NULL;
- int size = 0;
+ int16_t farFrame[FRAME_LEN];
+ const int16_t* out_ptr = NULL;
+ int size = 0;
- // Buffer the current frame.
- // Fetch an older one corresponding to the delay.
- WebRtcAecm_BufferFarFrame(aecm, farend, FRAME_LEN);
- WebRtcAecm_FetchFarFrame(aecm, farFrame, FRAME_LEN, aecm->knownDelay);
+ // Buffer the current frame.
+ // Fetch an older one corresponding to the delay.
+ WebRtcAecm_BufferFarFrame(aecm, farend, FRAME_LEN);
+ WebRtcAecm_FetchFarFrame(aecm, farFrame, FRAME_LEN, aecm->knownDelay);
- // Buffer the synchronized far and near frames,
- // to pass the smaller blocks individually.
- WebRtc_WriteBuffer(aecm->farFrameBuf, farFrame, FRAME_LEN);
- WebRtc_WriteBuffer(aecm->nearNoisyFrameBuf, nearendNoisy, FRAME_LEN);
- if (nearendClean != NULL)
- {
- WebRtc_WriteBuffer(aecm->nearCleanFrameBuf, nearendClean, FRAME_LEN);
+ // Buffer the synchronized far and near frames,
+ // to pass the smaller blocks individually.
+ WebRtc_WriteBuffer(aecm->farFrameBuf, farFrame, FRAME_LEN);
+ WebRtc_WriteBuffer(aecm->nearNoisyFrameBuf, nearendNoisy, FRAME_LEN);
+ if (nearendClean != NULL) {
+ WebRtc_WriteBuffer(aecm->nearCleanFrameBuf, nearendClean, FRAME_LEN);
+ }
+
+ // Process as many blocks as possible.
+ while (WebRtc_available_read(aecm->farFrameBuf) >= PART_LEN) {
+ int16_t far_block[PART_LEN];
+ const int16_t* far_block_ptr = NULL;
+ int16_t near_noisy_block[PART_LEN];
+ const int16_t* near_noisy_block_ptr = NULL;
+
+ WebRtc_ReadBuffer(aecm->farFrameBuf, (void**)&far_block_ptr, far_block,
+ PART_LEN);
+ WebRtc_ReadBuffer(aecm->nearNoisyFrameBuf, (void**)&near_noisy_block_ptr,
+ near_noisy_block, PART_LEN);
+ if (nearendClean != NULL) {
+ int16_t near_clean_block[PART_LEN];
+ const int16_t* near_clean_block_ptr = NULL;
+
+ WebRtc_ReadBuffer(aecm->nearCleanFrameBuf, (void**)&near_clean_block_ptr,
+ near_clean_block, PART_LEN);
+ if (WebRtcAecm_ProcessBlock(aecm, far_block_ptr, near_noisy_block_ptr,
+ near_clean_block_ptr, outBlock) == -1) {
+ return -1;
+ }
+ } else {
+ if (WebRtcAecm_ProcessBlock(aecm, far_block_ptr, near_noisy_block_ptr,
+ NULL, outBlock) == -1) {
+ return -1;
+ }
}
- // Process as many blocks as possible.
- while (WebRtc_available_read(aecm->farFrameBuf) >= PART_LEN)
- {
- int16_t far_block[PART_LEN];
- const int16_t* far_block_ptr = NULL;
- int16_t near_noisy_block[PART_LEN];
- const int16_t* near_noisy_block_ptr = NULL;
+ WebRtc_WriteBuffer(aecm->outFrameBuf, outBlock, PART_LEN);
+ }
- WebRtc_ReadBuffer(aecm->farFrameBuf, (void**) &far_block_ptr, far_block,
- PART_LEN);
- WebRtc_ReadBuffer(aecm->nearNoisyFrameBuf,
- (void**) &near_noisy_block_ptr,
- near_noisy_block,
- PART_LEN);
- if (nearendClean != NULL)
- {
- int16_t near_clean_block[PART_LEN];
- const int16_t* near_clean_block_ptr = NULL;
+ // Stuff the out buffer if we have less than a frame to output.
+ // This should only happen for the first frame.
+ size = (int)WebRtc_available_read(aecm->outFrameBuf);
+ if (size < FRAME_LEN) {
+ WebRtc_MoveReadPtr(aecm->outFrameBuf, size - FRAME_LEN);
+ }
- WebRtc_ReadBuffer(aecm->nearCleanFrameBuf,
- (void**) &near_clean_block_ptr,
- near_clean_block,
- PART_LEN);
- if (WebRtcAecm_ProcessBlock(aecm,
- far_block_ptr,
- near_noisy_block_ptr,
- near_clean_block_ptr,
- outBlock) == -1)
- {
- return -1;
- }
- } else
- {
- if (WebRtcAecm_ProcessBlock(aecm,
- far_block_ptr,
- near_noisy_block_ptr,
- NULL,
- outBlock) == -1)
- {
- return -1;
- }
- }
+ // Obtain an output frame.
+ WebRtc_ReadBuffer(aecm->outFrameBuf, (void**)&out_ptr, out, FRAME_LEN);
+ if (out_ptr != out) {
+ // ReadBuffer() hasn't copied to |out| in this case.
+ memcpy(out, out_ptr, FRAME_LEN * sizeof(int16_t));
+ }
- WebRtc_WriteBuffer(aecm->outFrameBuf, outBlock, PART_LEN);
- }
-
- // Stuff the out buffer if we have less than a frame to output.
- // This should only happen for the first frame.
- size = (int) WebRtc_available_read(aecm->outFrameBuf);
- if (size < FRAME_LEN)
- {
- WebRtc_MoveReadPtr(aecm->outFrameBuf, size - FRAME_LEN);
- }
-
- // Obtain an output frame.
- WebRtc_ReadBuffer(aecm->outFrameBuf, (void**) &out_ptr, out, FRAME_LEN);
- if (out_ptr != out) {
- // ReadBuffer() hasn't copied to |out| in this case.
- memcpy(out, out_ptr, FRAME_LEN * sizeof(int16_t));
- }
-
- return 0;
+ return 0;
}
// WebRtcAecm_AsymFilt(...)
@@ -653,26 +591,23 @@
//
// Return: - Filtered value.
//
-int16_t WebRtcAecm_AsymFilt(const int16_t filtOld, const int16_t inVal,
+int16_t WebRtcAecm_AsymFilt(const int16_t filtOld,
+ const int16_t inVal,
const int16_t stepSizePos,
- const int16_t stepSizeNeg)
-{
- int16_t retVal;
+ const int16_t stepSizeNeg) {
+ int16_t retVal;
- if ((filtOld == WEBRTC_SPL_WORD16_MAX) | (filtOld == WEBRTC_SPL_WORD16_MIN))
- {
- return inVal;
- }
- retVal = filtOld;
- if (filtOld > inVal)
- {
- retVal -= (filtOld - inVal) >> stepSizeNeg;
- } else
- {
- retVal += (inVal - filtOld) >> stepSizePos;
- }
+ if ((filtOld == WEBRTC_SPL_WORD16_MAX) | (filtOld == WEBRTC_SPL_WORD16_MIN)) {
+ return inVal;
+ }
+ retVal = filtOld;
+ if (filtOld > inVal) {
+ retVal -= (filtOld - inVal) >> stepSizeNeg;
+ } else {
+ retVal += (inVal - filtOld) >> stepSizePos;
+ }
- return retVal;
+ return retVal;
}
// ExtractFractionPart(a, zeros)
@@ -700,8 +635,9 @@
// WebRtcAecm_CalcEnergies(...)
//
-// This function calculates the log of energies for nearend, farend and estimated
-// echoes. There is also an update of energy decision levels, i.e. internal VAD.
+// This function calculates the log of energies for nearend, farend and
+// estimated echoes. There is also an update of energy decision levels, i.e.
+// internal VAD.
//
//
// @param aecm [i/o] Handle of the AECM instance.
@@ -716,123 +652,112 @@
const int16_t far_q,
const uint32_t nearEner,
int32_t* echoEst) {
- // Local variables
- uint32_t tmpAdapt = 0;
- uint32_t tmpStored = 0;
- uint32_t tmpFar = 0;
+ // Local variables
+ uint32_t tmpAdapt = 0;
+ uint32_t tmpStored = 0;
+ uint32_t tmpFar = 0;
- int i;
+ int i;
- int16_t tmp16;
- int16_t increase_max_shifts = 4;
- int16_t decrease_max_shifts = 11;
- int16_t increase_min_shifts = 11;
- int16_t decrease_min_shifts = 3;
+ int16_t tmp16;
+ int16_t increase_max_shifts = 4;
+ int16_t decrease_max_shifts = 11;
+ int16_t increase_min_shifts = 11;
+ int16_t decrease_min_shifts = 3;
- // Get log of near end energy and store in buffer
+ // Get log of near end energy and store in buffer
- // Shift buffer
- memmove(aecm->nearLogEnergy + 1, aecm->nearLogEnergy,
- sizeof(int16_t) * (MAX_BUF_LEN - 1));
+ // Shift buffer
+ memmove(aecm->nearLogEnergy + 1, aecm->nearLogEnergy,
+ sizeof(int16_t) * (MAX_BUF_LEN - 1));
- // Logarithm of integrated magnitude spectrum (nearEner)
- aecm->nearLogEnergy[0] = LogOfEnergyInQ8(nearEner, aecm->dfaNoisyQDomain);
+ // Logarithm of integrated magnitude spectrum (nearEner)
+ aecm->nearLogEnergy[0] = LogOfEnergyInQ8(nearEner, aecm->dfaNoisyQDomain);
- WebRtcAecm_CalcLinearEnergies(aecm, far_spectrum, echoEst, &tmpFar, &tmpAdapt, &tmpStored);
+ WebRtcAecm_CalcLinearEnergies(aecm, far_spectrum, echoEst, &tmpFar, &tmpAdapt,
+ &tmpStored);
- // Shift buffers
- memmove(aecm->echoAdaptLogEnergy + 1, aecm->echoAdaptLogEnergy,
- sizeof(int16_t) * (MAX_BUF_LEN - 1));
- memmove(aecm->echoStoredLogEnergy + 1, aecm->echoStoredLogEnergy,
- sizeof(int16_t) * (MAX_BUF_LEN - 1));
+ // Shift buffers
+ memmove(aecm->echoAdaptLogEnergy + 1, aecm->echoAdaptLogEnergy,
+ sizeof(int16_t) * (MAX_BUF_LEN - 1));
+ memmove(aecm->echoStoredLogEnergy + 1, aecm->echoStoredLogEnergy,
+ sizeof(int16_t) * (MAX_BUF_LEN - 1));
- // Logarithm of delayed far end energy
- aecm->farLogEnergy = LogOfEnergyInQ8(tmpFar, far_q);
+ // Logarithm of delayed far end energy
+ aecm->farLogEnergy = LogOfEnergyInQ8(tmpFar, far_q);
- // Logarithm of estimated echo energy through adapted channel
- aecm->echoAdaptLogEnergy[0] = LogOfEnergyInQ8(tmpAdapt,
- RESOLUTION_CHANNEL16 + far_q);
+ // Logarithm of estimated echo energy through adapted channel
+ aecm->echoAdaptLogEnergy[0] =
+ LogOfEnergyInQ8(tmpAdapt, RESOLUTION_CHANNEL16 + far_q);
- // Logarithm of estimated echo energy through stored channel
- aecm->echoStoredLogEnergy[0] =
- LogOfEnergyInQ8(tmpStored, RESOLUTION_CHANNEL16 + far_q);
+ // Logarithm of estimated echo energy through stored channel
+ aecm->echoStoredLogEnergy[0] =
+ LogOfEnergyInQ8(tmpStored, RESOLUTION_CHANNEL16 + far_q);
- // Update farend energy levels (min, max, vad, mse)
- if (aecm->farLogEnergy > FAR_ENERGY_MIN)
- {
- if (aecm->startupState == 0)
- {
- increase_max_shifts = 2;
- decrease_min_shifts = 2;
- increase_min_shifts = 8;
- }
-
- aecm->farEnergyMin = WebRtcAecm_AsymFilt(aecm->farEnergyMin, aecm->farLogEnergy,
- increase_min_shifts, decrease_min_shifts);
- aecm->farEnergyMax = WebRtcAecm_AsymFilt(aecm->farEnergyMax, aecm->farLogEnergy,
- increase_max_shifts, decrease_max_shifts);
- aecm->farEnergyMaxMin = (aecm->farEnergyMax - aecm->farEnergyMin);
-
- // Dynamic VAD region size
- tmp16 = 2560 - aecm->farEnergyMin;
- if (tmp16 > 0)
- {
- tmp16 = (int16_t)((tmp16 * FAR_ENERGY_VAD_REGION) >> 9);
- } else
- {
- tmp16 = 0;
- }
- tmp16 += FAR_ENERGY_VAD_REGION;
-
- if ((aecm->startupState == 0) | (aecm->vadUpdateCount > 1024))
- {
- // In startup phase or VAD update halted
- aecm->farEnergyVAD = aecm->farEnergyMin + tmp16;
- } else
- {
- if (aecm->farEnergyVAD > aecm->farLogEnergy)
- {
- aecm->farEnergyVAD +=
- (aecm->farLogEnergy + tmp16 - aecm->farEnergyVAD) >> 6;
- aecm->vadUpdateCount = 0;
- } else
- {
- aecm->vadUpdateCount++;
- }
- }
- // Put MSE threshold higher than VAD
- aecm->farEnergyMSE = aecm->farEnergyVAD + (1 << 8);
+ // Update farend energy levels (min, max, vad, mse)
+ if (aecm->farLogEnergy > FAR_ENERGY_MIN) {
+ if (aecm->startupState == 0) {
+ increase_max_shifts = 2;
+ decrease_min_shifts = 2;
+ increase_min_shifts = 8;
}
- // Update VAD variables
- if (aecm->farLogEnergy > aecm->farEnergyVAD)
- {
- if ((aecm->startupState == 0) | (aecm->farEnergyMaxMin > FAR_ENERGY_DIFF))
- {
- // We are in startup or have significant dynamics in input speech level
- aecm->currentVADValue = 1;
- }
- } else
- {
- aecm->currentVADValue = 0;
+ aecm->farEnergyMin =
+ WebRtcAecm_AsymFilt(aecm->farEnergyMin, aecm->farLogEnergy,
+ increase_min_shifts, decrease_min_shifts);
+ aecm->farEnergyMax =
+ WebRtcAecm_AsymFilt(aecm->farEnergyMax, aecm->farLogEnergy,
+ increase_max_shifts, decrease_max_shifts);
+ aecm->farEnergyMaxMin = (aecm->farEnergyMax - aecm->farEnergyMin);
+
+ // Dynamic VAD region size
+ tmp16 = 2560 - aecm->farEnergyMin;
+ if (tmp16 > 0) {
+ tmp16 = (int16_t)((tmp16 * FAR_ENERGY_VAD_REGION) >> 9);
+ } else {
+ tmp16 = 0;
}
- if ((aecm->currentVADValue) && (aecm->firstVAD))
- {
- aecm->firstVAD = 0;
- if (aecm->echoAdaptLogEnergy[0] > aecm->nearLogEnergy[0])
- {
- // The estimated echo has higher energy than the near end signal.
- // This means that the initialization was too aggressive. Scale
- // down by a factor 8
- for (i = 0; i < PART_LEN1; i++)
- {
- aecm->channelAdapt16[i] >>= 3;
- }
- // Compensate the adapted echo energy level accordingly.
- aecm->echoAdaptLogEnergy[0] -= (3 << 8);
- aecm->firstVAD = 1;
- }
+ tmp16 += FAR_ENERGY_VAD_REGION;
+
+ if ((aecm->startupState == 0) | (aecm->vadUpdateCount > 1024)) {
+ // In startup phase or VAD update halted
+ aecm->farEnergyVAD = aecm->farEnergyMin + tmp16;
+ } else {
+ if (aecm->farEnergyVAD > aecm->farLogEnergy) {
+ aecm->farEnergyVAD +=
+ (aecm->farLogEnergy + tmp16 - aecm->farEnergyVAD) >> 6;
+ aecm->vadUpdateCount = 0;
+ } else {
+ aecm->vadUpdateCount++;
+ }
}
+ // Put MSE threshold higher than VAD
+ aecm->farEnergyMSE = aecm->farEnergyVAD + (1 << 8);
+ }
+
+ // Update VAD variables
+ if (aecm->farLogEnergy > aecm->farEnergyVAD) {
+ if ((aecm->startupState == 0) | (aecm->farEnergyMaxMin > FAR_ENERGY_DIFF)) {
+ // We are in startup or have significant dynamics in input speech level
+ aecm->currentVADValue = 1;
+ }
+ } else {
+ aecm->currentVADValue = 0;
+ }
+ if ((aecm->currentVADValue) && (aecm->firstVAD)) {
+ aecm->firstVAD = 0;
+ if (aecm->echoAdaptLogEnergy[0] > aecm->nearLogEnergy[0]) {
+ // The estimated echo has higher energy than the near end signal.
+ // This means that the initialization was too aggressive. Scale
+ // down by a factor 8
+ for (i = 0; i < PART_LEN1; i++) {
+ aecm->channelAdapt16[i] >>= 3;
+ }
+ // Compensate the adapted echo energy level accordingly.
+ aecm->echoAdaptLogEnergy[0] -= (3 << 8);
+ aecm->firstVAD = 1;
+ }
+ }
}
// WebRtcAecm_CalcStepSize(...)
@@ -841,52 +766,50 @@
//
//
// @param aecm [in] Handle of the AECM instance.
-// @param mu [out] (Return value) Stepsize in log2(), i.e. number of shifts.
+// @param mu [out] (Return value) Stepsize in log2(), i.e. number of
+// shifts.
//
//
int16_t WebRtcAecm_CalcStepSize(AecmCore* const aecm) {
- int32_t tmp32;
- int16_t tmp16;
- int16_t mu = MU_MAX;
+ int32_t tmp32;
+ int16_t tmp16;
+ int16_t mu = MU_MAX;
- // Here we calculate the step size mu used in the
- // following NLMS based Channel estimation algorithm
- if (!aecm->currentVADValue)
- {
- // Far end energy level too low, no channel update
- mu = 0;
- } else if (aecm->startupState > 0)
- {
- if (aecm->farEnergyMin >= aecm->farEnergyMax)
- {
- mu = MU_MIN;
- } else
- {
- tmp16 = (aecm->farLogEnergy - aecm->farEnergyMin);
- tmp32 = tmp16 * MU_DIFF;
- tmp32 = WebRtcSpl_DivW32W16(tmp32, aecm->farEnergyMaxMin);
- mu = MU_MIN - 1 - (int16_t)(tmp32);
- // The -1 is an alternative to rounding. This way we get a larger
- // stepsize, so we in some sense compensate for truncation in NLMS
- }
- if (mu < MU_MAX)
- {
- mu = MU_MAX; // Equivalent with maximum step size of 2^-MU_MAX
- }
+ // Here we calculate the step size mu used in the
+ // following NLMS based Channel estimation algorithm
+ if (!aecm->currentVADValue) {
+ // Far end energy level too low, no channel update
+ mu = 0;
+ } else if (aecm->startupState > 0) {
+ if (aecm->farEnergyMin >= aecm->farEnergyMax) {
+ mu = MU_MIN;
+ } else {
+ tmp16 = (aecm->farLogEnergy - aecm->farEnergyMin);
+ tmp32 = tmp16 * MU_DIFF;
+ tmp32 = WebRtcSpl_DivW32W16(tmp32, aecm->farEnergyMaxMin);
+ mu = MU_MIN - 1 - (int16_t)(tmp32);
+ // The -1 is an alternative to rounding. This way we get a larger
+ // stepsize, so we in some sense compensate for truncation in NLMS
}
+ if (mu < MU_MAX) {
+ mu = MU_MAX; // Equivalent with maximum step size of 2^-MU_MAX
+ }
+ }
- return mu;
+ return mu;
}
// WebRtcAecm_UpdateChannel(...)
//
-// This function performs channel estimation. NLMS and decision on channel storage.
+// This function performs channel estimation. NLMS and decision on channel
+// storage.
//
//
// @param aecm [i/o] Handle of the AECM instance.
// @param far_spectrum [in] Absolute value of the farend signal in Q(far_q)
// @param far_q [in] Q-domain of the farend signal
-// @param dfa [in] Absolute value of the nearend signal (Q[aecm->dfaQDomain])
+// @param dfa [in] Absolute value of the nearend signal
+// (Q[aecm->dfaQDomain])
// @param mu [in] NLMS step size.
// @param echoEst [i/o] Estimated echo in Q(far_q+RESOLUTION_CHANNEL16).
//
@@ -896,343 +819,301 @@
const uint16_t* const dfa,
const int16_t mu,
int32_t* echoEst) {
- uint32_t tmpU32no1, tmpU32no2;
- int32_t tmp32no1, tmp32no2;
- int32_t mseStored;
- int32_t mseAdapt;
+ uint32_t tmpU32no1, tmpU32no2;
+ int32_t tmp32no1, tmp32no2;
+ int32_t mseStored;
+ int32_t mseAdapt;
- int i;
+ int i;
- int16_t zerosFar, zerosNum, zerosCh, zerosDfa;
- int16_t shiftChFar, shiftNum, shift2ResChan;
- int16_t tmp16no1;
- int16_t xfaQ, dfaQ;
+ int16_t zerosFar, zerosNum, zerosCh, zerosDfa;
+ int16_t shiftChFar, shiftNum, shift2ResChan;
+ int16_t tmp16no1;
+ int16_t xfaQ, dfaQ;
- // This is the channel estimation algorithm. It is base on NLMS but has a variable step
- // length, which was calculated above.
- if (mu)
- {
- for (i = 0; i < PART_LEN1; i++)
- {
- // Determine norm of channel and farend to make sure we don't get overflow in
- // multiplication
- zerosCh = WebRtcSpl_NormU32(aecm->channelAdapt32[i]);
- zerosFar = WebRtcSpl_NormU32((uint32_t)far_spectrum[i]);
- if (zerosCh + zerosFar > 31)
- {
- // Multiplication is safe
- tmpU32no1 = WEBRTC_SPL_UMUL_32_16(aecm->channelAdapt32[i],
- far_spectrum[i]);
- shiftChFar = 0;
- } else
- {
- // We need to shift down before multiplication
- shiftChFar = 32 - zerosCh - zerosFar;
- // If zerosCh == zerosFar == 0, shiftChFar is 32. A
- // right shift of 32 is undefined. To avoid that, we
- // do this check.
- tmpU32no1 = rtc::dchecked_cast<uint32_t>(
- shiftChFar >= 32
- ? 0
- : aecm->channelAdapt32[i] >> shiftChFar) *
- far_spectrum[i];
- }
- // Determine Q-domain of numerator
- zerosNum = WebRtcSpl_NormU32(tmpU32no1);
- if (dfa[i])
- {
- zerosDfa = WebRtcSpl_NormU32((uint32_t)dfa[i]);
- } else
- {
- zerosDfa = 32;
- }
- tmp16no1 = zerosDfa - 2 + aecm->dfaNoisyQDomain -
- RESOLUTION_CHANNEL32 - far_q + shiftChFar;
- if (zerosNum > tmp16no1 + 1)
- {
- xfaQ = tmp16no1;
- dfaQ = zerosDfa - 2;
- } else
- {
- xfaQ = zerosNum - 2;
- dfaQ = RESOLUTION_CHANNEL32 + far_q - aecm->dfaNoisyQDomain -
- shiftChFar + xfaQ;
- }
- // Add in the same Q-domain
- tmpU32no1 = WEBRTC_SPL_SHIFT_W32(tmpU32no1, xfaQ);
- tmpU32no2 = WEBRTC_SPL_SHIFT_W32((uint32_t)dfa[i], dfaQ);
- tmp32no1 = (int32_t)tmpU32no2 - (int32_t)tmpU32no1;
- zerosNum = WebRtcSpl_NormW32(tmp32no1);
- if ((tmp32no1) && (far_spectrum[i] > (CHANNEL_VAD << far_q)))
- {
- //
- // Update is needed
- //
- // This is what we would like to compute
- //
- // tmp32no1 = dfa[i] - (aecm->channelAdapt[i] * far_spectrum[i])
- // tmp32norm = (i + 1)
- // aecm->channelAdapt[i] += (2^mu) * tmp32no1
- // / (tmp32norm * far_spectrum[i])
- //
+ // This is the channel estimation algorithm. It is base on NLMS but has a
+ // variable step length, which was calculated above.
+ if (mu) {
+ for (i = 0; i < PART_LEN1; i++) {
+ // Determine norm of channel and farend to make sure we don't get overflow
+ // in multiplication
+ zerosCh = WebRtcSpl_NormU32(aecm->channelAdapt32[i]);
+ zerosFar = WebRtcSpl_NormU32((uint32_t)far_spectrum[i]);
+ if (zerosCh + zerosFar > 31) {
+ // Multiplication is safe
+ tmpU32no1 =
+ WEBRTC_SPL_UMUL_32_16(aecm->channelAdapt32[i], far_spectrum[i]);
+ shiftChFar = 0;
+ } else {
+ // We need to shift down before multiplication
+ shiftChFar = 32 - zerosCh - zerosFar;
+ // If zerosCh == zerosFar == 0, shiftChFar is 32. A
+ // right shift of 32 is undefined. To avoid that, we
+ // do this check.
+ tmpU32no1 =
+ rtc::dchecked_cast<uint32_t>(
+ shiftChFar >= 32 ? 0 : aecm->channelAdapt32[i] >> shiftChFar) *
+ far_spectrum[i];
+ }
+ // Determine Q-domain of numerator
+ zerosNum = WebRtcSpl_NormU32(tmpU32no1);
+ if (dfa[i]) {
+ zerosDfa = WebRtcSpl_NormU32((uint32_t)dfa[i]);
+ } else {
+ zerosDfa = 32;
+ }
+ tmp16no1 = zerosDfa - 2 + aecm->dfaNoisyQDomain - RESOLUTION_CHANNEL32 -
+ far_q + shiftChFar;
+ if (zerosNum > tmp16no1 + 1) {
+ xfaQ = tmp16no1;
+ dfaQ = zerosDfa - 2;
+ } else {
+ xfaQ = zerosNum - 2;
+ dfaQ = RESOLUTION_CHANNEL32 + far_q - aecm->dfaNoisyQDomain -
+ shiftChFar + xfaQ;
+ }
+ // Add in the same Q-domain
+ tmpU32no1 = WEBRTC_SPL_SHIFT_W32(tmpU32no1, xfaQ);
+ tmpU32no2 = WEBRTC_SPL_SHIFT_W32((uint32_t)dfa[i], dfaQ);
+ tmp32no1 = (int32_t)tmpU32no2 - (int32_t)tmpU32no1;
+ zerosNum = WebRtcSpl_NormW32(tmp32no1);
+ if ((tmp32no1) && (far_spectrum[i] > (CHANNEL_VAD << far_q))) {
+ //
+ // Update is needed
+ //
+ // This is what we would like to compute
+ //
+ // tmp32no1 = dfa[i] - (aecm->channelAdapt[i] * far_spectrum[i])
+ // tmp32norm = (i + 1)
+ // aecm->channelAdapt[i] += (2^mu) * tmp32no1
+ // / (tmp32norm * far_spectrum[i])
+ //
- // Make sure we don't get overflow in multiplication.
- if (zerosNum + zerosFar > 31)
- {
- if (tmp32no1 > 0)
- {
- tmp32no2 = (int32_t)WEBRTC_SPL_UMUL_32_16(tmp32no1,
- far_spectrum[i]);
- } else
- {
- tmp32no2 = -(int32_t)WEBRTC_SPL_UMUL_32_16(-tmp32no1,
- far_spectrum[i]);
- }
- shiftNum = 0;
- } else
- {
- shiftNum = 32 - (zerosNum + zerosFar);
- if (tmp32no1 > 0)
- {
- tmp32no2 = (tmp32no1 >> shiftNum) * far_spectrum[i];
- } else
- {
- tmp32no2 = -((-tmp32no1 >> shiftNum) * far_spectrum[i]);
- }
- }
- // Normalize with respect to frequency bin
- tmp32no2 = WebRtcSpl_DivW32W16(tmp32no2, i + 1);
- // Make sure we are in the right Q-domain
- shift2ResChan = shiftNum + shiftChFar - xfaQ - mu - ((30 - zerosFar) << 1);
- if (WebRtcSpl_NormW32(tmp32no2) < shift2ResChan)
- {
- tmp32no2 = WEBRTC_SPL_WORD32_MAX;
- } else
- {
- tmp32no2 = WEBRTC_SPL_SHIFT_W32(tmp32no2, shift2ResChan);
- }
- aecm->channelAdapt32[i] =
- WebRtcSpl_AddSatW32(aecm->channelAdapt32[i], tmp32no2);
- if (aecm->channelAdapt32[i] < 0)
- {
- // We can never have negative channel gain
- aecm->channelAdapt32[i] = 0;
- }
- aecm->channelAdapt16[i] =
- (int16_t)(aecm->channelAdapt32[i] >> 16);
- }
+ // Make sure we don't get overflow in multiplication.
+ if (zerosNum + zerosFar > 31) {
+ if (tmp32no1 > 0) {
+ tmp32no2 =
+ (int32_t)WEBRTC_SPL_UMUL_32_16(tmp32no1, far_spectrum[i]);
+ } else {
+ tmp32no2 =
+ -(int32_t)WEBRTC_SPL_UMUL_32_16(-tmp32no1, far_spectrum[i]);
+ }
+ shiftNum = 0;
+ } else {
+ shiftNum = 32 - (zerosNum + zerosFar);
+ if (tmp32no1 > 0) {
+ tmp32no2 = (tmp32no1 >> shiftNum) * far_spectrum[i];
+ } else {
+ tmp32no2 = -((-tmp32no1 >> shiftNum) * far_spectrum[i]);
+ }
}
+ // Normalize with respect to frequency bin
+ tmp32no2 = WebRtcSpl_DivW32W16(tmp32no2, i + 1);
+ // Make sure we are in the right Q-domain
+ shift2ResChan =
+ shiftNum + shiftChFar - xfaQ - mu - ((30 - zerosFar) << 1);
+ if (WebRtcSpl_NormW32(tmp32no2) < shift2ResChan) {
+ tmp32no2 = WEBRTC_SPL_WORD32_MAX;
+ } else {
+ tmp32no2 = WEBRTC_SPL_SHIFT_W32(tmp32no2, shift2ResChan);
+ }
+ aecm->channelAdapt32[i] =
+ WebRtcSpl_AddSatW32(aecm->channelAdapt32[i], tmp32no2);
+ if (aecm->channelAdapt32[i] < 0) {
+ // We can never have negative channel gain
+ aecm->channelAdapt32[i] = 0;
+ }
+ aecm->channelAdapt16[i] = (int16_t)(aecm->channelAdapt32[i] >> 16);
+ }
}
- // END: Adaptive channel update
+ }
+ // END: Adaptive channel update
- // Determine if we should store or restore the channel
- if ((aecm->startupState == 0) & (aecm->currentVADValue))
- {
- // During startup we store the channel every block,
- // and we recalculate echo estimate
+ // Determine if we should store or restore the channel
+ if ((aecm->startupState == 0) & (aecm->currentVADValue)) {
+ // During startup we store the channel every block,
+ // and we recalculate echo estimate
+ WebRtcAecm_StoreAdaptiveChannel(aecm, far_spectrum, echoEst);
+ } else {
+ if (aecm->farLogEnergy < aecm->farEnergyMSE) {
+ aecm->mseChannelCount = 0;
+ } else {
+ aecm->mseChannelCount++;
+ }
+ // Enough data for validation. Store channel if we can.
+ if (aecm->mseChannelCount >= (MIN_MSE_COUNT + 10)) {
+ // We have enough data.
+ // Calculate MSE of "Adapt" and "Stored" versions.
+ // It is actually not MSE, but average absolute error.
+ mseStored = 0;
+ mseAdapt = 0;
+ for (i = 0; i < MIN_MSE_COUNT; i++) {
+ tmp32no1 = ((int32_t)aecm->echoStoredLogEnergy[i] -
+ (int32_t)aecm->nearLogEnergy[i]);
+ tmp32no2 = WEBRTC_SPL_ABS_W32(tmp32no1);
+ mseStored += tmp32no2;
+
+ tmp32no1 = ((int32_t)aecm->echoAdaptLogEnergy[i] -
+ (int32_t)aecm->nearLogEnergy[i]);
+ tmp32no2 = WEBRTC_SPL_ABS_W32(tmp32no1);
+ mseAdapt += tmp32no2;
+ }
+ if (((mseStored << MSE_RESOLUTION) < (MIN_MSE_DIFF * mseAdapt)) &
+ ((aecm->mseStoredOld << MSE_RESOLUTION) <
+ (MIN_MSE_DIFF * aecm->mseAdaptOld))) {
+ // The stored channel has a significantly lower MSE than the adaptive
+ // one for two consecutive calculations. Reset the adaptive channel.
+ WebRtcAecm_ResetAdaptiveChannel(aecm);
+ } else if (((MIN_MSE_DIFF * mseStored) > (mseAdapt << MSE_RESOLUTION)) &
+ (mseAdapt < aecm->mseThreshold) &
+ (aecm->mseAdaptOld < aecm->mseThreshold)) {
+ // The adaptive channel has a significantly lower MSE than the stored
+ // one. The MSE for the adaptive channel has also been low for two
+ // consecutive calculations. Store the adaptive channel.
WebRtcAecm_StoreAdaptiveChannel(aecm, far_spectrum, echoEst);
- } else
- {
- if (aecm->farLogEnergy < aecm->farEnergyMSE)
- {
- aecm->mseChannelCount = 0;
- } else
- {
- aecm->mseChannelCount++;
+
+ // Update threshold
+ if (aecm->mseThreshold == WEBRTC_SPL_WORD32_MAX) {
+ aecm->mseThreshold = (mseAdapt + aecm->mseAdaptOld);
+ } else {
+ int scaled_threshold = aecm->mseThreshold * 5 / 8;
+ aecm->mseThreshold += ((mseAdapt - scaled_threshold) * 205) >> 8;
}
- // Enough data for validation. Store channel if we can.
- if (aecm->mseChannelCount >= (MIN_MSE_COUNT + 10))
- {
- // We have enough data.
- // Calculate MSE of "Adapt" and "Stored" versions.
- // It is actually not MSE, but average absolute error.
- mseStored = 0;
- mseAdapt = 0;
- for (i = 0; i < MIN_MSE_COUNT; i++)
- {
- tmp32no1 = ((int32_t)aecm->echoStoredLogEnergy[i]
- - (int32_t)aecm->nearLogEnergy[i]);
- tmp32no2 = WEBRTC_SPL_ABS_W32(tmp32no1);
- mseStored += tmp32no2;
+ }
- tmp32no1 = ((int32_t)aecm->echoAdaptLogEnergy[i]
- - (int32_t)aecm->nearLogEnergy[i]);
- tmp32no2 = WEBRTC_SPL_ABS_W32(tmp32no1);
- mseAdapt += tmp32no2;
- }
- if (((mseStored << MSE_RESOLUTION) < (MIN_MSE_DIFF * mseAdapt))
- & ((aecm->mseStoredOld << MSE_RESOLUTION) < (MIN_MSE_DIFF
- * aecm->mseAdaptOld)))
- {
- // The stored channel has a significantly lower MSE than the adaptive one for
- // two consecutive calculations. Reset the adaptive channel.
- WebRtcAecm_ResetAdaptiveChannel(aecm);
- } else if (((MIN_MSE_DIFF * mseStored) > (mseAdapt << MSE_RESOLUTION)) & (mseAdapt
- < aecm->mseThreshold) & (aecm->mseAdaptOld < aecm->mseThreshold))
- {
- // The adaptive channel has a significantly lower MSE than the stored one.
- // The MSE for the adaptive channel has also been low for two consecutive
- // calculations. Store the adaptive channel.
- WebRtcAecm_StoreAdaptiveChannel(aecm, far_spectrum, echoEst);
+ // Reset counter
+ aecm->mseChannelCount = 0;
- // Update threshold
- if (aecm->mseThreshold == WEBRTC_SPL_WORD32_MAX)
- {
- aecm->mseThreshold = (mseAdapt + aecm->mseAdaptOld);
- } else
- {
- int scaled_threshold = aecm->mseThreshold * 5 / 8;
- aecm->mseThreshold +=
- ((mseAdapt - scaled_threshold) * 205) >> 8;
- }
-
- }
-
- // Reset counter
- aecm->mseChannelCount = 0;
-
- // Store the MSE values.
- aecm->mseStoredOld = mseStored;
- aecm->mseAdaptOld = mseAdapt;
- }
+ // Store the MSE values.
+ aecm->mseStoredOld = mseStored;
+ aecm->mseAdaptOld = mseAdapt;
}
- // END: Determine if we should store or reset channel estimate.
+ }
+ // END: Determine if we should store or reset channel estimate.
}
// CalcSuppressionGain(...)
//
-// This function calculates the suppression gain that is used in the Wiener filter.
+// This function calculates the suppression gain that is used in the Wiener
+// filter.
//
//
// @param aecm [i/n] Handle of the AECM instance.
-// @param supGain [out] (Return value) Suppression gain with which to scale the noise
+// @param supGain [out] (Return value) Suppression gain with which to scale
+// the noise
// level (Q14).
//
//
int16_t WebRtcAecm_CalcSuppressionGain(AecmCore* const aecm) {
- int32_t tmp32no1;
+ int32_t tmp32no1;
- int16_t supGain = SUPGAIN_DEFAULT;
- int16_t tmp16no1;
- int16_t dE = 0;
+ int16_t supGain = SUPGAIN_DEFAULT;
+ int16_t tmp16no1;
+ int16_t dE = 0;
- // Determine suppression gain used in the Wiener filter. The gain is based on a mix of far
- // end energy and echo estimation error.
- // Adjust for the far end signal level. A low signal level indicates no far end signal,
- // hence we set the suppression gain to 0
- if (!aecm->currentVADValue)
- {
- supGain = 0;
- } else
- {
- // Adjust for possible double talk. If we have large variations in estimation error we
- // likely have double talk (or poor channel).
- tmp16no1 = (aecm->nearLogEnergy[0] - aecm->echoStoredLogEnergy[0] - ENERGY_DEV_OFFSET);
- dE = WEBRTC_SPL_ABS_W16(tmp16no1);
+ // Determine suppression gain used in the Wiener filter. The gain is based on
+ // a mix of far end energy and echo estimation error. Adjust for the far end
+ // signal level. A low signal level indicates no far end signal, hence we set
+ // the suppression gain to 0
+ if (!aecm->currentVADValue) {
+ supGain = 0;
+ } else {
+ // Adjust for possible double talk. If we have large variations in
+ // estimation error we likely have double talk (or poor channel).
+ tmp16no1 = (aecm->nearLogEnergy[0] - aecm->echoStoredLogEnergy[0] -
+ ENERGY_DEV_OFFSET);
+ dE = WEBRTC_SPL_ABS_W16(tmp16no1);
- if (dE < ENERGY_DEV_TOL)
- {
- // Likely no double talk. The better estimation, the more we can suppress signal.
- // Update counters
- if (dE < SUPGAIN_EPC_DT)
- {
- tmp32no1 = aecm->supGainErrParamDiffAB * dE;
- tmp32no1 += (SUPGAIN_EPC_DT >> 1);
- tmp16no1 = (int16_t)WebRtcSpl_DivW32W16(tmp32no1, SUPGAIN_EPC_DT);
- supGain = aecm->supGainErrParamA - tmp16no1;
- } else
- {
- tmp32no1 = aecm->supGainErrParamDiffBD * (ENERGY_DEV_TOL - dE);
- tmp32no1 += ((ENERGY_DEV_TOL - SUPGAIN_EPC_DT) >> 1);
- tmp16no1 = (int16_t)WebRtcSpl_DivW32W16(tmp32no1, (ENERGY_DEV_TOL
- - SUPGAIN_EPC_DT));
- supGain = aecm->supGainErrParamD + tmp16no1;
- }
- } else
- {
- // Likely in double talk. Use default value
- supGain = aecm->supGainErrParamD;
- }
+ if (dE < ENERGY_DEV_TOL) {
+ // Likely no double talk. The better estimation, the more we can suppress
+ // signal. Update counters
+ if (dE < SUPGAIN_EPC_DT) {
+ tmp32no1 = aecm->supGainErrParamDiffAB * dE;
+ tmp32no1 += (SUPGAIN_EPC_DT >> 1);
+ tmp16no1 = (int16_t)WebRtcSpl_DivW32W16(tmp32no1, SUPGAIN_EPC_DT);
+ supGain = aecm->supGainErrParamA - tmp16no1;
+ } else {
+ tmp32no1 = aecm->supGainErrParamDiffBD * (ENERGY_DEV_TOL - dE);
+ tmp32no1 += ((ENERGY_DEV_TOL - SUPGAIN_EPC_DT) >> 1);
+ tmp16no1 = (int16_t)WebRtcSpl_DivW32W16(
+ tmp32no1, (ENERGY_DEV_TOL - SUPGAIN_EPC_DT));
+ supGain = aecm->supGainErrParamD + tmp16no1;
+ }
+ } else {
+ // Likely in double talk. Use default value
+ supGain = aecm->supGainErrParamD;
}
+ }
- if (supGain > aecm->supGainOld)
- {
- tmp16no1 = supGain;
- } else
- {
- tmp16no1 = aecm->supGainOld;
- }
- aecm->supGainOld = supGain;
- if (tmp16no1 < aecm->supGain)
- {
- aecm->supGain += (int16_t)((tmp16no1 - aecm->supGain) >> 4);
- } else
- {
- aecm->supGain += (int16_t)((tmp16no1 - aecm->supGain) >> 4);
- }
+ if (supGain > aecm->supGainOld) {
+ tmp16no1 = supGain;
+ } else {
+ tmp16no1 = aecm->supGainOld;
+ }
+ aecm->supGainOld = supGain;
+ if (tmp16no1 < aecm->supGain) {
+ aecm->supGain += (int16_t)((tmp16no1 - aecm->supGain) >> 4);
+ } else {
+ aecm->supGain += (int16_t)((tmp16no1 - aecm->supGain) >> 4);
+ }
- // END: Update suppression gain
+ // END: Update suppression gain
- return aecm->supGain;
+ return aecm->supGain;
}
void WebRtcAecm_BufferFarFrame(AecmCore* const aecm,
const int16_t* const farend,
const int farLen) {
- int writeLen = farLen, writePos = 0;
+ int writeLen = farLen, writePos = 0;
- // Check if the write position must be wrapped
- while (aecm->farBufWritePos + writeLen > FAR_BUF_LEN)
- {
- // Write to remaining buffer space before wrapping
- writeLen = FAR_BUF_LEN - aecm->farBufWritePos;
- memcpy(aecm->farBuf + aecm->farBufWritePos, farend + writePos,
- sizeof(int16_t) * writeLen);
- aecm->farBufWritePos = 0;
- writePos = writeLen;
- writeLen = farLen - writeLen;
- }
-
+ // Check if the write position must be wrapped
+ while (aecm->farBufWritePos + writeLen > FAR_BUF_LEN) {
+ // Write to remaining buffer space before wrapping
+ writeLen = FAR_BUF_LEN - aecm->farBufWritePos;
memcpy(aecm->farBuf + aecm->farBufWritePos, farend + writePos,
sizeof(int16_t) * writeLen);
- aecm->farBufWritePos += writeLen;
+ aecm->farBufWritePos = 0;
+ writePos = writeLen;
+ writeLen = farLen - writeLen;
+ }
+
+ memcpy(aecm->farBuf + aecm->farBufWritePos, farend + writePos,
+ sizeof(int16_t) * writeLen);
+ aecm->farBufWritePos += writeLen;
}
void WebRtcAecm_FetchFarFrame(AecmCore* const aecm,
int16_t* const farend,
const int farLen,
const int knownDelay) {
- int readLen = farLen;
- int readPos = 0;
- int delayChange = knownDelay - aecm->lastKnownDelay;
+ int readLen = farLen;
+ int readPos = 0;
+ int delayChange = knownDelay - aecm->lastKnownDelay;
- aecm->farBufReadPos -= delayChange;
+ aecm->farBufReadPos -= delayChange;
- // Check if delay forces a read position wrap
- while (aecm->farBufReadPos < 0)
- {
- aecm->farBufReadPos += FAR_BUF_LEN;
- }
- while (aecm->farBufReadPos > FAR_BUF_LEN - 1)
- {
- aecm->farBufReadPos -= FAR_BUF_LEN;
- }
+ // Check if delay forces a read position wrap
+ while (aecm->farBufReadPos < 0) {
+ aecm->farBufReadPos += FAR_BUF_LEN;
+ }
+ while (aecm->farBufReadPos > FAR_BUF_LEN - 1) {
+ aecm->farBufReadPos -= FAR_BUF_LEN;
+ }
- aecm->lastKnownDelay = knownDelay;
+ aecm->lastKnownDelay = knownDelay;
- // Check if read position must be wrapped
- while (aecm->farBufReadPos + readLen > FAR_BUF_LEN)
- {
-
- // Read from remaining buffer space before wrapping
- readLen = FAR_BUF_LEN - aecm->farBufReadPos;
- memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos,
- sizeof(int16_t) * readLen);
- aecm->farBufReadPos = 0;
- readPos = readLen;
- readLen = farLen - readLen;
- }
+ // Check if read position must be wrapped
+ while (aecm->farBufReadPos + readLen > FAR_BUF_LEN) {
+ // Read from remaining buffer space before wrapping
+ readLen = FAR_BUF_LEN - aecm->farBufReadPos;
memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos,
sizeof(int16_t) * readLen);
- aecm->farBufReadPos += readLen;
+ aecm->farBufReadPos = 0;
+ readPos = readLen;
+ readLen = farLen - readLen;
+ }
+ memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos,
+ sizeof(int16_t) * readLen);
+ aecm->farBufReadPos += readLen;
}
diff --git a/modules/audio_processing/aecm/aecm_core.h b/modules/audio_processing/aecm/aecm_core.h
index feb997e..3da3bca 100644
--- a/modules/audio_processing/aecm/aecm_core.h
+++ b/modules/audio_processing/aecm/aecm_core.h
@@ -29,109 +29,109 @@
#endif
typedef struct {
- int16_t real;
- int16_t imag;
+ int16_t real;
+ int16_t imag;
} ComplexInt16;
typedef struct {
- int farBufWritePos;
- int farBufReadPos;
- int knownDelay;
- int lastKnownDelay;
- int firstVAD; // Parameter to control poorly initialized channels
+ int farBufWritePos;
+ int farBufReadPos;
+ int knownDelay;
+ int lastKnownDelay;
+ int firstVAD; // Parameter to control poorly initialized channels
- RingBuffer* farFrameBuf;
- RingBuffer* nearNoisyFrameBuf;
- RingBuffer* nearCleanFrameBuf;
- RingBuffer* outFrameBuf;
+ RingBuffer* farFrameBuf;
+ RingBuffer* nearNoisyFrameBuf;
+ RingBuffer* nearCleanFrameBuf;
+ RingBuffer* outFrameBuf;
- int16_t farBuf[FAR_BUF_LEN];
+ int16_t farBuf[FAR_BUF_LEN];
- int16_t mult;
- uint32_t seed;
+ int16_t mult;
+ uint32_t seed;
- // Delay estimation variables
- void* delay_estimator_farend;
- void* delay_estimator;
- uint16_t currentDelay;
- // Far end history variables
- // TODO(bjornv): Replace |far_history| with ring_buffer.
- uint16_t far_history[PART_LEN1 * MAX_DELAY];
- int far_history_pos;
- int far_q_domains[MAX_DELAY];
+ // Delay estimation variables
+ void* delay_estimator_farend;
+ void* delay_estimator;
+ uint16_t currentDelay;
+ // Far end history variables
+ // TODO(bjornv): Replace |far_history| with ring_buffer.
+ uint16_t far_history[PART_LEN1 * MAX_DELAY];
+ int far_history_pos;
+ int far_q_domains[MAX_DELAY];
- int16_t nlpFlag;
- int16_t fixedDelay;
+ int16_t nlpFlag;
+ int16_t fixedDelay;
- uint32_t totCount;
+ uint32_t totCount;
- int16_t dfaCleanQDomain;
- int16_t dfaCleanQDomainOld;
- int16_t dfaNoisyQDomain;
- int16_t dfaNoisyQDomainOld;
+ int16_t dfaCleanQDomain;
+ int16_t dfaCleanQDomainOld;
+ int16_t dfaNoisyQDomain;
+ int16_t dfaNoisyQDomainOld;
- int16_t nearLogEnergy[MAX_BUF_LEN];
- int16_t farLogEnergy;
- int16_t echoAdaptLogEnergy[MAX_BUF_LEN];
- int16_t echoStoredLogEnergy[MAX_BUF_LEN];
+ int16_t nearLogEnergy[MAX_BUF_LEN];
+ int16_t farLogEnergy;
+ int16_t echoAdaptLogEnergy[MAX_BUF_LEN];
+ int16_t echoStoredLogEnergy[MAX_BUF_LEN];
- // The extra 16 or 32 bytes in the following buffers are for alignment based
- // Neon code.
- // It's designed this way since the current GCC compiler can't align a
- // buffer in 16 or 32 byte boundaries properly.
- int16_t channelStored_buf[PART_LEN1 + 8];
- int16_t channelAdapt16_buf[PART_LEN1 + 8];
- int32_t channelAdapt32_buf[PART_LEN1 + 8];
- int16_t xBuf_buf[PART_LEN2 + 16]; // farend
- int16_t dBufClean_buf[PART_LEN2 + 16]; // nearend
- int16_t dBufNoisy_buf[PART_LEN2 + 16]; // nearend
- int16_t outBuf_buf[PART_LEN + 8];
+ // The extra 16 or 32 bytes in the following buffers are for alignment based
+ // Neon code.
+ // It's designed this way since the current GCC compiler can't align a
+ // buffer in 16 or 32 byte boundaries properly.
+ int16_t channelStored_buf[PART_LEN1 + 8];
+ int16_t channelAdapt16_buf[PART_LEN1 + 8];
+ int32_t channelAdapt32_buf[PART_LEN1 + 8];
+ int16_t xBuf_buf[PART_LEN2 + 16]; // farend
+ int16_t dBufClean_buf[PART_LEN2 + 16]; // nearend
+ int16_t dBufNoisy_buf[PART_LEN2 + 16]; // nearend
+ int16_t outBuf_buf[PART_LEN + 8];
- // Pointers to the above buffers
- int16_t *channelStored;
- int16_t *channelAdapt16;
- int32_t *channelAdapt32;
- int16_t *xBuf;
- int16_t *dBufClean;
- int16_t *dBufNoisy;
- int16_t *outBuf;
+ // Pointers to the above buffers
+ int16_t* channelStored;
+ int16_t* channelAdapt16;
+ int32_t* channelAdapt32;
+ int16_t* xBuf;
+ int16_t* dBufClean;
+ int16_t* dBufNoisy;
+ int16_t* outBuf;
- int32_t echoFilt[PART_LEN1];
- int16_t nearFilt[PART_LEN1];
- int32_t noiseEst[PART_LEN1];
- int noiseEstTooLowCtr[PART_LEN1];
- int noiseEstTooHighCtr[PART_LEN1];
- int16_t noiseEstCtr;
- int16_t cngMode;
+ int32_t echoFilt[PART_LEN1];
+ int16_t nearFilt[PART_LEN1];
+ int32_t noiseEst[PART_LEN1];
+ int noiseEstTooLowCtr[PART_LEN1];
+ int noiseEstTooHighCtr[PART_LEN1];
+ int16_t noiseEstCtr;
+ int16_t cngMode;
- int32_t mseAdaptOld;
- int32_t mseStoredOld;
- int32_t mseThreshold;
+ int32_t mseAdaptOld;
+ int32_t mseStoredOld;
+ int32_t mseThreshold;
- int16_t farEnergyMin;
- int16_t farEnergyMax;
- int16_t farEnergyMaxMin;
- int16_t farEnergyVAD;
- int16_t farEnergyMSE;
- int currentVADValue;
- int16_t vadUpdateCount;
+ int16_t farEnergyMin;
+ int16_t farEnergyMax;
+ int16_t farEnergyMaxMin;
+ int16_t farEnergyVAD;
+ int16_t farEnergyMSE;
+ int currentVADValue;
+ int16_t vadUpdateCount;
- int16_t startupState;
- int16_t mseChannelCount;
- int16_t supGain;
- int16_t supGainOld;
+ int16_t startupState;
+ int16_t mseChannelCount;
+ int16_t supGain;
+ int16_t supGainOld;
- int16_t supGainErrParamA;
- int16_t supGainErrParamD;
- int16_t supGainErrParamDiffAB;
- int16_t supGainErrParamDiffBD;
+ int16_t supGainErrParamA;
+ int16_t supGainErrParamD;
+ int16_t supGainErrParamDiffAB;
+ int16_t supGainErrParamDiffBD;
- struct RealFFT* real_fft;
+ struct RealFFT* real_fft;
#ifdef AEC_DEBUG
- FILE *farFile;
- FILE *nearFile;
- FILE *outFile;
+ FILE* farFile;
+ FILE* nearFile;
+ FILE* outFile;
#endif
} AecmCore;
diff --git a/modules/audio_processing/aecm/aecm_core_c.cc b/modules/audio_processing/aecm/aecm_core_c.cc
index effe048..b640f1a 100644
--- a/modules/audio_processing/aecm/aecm_core_c.cc
+++ b/modules/audio_processing/aecm/aecm_core_c.cc
@@ -30,28 +30,25 @@
// Square root of Hanning window in Q14.
static const ALIGN8_BEG int16_t WebRtcAecm_kSqrtHanning[] ALIGN8_END = {
- 0, 399, 798, 1196, 1594, 1990, 2386, 2780, 3172,
- 3562, 3951, 4337, 4720, 5101, 5478, 5853, 6224,
- 6591, 6954, 7313, 7668, 8019, 8364, 8705, 9040,
- 9370, 9695, 10013, 10326, 10633, 10933, 11227, 11514,
- 11795, 12068, 12335, 12594, 12845, 13089, 13325, 13553,
- 13773, 13985, 14189, 14384, 14571, 14749, 14918, 15079,
- 15231, 15373, 15506, 15631, 15746, 15851, 15947, 16034,
- 16111, 16179, 16237, 16286, 16325, 16354, 16373, 16384
-};
+ 0, 399, 798, 1196, 1594, 1990, 2386, 2780, 3172, 3562, 3951,
+ 4337, 4720, 5101, 5478, 5853, 6224, 6591, 6954, 7313, 7668, 8019,
+ 8364, 8705, 9040, 9370, 9695, 10013, 10326, 10633, 10933, 11227, 11514,
+ 11795, 12068, 12335, 12594, 12845, 13089, 13325, 13553, 13773, 13985, 14189,
+ 14384, 14571, 14749, 14918, 15079, 15231, 15373, 15506, 15631, 15746, 15851,
+ 15947, 16034, 16111, 16179, 16237, 16286, 16325, 16354, 16373, 16384};
#ifdef AECM_WITH_ABS_APPROX
-//Q15 alpha = 0.99439986968132 const Factor for magnitude approximation
+// Q15 alpha = 0.99439986968132 const Factor for magnitude approximation
static const uint16_t kAlpha1 = 32584;
-//Q15 beta = 0.12967166976970 const Factor for magnitude approximation
+// Q15 beta = 0.12967166976970 const Factor for magnitude approximation
static const uint16_t kBeta1 = 4249;
-//Q15 alpha = 0.94234827210087 const Factor for magnitude approximation
+// Q15 alpha = 0.94234827210087 const Factor for magnitude approximation
static const uint16_t kAlpha2 = 30879;
-//Q15 beta = 0.33787806009150 const Factor for magnitude approximation
+// Q15 beta = 0.33787806009150 const Factor for magnitude approximation
static const uint16_t kBeta2 = 11072;
-//Q15 alpha = 0.82247698684306 const Factor for magnitude approximation
+// Q15 alpha = 0.82247698684306 const Factor for magnitude approximation
static const uint16_t kAlpha3 = 26951;
-//Q15 beta = 0.57762063060713 const Factor for magnitude approximation
+// Q15 beta = 0.57762063060713 const Factor for magnitude approximation
static const uint16_t kBeta3 = 18927;
#endif
@@ -77,8 +74,8 @@
int16_t scaled_time_signal = time_signal[i] * (1 << time_signal_scaling);
fft[i] = (int16_t)((scaled_time_signal * WebRtcAecm_kSqrtHanning[i]) >> 14);
scaled_time_signal = time_signal[i + PART_LEN] * (1 << time_signal_scaling);
- fft[PART_LEN + i] = (int16_t)((
- scaled_time_signal * WebRtcAecm_kSqrtHanning[PART_LEN - i]) >> 14);
+ fft[PART_LEN + i] = (int16_t)(
+ (scaled_time_signal * WebRtcAecm_kSqrtHanning[PART_LEN - i]) >> 14);
}
// Do forward FFT, then take only the first PART_LEN complex samples,
@@ -115,32 +112,27 @@
outCFFT = WebRtcSpl_RealInverseFFT(aecm->real_fft, fft, ifft_out);
for (i = 0; i < PART_LEN; i++) {
ifft_out[i] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(
- ifft_out[i], WebRtcAecm_kSqrtHanning[i], 14);
+ ifft_out[i], WebRtcAecm_kSqrtHanning[i], 14);
tmp32no1 = WEBRTC_SPL_SHIFT_W32((int32_t)ifft_out[i],
- outCFFT - aecm->dfaCleanQDomain);
+ outCFFT - aecm->dfaCleanQDomain);
output[i] = (int16_t)WEBRTC_SPL_SAT(WEBRTC_SPL_WORD16_MAX,
tmp32no1 + aecm->outBuf[i],
WEBRTC_SPL_WORD16_MIN);
- tmp32no1 = (ifft_out[PART_LEN + i] *
- WebRtcAecm_kSqrtHanning[PART_LEN - i]) >> 14;
- tmp32no1 = WEBRTC_SPL_SHIFT_W32(tmp32no1,
- outCFFT - aecm->dfaCleanQDomain);
- aecm->outBuf[i] = (int16_t)WEBRTC_SPL_SAT(WEBRTC_SPL_WORD16_MAX,
- tmp32no1,
- WEBRTC_SPL_WORD16_MIN);
+ tmp32no1 =
+ (ifft_out[PART_LEN + i] * WebRtcAecm_kSqrtHanning[PART_LEN - i]) >> 14;
+ tmp32no1 = WEBRTC_SPL_SHIFT_W32(tmp32no1, outCFFT - aecm->dfaCleanQDomain);
+ aecm->outBuf[i] = (int16_t)WEBRTC_SPL_SAT(WEBRTC_SPL_WORD16_MAX, tmp32no1,
+ WEBRTC_SPL_WORD16_MIN);
}
// Copy the current block to the old position
// (aecm->outBuf is shifted elsewhere)
memcpy(aecm->xBuf, aecm->xBuf + PART_LEN, sizeof(int16_t) * PART_LEN);
- memcpy(aecm->dBufNoisy,
- aecm->dBufNoisy + PART_LEN,
+ memcpy(aecm->dBufNoisy, aecm->dBufNoisy + PART_LEN,
sizeof(int16_t) * PART_LEN);
- if (nearendClean != NULL)
- {
- memcpy(aecm->dBufClean,
- aecm->dBufClean + PART_LEN,
+ if (nearendClean != NULL) {
+ memcpy(aecm->dBufClean, aecm->dBufClean + PART_LEN,
sizeof(int16_t) * PART_LEN);
}
}
@@ -171,7 +163,7 @@
// In fft_buf, +16 for 32-byte alignment.
int16_t fft_buf[PART_LEN4 + 16];
- int16_t *fft = (int16_t *) (((uintptr_t) fft_buf + 31) & ~31);
+ int16_t* fft = (int16_t*)(((uintptr_t)fft_buf + 31) & ~31);
int16_t tmp16no1;
#ifndef WEBRTC_ARCH_ARM_V7
@@ -196,54 +188,43 @@
freq_signal[0].imag = 0;
freq_signal[PART_LEN].imag = 0;
freq_signal_abs[0] = (uint16_t)WEBRTC_SPL_ABS_W16(freq_signal[0].real);
- freq_signal_abs[PART_LEN] = (uint16_t)WEBRTC_SPL_ABS_W16(
- freq_signal[PART_LEN].real);
- (*freq_signal_sum_abs) = (uint32_t)(freq_signal_abs[0]) +
- (uint32_t)(freq_signal_abs[PART_LEN]);
+ freq_signal_abs[PART_LEN] =
+ (uint16_t)WEBRTC_SPL_ABS_W16(freq_signal[PART_LEN].real);
+ (*freq_signal_sum_abs) =
+ (uint32_t)(freq_signal_abs[0]) + (uint32_t)(freq_signal_abs[PART_LEN]);
- for (i = 1; i < PART_LEN; i++)
- {
- if (freq_signal[i].real == 0)
- {
+ for (i = 1; i < PART_LEN; i++) {
+ if (freq_signal[i].real == 0) {
freq_signal_abs[i] = (uint16_t)WEBRTC_SPL_ABS_W16(freq_signal[i].imag);
- }
- else if (freq_signal[i].imag == 0)
- {
+ } else if (freq_signal[i].imag == 0) {
freq_signal_abs[i] = (uint16_t)WEBRTC_SPL_ABS_W16(freq_signal[i].real);
- }
- else
- {
- // Approximation for magnitude of complex fft output
- // magn = sqrt(real^2 + imag^2)
- // magn ~= alpha * max(|imag|,|real|) + beta * min(|imag|,|real|)
- //
- // The parameters alpha and beta are stored in Q15
+ } else {
+// Approximation for magnitude of complex fft output
+// magn = sqrt(real^2 + imag^2)
+// magn ~= alpha * max(|imag|,|real|) + beta * min(|imag|,|real|)
+//
+// The parameters alpha and beta are stored in Q15
#ifdef AECM_WITH_ABS_APPROX
tmp16no1 = WEBRTC_SPL_ABS_W16(freq_signal[i].real);
tmp16no2 = WEBRTC_SPL_ABS_W16(freq_signal[i].imag);
- if(tmp16no1 > tmp16no2)
- {
+ if (tmp16no1 > tmp16no2) {
max_value = tmp16no1;
min_value = tmp16no2;
- } else
- {
+ } else {
max_value = tmp16no2;
min_value = tmp16no1;
}
// Magnitude in Q(-6)
- if ((max_value >> 2) > min_value)
- {
+ if ((max_value >> 2) > min_value) {
alpha = kAlpha1;
beta = kBeta1;
- } else if ((max_value >> 1) > min_value)
- {
+ } else if ((max_value >> 1) > min_value) {
alpha = kAlpha2;
beta = kBeta2;
- } else
- {
+ } else {
alpha = kAlpha3;
beta = kBeta3;
}
@@ -253,24 +234,21 @@
#else
#ifdef WEBRTC_ARCH_ARM_V7
__asm __volatile(
- "smulbb %[tmp32no1], %[real], %[real]\n\t"
- "smlabb %[tmp32no2], %[imag], %[imag], %[tmp32no1]\n\t"
- :[tmp32no1]"+&r"(tmp32no1),
- [tmp32no2]"=r"(tmp32no2)
- :[real]"r"(freq_signal[i].real),
- [imag]"r"(freq_signal[i].imag)
- );
+ "smulbb %[tmp32no1], %[real], %[real]\n\t"
+ "smlabb %[tmp32no2], %[imag], %[imag], %[tmp32no1]\n\t"
+ : [tmp32no1] "+&r"(tmp32no1), [tmp32no2] "=r"(tmp32no2)
+ : [real] "r"(freq_signal[i].real), [imag] "r"(freq_signal[i].imag));
#else
tmp16no1 = WEBRTC_SPL_ABS_W16(freq_signal[i].real);
tmp16no2 = WEBRTC_SPL_ABS_W16(freq_signal[i].imag);
tmp32no1 = tmp16no1 * tmp16no1;
tmp32no2 = tmp16no2 * tmp16no2;
tmp32no2 = WebRtcSpl_AddSatW32(tmp32no1, tmp32no2);
-#endif // WEBRTC_ARCH_ARM_V7
+#endif // WEBRTC_ARCH_ARM_V7
tmp32no1 = WebRtcSpl_SqrtFloor(tmp32no2);
freq_signal_abs[i] = (uint16_t)tmp32no1;
-#endif // AECM_WITH_ABS_APPROX
+#endif // AECM_WITH_ABS_APPROX
}
(*freq_signal_sum_abs) += (uint32_t)freq_signal_abs[i];
}
@@ -279,11 +257,11 @@
}
int RTC_NO_SANITIZE("signed-integer-overflow") // bugs.webrtc.org/8200
-WebRtcAecm_ProcessBlock(AecmCore* aecm,
- const int16_t* farend,
- const int16_t* nearendNoisy,
- const int16_t* nearendClean,
- int16_t* output) {
+ WebRtcAecm_ProcessBlock(AecmCore* aecm,
+ const int16_t* farend,
+ const int16_t* nearendNoisy,
+ const int16_t* nearendClean,
+ int16_t* output) {
int i;
uint32_t xfaSum;
@@ -302,13 +280,13 @@
// 32 byte aligned buffers (with +8 or +16).
// TODO(kma): define fft with ComplexInt16.
- int16_t fft_buf[PART_LEN4 + 2 + 16]; // +2 to make a loop safe.
+ int16_t fft_buf[PART_LEN4 + 2 + 16]; // +2 to make a loop safe.
int32_t echoEst32_buf[PART_LEN1 + 8];
int32_t dfw_buf[PART_LEN2 + 8];
int32_t efw_buf[PART_LEN2 + 8];
- int16_t* fft = (int16_t*) (((uintptr_t) fft_buf + 31) & ~ 31);
- int32_t* echoEst32 = (int32_t*) (((uintptr_t) echoEst32_buf + 31) & ~ 31);
+ int16_t* fft = (int16_t*)(((uintptr_t)fft_buf + 31) & ~31);
+ int32_t* echoEst32 = (int32_t*)(((uintptr_t)echoEst32_buf + 31) & ~31);
ComplexInt16* dfw = (ComplexInt16*)(((uintptr_t)dfw_buf + 31) & ~31);
ComplexInt16* efw = (ComplexInt16*)(((uintptr_t)efw_buf + 31) & ~31);
@@ -334,53 +312,37 @@
// (1) another CONV_LEN blocks
// (2) the rest
- if (aecm->startupState < 2)
- {
- aecm->startupState = (aecm->totCount >= CONV_LEN) +
- (aecm->totCount >= CONV_LEN2);
+ if (aecm->startupState < 2) {
+ aecm->startupState =
+ (aecm->totCount >= CONV_LEN) + (aecm->totCount >= CONV_LEN2);
}
// END: Determine startup state
// Buffer near and far end signals
memcpy(aecm->xBuf + PART_LEN, farend, sizeof(int16_t) * PART_LEN);
memcpy(aecm->dBufNoisy + PART_LEN, nearendNoisy, sizeof(int16_t) * PART_LEN);
- if (nearendClean != NULL)
- {
- memcpy(aecm->dBufClean + PART_LEN,
- nearendClean,
+ if (nearendClean != NULL) {
+ memcpy(aecm->dBufClean + PART_LEN, nearendClean,
sizeof(int16_t) * PART_LEN);
}
// Transform far end signal from time domain to frequency domain.
- far_q = TimeToFrequencyDomain(aecm,
- aecm->xBuf,
- dfw,
- xfa,
- &xfaSum);
+ far_q = TimeToFrequencyDomain(aecm, aecm->xBuf, dfw, xfa, &xfaSum);
// Transform noisy near end signal from time domain to frequency domain.
- zerosDBufNoisy = TimeToFrequencyDomain(aecm,
- aecm->dBufNoisy,
- dfw,
- dfaNoisy,
- &dfaNoisySum);
+ zerosDBufNoisy =
+ TimeToFrequencyDomain(aecm, aecm->dBufNoisy, dfw, dfaNoisy, &dfaNoisySum);
aecm->dfaNoisyQDomainOld = aecm->dfaNoisyQDomain;
aecm->dfaNoisyQDomain = (int16_t)zerosDBufNoisy;
-
- if (nearendClean == NULL)
- {
+ if (nearendClean == NULL) {
ptrDfaClean = dfaNoisy;
aecm->dfaCleanQDomainOld = aecm->dfaNoisyQDomainOld;
aecm->dfaCleanQDomain = aecm->dfaNoisyQDomain;
dfaCleanSum = dfaNoisySum;
- } else
- {
+ } else {
// Transform clean near end signal from time domain to frequency domain.
- zerosDBufClean = TimeToFrequencyDomain(aecm,
- aecm->dBufClean,
- dfw,
- dfaClean,
+ zerosDBufClean = TimeToFrequencyDomain(aecm, aecm->dBufClean, dfw, dfaClean,
&dfaCleanSum);
aecm->dfaCleanQDomainOld = aecm->dfaCleanQDomain;
aecm->dfaCleanQDomain = (int16_t)zerosDBufClean;
@@ -389,46 +351,34 @@
// Get the delay
// Save far-end history and estimate delay
WebRtcAecm_UpdateFarHistory(aecm, xfa, far_q);
- if (WebRtc_AddFarSpectrumFix(aecm->delay_estimator_farend,
- xfa,
- PART_LEN1,
+ if (WebRtc_AddFarSpectrumFix(aecm->delay_estimator_farend, xfa, PART_LEN1,
far_q) == -1) {
return -1;
}
- delay = WebRtc_DelayEstimatorProcessFix(aecm->delay_estimator,
- dfaNoisy,
- PART_LEN1,
- zerosDBufNoisy);
- if (delay == -1)
- {
+ delay = WebRtc_DelayEstimatorProcessFix(aecm->delay_estimator, dfaNoisy,
+ PART_LEN1, zerosDBufNoisy);
+ if (delay == -1) {
return -1;
- }
- else if (delay == -2)
- {
+ } else if (delay == -2) {
// If the delay is unknown, we assume zero.
// NOTE: this will have to be adjusted if we ever add lookahead.
delay = 0;
}
- if (aecm->fixedDelay >= 0)
- {
+ if (aecm->fixedDelay >= 0) {
// Use fixed delay
delay = aecm->fixedDelay;
}
// Get aligned far end spectrum
far_spectrum_ptr = WebRtcAecm_AlignedFarend(aecm, &far_q, delay);
- zerosXBuf = (int16_t) far_q;
- if (far_spectrum_ptr == NULL)
- {
+ zerosXBuf = (int16_t)far_q;
+ if (far_spectrum_ptr == NULL) {
return -1;
}
// Calculate log(energy) and update energy threshold levels
- WebRtcAecm_CalcEnergies(aecm,
- far_spectrum_ptr,
- zerosXBuf,
- dfaNoisySum,
+ WebRtcAecm_CalcEnergies(aecm, far_spectrum_ptr, zerosXBuf, dfaNoisySum,
echoEst32);
// Calculate stepsize
@@ -440,18 +390,12 @@
// This is the channel estimation algorithm.
// It is base on NLMS but has a variable step length,
// which was calculated above.
- WebRtcAecm_UpdateChannel(aecm,
- far_spectrum_ptr,
- zerosXBuf,
- dfaNoisy,
- mu,
+ WebRtcAecm_UpdateChannel(aecm, far_spectrum_ptr, zerosXBuf, dfaNoisy, mu,
echoEst32);
supGain = WebRtcAecm_CalcSuppressionGain(aecm);
-
// Calculate Wiener filter hnl[]
- for (i = 0; i < PART_LEN1; i++)
- {
+ for (i = 0; i < PART_LEN1; i++) {
// Far end signal through channel estimate in Q8
// How much can we shift right to preserve resolution
tmp32no1 = echoEst32[i] - aecm->echoFilt[i];
@@ -460,28 +404,24 @@
zeros32 = WebRtcSpl_NormW32(aecm->echoFilt[i]) + 1;
zeros16 = WebRtcSpl_NormW16(supGain) + 1;
- if (zeros32 + zeros16 > 16)
- {
+ if (zeros32 + zeros16 > 16) {
// Multiplication is safe
// Result in
// Q(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN+
// aecm->xfaQDomainBuf[diff])
- echoEst32Gained = WEBRTC_SPL_UMUL_32_16((uint32_t)aecm->echoFilt[i],
- (uint16_t)supGain);
+ echoEst32Gained =
+ WEBRTC_SPL_UMUL_32_16((uint32_t)aecm->echoFilt[i], (uint16_t)supGain);
resolutionDiff = 14 - RESOLUTION_CHANNEL16 - RESOLUTION_SUPGAIN;
resolutionDiff += (aecm->dfaCleanQDomain - zerosXBuf);
- } else
- {
+ } else {
tmp16no1 = 17 - zeros32 - zeros16;
- resolutionDiff = 14 + tmp16no1 - RESOLUTION_CHANNEL16 -
- RESOLUTION_SUPGAIN;
+ resolutionDiff =
+ 14 + tmp16no1 - RESOLUTION_CHANNEL16 - RESOLUTION_SUPGAIN;
resolutionDiff += (aecm->dfaCleanQDomain - zerosXBuf);
- if (zeros32 > tmp16no1)
- {
+ if (zeros32 > tmp16no1) {
echoEst32Gained = WEBRTC_SPL_UMUL_32_16((uint32_t)aecm->echoFilt[i],
supGain >> tmp16no1);
- } else
- {
+ } else {
// Result in Q-(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN-16)
echoEst32Gained = (aecm->echoFilt[i] >> tmp16no1) * supGain;
}
@@ -513,125 +453,100 @@
}
// Wiener filter coefficients, resulting hnl in Q14
- if (echoEst32Gained == 0)
- {
+ if (echoEst32Gained == 0) {
hnl[i] = ONE_Q14;
- } else if (aecm->nearFilt[i] == 0)
- {
+ } else if (aecm->nearFilt[i] == 0) {
hnl[i] = 0;
- } else
- {
+ } else {
// Multiply the suppression gain
// Rounding
echoEst32Gained += (uint32_t)(aecm->nearFilt[i] >> 1);
- tmpU32 = WebRtcSpl_DivU32U16(echoEst32Gained,
- (uint16_t)aecm->nearFilt[i]);
+ tmpU32 =
+ WebRtcSpl_DivU32U16(echoEst32Gained, (uint16_t)aecm->nearFilt[i]);
// Current resolution is
// Q-(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN- max(0,17-zeros16- zeros32))
// Make sure we are in Q14
tmp32no1 = (int32_t)WEBRTC_SPL_SHIFT_W32(tmpU32, resolutionDiff);
- if (tmp32no1 > ONE_Q14)
- {
+ if (tmp32no1 > ONE_Q14) {
hnl[i] = 0;
- } else if (tmp32no1 < 0)
- {
+ } else if (tmp32no1 < 0) {
hnl[i] = ONE_Q14;
- } else
- {
+ } else {
// 1-echoEst/dfa
hnl[i] = ONE_Q14 - (int16_t)tmp32no1;
- if (hnl[i] < 0)
- {
+ if (hnl[i] < 0) {
hnl[i] = 0;
}
}
}
- if (hnl[i])
- {
+ if (hnl[i]) {
numPosCoef++;
}
}
// Only in wideband. Prevent the gain in upper band from being larger than
// in lower band.
- if (aecm->mult == 2)
- {
+ if (aecm->mult == 2) {
// TODO(bjornv): Investigate if the scaling of hnl[i] below can cause
// speech distortion in double-talk.
- for (i = 0; i < PART_LEN1; i++)
- {
+ for (i = 0; i < PART_LEN1; i++) {
hnl[i] = (int16_t)((hnl[i] * hnl[i]) >> 14);
}
- for (i = kMinPrefBand; i <= kMaxPrefBand; i++)
- {
+ for (i = kMinPrefBand; i <= kMaxPrefBand; i++) {
avgHnl32 += (int32_t)hnl[i];
}
RTC_DCHECK_GT(kMaxPrefBand - kMinPrefBand + 1, 0);
avgHnl32 /= (kMaxPrefBand - kMinPrefBand + 1);
- for (i = kMaxPrefBand; i < PART_LEN1; i++)
- {
- if (hnl[i] > (int16_t)avgHnl32)
- {
+ for (i = kMaxPrefBand; i < PART_LEN1; i++) {
+ if (hnl[i] > (int16_t)avgHnl32) {
hnl[i] = (int16_t)avgHnl32;
}
}
}
// Calculate NLP gain, result is in Q14
- if (aecm->nlpFlag)
- {
- for (i = 0; i < PART_LEN1; i++)
- {
+ if (aecm->nlpFlag) {
+ for (i = 0; i < PART_LEN1; i++) {
// Truncate values close to zero and one.
- if (hnl[i] > NLP_COMP_HIGH)
- {
+ if (hnl[i] > NLP_COMP_HIGH) {
hnl[i] = ONE_Q14;
- } else if (hnl[i] < NLP_COMP_LOW)
- {
+ } else if (hnl[i] < NLP_COMP_LOW) {
hnl[i] = 0;
}
// Remove outliers
- if (numPosCoef < 3)
- {
+ if (numPosCoef < 3) {
nlpGain = 0;
- } else
- {
+ } else {
nlpGain = ONE_Q14;
}
// NLP
- if ((hnl[i] == ONE_Q14) && (nlpGain == ONE_Q14))
- {
+ if ((hnl[i] == ONE_Q14) && (nlpGain == ONE_Q14)) {
hnl[i] = ONE_Q14;
- } else
- {
+ } else {
hnl[i] = (int16_t)((hnl[i] * nlpGain) >> 14);
}
// multiply with Wiener coefficients
- efw[i].real = (int16_t)(WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real,
- hnl[i], 14));
- efw[i].imag = (int16_t)(WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag,
- hnl[i], 14));
+ efw[i].real = (int16_t)(
+ WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real, hnl[i], 14));
+ efw[i].imag = (int16_t)(
+ WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag, hnl[i], 14));
}
- }
- else
- {
+ } else {
// multiply with Wiener coefficients
- for (i = 0; i < PART_LEN1; i++)
- {
- efw[i].real = (int16_t)(WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real,
- hnl[i], 14));
- efw[i].imag = (int16_t)(WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag,
- hnl[i], 14));
+ for (i = 0; i < PART_LEN1; i++) {
+ efw[i].real = (int16_t)(
+ WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real, hnl[i], 14));
+ efw[i].imag = (int16_t)(
+ WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag, hnl[i], 14));
}
}
- if (aecm->cngMode == AecmTrue)
- {
+ if (aecm->cngMode == AecmTrue) {
ComfortNoise(aecm, ptrDfaClean, efw, hnl);
}
@@ -660,83 +575,66 @@
RTC_DCHECK_GE(shiftFromNearToNoise, 0);
RTC_DCHECK_LT(shiftFromNearToNoise, 16);
- if (aecm->noiseEstCtr < 100)
- {
+ if (aecm->noiseEstCtr < 100) {
// Track the minimum more quickly initially.
aecm->noiseEstCtr++;
minTrackShift = 6;
- } else
- {
+ } else {
minTrackShift = 9;
}
// Estimate noise power.
- for (i = 0; i < PART_LEN1; i++)
- {
+ for (i = 0; i < PART_LEN1; i++) {
// Shift to the noise domain.
tmp32 = (int32_t)dfa[i];
outLShift32 = tmp32 << shiftFromNearToNoise;
- if (outLShift32 < aecm->noiseEst[i])
- {
+ if (outLShift32 < aecm->noiseEst[i]) {
// Reset "too low" counter
aecm->noiseEstTooLowCtr[i] = 0;
// Track the minimum.
- if (aecm->noiseEst[i] < (1 << minTrackShift))
- {
+ if (aecm->noiseEst[i] < (1 << minTrackShift)) {
// For small values, decrease noiseEst[i] every
// |kNoiseEstIncCount| block. The regular approach below can not
// go further down due to truncation.
aecm->noiseEstTooHighCtr[i]++;
- if (aecm->noiseEstTooHighCtr[i] >= kNoiseEstIncCount)
- {
+ if (aecm->noiseEstTooHighCtr[i] >= kNoiseEstIncCount) {
aecm->noiseEst[i]--;
- aecm->noiseEstTooHighCtr[i] = 0; // Reset the counter
+ aecm->noiseEstTooHighCtr[i] = 0; // Reset the counter
}
+ } else {
+ aecm->noiseEst[i] -=
+ ((aecm->noiseEst[i] - outLShift32) >> minTrackShift);
}
- else
- {
- aecm->noiseEst[i] -= ((aecm->noiseEst[i] - outLShift32)
- >> minTrackShift);
- }
- } else
- {
+ } else {
// Reset "too high" counter
aecm->noiseEstTooHighCtr[i] = 0;
// Ramp slowly upwards until we hit the minimum again.
- if ((aecm->noiseEst[i] >> 19) > 0)
- {
+ if ((aecm->noiseEst[i] >> 19) > 0) {
// Avoid overflow.
// Multiplication with 2049 will cause wrap around. Scale
// down first and then multiply
aecm->noiseEst[i] >>= 11;
aecm->noiseEst[i] *= 2049;
- }
- else if ((aecm->noiseEst[i] >> 11) > 0)
- {
+ } else if ((aecm->noiseEst[i] >> 11) > 0) {
// Large enough for relative increase
aecm->noiseEst[i] *= 2049;
aecm->noiseEst[i] >>= 11;
- }
- else
- {
+ } else {
// Make incremental increases based on size every
// |kNoiseEstIncCount| block
aecm->noiseEstTooLowCtr[i]++;
- if (aecm->noiseEstTooLowCtr[i] >= kNoiseEstIncCount)
- {
+ if (aecm->noiseEstTooLowCtr[i] >= kNoiseEstIncCount) {
aecm->noiseEst[i] += (aecm->noiseEst[i] >> 9) + 1;
- aecm->noiseEstTooLowCtr[i] = 0; // Reset counter
+ aecm->noiseEstTooLowCtr[i] = 0; // Reset counter
}
}
}
}
- for (i = 0; i < PART_LEN1; i++)
- {
+ for (i = 0; i < PART_LEN1; i++) {
tmp32 = aecm->noiseEst[i] >> shiftFromNearToNoise;
- if (tmp32 > 32767)
- {
+ if (tmp32 > 32767) {
tmp32 = 32767;
aecm->noiseEst[i] = tmp32 << shiftFromNearToNoise;
}
@@ -750,23 +648,21 @@
WebRtcSpl_RandUArray(randW16, PART_LEN, &aecm->seed);
// Generate noise according to estimated energy.
- uReal[0] = 0; // Reject LF noise.
+ uReal[0] = 0; // Reject LF noise.
uImag[0] = 0;
- for (i = 1; i < PART_LEN1; i++)
- {
+ for (i = 1; i < PART_LEN1; i++) {
// Get a random index for the cos and sin tables over [0 359].
tmp16 = (int16_t)((359 * randW16[i - 1]) >> 15);
// Tables are in Q13.
- uReal[i] = (int16_t)((noiseRShift16[i] * WebRtcAecm_kCosTable[tmp16]) >>
- 13);
- uImag[i] = (int16_t)((-noiseRShift16[i] * WebRtcAecm_kSinTable[tmp16]) >>
- 13);
+ uReal[i] =
+ (int16_t)((noiseRShift16[i] * WebRtcAecm_kCosTable[tmp16]) >> 13);
+ uImag[i] =
+ (int16_t)((-noiseRShift16[i] * WebRtcAecm_kSinTable[tmp16]) >> 13);
}
uImag[PART_LEN] = 0;
- for (i = 0; i < PART_LEN1; i++)
- {
+ for (i = 0; i < PART_LEN1; i++) {
out[i].real = WebRtcSpl_AddSatW16(out[i].real, uReal[i]);
out[i].imag = WebRtcSpl_AddSatW16(out[i].imag, uImag[i]);
}
diff --git a/modules/audio_processing/aecm/aecm_core_mips.cc b/modules/audio_processing/aecm/aecm_core_mips.cc
index 58e5ec5..11e4095 100644
--- a/modules/audio_processing/aecm/aecm_core_mips.cc
+++ b/modules/audio_processing/aecm/aecm_core_mips.cc
@@ -16,56 +16,37 @@
#include "rtc_base/numerics/safe_conversions.h"
static const ALIGN8_BEG int16_t WebRtcAecm_kSqrtHanning[] ALIGN8_END = {
- 0, 399, 798, 1196, 1594, 1990, 2386, 2780, 3172,
- 3562, 3951, 4337, 4720, 5101, 5478, 5853, 6224,
- 6591, 6954, 7313, 7668, 8019, 8364, 8705, 9040,
- 9370, 9695, 10013, 10326, 10633, 10933, 11227, 11514,
- 11795, 12068, 12335, 12594, 12845, 13089, 13325, 13553,
- 13773, 13985, 14189, 14384, 14571, 14749, 14918, 15079,
- 15231, 15373, 15506, 15631, 15746, 15851, 15947, 16034,
- 16111, 16179, 16237, 16286, 16325, 16354, 16373, 16384
-};
+ 0, 399, 798, 1196, 1594, 1990, 2386, 2780, 3172, 3562, 3951,
+ 4337, 4720, 5101, 5478, 5853, 6224, 6591, 6954, 7313, 7668, 8019,
+ 8364, 8705, 9040, 9370, 9695, 10013, 10326, 10633, 10933, 11227, 11514,
+ 11795, 12068, 12335, 12594, 12845, 13089, 13325, 13553, 13773, 13985, 14189,
+ 14384, 14571, 14749, 14918, 15079, 15231, 15373, 15506, 15631, 15746, 15851,
+ 15947, 16034, 16111, 16179, 16237, 16286, 16325, 16354, 16373, 16384};
static const int16_t kNoiseEstQDomain = 15;
static const int16_t kNoiseEstIncCount = 5;
static int16_t coefTable[] = {
- 0, 4, 256, 260, 128, 132, 384, 388,
- 64, 68, 320, 324, 192, 196, 448, 452,
- 32, 36, 288, 292, 160, 164, 416, 420,
- 96, 100, 352, 356, 224, 228, 480, 484,
- 16, 20, 272, 276, 144, 148, 400, 404,
- 80, 84, 336, 340, 208, 212, 464, 468,
- 48, 52, 304, 308, 176, 180, 432, 436,
- 112, 116, 368, 372, 240, 244, 496, 500,
- 8, 12, 264, 268, 136, 140, 392, 396,
- 72, 76, 328, 332, 200, 204, 456, 460,
- 40, 44, 296, 300, 168, 172, 424, 428,
- 104, 108, 360, 364, 232, 236, 488, 492,
- 24, 28, 280, 284, 152, 156, 408, 412,
- 88, 92, 344, 348, 216, 220, 472, 476,
- 56, 60, 312, 316, 184, 188, 440, 444,
- 120, 124, 376, 380, 248, 252, 504, 508
-};
+ 0, 4, 256, 260, 128, 132, 384, 388, 64, 68, 320, 324, 192, 196, 448,
+ 452, 32, 36, 288, 292, 160, 164, 416, 420, 96, 100, 352, 356, 224, 228,
+ 480, 484, 16, 20, 272, 276, 144, 148, 400, 404, 80, 84, 336, 340, 208,
+ 212, 464, 468, 48, 52, 304, 308, 176, 180, 432, 436, 112, 116, 368, 372,
+ 240, 244, 496, 500, 8, 12, 264, 268, 136, 140, 392, 396, 72, 76, 328,
+ 332, 200, 204, 456, 460, 40, 44, 296, 300, 168, 172, 424, 428, 104, 108,
+ 360, 364, 232, 236, 488, 492, 24, 28, 280, 284, 152, 156, 408, 412, 88,
+ 92, 344, 348, 216, 220, 472, 476, 56, 60, 312, 316, 184, 188, 440, 444,
+ 120, 124, 376, 380, 248, 252, 504, 508};
static int16_t coefTable_ifft[] = {
- 0, 512, 256, 508, 128, 252, 384, 380,
- 64, 124, 320, 444, 192, 188, 448, 316,
- 32, 60, 288, 476, 160, 220, 416, 348,
- 96, 92, 352, 412, 224, 156, 480, 284,
- 16, 28, 272, 492, 144, 236, 400, 364,
- 80, 108, 336, 428, 208, 172, 464, 300,
- 48, 44, 304, 460, 176, 204, 432, 332,
- 112, 76, 368, 396, 240, 140, 496, 268,
- 8, 12, 264, 500, 136, 244, 392, 372,
- 72, 116, 328, 436, 200, 180, 456, 308,
- 40, 52, 296, 468, 168, 212, 424, 340,
- 104, 84, 360, 404, 232, 148, 488, 276,
- 24, 20, 280, 484, 152, 228, 408, 356,
- 88, 100, 344, 420, 216, 164, 472, 292,
- 56, 36, 312, 452, 184, 196, 440, 324,
- 120, 68, 376, 388, 248, 132, 504, 260
-};
+ 0, 512, 256, 508, 128, 252, 384, 380, 64, 124, 320, 444, 192, 188, 448,
+ 316, 32, 60, 288, 476, 160, 220, 416, 348, 96, 92, 352, 412, 224, 156,
+ 480, 284, 16, 28, 272, 492, 144, 236, 400, 364, 80, 108, 336, 428, 208,
+ 172, 464, 300, 48, 44, 304, 460, 176, 204, 432, 332, 112, 76, 368, 396,
+ 240, 140, 496, 268, 8, 12, 264, 500, 136, 244, 392, 372, 72, 116, 328,
+ 436, 200, 180, 456, 308, 40, 52, 296, 468, 168, 212, 424, 340, 104, 84,
+ 360, 404, 232, 148, 488, 276, 24, 20, 280, 484, 152, 228, 408, 356, 88,
+ 100, 344, 420, 216, 164, 472, 292, 56, 36, 312, 452, 184, 196, 440, 324,
+ 120, 68, 376, 388, 248, 132, 504, 260};
static void ComfortNoise(AecmCore* aecm,
const uint16_t* dfa,
@@ -81,122 +62,152 @@
int32_t tmp1, tmp2, tmp3, tmp4;
int16_t* pfrfi;
ComplexInt16* pfreq_signal;
- int16_t f_coef, s_coef;
+ int16_t f_coef, s_coef;
int32_t load_ptr, store_ptr1, store_ptr2, shift, shift1;
int32_t hann, hann1, coefs;
memset(fft, 0, sizeof(int16_t) * PART_LEN4);
// FFT of signal
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[shift], %[time_signal_scaling], -14 \n\t"
- "addiu %[i], $zero, 64 \n\t"
- "addiu %[load_ptr], %[time_signal], 0 \n\t"
- "addiu %[hann], %[hanning], 0 \n\t"
- "addiu %[hann1], %[hanning], 128 \n\t"
- "addiu %[coefs], %[coefTable], 0 \n\t"
- "bltz %[shift], 2f \n\t"
- " negu %[shift1], %[shift] \n\t"
- "1: \n\t"
- "lh %[tmp1], 0(%[load_ptr]) \n\t"
- "lh %[tmp2], 0(%[hann]) \n\t"
- "lh %[tmp3], 128(%[load_ptr]) \n\t"
- "lh %[tmp4], 0(%[hann1]) \n\t"
- "addiu %[i], %[i], -1 \n\t"
- "mul %[tmp1], %[tmp1], %[tmp2] \n\t"
- "mul %[tmp3], %[tmp3], %[tmp4] \n\t"
- "lh %[f_coef], 0(%[coefs]) \n\t"
- "lh %[s_coef], 2(%[coefs]) \n\t"
- "addiu %[load_ptr], %[load_ptr], 2 \n\t"
- "addiu %[hann], %[hann], 2 \n\t"
- "addiu %[hann1], %[hann1], -2 \n\t"
- "addu %[store_ptr1], %[fft], %[f_coef] \n\t"
- "addu %[store_ptr2], %[fft], %[s_coef] \n\t"
- "sllv %[tmp1], %[tmp1], %[shift] \n\t"
- "sllv %[tmp3], %[tmp3], %[shift] \n\t"
- "sh %[tmp1], 0(%[store_ptr1]) \n\t"
- "sh %[tmp3], 0(%[store_ptr2]) \n\t"
- "bgtz %[i], 1b \n\t"
- " addiu %[coefs], %[coefs], 4 \n\t"
- "b 3f \n\t"
- " nop \n\t"
- "2: \n\t"
- "lh %[tmp1], 0(%[load_ptr]) \n\t"
- "lh %[tmp2], 0(%[hann]) \n\t"
- "lh %[tmp3], 128(%[load_ptr]) \n\t"
- "lh %[tmp4], 0(%[hann1]) \n\t"
- "addiu %[i], %[i], -1 \n\t"
- "mul %[tmp1], %[tmp1], %[tmp2] \n\t"
- "mul %[tmp3], %[tmp3], %[tmp4] \n\t"
- "lh %[f_coef], 0(%[coefs]) \n\t"
- "lh %[s_coef], 2(%[coefs]) \n\t"
- "addiu %[load_ptr], %[load_ptr], 2 \n\t"
- "addiu %[hann], %[hann], 2 \n\t"
- "addiu %[hann1], %[hann1], -2 \n\t"
- "addu %[store_ptr1], %[fft], %[f_coef] \n\t"
- "addu %[store_ptr2], %[fft], %[s_coef] \n\t"
- "srav %[tmp1], %[tmp1], %[shift1] \n\t"
- "srav %[tmp3], %[tmp3], %[shift1] \n\t"
- "sh %[tmp1], 0(%[store_ptr1]) \n\t"
- "sh %[tmp3], 0(%[store_ptr2]) \n\t"
- "bgtz %[i], 2b \n\t"
- " addiu %[coefs], %[coefs], 4 \n\t"
- "3: \n\t"
- ".set pop \n\t"
- : [load_ptr] "=&r" (load_ptr), [shift] "=&r" (shift), [hann] "=&r" (hann),
- [hann1] "=&r" (hann1), [shift1] "=&r" (shift1), [coefs] "=&r" (coefs),
- [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2), [tmp3] "=&r" (tmp3),
- [tmp4] "=&r" (tmp4), [i] "=&r" (i), [f_coef] "=&r" (f_coef),
- [s_coef] "=&r" (s_coef), [store_ptr1] "=&r" (store_ptr1),
- [store_ptr2] "=&r" (store_ptr2)
- : [time_signal] "r" (time_signal), [coefTable] "r" (coefTable),
- [time_signal_scaling] "r" (time_signal_scaling),
- [hanning] "r" (WebRtcAecm_kSqrtHanning), [fft] "r" (fft)
- : "memory", "hi", "lo"
- );
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "addiu %[shift], %[time_signal_scaling], -14 \n\t"
+ "addiu %[i], $zero, 64 \n\t"
+ "addiu %[load_ptr], %[time_signal], 0 \n\t"
+ "addiu %[hann], %[hanning], 0 \n\t"
+ "addiu %[hann1], %[hanning], 128 \n\t"
+ "addiu %[coefs], %[coefTable], 0 \n\t"
+ "bltz %[shift], 2f \n\t"
+ " negu %[shift1], %[shift] \n\t"
+ "1: "
+ "\n\t"
+ "lh %[tmp1], 0(%[load_ptr]) \n\t"
+ "lh %[tmp2], 0(%[hann]) \n\t"
+ "lh %[tmp3], 128(%[load_ptr]) \n\t"
+ "lh %[tmp4], 0(%[hann1]) \n\t"
+ "addiu %[i], %[i], -1 \n\t"
+ "mul %[tmp1], %[tmp1], %[tmp2] \n\t"
+ "mul %[tmp3], %[tmp3], %[tmp4] \n\t"
+ "lh %[f_coef], 0(%[coefs]) \n\t"
+ "lh %[s_coef], 2(%[coefs]) \n\t"
+ "addiu %[load_ptr], %[load_ptr], 2 \n\t"
+ "addiu %[hann], %[hann], 2 \n\t"
+ "addiu %[hann1], %[hann1], -2 \n\t"
+ "addu %[store_ptr1], %[fft], %[f_coef] \n\t"
+ "addu %[store_ptr2], %[fft], %[s_coef] \n\t"
+ "sllv %[tmp1], %[tmp1], %[shift] \n\t"
+ "sllv %[tmp3], %[tmp3], %[shift] \n\t"
+ "sh %[tmp1], 0(%[store_ptr1]) \n\t"
+ "sh %[tmp3], 0(%[store_ptr2]) \n\t"
+ "bgtz %[i], 1b \n\t"
+ " addiu %[coefs], %[coefs], 4 \n\t"
+ "b 3f \n\t"
+ " nop \n\t"
+ "2: "
+ "\n\t"
+ "lh %[tmp1], 0(%[load_ptr]) \n\t"
+ "lh %[tmp2], 0(%[hann]) \n\t"
+ "lh %[tmp3], 128(%[load_ptr]) \n\t"
+ "lh %[tmp4], 0(%[hann1]) \n\t"
+ "addiu %[i], %[i], -1 \n\t"
+ "mul %[tmp1], %[tmp1], %[tmp2] \n\t"
+ "mul %[tmp3], %[tmp3], %[tmp4] \n\t"
+ "lh %[f_coef], 0(%[coefs]) \n\t"
+ "lh %[s_coef], 2(%[coefs]) \n\t"
+ "addiu %[load_ptr], %[load_ptr], 2 \n\t"
+ "addiu %[hann], %[hann], 2 \n\t"
+ "addiu %[hann1], %[hann1], -2 \n\t"
+ "addu %[store_ptr1], %[fft], %[f_coef] \n\t"
+ "addu %[store_ptr2], %[fft], %[s_coef] \n\t"
+ "srav %[tmp1], %[tmp1], %[shift1] \n\t"
+ "srav %[tmp3], %[tmp3], %[shift1] \n\t"
+ "sh %[tmp1], 0(%[store_ptr1]) \n\t"
+ "sh %[tmp3], 0(%[store_ptr2]) \n\t"
+ "bgtz %[i], 2b \n\t"
+ " addiu %[coefs], %[coefs], 4 \n\t"
+ "3: "
+ "\n\t"
+ ".set pop \n\t"
+ : [load_ptr] "=&r"(load_ptr), [shift] "=&r"(shift), [hann] "=&r"(hann),
+ [hann1] "=&r"(hann1), [shift1] "=&r"(shift1), [coefs] "=&r"(coefs),
+ [tmp1] "=&r"(tmp1), [tmp2] "=&r"(tmp2), [tmp3] "=&r"(tmp3),
+ [tmp4] "=&r"(tmp4), [i] "=&r"(i), [f_coef] "=&r"(f_coef),
+ [s_coef] "=&r"(s_coef), [store_ptr1] "=&r"(store_ptr1),
+ [store_ptr2] "=&r"(store_ptr2)
+ : [time_signal] "r"(time_signal), [coefTable] "r"(coefTable),
+ [time_signal_scaling] "r"(time_signal_scaling),
+ [hanning] "r"(WebRtcAecm_kSqrtHanning), [fft] "r"(fft)
+ : "memory", "hi", "lo");
WebRtcSpl_ComplexFFT(fft, PART_LEN_SHIFT, 1);
pfrfi = fft;
pfreq_signal = freq_signal;
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[j], $zero, 128 \n\t"
- "1: \n\t"
- "lh %[tmp1], 0(%[pfrfi]) \n\t"
- "lh %[tmp2], 2(%[pfrfi]) \n\t"
- "lh %[tmp3], 4(%[pfrfi]) \n\t"
- "lh %[tmp4], 6(%[pfrfi]) \n\t"
- "subu %[tmp2], $zero, %[tmp2] \n\t"
- "sh %[tmp1], 0(%[pfreq_signal]) \n\t"
- "sh %[tmp2], 2(%[pfreq_signal]) \n\t"
- "subu %[tmp4], $zero, %[tmp4] \n\t"
- "sh %[tmp3], 4(%[pfreq_signal]) \n\t"
- "sh %[tmp4], 6(%[pfreq_signal]) \n\t"
- "lh %[tmp1], 8(%[pfrfi]) \n\t"
- "lh %[tmp2], 10(%[pfrfi]) \n\t"
- "lh %[tmp3], 12(%[pfrfi]) \n\t"
- "lh %[tmp4], 14(%[pfrfi]) \n\t"
- "addiu %[j], %[j], -8 \n\t"
- "subu %[tmp2], $zero, %[tmp2] \n\t"
- "sh %[tmp1], 8(%[pfreq_signal]) \n\t"
- "sh %[tmp2], 10(%[pfreq_signal]) \n\t"
- "subu %[tmp4], $zero, %[tmp4] \n\t"
- "sh %[tmp3], 12(%[pfreq_signal]) \n\t"
- "sh %[tmp4], 14(%[pfreq_signal]) \n\t"
- "addiu %[pfreq_signal], %[pfreq_signal], 16 \n\t"
- "bgtz %[j], 1b \n\t"
- " addiu %[pfrfi], %[pfrfi], 16 \n\t"
- ".set pop \n\t"
- : [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2), [tmp3] "=&r" (tmp3),
- [j] "=&r" (j), [pfrfi] "+r" (pfrfi), [pfreq_signal] "+r" (pfreq_signal),
- [tmp4] "=&r" (tmp4)
- :
- : "memory"
- );
+ __asm __volatile(
+ ".set push "
+ "\n\t"
+ ".set noreorder "
+ "\n\t"
+ "addiu %[j], $zero, 128 "
+ "\n\t"
+ "1: "
+ "\n\t"
+ "lh %[tmp1], 0(%[pfrfi]) "
+ "\n\t"
+ "lh %[tmp2], 2(%[pfrfi]) "
+ "\n\t"
+ "lh %[tmp3], 4(%[pfrfi]) "
+ "\n\t"
+ "lh %[tmp4], 6(%[pfrfi]) "
+ "\n\t"
+ "subu %[tmp2], $zero, %[tmp2] "
+ "\n\t"
+ "sh %[tmp1], 0(%[pfreq_signal]) "
+ "\n\t"
+ "sh %[tmp2], 2(%[pfreq_signal]) "
+ "\n\t"
+ "subu %[tmp4], $zero, %[tmp4] "
+ "\n\t"
+ "sh %[tmp3], 4(%[pfreq_signal]) "
+ "\n\t"
+ "sh %[tmp4], 6(%[pfreq_signal]) "
+ "\n\t"
+ "lh %[tmp1], 8(%[pfrfi]) "
+ "\n\t"
+ "lh %[tmp2], 10(%[pfrfi]) "
+ "\n\t"
+ "lh %[tmp3], 12(%[pfrfi]) "
+ "\n\t"
+ "lh %[tmp4], 14(%[pfrfi]) "
+ "\n\t"
+ "addiu %[j], %[j], -8 "
+ "\n\t"
+ "subu %[tmp2], $zero, %[tmp2] "
+ "\n\t"
+ "sh %[tmp1], 8(%[pfreq_signal]) "
+ "\n\t"
+ "sh %[tmp2], 10(%[pfreq_signal]) "
+ "\n\t"
+ "subu %[tmp4], $zero, %[tmp4] "
+ "\n\t"
+ "sh %[tmp3], 12(%[pfreq_signal]) "
+ "\n\t"
+ "sh %[tmp4], 14(%[pfreq_signal]) "
+ "\n\t"
+ "addiu %[pfreq_signal], %[pfreq_signal], 16 "
+ "\n\t"
+ "bgtz %[j], 1b "
+ "\n\t"
+ " addiu %[pfrfi], %[pfrfi], 16 "
+ "\n\t"
+ ".set pop "
+ "\n\t"
+ : [tmp1] "=&r"(tmp1), [tmp2] "=&r"(tmp2), [tmp3] "=&r"(tmp3),
+ [j] "=&r"(j), [pfrfi] "+r"(pfrfi), [pfreq_signal] "+r"(pfreq_signal),
+ [tmp4] "=&r"(tmp4)
+ :
+ : "memory");
}
static void InverseFFTAndWindow(AecmCore* aecm,
@@ -216,67 +227,118 @@
const int16_t* pp_kSqrtHanning = &WebRtcAecm_kSqrtHanning[PART_LEN];
int16_t* output1 = output;
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[i], $zero, 64 \n\t"
- "1: \n\t"
- "lh %[tmp1], 0(%[pcoefTable_ifft]) \n\t"
- "lh %[tmp2], 2(%[pcoefTable_ifft]) \n\t"
- "lh %[tmp_re], 0(%[pefw]) \n\t"
- "lh %[tmp_im], 2(%[pefw]) \n\t"
- "addu %[pfft], %[fft], %[tmp2] \n\t"
- "sh %[tmp_re], 0(%[pfft]) \n\t"
- "sh %[tmp_im], 2(%[pfft]) \n\t"
- "addu %[pfft], %[fft], %[tmp1] \n\t"
- "sh %[tmp_re], 0(%[pfft]) \n\t"
- "subu %[tmp_im], $zero, %[tmp_im] \n\t"
- "sh %[tmp_im], 2(%[pfft]) \n\t"
- "lh %[tmp1], 4(%[pcoefTable_ifft]) \n\t"
- "lh %[tmp2], 6(%[pcoefTable_ifft]) \n\t"
- "lh %[tmp_re], 4(%[pefw]) \n\t"
- "lh %[tmp_im], 6(%[pefw]) \n\t"
- "addu %[pfft], %[fft], %[tmp2] \n\t"
- "sh %[tmp_re], 0(%[pfft]) \n\t"
- "sh %[tmp_im], 2(%[pfft]) \n\t"
- "addu %[pfft], %[fft], %[tmp1] \n\t"
- "sh %[tmp_re], 0(%[pfft]) \n\t"
- "subu %[tmp_im], $zero, %[tmp_im] \n\t"
- "sh %[tmp_im], 2(%[pfft]) \n\t"
- "lh %[tmp1], 8(%[pcoefTable_ifft]) \n\t"
- "lh %[tmp2], 10(%[pcoefTable_ifft]) \n\t"
- "lh %[tmp_re], 8(%[pefw]) \n\t"
- "lh %[tmp_im], 10(%[pefw]) \n\t"
- "addu %[pfft], %[fft], %[tmp2] \n\t"
- "sh %[tmp_re], 0(%[pfft]) \n\t"
- "sh %[tmp_im], 2(%[pfft]) \n\t"
- "addu %[pfft], %[fft], %[tmp1] \n\t"
- "sh %[tmp_re], 0(%[pfft]) \n\t"
- "subu %[tmp_im], $zero, %[tmp_im] \n\t"
- "sh %[tmp_im], 2(%[pfft]) \n\t"
- "lh %[tmp1], 12(%[pcoefTable_ifft]) \n\t"
- "lh %[tmp2], 14(%[pcoefTable_ifft]) \n\t"
- "lh %[tmp_re], 12(%[pefw]) \n\t"
- "lh %[tmp_im], 14(%[pefw]) \n\t"
- "addu %[pfft], %[fft], %[tmp2] \n\t"
- "sh %[tmp_re], 0(%[pfft]) \n\t"
- "sh %[tmp_im], 2(%[pfft]) \n\t"
- "addu %[pfft], %[fft], %[tmp1] \n\t"
- "sh %[tmp_re], 0(%[pfft]) \n\t"
- "subu %[tmp_im], $zero, %[tmp_im] \n\t"
- "sh %[tmp_im], 2(%[pfft]) \n\t"
- "addiu %[pcoefTable_ifft], %[pcoefTable_ifft], 16 \n\t"
- "addiu %[i], %[i], -4 \n\t"
- "bgtz %[i], 1b \n\t"
- " addiu %[pefw], %[pefw], 16 \n\t"
- ".set pop \n\t"
- : [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2), [pfft] "+r" (pfft),
- [i] "=&r" (i), [tmp_re] "=&r" (tmp_re), [tmp_im] "=&r" (tmp_im),
- [pefw] "+r" (pefw), [pcoefTable_ifft] "+r" (pcoefTable_ifft),
- [fft] "+r" (fft)
- :
- : "memory"
- );
+ __asm __volatile(
+ ".set push "
+ "\n\t"
+ ".set noreorder "
+ "\n\t"
+ "addiu %[i], $zero, 64 "
+ "\n\t"
+ "1: "
+ "\n\t"
+ "lh %[tmp1], 0(%[pcoefTable_ifft]) "
+ "\n\t"
+ "lh %[tmp2], 2(%[pcoefTable_ifft]) "
+ "\n\t"
+ "lh %[tmp_re], 0(%[pefw]) "
+ "\n\t"
+ "lh %[tmp_im], 2(%[pefw]) "
+ "\n\t"
+ "addu %[pfft], %[fft], %[tmp2] "
+ "\n\t"
+ "sh %[tmp_re], 0(%[pfft]) "
+ "\n\t"
+ "sh %[tmp_im], 2(%[pfft]) "
+ "\n\t"
+ "addu %[pfft], %[fft], %[tmp1] "
+ "\n\t"
+ "sh %[tmp_re], 0(%[pfft]) "
+ "\n\t"
+ "subu %[tmp_im], $zero, %[tmp_im] "
+ "\n\t"
+ "sh %[tmp_im], 2(%[pfft]) "
+ "\n\t"
+ "lh %[tmp1], 4(%[pcoefTable_ifft]) "
+ "\n\t"
+ "lh %[tmp2], 6(%[pcoefTable_ifft]) "
+ "\n\t"
+ "lh %[tmp_re], 4(%[pefw]) "
+ "\n\t"
+ "lh %[tmp_im], 6(%[pefw]) "
+ "\n\t"
+ "addu %[pfft], %[fft], %[tmp2] "
+ "\n\t"
+ "sh %[tmp_re], 0(%[pfft]) "
+ "\n\t"
+ "sh %[tmp_im], 2(%[pfft]) "
+ "\n\t"
+ "addu %[pfft], %[fft], %[tmp1] "
+ "\n\t"
+ "sh %[tmp_re], 0(%[pfft]) "
+ "\n\t"
+ "subu %[tmp_im], $zero, %[tmp_im] "
+ "\n\t"
+ "sh %[tmp_im], 2(%[pfft]) "
+ "\n\t"
+ "lh %[tmp1], 8(%[pcoefTable_ifft]) "
+ "\n\t"
+ "lh %[tmp2], 10(%[pcoefTable_ifft]) "
+ "\n\t"
+ "lh %[tmp_re], 8(%[pefw]) "
+ "\n\t"
+ "lh %[tmp_im], 10(%[pefw]) "
+ "\n\t"
+ "addu %[pfft], %[fft], %[tmp2] "
+ "\n\t"
+ "sh %[tmp_re], 0(%[pfft]) "
+ "\n\t"
+ "sh %[tmp_im], 2(%[pfft]) "
+ "\n\t"
+ "addu %[pfft], %[fft], %[tmp1] "
+ "\n\t"
+ "sh %[tmp_re], 0(%[pfft]) "
+ "\n\t"
+ "subu %[tmp_im], $zero, %[tmp_im] "
+ "\n\t"
+ "sh %[tmp_im], 2(%[pfft]) "
+ "\n\t"
+ "lh %[tmp1], 12(%[pcoefTable_ifft]) "
+ "\n\t"
+ "lh %[tmp2], 14(%[pcoefTable_ifft]) "
+ "\n\t"
+ "lh %[tmp_re], 12(%[pefw]) "
+ "\n\t"
+ "lh %[tmp_im], 14(%[pefw]) "
+ "\n\t"
+ "addu %[pfft], %[fft], %[tmp2] "
+ "\n\t"
+ "sh %[tmp_re], 0(%[pfft]) "
+ "\n\t"
+ "sh %[tmp_im], 2(%[pfft]) "
+ "\n\t"
+ "addu %[pfft], %[fft], %[tmp1] "
+ "\n\t"
+ "sh %[tmp_re], 0(%[pfft]) "
+ "\n\t"
+ "subu %[tmp_im], $zero, %[tmp_im] "
+ "\n\t"
+ "sh %[tmp_im], 2(%[pfft]) "
+ "\n\t"
+ "addiu %[pcoefTable_ifft], %[pcoefTable_ifft], 16 "
+ "\n\t"
+ "addiu %[i], %[i], -4 "
+ "\n\t"
+ "bgtz %[i], 1b "
+ "\n\t"
+ " addiu %[pefw], %[pefw], 16 "
+ "\n\t"
+ ".set pop "
+ "\n\t"
+ : [tmp1] "=&r"(tmp1), [tmp2] "=&r"(tmp2), [pfft] "+r"(pfft), [i] "=&r"(i),
+ [tmp_re] "=&r"(tmp_re), [tmp_im] "=&r"(tmp_im), [pefw] "+r"(pefw),
+ [pcoefTable_ifft] "+r"(pcoefTable_ifft), [fft] "+r"(fft)
+ :
+ : "memory");
fft[2] = efw[PART_LEN].real;
fft[3] = -efw[PART_LEN].imag;
@@ -284,150 +346,235 @@
outCFFT = WebRtcSpl_ComplexIFFT(fft, PART_LEN_SHIFT, 1);
pfft = fft;
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[i], $zero, 128 \n\t"
- "1: \n\t"
- "lh %[tmp1], 0(%[ppfft]) \n\t"
- "lh %[tmp2], 4(%[ppfft]) \n\t"
- "lh %[tmp3], 8(%[ppfft]) \n\t"
- "lh %[tmp4], 12(%[ppfft]) \n\t"
- "addiu %[i], %[i], -4 \n\t"
- "sh %[tmp1], 0(%[pfft]) \n\t"
- "sh %[tmp2], 2(%[pfft]) \n\t"
- "sh %[tmp3], 4(%[pfft]) \n\t"
- "sh %[tmp4], 6(%[pfft]) \n\t"
- "addiu %[ppfft], %[ppfft], 16 \n\t"
- "bgtz %[i], 1b \n\t"
- " addiu %[pfft], %[pfft], 8 \n\t"
- ".set pop \n\t"
- : [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2), [pfft] "+r" (pfft),
- [i] "=&r" (i), [tmp3] "=&r" (tmp3), [tmp4] "=&r" (tmp4),
- [ppfft] "+r" (ppfft)
- :
- : "memory"
- );
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "addiu %[i], $zero, 128 \n\t"
+ "1: \n\t"
+ "lh %[tmp1], 0(%[ppfft]) \n\t"
+ "lh %[tmp2], 4(%[ppfft]) \n\t"
+ "lh %[tmp3], 8(%[ppfft]) \n\t"
+ "lh %[tmp4], 12(%[ppfft]) \n\t"
+ "addiu %[i], %[i], -4 \n\t"
+ "sh %[tmp1], 0(%[pfft]) \n\t"
+ "sh %[tmp2], 2(%[pfft]) \n\t"
+ "sh %[tmp3], 4(%[pfft]) \n\t"
+ "sh %[tmp4], 6(%[pfft]) \n\t"
+ "addiu %[ppfft], %[ppfft], 16 \n\t"
+ "bgtz %[i], 1b \n\t"
+ " addiu %[pfft], %[pfft], 8 \n\t"
+ ".set pop \n\t"
+ : [tmp1] "=&r"(tmp1), [tmp2] "=&r"(tmp2), [pfft] "+r"(pfft), [i] "=&r"(i),
+ [tmp3] "=&r"(tmp3), [tmp4] "=&r"(tmp4), [ppfft] "+r"(ppfft)
+ :
+ : "memory");
pfft = fft;
out_aecm = (int32_t)(outCFFT - aecm->dfaCleanQDomain);
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[i], $zero, 64 \n\t"
- "11: \n\t"
- "lh %[tmp1], 0(%[pfft]) \n\t"
- "lh %[tmp2], 0(%[p_kSqrtHanning]) \n\t"
- "addiu %[i], %[i], -2 \n\t"
- "mul %[tmp1], %[tmp1], %[tmp2] \n\t"
- "lh %[tmp3], 2(%[pfft]) \n\t"
- "lh %[tmp4], 2(%[p_kSqrtHanning]) \n\t"
- "mul %[tmp3], %[tmp3], %[tmp4] \n\t"
- "addiu %[tmp1], %[tmp1], 8192 \n\t"
- "sra %[tmp1], %[tmp1], 14 \n\t"
- "addiu %[tmp3], %[tmp3], 8192 \n\t"
- "sra %[tmp3], %[tmp3], 14 \n\t"
- "bgez %[out_aecm], 1f \n\t"
- " negu %[tmp2], %[out_aecm] \n\t"
- "srav %[tmp1], %[tmp1], %[tmp2] \n\t"
- "b 2f \n\t"
- " srav %[tmp3], %[tmp3], %[tmp2] \n\t"
- "1: \n\t"
- "sllv %[tmp1], %[tmp1], %[out_aecm] \n\t"
- "sllv %[tmp3], %[tmp3], %[out_aecm] \n\t"
- "2: \n\t"
- "lh %[tmp4], 0(%[paecm_buf]) \n\t"
- "lh %[tmp2], 2(%[paecm_buf]) \n\t"
- "addu %[tmp3], %[tmp3], %[tmp2] \n\t"
- "addu %[tmp1], %[tmp1], %[tmp4] \n\t"
+ __asm __volatile(
+ ".set push "
+ "\n\t"
+ ".set noreorder "
+ "\n\t"
+ "addiu %[i], $zero, 64 "
+ "\n\t"
+ "11: "
+ "\n\t"
+ "lh %[tmp1], 0(%[pfft]) "
+ "\n\t"
+ "lh %[tmp2], 0(%[p_kSqrtHanning]) "
+ "\n\t"
+ "addiu %[i], %[i], -2 "
+ "\n\t"
+ "mul %[tmp1], %[tmp1], %[tmp2] "
+ "\n\t"
+ "lh %[tmp3], 2(%[pfft]) "
+ "\n\t"
+ "lh %[tmp4], 2(%[p_kSqrtHanning]) "
+ "\n\t"
+ "mul %[tmp3], %[tmp3], %[tmp4] "
+ "\n\t"
+ "addiu %[tmp1], %[tmp1], 8192 "
+ "\n\t"
+ "sra %[tmp1], %[tmp1], 14 "
+ "\n\t"
+ "addiu %[tmp3], %[tmp3], 8192 "
+ "\n\t"
+ "sra %[tmp3], %[tmp3], 14 "
+ "\n\t"
+ "bgez %[out_aecm], 1f "
+ "\n\t"
+ " negu %[tmp2], %[out_aecm] "
+ "\n\t"
+ "srav %[tmp1], %[tmp1], %[tmp2] "
+ "\n\t"
+ "b 2f "
+ "\n\t"
+ " srav %[tmp3], %[tmp3], %[tmp2] "
+ "\n\t"
+ "1: "
+ "\n\t"
+ "sllv %[tmp1], %[tmp1], %[out_aecm] "
+ "\n\t"
+ "sllv %[tmp3], %[tmp3], %[out_aecm] "
+ "\n\t"
+ "2: "
+ "\n\t"
+ "lh %[tmp4], 0(%[paecm_buf]) "
+ "\n\t"
+ "lh %[tmp2], 2(%[paecm_buf]) "
+ "\n\t"
+ "addu %[tmp3], %[tmp3], %[tmp2] "
+ "\n\t"
+ "addu %[tmp1], %[tmp1], %[tmp4] "
+ "\n\t"
#if defined(MIPS_DSP_R1_LE)
- "shll_s.w %[tmp1], %[tmp1], 16 \n\t"
- "sra %[tmp1], %[tmp1], 16 \n\t"
- "shll_s.w %[tmp3], %[tmp3], 16 \n\t"
- "sra %[tmp3], %[tmp3], 16 \n\t"
-#else // #if defined(MIPS_DSP_R1_LE)
- "sra %[tmp4], %[tmp1], 31 \n\t"
- "sra %[tmp2], %[tmp1], 15 \n\t"
- "beq %[tmp4], %[tmp2], 3f \n\t"
- " ori %[tmp2], $zero, 0x7fff \n\t"
- "xor %[tmp1], %[tmp2], %[tmp4] \n\t"
- "3: \n\t"
- "sra %[tmp2], %[tmp3], 31 \n\t"
- "sra %[tmp4], %[tmp3], 15 \n\t"
- "beq %[tmp2], %[tmp4], 4f \n\t"
- " ori %[tmp4], $zero, 0x7fff \n\t"
- "xor %[tmp3], %[tmp4], %[tmp2] \n\t"
- "4: \n\t"
+ "shll_s.w %[tmp1], %[tmp1], 16 "
+ "\n\t"
+ "sra %[tmp1], %[tmp1], 16 "
+ "\n\t"
+ "shll_s.w %[tmp3], %[tmp3], 16 "
+ "\n\t"
+ "sra %[tmp3], %[tmp3], 16 "
+ "\n\t"
+#else // #if defined(MIPS_DSP_R1_LE)
+ "sra %[tmp4], %[tmp1], 31 "
+ "\n\t"
+ "sra %[tmp2], %[tmp1], 15 "
+ "\n\t"
+ "beq %[tmp4], %[tmp2], 3f "
+ "\n\t"
+ " ori %[tmp2], $zero, 0x7fff "
+ "\n\t"
+ "xor %[tmp1], %[tmp2], %[tmp4] "
+ "\n\t"
+ "3: "
+ "\n\t"
+ "sra %[tmp2], %[tmp3], 31 "
+ "\n\t"
+ "sra %[tmp4], %[tmp3], 15 "
+ "\n\t"
+ "beq %[tmp2], %[tmp4], 4f "
+ "\n\t"
+ " ori %[tmp4], $zero, 0x7fff "
+ "\n\t"
+ "xor %[tmp3], %[tmp4], %[tmp2] "
+ "\n\t"
+ "4: "
+ "\n\t"
#endif // #if defined(MIPS_DSP_R1_LE)
- "sh %[tmp1], 0(%[pfft]) \n\t"
- "sh %[tmp1], 0(%[output1]) \n\t"
- "sh %[tmp3], 2(%[pfft]) \n\t"
- "sh %[tmp3], 2(%[output1]) \n\t"
- "lh %[tmp1], 128(%[pfft]) \n\t"
- "lh %[tmp2], 0(%[pp_kSqrtHanning]) \n\t"
- "mul %[tmp1], %[tmp1], %[tmp2] \n\t"
- "lh %[tmp3], 130(%[pfft]) \n\t"
- "lh %[tmp4], -2(%[pp_kSqrtHanning]) \n\t"
- "mul %[tmp3], %[tmp3], %[tmp4] \n\t"
- "sra %[tmp1], %[tmp1], 14 \n\t"
- "sra %[tmp3], %[tmp3], 14 \n\t"
- "bgez %[out_aecm], 5f \n\t"
- " negu %[tmp2], %[out_aecm] \n\t"
- "srav %[tmp3], %[tmp3], %[tmp2] \n\t"
- "b 6f \n\t"
- " srav %[tmp1], %[tmp1], %[tmp2] \n\t"
- "5: \n\t"
- "sllv %[tmp1], %[tmp1], %[out_aecm] \n\t"
- "sllv %[tmp3], %[tmp3], %[out_aecm] \n\t"
- "6: \n\t"
+ "sh %[tmp1], 0(%[pfft]) "
+ "\n\t"
+ "sh %[tmp1], 0(%[output1]) "
+ "\n\t"
+ "sh %[tmp3], 2(%[pfft]) "
+ "\n\t"
+ "sh %[tmp3], 2(%[output1]) "
+ "\n\t"
+ "lh %[tmp1], 128(%[pfft]) "
+ "\n\t"
+ "lh %[tmp2], 0(%[pp_kSqrtHanning]) "
+ "\n\t"
+ "mul %[tmp1], %[tmp1], %[tmp2] "
+ "\n\t"
+ "lh %[tmp3], 130(%[pfft]) "
+ "\n\t"
+ "lh %[tmp4], -2(%[pp_kSqrtHanning]) "
+ "\n\t"
+ "mul %[tmp3], %[tmp3], %[tmp4] "
+ "\n\t"
+ "sra %[tmp1], %[tmp1], 14 "
+ "\n\t"
+ "sra %[tmp3], %[tmp3], 14 "
+ "\n\t"
+ "bgez %[out_aecm], 5f "
+ "\n\t"
+ " negu %[tmp2], %[out_aecm] "
+ "\n\t"
+ "srav %[tmp3], %[tmp3], %[tmp2] "
+ "\n\t"
+ "b 6f "
+ "\n\t"
+ " srav %[tmp1], %[tmp1], %[tmp2] "
+ "\n\t"
+ "5: "
+ "\n\t"
+ "sllv %[tmp1], %[tmp1], %[out_aecm] "
+ "\n\t"
+ "sllv %[tmp3], %[tmp3], %[out_aecm] "
+ "\n\t"
+ "6: "
+ "\n\t"
#if defined(MIPS_DSP_R1_LE)
- "shll_s.w %[tmp1], %[tmp1], 16 \n\t"
- "sra %[tmp1], %[tmp1], 16 \n\t"
- "shll_s.w %[tmp3], %[tmp3], 16 \n\t"
- "sra %[tmp3], %[tmp3], 16 \n\t"
-#else // #if defined(MIPS_DSP_R1_LE)
- "sra %[tmp4], %[tmp1], 31 \n\t"
- "sra %[tmp2], %[tmp1], 15 \n\t"
- "beq %[tmp4], %[tmp2], 7f \n\t"
- " ori %[tmp2], $zero, 0x7fff \n\t"
- "xor %[tmp1], %[tmp2], %[tmp4] \n\t"
- "7: \n\t"
- "sra %[tmp2], %[tmp3], 31 \n\t"
- "sra %[tmp4], %[tmp3], 15 \n\t"
- "beq %[tmp2], %[tmp4], 8f \n\t"
- " ori %[tmp4], $zero, 0x7fff \n\t"
- "xor %[tmp3], %[tmp4], %[tmp2] \n\t"
- "8: \n\t"
+ "shll_s.w %[tmp1], %[tmp1], 16 "
+ "\n\t"
+ "sra %[tmp1], %[tmp1], 16 "
+ "\n\t"
+ "shll_s.w %[tmp3], %[tmp3], 16 "
+ "\n\t"
+ "sra %[tmp3], %[tmp3], 16 "
+ "\n\t"
+#else // #if defined(MIPS_DSP_R1_LE)
+ "sra %[tmp4], %[tmp1], 31 "
+ "\n\t"
+ "sra %[tmp2], %[tmp1], 15 "
+ "\n\t"
+ "beq %[tmp4], %[tmp2], 7f "
+ "\n\t"
+ " ori %[tmp2], $zero, 0x7fff "
+ "\n\t"
+ "xor %[tmp1], %[tmp2], %[tmp4] "
+ "\n\t"
+ "7: "
+ "\n\t"
+ "sra %[tmp2], %[tmp3], 31 "
+ "\n\t"
+ "sra %[tmp4], %[tmp3], 15 "
+ "\n\t"
+ "beq %[tmp2], %[tmp4], 8f "
+ "\n\t"
+ " ori %[tmp4], $zero, 0x7fff "
+ "\n\t"
+ "xor %[tmp3], %[tmp4], %[tmp2] "
+ "\n\t"
+ "8: "
+ "\n\t"
#endif // #if defined(MIPS_DSP_R1_LE)
- "sh %[tmp1], 0(%[paecm_buf]) \n\t"
- "sh %[tmp3], 2(%[paecm_buf]) \n\t"
- "addiu %[output1], %[output1], 4 \n\t"
- "addiu %[paecm_buf], %[paecm_buf], 4 \n\t"
- "addiu %[pfft], %[pfft], 4 \n\t"
- "addiu %[p_kSqrtHanning], %[p_kSqrtHanning], 4 \n\t"
- "bgtz %[i], 11b \n\t"
- " addiu %[pp_kSqrtHanning], %[pp_kSqrtHanning], -4 \n\t"
- ".set pop \n\t"
- : [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2), [pfft] "+r" (pfft),
- [output1] "+r" (output1), [tmp3] "=&r" (tmp3), [tmp4] "=&r" (tmp4),
- [paecm_buf] "+r" (paecm_buf), [i] "=&r" (i),
- [pp_kSqrtHanning] "+r" (pp_kSqrtHanning),
- [p_kSqrtHanning] "+r" (p_kSqrtHanning)
- : [out_aecm] "r" (out_aecm),
- [WebRtcAecm_kSqrtHanning] "r" (WebRtcAecm_kSqrtHanning)
- : "hi", "lo","memory"
- );
+ "sh %[tmp1], 0(%[paecm_buf]) "
+ "\n\t"
+ "sh %[tmp3], 2(%[paecm_buf]) "
+ "\n\t"
+ "addiu %[output1], %[output1], 4 "
+ "\n\t"
+ "addiu %[paecm_buf], %[paecm_buf], 4 "
+ "\n\t"
+ "addiu %[pfft], %[pfft], 4 "
+ "\n\t"
+ "addiu %[p_kSqrtHanning], %[p_kSqrtHanning], 4 "
+ "\n\t"
+ "bgtz %[i], 11b "
+ "\n\t"
+ " addiu %[pp_kSqrtHanning], %[pp_kSqrtHanning], -4 "
+ "\n\t"
+ ".set pop "
+ "\n\t"
+ : [tmp1] "=&r"(tmp1), [tmp2] "=&r"(tmp2), [pfft] "+r"(pfft),
+ [output1] "+r"(output1), [tmp3] "=&r"(tmp3), [tmp4] "=&r"(tmp4),
+ [paecm_buf] "+r"(paecm_buf), [i] "=&r"(i),
+ [pp_kSqrtHanning] "+r"(pp_kSqrtHanning),
+ [p_kSqrtHanning] "+r"(p_kSqrtHanning)
+ : [out_aecm] "r"(out_aecm),
+ [WebRtcAecm_kSqrtHanning] "r"(WebRtcAecm_kSqrtHanning)
+ : "hi", "lo", "memory");
// Copy the current block to the old position
// (aecm->outBuf is shifted elsewhere)
memcpy(aecm->xBuf, aecm->xBuf + PART_LEN, sizeof(int16_t) * PART_LEN);
- memcpy(aecm->dBufNoisy,
- aecm->dBufNoisy + PART_LEN,
+ memcpy(aecm->dBufNoisy, aecm->dBufNoisy + PART_LEN,
sizeof(int16_t) * PART_LEN);
if (nearendClean != NULL) {
- memcpy(aecm->dBufClean,
- aecm->dBufClean + PART_LEN,
+ memcpy(aecm->dBufClean, aecm->dBufClean + PART_LEN,
sizeof(int16_t) * PART_LEN);
}
}
@@ -451,62 +598,61 @@
// Get energy for the delayed far end signal and estimated
// echo using both stored and adapted channels.
- for (i = 0; i < PART_LEN; i+= 4) {
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "lh %[stored0], 0(%[ch_stored_p]) \n\t"
- "lhu %[adept0], 0(%[ch_adapt_p]) \n\t"
- "lhu %[spectrum0], 0(%[spectrum_p]) \n\t"
- "lh %[stored1], 2(%[ch_stored_p]) \n\t"
- "lhu %[adept1], 2(%[ch_adapt_p]) \n\t"
- "lhu %[spectrum1], 2(%[spectrum_p]) \n\t"
- "mul %[echo0], %[stored0], %[spectrum0] \n\t"
- "mul %[temp0], %[adept0], %[spectrum0] \n\t"
- "mul %[echo1], %[stored1], %[spectrum1] \n\t"
- "mul %[temp1], %[adept1], %[spectrum1] \n\t"
- "addu %[par1], %[par1], %[spectrum0] \n\t"
- "addu %[par1], %[par1], %[spectrum1] \n\t"
- "addiu %[echo_p], %[echo_p], 16 \n\t"
- "addu %[par3], %[par3], %[echo0] \n\t"
- "addu %[par2], %[par2], %[temp0] \n\t"
- "addu %[par3], %[par3], %[echo1] \n\t"
- "addu %[par2], %[par2], %[temp1] \n\t"
- "usw %[echo0], -16(%[echo_p]) \n\t"
- "usw %[echo1], -12(%[echo_p]) \n\t"
- "lh %[stored0], 4(%[ch_stored_p]) \n\t"
- "lhu %[adept0], 4(%[ch_adapt_p]) \n\t"
- "lhu %[spectrum0], 4(%[spectrum_p]) \n\t"
- "lh %[stored1], 6(%[ch_stored_p]) \n\t"
- "lhu %[adept1], 6(%[ch_adapt_p]) \n\t"
- "lhu %[spectrum1], 6(%[spectrum_p]) \n\t"
- "mul %[echo0], %[stored0], %[spectrum0] \n\t"
- "mul %[temp0], %[adept0], %[spectrum0] \n\t"
- "mul %[echo1], %[stored1], %[spectrum1] \n\t"
- "mul %[temp1], %[adept1], %[spectrum1] \n\t"
- "addu %[par1], %[par1], %[spectrum0] \n\t"
- "addu %[par1], %[par1], %[spectrum1] \n\t"
- "addiu %[ch_stored_p], %[ch_stored_p], 8 \n\t"
- "addiu %[ch_adapt_p], %[ch_adapt_p], 8 \n\t"
- "addiu %[spectrum_p], %[spectrum_p], 8 \n\t"
- "addu %[par3], %[par3], %[echo0] \n\t"
- "addu %[par2], %[par2], %[temp0] \n\t"
- "addu %[par3], %[par3], %[echo1] \n\t"
- "addu %[par2], %[par2], %[temp1] \n\t"
- "usw %[echo0], -8(%[echo_p]) \n\t"
- "usw %[echo1], -4(%[echo_p]) \n\t"
- ".set pop \n\t"
- : [temp0] "=&r" (temp0), [stored0] "=&r" (stored0),
- [adept0] "=&r" (adept0), [spectrum0] "=&r" (spectrum0),
- [echo0] "=&r" (echo0), [echo_p] "+r" (echo_p), [par3] "+r" (par3),
- [par1] "+r" (par1), [par2] "+r" (par2), [stored1] "=&r" (stored1),
- [adept1] "=&r" (adept1), [echo1] "=&r" (echo1),
- [spectrum1] "=&r" (spectrum1), [temp1] "=&r" (temp1),
- [ch_stored_p] "+r" (ch_stored_p), [ch_adapt_p] "+r" (ch_adapt_p),
- [spectrum_p] "+r" (spectrum_p)
- :
- : "hi", "lo", "memory"
- );
+ for (i = 0; i < PART_LEN; i += 4) {
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "lh %[stored0], 0(%[ch_stored_p]) \n\t"
+ "lhu %[adept0], 0(%[ch_adapt_p]) \n\t"
+ "lhu %[spectrum0], 0(%[spectrum_p]) \n\t"
+ "lh %[stored1], 2(%[ch_stored_p]) \n\t"
+ "lhu %[adept1], 2(%[ch_adapt_p]) \n\t"
+ "lhu %[spectrum1], 2(%[spectrum_p]) \n\t"
+ "mul %[echo0], %[stored0], %[spectrum0] \n\t"
+ "mul %[temp0], %[adept0], %[spectrum0] \n\t"
+ "mul %[echo1], %[stored1], %[spectrum1] \n\t"
+ "mul %[temp1], %[adept1], %[spectrum1] \n\t"
+ "addu %[par1], %[par1], %[spectrum0] \n\t"
+ "addu %[par1], %[par1], %[spectrum1] \n\t"
+ "addiu %[echo_p], %[echo_p], 16 \n\t"
+ "addu %[par3], %[par3], %[echo0] \n\t"
+ "addu %[par2], %[par2], %[temp0] \n\t"
+ "addu %[par3], %[par3], %[echo1] \n\t"
+ "addu %[par2], %[par2], %[temp1] \n\t"
+ "usw %[echo0], -16(%[echo_p]) \n\t"
+ "usw %[echo1], -12(%[echo_p]) \n\t"
+ "lh %[stored0], 4(%[ch_stored_p]) \n\t"
+ "lhu %[adept0], 4(%[ch_adapt_p]) \n\t"
+ "lhu %[spectrum0], 4(%[spectrum_p]) \n\t"
+ "lh %[stored1], 6(%[ch_stored_p]) \n\t"
+ "lhu %[adept1], 6(%[ch_adapt_p]) \n\t"
+ "lhu %[spectrum1], 6(%[spectrum_p]) \n\t"
+ "mul %[echo0], %[stored0], %[spectrum0] \n\t"
+ "mul %[temp0], %[adept0], %[spectrum0] \n\t"
+ "mul %[echo1], %[stored1], %[spectrum1] \n\t"
+ "mul %[temp1], %[adept1], %[spectrum1] \n\t"
+ "addu %[par1], %[par1], %[spectrum0] \n\t"
+ "addu %[par1], %[par1], %[spectrum1] \n\t"
+ "addiu %[ch_stored_p], %[ch_stored_p], 8 \n\t"
+ "addiu %[ch_adapt_p], %[ch_adapt_p], 8 \n\t"
+ "addiu %[spectrum_p], %[spectrum_p], 8 \n\t"
+ "addu %[par3], %[par3], %[echo0] \n\t"
+ "addu %[par2], %[par2], %[temp0] \n\t"
+ "addu %[par3], %[par3], %[echo1] \n\t"
+ "addu %[par2], %[par2], %[temp1] \n\t"
+ "usw %[echo0], -8(%[echo_p]) \n\t"
+ "usw %[echo1], -4(%[echo_p]) \n\t"
+ ".set pop \n\t"
+ : [temp0] "=&r"(temp0), [stored0] "=&r"(stored0),
+ [adept0] "=&r"(adept0), [spectrum0] "=&r"(spectrum0),
+ [echo0] "=&r"(echo0), [echo_p] "+r"(echo_p), [par3] "+r"(par3),
+ [par1] "+r"(par1), [par2] "+r"(par2), [stored1] "=&r"(stored1),
+ [adept1] "=&r"(adept1), [echo1] "=&r"(echo1),
+ [spectrum1] "=&r"(spectrum1), [temp1] "=&r"(temp1),
+ [ch_stored_p] "+r"(ch_stored_p), [ch_adapt_p] "+r"(ch_adapt_p),
+ [spectrum_p] "+r"(spectrum_p)
+ :
+ : "hi", "lo", "memory");
}
echo_est[PART_LEN] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[PART_LEN],
@@ -537,35 +683,33 @@
sizeof(int16_t) * PART_LEN1);
// Recalculate echo estimate
for (i = 0; i < PART_LEN; i += 4) {
- __asm __volatile (
- "ulw %[temp0], 0(%[temp8]) \n\t"
- "ulw %[temp2], 0(%[temp1]) \n\t"
- "ulw %[temp4], 4(%[temp8]) \n\t"
- "ulw %[temp5], 4(%[temp1]) \n\t"
- "muleq_s.w.phl %[temp3], %[temp2], %[temp0] \n\t"
- "muleq_s.w.phr %[temp0], %[temp2], %[temp0] \n\t"
- "muleq_s.w.phl %[temp6], %[temp5], %[temp4] \n\t"
- "muleq_s.w.phr %[temp4], %[temp5], %[temp4] \n\t"
- "addiu %[temp7], %[temp7], 16 \n\t"
- "addiu %[temp1], %[temp1], 8 \n\t"
- "addiu %[temp8], %[temp8], 8 \n\t"
- "sra %[temp3], %[temp3], 1 \n\t"
- "sra %[temp0], %[temp0], 1 \n\t"
- "sra %[temp6], %[temp6], 1 \n\t"
- "sra %[temp4], %[temp4], 1 \n\t"
- "usw %[temp3], -12(%[temp7]) \n\t"
- "usw %[temp0], -16(%[temp7]) \n\t"
- "usw %[temp6], -4(%[temp7]) \n\t"
- "usw %[temp4], -8(%[temp7]) \n\t"
- : [temp0] "=&r" (temp0), [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [temp4] "=&r" (temp4), [temp5] "=&r" (temp5), [temp6] "=&r" (temp6),
- [temp1] "+r" (temp1), [temp8] "+r" (temp8), [temp7] "+r" (temp7)
- :
- : "hi", "lo", "memory"
- );
+ __asm __volatile(
+ "ulw %[temp0], 0(%[temp8]) \n\t"
+ "ulw %[temp2], 0(%[temp1]) \n\t"
+ "ulw %[temp4], 4(%[temp8]) \n\t"
+ "ulw %[temp5], 4(%[temp1]) \n\t"
+ "muleq_s.w.phl %[temp3], %[temp2], %[temp0] \n\t"
+ "muleq_s.w.phr %[temp0], %[temp2], %[temp0] \n\t"
+ "muleq_s.w.phl %[temp6], %[temp5], %[temp4] \n\t"
+ "muleq_s.w.phr %[temp4], %[temp5], %[temp4] \n\t"
+ "addiu %[temp7], %[temp7], 16 \n\t"
+ "addiu %[temp1], %[temp1], 8 \n\t"
+ "addiu %[temp8], %[temp8], 8 \n\t"
+ "sra %[temp3], %[temp3], 1 \n\t"
+ "sra %[temp0], %[temp0], 1 \n\t"
+ "sra %[temp6], %[temp6], 1 \n\t"
+ "sra %[temp4], %[temp4], 1 \n\t"
+ "usw %[temp3], -12(%[temp7]) \n\t"
+ "usw %[temp0], -16(%[temp7]) \n\t"
+ "usw %[temp6], -4(%[temp7]) \n\t"
+ "usw %[temp4], -8(%[temp7]) \n\t"
+ : [temp0] "=&r"(temp0), [temp2] "=&r"(temp2), [temp3] "=&r"(temp3),
+ [temp4] "=&r"(temp4), [temp5] "=&r"(temp5), [temp6] "=&r"(temp6),
+ [temp1] "+r"(temp1), [temp8] "+r"(temp8), [temp7] "+r"(temp7)
+ :
+ : "hi", "lo", "memory");
}
- echo_est[i] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i],
- far_spectrum[i]);
+ echo_est[i] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i], far_spectrum[i]);
}
void WebRtcAecm_ResetAdaptiveChannel_mips(AecmCore* aecm) {
@@ -579,31 +723,28 @@
// The stored channel has a significantly lower MSE than the adaptive one for
// two consecutive calculations. Reset the adaptive channel.
- memcpy(aecm->channelAdapt16,
- aecm->channelStored,
+ memcpy(aecm->channelAdapt16, aecm->channelStored,
sizeof(int16_t) * PART_LEN1);
// Restore the W32 channel
for (i = 0; i < PART_LEN; i += 4) {
- __asm __volatile (
- "ulw %[temp1], 0(%[temp0]) \n\t"
- "ulw %[temp4], 4(%[temp0]) \n\t"
- "preceq.w.phl %[temp2], %[temp1] \n\t"
- "preceq.w.phr %[temp1], %[temp1] \n\t"
- "preceq.w.phl %[temp5], %[temp4] \n\t"
- "preceq.w.phr %[temp4], %[temp4] \n\t"
- "addiu %[temp0], %[temp0], 8 \n\t"
- "usw %[temp2], 4(%[temp3]) \n\t"
- "usw %[temp1], 0(%[temp3]) \n\t"
- "usw %[temp5], 12(%[temp3]) \n\t"
- "usw %[temp4], 8(%[temp3]) \n\t"
- "addiu %[temp3], %[temp3], 16 \n\t"
- : [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
- [temp4] "=&r" (temp4), [temp5] "=&r" (temp5),
- [temp3] "+r" (temp3), [temp0] "+r" (temp0)
- :
- : "memory"
- );
+ __asm __volatile(
+ "ulw %[temp1], 0(%[temp0]) \n\t"
+ "ulw %[temp4], 4(%[temp0]) \n\t"
+ "preceq.w.phl %[temp2], %[temp1] \n\t"
+ "preceq.w.phr %[temp1], %[temp1] \n\t"
+ "preceq.w.phl %[temp5], %[temp4] \n\t"
+ "preceq.w.phr %[temp4], %[temp4] \n\t"
+ "addiu %[temp0], %[temp0], 8 \n\t"
+ "usw %[temp2], 4(%[temp3]) \n\t"
+ "usw %[temp1], 0(%[temp3]) \n\t"
+ "usw %[temp5], 12(%[temp3]) \n\t"
+ "usw %[temp4], 8(%[temp3]) \n\t"
+ "addiu %[temp3], %[temp3], 16 \n\t"
+ : [temp1] "=&r"(temp1), [temp2] "=&r"(temp2), [temp4] "=&r"(temp4),
+ [temp5] "=&r"(temp5), [temp3] "+r"(temp3), [temp0] "+r"(temp0)
+ :
+ : "memory");
}
aecm->channelAdapt32[i] = (int32_t)aecm->channelStored[i] << 16;
@@ -633,7 +774,7 @@
// In fft_buf, +16 for 32-byte alignment.
int16_t fft_buf[PART_LEN4 + 16];
- int16_t *fft = (int16_t *) (((uintptr_t) fft_buf + 31) & ~31);
+ int16_t* fft = (int16_t*)(((uintptr_t)fft_buf + 31) & ~31);
int16_t tmp16no1;
#if !defined(MIPS_DSP_R2_LE)
@@ -662,25 +803,18 @@
freq_signal[PART_LEN].imag = 0;
freq_signal[PART_LEN].real = fft[PART_LEN2];
freq_signal_abs[0] = (uint16_t)WEBRTC_SPL_ABS_W16(freq_signal[0].real);
- freq_signal_abs[PART_LEN] = (uint16_t)WEBRTC_SPL_ABS_W16(
- freq_signal[PART_LEN].real);
- (*freq_signal_sum_abs) = (uint32_t)(freq_signal_abs[0]) +
- (uint32_t)(freq_signal_abs[PART_LEN]);
+ freq_signal_abs[PART_LEN] =
+ (uint16_t)WEBRTC_SPL_ABS_W16(freq_signal[PART_LEN].real);
+ (*freq_signal_sum_abs) =
+ (uint32_t)(freq_signal_abs[0]) + (uint32_t)(freq_signal_abs[PART_LEN]);
#if !defined(MIPS_DSP_R2_LE)
for (i = 1; i < PART_LEN; i++) {
- if (freq_signal[i].real == 0)
- {
- freq_signal_abs[i] = (uint16_t)WEBRTC_SPL_ABS_W16(
- freq_signal[i].imag);
- }
- else if (freq_signal[i].imag == 0)
- {
- freq_signal_abs[i] = (uint16_t)WEBRTC_SPL_ABS_W16(
- freq_signal[i].real);
- }
- else
- {
+ if (freq_signal[i].real == 0) {
+ freq_signal_abs[i] = (uint16_t)WEBRTC_SPL_ABS_W16(freq_signal[i].imag);
+ } else if (freq_signal[i].imag == 0) {
+ freq_signal_abs[i] = (uint16_t)WEBRTC_SPL_ABS_W16(freq_signal[i].real);
+ } else {
// Approximation for magnitude of complex fft output
// magn = sqrt(real^2 + imag^2)
// magn ~= alpha * max(|imag|,|real|) + beta * min(|imag|,|real|)
@@ -697,32 +831,30 @@
}
(*freq_signal_sum_abs) += (uint32_t)freq_signal_abs[i];
}
-#else // #if !defined(MIPS_DSP_R2_LE)
- freqs = (uint32_t)(freq_signal_abs[0]) +
- (uint32_t)(freq_signal_abs[PART_LEN]);
+#else // #if !defined(MIPS_DSP_R2_LE)
+ freqs =
+ (uint32_t)(freq_signal_abs[0]) + (uint32_t)(freq_signal_abs[PART_LEN]);
freqp = &(freq_signal[1].real);
- __asm __volatile (
- "lw %[freqt0], 0(%[freqp]) \n\t"
- "lw %[freqt1], 4(%[freqp]) \n\t"
- "lw %[freqt2], 8(%[freqp]) \n\t"
- "mult $ac0, $zero, $zero \n\t"
- "mult $ac1, $zero, $zero \n\t"
- "mult $ac2, $zero, $zero \n\t"
- "dpaq_s.w.ph $ac0, %[freqt0], %[freqt0] \n\t"
- "dpaq_s.w.ph $ac1, %[freqt1], %[freqt1] \n\t"
- "dpaq_s.w.ph $ac2, %[freqt2], %[freqt2] \n\t"
- "addiu %[freqp], %[freqp], 12 \n\t"
- "extr.w %[tmp32no20], $ac0, 1 \n\t"
- "extr.w %[tmp32no21], $ac1, 1 \n\t"
- "extr.w %[tmp32no22], $ac2, 1 \n\t"
- : [freqt0] "=&r" (freqt0), [freqt1] "=&r" (freqt1),
- [freqt2] "=&r" (freqt2), [freqp] "+r" (freqp),
- [tmp32no20] "=r" (tmp32no20), [tmp32no21] "=r" (tmp32no21),
- [tmp32no22] "=r" (tmp32no22)
- :
- : "memory", "hi", "lo", "$ac1hi", "$ac1lo", "$ac2hi", "$ac2lo"
- );
+ __asm __volatile(
+ "lw %[freqt0], 0(%[freqp]) \n\t"
+ "lw %[freqt1], 4(%[freqp]) \n\t"
+ "lw %[freqt2], 8(%[freqp]) \n\t"
+ "mult $ac0, $zero, $zero \n\t"
+ "mult $ac1, $zero, $zero \n\t"
+ "mult $ac2, $zero, $zero \n\t"
+ "dpaq_s.w.ph $ac0, %[freqt0], %[freqt0] \n\t"
+ "dpaq_s.w.ph $ac1, %[freqt1], %[freqt1] \n\t"
+ "dpaq_s.w.ph $ac2, %[freqt2], %[freqt2] \n\t"
+ "addiu %[freqp], %[freqp], 12 \n\t"
+ "extr.w %[tmp32no20], $ac0, 1 \n\t"
+ "extr.w %[tmp32no21], $ac1, 1 \n\t"
+ "extr.w %[tmp32no22], $ac2, 1 \n\t"
+ : [freqt0] "=&r"(freqt0), [freqt1] "=&r"(freqt1), [freqt2] "=&r"(freqt2),
+ [freqp] "+r"(freqp), [tmp32no20] "=r"(tmp32no20),
+ [tmp32no21] "=r"(tmp32no21), [tmp32no22] "=r"(tmp32no22)
+ :
+ : "memory", "hi", "lo", "$ac1hi", "$ac1lo", "$ac2hi", "$ac2lo");
tmp32no10 = WebRtcSpl_SqrtFloor(tmp32no20);
tmp32no11 = WebRtcSpl_SqrtFloor(tmp32no21);
@@ -734,57 +866,54 @@
freqs += (uint32_t)tmp32no11;
freqs += (uint32_t)tmp32no12;
freqabsp = &(freq_signal_abs[4]);
- for (i = 4; i < PART_LEN; i+=4)
- {
- __asm __volatile (
- "ulw %[freqt0], 0(%[freqp]) \n\t"
- "ulw %[freqt1], 4(%[freqp]) \n\t"
- "ulw %[freqt2], 8(%[freqp]) \n\t"
- "ulw %[freqt3], 12(%[freqp]) \n\t"
- "mult $ac0, $zero, $zero \n\t"
- "mult $ac1, $zero, $zero \n\t"
- "mult $ac2, $zero, $zero \n\t"
- "mult $ac3, $zero, $zero \n\t"
- "dpaq_s.w.ph $ac0, %[freqt0], %[freqt0] \n\t"
- "dpaq_s.w.ph $ac1, %[freqt1], %[freqt1] \n\t"
- "dpaq_s.w.ph $ac2, %[freqt2], %[freqt2] \n\t"
- "dpaq_s.w.ph $ac3, %[freqt3], %[freqt3] \n\t"
- "addiu %[freqp], %[freqp], 16 \n\t"
- "addiu %[freqabsp], %[freqabsp], 8 \n\t"
- "extr.w %[tmp32no20], $ac0, 1 \n\t"
- "extr.w %[tmp32no21], $ac1, 1 \n\t"
- "extr.w %[tmp32no22], $ac2, 1 \n\t"
- "extr.w %[tmp32no23], $ac3, 1 \n\t"
- : [freqt0] "=&r" (freqt0), [freqt1] "=&r" (freqt1),
- [freqt2] "=&r" (freqt2), [freqt3] "=&r" (freqt3),
- [tmp32no20] "=r" (tmp32no20), [tmp32no21] "=r" (tmp32no21),
- [tmp32no22] "=r" (tmp32no22), [tmp32no23] "=r" (tmp32no23),
- [freqabsp] "+r" (freqabsp), [freqp] "+r" (freqp)
- :
- : "memory", "hi", "lo", "$ac1hi", "$ac1lo",
- "$ac2hi", "$ac2lo", "$ac3hi", "$ac3lo"
- );
+ for (i = 4; i < PART_LEN; i += 4) {
+ __asm __volatile(
+ "ulw %[freqt0], 0(%[freqp]) \n\t"
+ "ulw %[freqt1], 4(%[freqp]) \n\t"
+ "ulw %[freqt2], 8(%[freqp]) \n\t"
+ "ulw %[freqt3], 12(%[freqp]) \n\t"
+ "mult $ac0, $zero, $zero \n\t"
+ "mult $ac1, $zero, $zero \n\t"
+ "mult $ac2, $zero, $zero \n\t"
+ "mult $ac3, $zero, $zero \n\t"
+ "dpaq_s.w.ph $ac0, %[freqt0], %[freqt0] \n\t"
+ "dpaq_s.w.ph $ac1, %[freqt1], %[freqt1] \n\t"
+ "dpaq_s.w.ph $ac2, %[freqt2], %[freqt2] \n\t"
+ "dpaq_s.w.ph $ac3, %[freqt3], %[freqt3] \n\t"
+ "addiu %[freqp], %[freqp], 16 \n\t"
+ "addiu %[freqabsp], %[freqabsp], 8 \n\t"
+ "extr.w %[tmp32no20], $ac0, 1 \n\t"
+ "extr.w %[tmp32no21], $ac1, 1 \n\t"
+ "extr.w %[tmp32no22], $ac2, 1 \n\t"
+ "extr.w %[tmp32no23], $ac3, 1 \n\t"
+ : [freqt0] "=&r"(freqt0), [freqt1] "=&r"(freqt1),
+ [freqt2] "=&r"(freqt2), [freqt3] "=&r"(freqt3),
+ [tmp32no20] "=r"(tmp32no20), [tmp32no21] "=r"(tmp32no21),
+ [tmp32no22] "=r"(tmp32no22), [tmp32no23] "=r"(tmp32no23),
+ [freqabsp] "+r"(freqabsp), [freqp] "+r"(freqp)
+ :
+ : "memory", "hi", "lo", "$ac1hi", "$ac1lo", "$ac2hi", "$ac2lo",
+ "$ac3hi", "$ac3lo");
tmp32no10 = WebRtcSpl_SqrtFloor(tmp32no20);
tmp32no11 = WebRtcSpl_SqrtFloor(tmp32no21);
tmp32no12 = WebRtcSpl_SqrtFloor(tmp32no22);
tmp32no13 = WebRtcSpl_SqrtFloor(tmp32no23);
- __asm __volatile (
- "sh %[tmp32no10], -8(%[freqabsp]) \n\t"
- "sh %[tmp32no11], -6(%[freqabsp]) \n\t"
- "sh %[tmp32no12], -4(%[freqabsp]) \n\t"
- "sh %[tmp32no13], -2(%[freqabsp]) \n\t"
- "addu %[freqs], %[freqs], %[tmp32no10] \n\t"
- "addu %[freqs], %[freqs], %[tmp32no11] \n\t"
- "addu %[freqs], %[freqs], %[tmp32no12] \n\t"
- "addu %[freqs], %[freqs], %[tmp32no13] \n\t"
- : [freqs] "+r" (freqs)
- : [tmp32no10] "r" (tmp32no10), [tmp32no11] "r" (tmp32no11),
- [tmp32no12] "r" (tmp32no12), [tmp32no13] "r" (tmp32no13),
- [freqabsp] "r" (freqabsp)
- : "memory"
- );
+ __asm __volatile(
+ "sh %[tmp32no10], -8(%[freqabsp]) \n\t"
+ "sh %[tmp32no11], -6(%[freqabsp]) \n\t"
+ "sh %[tmp32no12], -4(%[freqabsp]) \n\t"
+ "sh %[tmp32no13], -2(%[freqabsp]) \n\t"
+ "addu %[freqs], %[freqs], %[tmp32no10] \n\t"
+ "addu %[freqs], %[freqs], %[tmp32no11] \n\t"
+ "addu %[freqs], %[freqs], %[tmp32no12] \n\t"
+ "addu %[freqs], %[freqs], %[tmp32no13] \n\t"
+ : [freqs] "+r"(freqs)
+ : [tmp32no10] "r"(tmp32no10), [tmp32no11] "r"(tmp32no11),
+ [tmp32no12] "r"(tmp32no12), [tmp32no13] "r"(tmp32no13),
+ [freqabsp] "r"(freqabsp)
+ : "memory");
}
(*freq_signal_sum_abs) = freqs;
@@ -813,13 +942,13 @@
const uint16_t* far_spectrum_ptr = NULL;
// 32 byte aligned buffers (with +8 or +16).
- int16_t fft_buf[PART_LEN4 + 2 + 16]; // +2 to make a loop safe.
+ int16_t fft_buf[PART_LEN4 + 2 + 16]; // +2 to make a loop safe.
int32_t echoEst32_buf[PART_LEN1 + 8];
int32_t dfw_buf[PART_LEN2 + 8];
int32_t efw_buf[PART_LEN2 + 8];
- int16_t* fft = (int16_t*)(((uint32_t)fft_buf + 31) & ~ 31);
- int32_t* echoEst32 = (int32_t*)(((uint32_t)echoEst32_buf + 31) & ~ 31);
+ int16_t* fft = (int16_t*)(((uint32_t)fft_buf + 31) & ~31);
+ int32_t* echoEst32 = (int32_t*)(((uint32_t)echoEst32_buf + 31) & ~31);
ComplexInt16* dfw = (ComplexInt16*)(((uint32_t)dfw_buf + 31) & ~31);
ComplexInt16* efw = (ComplexInt16*)(((uint32_t)efw_buf + 31) & ~31);
@@ -856,35 +985,25 @@
// (2) the rest
if (aecm->startupState < 2) {
- aecm->startupState = (aecm->totCount >= CONV_LEN) +
- (aecm->totCount >= CONV_LEN2);
+ aecm->startupState =
+ (aecm->totCount >= CONV_LEN) + (aecm->totCount >= CONV_LEN2);
}
// END: Determine startup state
// Buffer near and far end signals
memcpy(aecm->xBuf + PART_LEN, farend, sizeof(int16_t) * PART_LEN);
- memcpy(aecm->dBufNoisy + PART_LEN,
- nearendNoisy,
- sizeof(int16_t) * PART_LEN);
+ memcpy(aecm->dBufNoisy + PART_LEN, nearendNoisy, sizeof(int16_t) * PART_LEN);
if (nearendClean != NULL) {
- memcpy(aecm->dBufClean + PART_LEN,
- nearendClean,
+ memcpy(aecm->dBufClean + PART_LEN, nearendClean,
sizeof(int16_t) * PART_LEN);
}
// Transform far end signal from time domain to frequency domain.
- far_q = TimeToFrequencyDomain(aecm,
- aecm->xBuf,
- dfw,
- xfa,
- &xfaSum);
+ far_q = TimeToFrequencyDomain(aecm, aecm->xBuf, dfw, xfa, &xfaSum);
// Transform noisy near end signal from time domain to frequency domain.
- zerosDBufNoisy = TimeToFrequencyDomain(aecm,
- aecm->dBufNoisy,
- dfw,
- dfaNoisy,
- &dfaNoisySum);
+ zerosDBufNoisy =
+ TimeToFrequencyDomain(aecm, aecm->dBufNoisy, dfw, dfaNoisy, &dfaNoisySum);
aecm->dfaNoisyQDomainOld = aecm->dfaNoisyQDomain;
aecm->dfaNoisyQDomain = (int16_t)zerosDBufNoisy;
@@ -895,10 +1014,7 @@
dfaCleanSum = dfaNoisySum;
} else {
// Transform clean near end signal from time domain to frequency domain.
- zerosDBufClean = TimeToFrequencyDomain(aecm,
- aecm->dBufClean,
- dfw,
- dfaClean,
+ zerosDBufClean = TimeToFrequencyDomain(aecm, aecm->dBufClean, dfw, dfaClean,
&dfaCleanSum);
aecm->dfaCleanQDomainOld = aecm->dfaCleanQDomain;
aecm->dfaCleanQDomain = (int16_t)zerosDBufClean;
@@ -912,14 +1028,11 @@
far_q) == -1) {
return -1;
}
- delay = WebRtc_DelayEstimatorProcessFix(aecm->delay_estimator,
- dfaNoisy,
- PART_LEN1,
- zerosDBufNoisy);
+ delay = WebRtc_DelayEstimatorProcessFix(aecm->delay_estimator, dfaNoisy,
+ PART_LEN1, zerosDBufNoisy);
if (delay == -1) {
return -1;
- }
- else if (delay == -2) {
+ } else if (delay == -2) {
// If the delay is unknown, we assume zero.
// NOTE: this will have to be adjusted if we ever add lookahead.
delay = 0;
@@ -932,17 +1045,14 @@
// Get aligned far end spectrum
far_spectrum_ptr = WebRtcAecm_AlignedFarend(aecm, &far_q, delay);
- zerosXBuf = (int16_t) far_q;
+ zerosXBuf = (int16_t)far_q;
if (far_spectrum_ptr == NULL) {
return -1;
}
// Calculate log(energy) and update energy threshold levels
- WebRtcAecm_CalcEnergies(aecm,
- far_spectrum_ptr,
- zerosXBuf,
- dfaNoisySum,
+ WebRtcAecm_CalcEnergies(aecm, far_spectrum_ptr, zerosXBuf, dfaNoisySum,
echoEst32);
// Calculate stepsize
mu = WebRtcAecm_CalcStepSize(aecm);
@@ -953,11 +1063,7 @@
// This is the channel estimation algorithm.
// It is base on NLMS but has a variable step length,
// which was calculated above.
- WebRtcAecm_UpdateChannel(aecm,
- far_spectrum_ptr,
- zerosXBuf,
- dfaNoisy,
- mu,
+ WebRtcAecm_UpdateChannel(aecm, far_spectrum_ptr, zerosXBuf, dfaNoisy, mu,
echoEst32);
supGain = WebRtcAecm_CalcSuppressionGain(aecm);
@@ -976,19 +1082,18 @@
// Multiplication is safe
// Result in
// Q(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN+aecm->xfaQDomainBuf[diff])
- echoEst32Gained = WEBRTC_SPL_UMUL_32_16((uint32_t)aecm->echoFilt[i],
- (uint16_t)supGain);
+ echoEst32Gained =
+ WEBRTC_SPL_UMUL_32_16((uint32_t)aecm->echoFilt[i], (uint16_t)supGain);
resolutionDiff = 14 - RESOLUTION_CHANNEL16 - RESOLUTION_SUPGAIN;
resolutionDiff += (aecm->dfaCleanQDomain - zerosXBuf);
} else {
tmp16no1 = 17 - zeros32 - zeros16;
- resolutionDiff = 14 + tmp16no1 - RESOLUTION_CHANNEL16 -
- RESOLUTION_SUPGAIN;
+ resolutionDiff =
+ 14 + tmp16no1 - RESOLUTION_CHANNEL16 - RESOLUTION_SUPGAIN;
resolutionDiff += (aecm->dfaCleanQDomain - zerosXBuf);
if (zeros32 > tmp16no1) {
- echoEst32Gained = WEBRTC_SPL_UMUL_32_16(
- (uint32_t)aecm->echoFilt[i],
- supGain >> tmp16no1);
+ echoEst32Gained = WEBRTC_SPL_UMUL_32_16((uint32_t)aecm->echoFilt[i],
+ supGain >> tmp16no1);
} else {
// Result in Q-(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN-16)
echoEst32Gained = (aecm->echoFilt[i] >> tmp16no1) * supGain;
@@ -1004,8 +1109,8 @@
tmp16no2 = ptrDfaClean[i] >> -qDomainDiff;
} else {
tmp16no1 = dfa_clean_q_domain_diff < 0
- ? aecm->nearFilt[i] >> -dfa_clean_q_domain_diff
- : aecm->nearFilt[i] << dfa_clean_q_domain_diff;
+ ? aecm->nearFilt[i] >> -dfa_clean_q_domain_diff
+ : aecm->nearFilt[i] << dfa_clean_q_domain_diff;
qDomainDiff = 0;
tmp16no2 = ptrDfaClean[i];
}
@@ -1017,8 +1122,8 @@
if ((tmp16no2) & (-qDomainDiff > zeros16)) {
aecm->nearFilt[i] = WEBRTC_SPL_WORD16_MAX;
} else {
- aecm->nearFilt[i] = qDomainDiff < 0 ? tmp16no2 << -qDomainDiff
- : tmp16no2 >> qDomainDiff;
+ aecm->nearFilt[i] =
+ qDomainDiff < 0 ? tmp16no2 << -qDomainDiff : tmp16no2 >> qDomainDiff;
}
// Wiener filter coefficients, resulting hnl in Q14
@@ -1031,8 +1136,8 @@
// Multiply the suppression gain
// Rounding
echoEst32Gained += (uint32_t)(aecm->nearFilt[i] >> 1);
- tmpU32 = WebRtcSpl_DivU32U16(echoEst32Gained,
- (uint16_t)aecm->nearFilt[i]);
+ tmpU32 =
+ WebRtcSpl_DivU32U16(echoEst32Gained, (uint16_t)aecm->nearFilt[i]);
// Current resolution is
// Q-(RESOLUTION_CHANNEL + RESOLUTION_SUPGAIN
@@ -1062,58 +1167,56 @@
// TODO(bjornv): Investigate if the scaling of hnl[i] below can cause
// speech distortion in double-talk.
for (i = 0; i < (PART_LEN1 >> 3); i++) {
- __asm __volatile (
- "lh %[temp1], 0(%[ptr1]) \n\t"
- "lh %[temp2], 2(%[ptr1]) \n\t"
- "lh %[temp3], 4(%[ptr1]) \n\t"
- "lh %[temp4], 6(%[ptr1]) \n\t"
- "lh %[temp5], 8(%[ptr1]) \n\t"
- "lh %[temp6], 10(%[ptr1]) \n\t"
- "lh %[temp7], 12(%[ptr1]) \n\t"
- "lh %[temp8], 14(%[ptr1]) \n\t"
- "mul %[temp1], %[temp1], %[temp1] \n\t"
- "mul %[temp2], %[temp2], %[temp2] \n\t"
- "mul %[temp3], %[temp3], %[temp3] \n\t"
- "mul %[temp4], %[temp4], %[temp4] \n\t"
- "mul %[temp5], %[temp5], %[temp5] \n\t"
- "mul %[temp6], %[temp6], %[temp6] \n\t"
- "mul %[temp7], %[temp7], %[temp7] \n\t"
- "mul %[temp8], %[temp8], %[temp8] \n\t"
- "sra %[temp1], %[temp1], 14 \n\t"
- "sra %[temp2], %[temp2], 14 \n\t"
- "sra %[temp3], %[temp3], 14 \n\t"
- "sra %[temp4], %[temp4], 14 \n\t"
- "sra %[temp5], %[temp5], 14 \n\t"
- "sra %[temp6], %[temp6], 14 \n\t"
- "sra %[temp7], %[temp7], 14 \n\t"
- "sra %[temp8], %[temp8], 14 \n\t"
- "sh %[temp1], 0(%[ptr1]) \n\t"
- "sh %[temp2], 2(%[ptr1]) \n\t"
- "sh %[temp3], 4(%[ptr1]) \n\t"
- "sh %[temp4], 6(%[ptr1]) \n\t"
- "sh %[temp5], 8(%[ptr1]) \n\t"
- "sh %[temp6], 10(%[ptr1]) \n\t"
- "sh %[temp7], 12(%[ptr1]) \n\t"
- "sh %[temp8], 14(%[ptr1]) \n\t"
- "addiu %[ptr1], %[ptr1], 16 \n\t"
- : [temp1] "=&r" (temp1), [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [temp4] "=&r" (temp4), [temp5] "=&r" (temp5), [temp6] "=&r" (temp6),
- [temp7] "=&r" (temp7), [temp8] "=&r" (temp8), [ptr1] "+r" (ptr1)
- :
- : "memory", "hi", "lo"
- );
+ __asm __volatile(
+ "lh %[temp1], 0(%[ptr1]) \n\t"
+ "lh %[temp2], 2(%[ptr1]) \n\t"
+ "lh %[temp3], 4(%[ptr1]) \n\t"
+ "lh %[temp4], 6(%[ptr1]) \n\t"
+ "lh %[temp5], 8(%[ptr1]) \n\t"
+ "lh %[temp6], 10(%[ptr1]) \n\t"
+ "lh %[temp7], 12(%[ptr1]) \n\t"
+ "lh %[temp8], 14(%[ptr1]) \n\t"
+ "mul %[temp1], %[temp1], %[temp1] \n\t"
+ "mul %[temp2], %[temp2], %[temp2] \n\t"
+ "mul %[temp3], %[temp3], %[temp3] \n\t"
+ "mul %[temp4], %[temp4], %[temp4] \n\t"
+ "mul %[temp5], %[temp5], %[temp5] \n\t"
+ "mul %[temp6], %[temp6], %[temp6] \n\t"
+ "mul %[temp7], %[temp7], %[temp7] \n\t"
+ "mul %[temp8], %[temp8], %[temp8] \n\t"
+ "sra %[temp1], %[temp1], 14 \n\t"
+ "sra %[temp2], %[temp2], 14 \n\t"
+ "sra %[temp3], %[temp3], 14 \n\t"
+ "sra %[temp4], %[temp4], 14 \n\t"
+ "sra %[temp5], %[temp5], 14 \n\t"
+ "sra %[temp6], %[temp6], 14 \n\t"
+ "sra %[temp7], %[temp7], 14 \n\t"
+ "sra %[temp8], %[temp8], 14 \n\t"
+ "sh %[temp1], 0(%[ptr1]) \n\t"
+ "sh %[temp2], 2(%[ptr1]) \n\t"
+ "sh %[temp3], 4(%[ptr1]) \n\t"
+ "sh %[temp4], 6(%[ptr1]) \n\t"
+ "sh %[temp5], 8(%[ptr1]) \n\t"
+ "sh %[temp6], 10(%[ptr1]) \n\t"
+ "sh %[temp7], 12(%[ptr1]) \n\t"
+ "sh %[temp8], 14(%[ptr1]) \n\t"
+ "addiu %[ptr1], %[ptr1], 16 \n\t"
+ : [temp1] "=&r"(temp1), [temp2] "=&r"(temp2), [temp3] "=&r"(temp3),
+ [temp4] "=&r"(temp4), [temp5] "=&r"(temp5), [temp6] "=&r"(temp6),
+ [temp7] "=&r"(temp7), [temp8] "=&r"(temp8), [ptr1] "+r"(ptr1)
+ :
+ : "memory", "hi", "lo");
}
- for(i = 0; i < (PART_LEN1 & 7); i++) {
- __asm __volatile (
- "lh %[temp1], 0(%[ptr1]) \n\t"
- "mul %[temp1], %[temp1], %[temp1] \n\t"
- "sra %[temp1], %[temp1], 14 \n\t"
- "sh %[temp1], 0(%[ptr1]) \n\t"
- "addiu %[ptr1], %[ptr1], 2 \n\t"
- : [temp1] "=&r" (temp1), [ptr1] "+r" (ptr1)
- :
- : "memory", "hi", "lo"
- );
+ for (i = 0; i < (PART_LEN1 & 7); i++) {
+ __asm __volatile(
+ "lh %[temp1], 0(%[ptr1]) \n\t"
+ "mul %[temp1], %[temp1], %[temp1] \n\t"
+ "sra %[temp1], %[temp1], 14 \n\t"
+ "sh %[temp1], 0(%[ptr1]) \n\t"
+ "addiu %[ptr1], %[ptr1], 2 \n\t"
+ : [temp1] "=&r"(temp1), [ptr1] "+r"(ptr1)
+ :
+ : "memory", "hi", "lo");
}
for (i = kMinPrefBand; i <= kMaxPrefBand; i++) {
@@ -1141,102 +1244,95 @@
} else {
for (i = 0; i < PART_LEN1; i++) {
#if defined(MIPS_DSP_R1_LE)
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "lh %[temp1], 0(%[ptr]) \n\t"
- "lh %[temp2], 0(%[dr_ptr]) \n\t"
- "slti %[temp4], %[temp1], 0x4001 \n\t"
- "beqz %[temp4], 3f \n\t"
- " lh %[temp3], 2(%[dr_ptr]) \n\t"
- "slti %[temp5], %[temp1], 3277 \n\t"
- "bnez %[temp5], 2f \n\t"
- " addiu %[dr_ptr], %[dr_ptr], 4 \n\t"
- "mul %[temp2], %[temp2], %[temp1] \n\t"
- "mul %[temp3], %[temp3], %[temp1] \n\t"
- "shra_r.w %[temp2], %[temp2], 14 \n\t"
- "shra_r.w %[temp3], %[temp3], 14 \n\t"
- "b 4f \n\t"
- " nop \n\t"
- "2: \n\t"
- "addu %[temp1], $zero, $zero \n\t"
- "addu %[temp2], $zero, $zero \n\t"
- "addu %[temp3], $zero, $zero \n\t"
- "b 1f \n\t"
- " nop \n\t"
- "3: \n\t"
- "addiu %[temp1], $0, 0x4000 \n\t"
- "1: \n\t"
- "sh %[temp1], 0(%[ptr]) \n\t"
- "4: \n\t"
- "sh %[temp2], 0(%[er_ptr]) \n\t"
- "sh %[temp3], 2(%[er_ptr]) \n\t"
- "addiu %[ptr], %[ptr], 2 \n\t"
- "addiu %[er_ptr], %[er_ptr], 4 \n\t"
- ".set pop \n\t"
- : [temp1] "=&r" (temp1), [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [temp4] "=&r" (temp4), [temp5] "=&r" (temp5), [ptr] "+r" (ptr),
- [er_ptr] "+r" (er_ptr), [dr_ptr] "+r" (dr_ptr)
- :
- : "memory", "hi", "lo"
- );
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "lh %[temp1], 0(%[ptr]) \n\t"
+ "lh %[temp2], 0(%[dr_ptr]) \n\t"
+ "slti %[temp4], %[temp1], 0x4001 \n\t"
+ "beqz %[temp4], 3f \n\t"
+ " lh %[temp3], 2(%[dr_ptr]) \n\t"
+ "slti %[temp5], %[temp1], 3277 \n\t"
+ "bnez %[temp5], 2f \n\t"
+ " addiu %[dr_ptr], %[dr_ptr], 4 \n\t"
+ "mul %[temp2], %[temp2], %[temp1] \n\t"
+ "mul %[temp3], %[temp3], %[temp1] \n\t"
+ "shra_r.w %[temp2], %[temp2], 14 \n\t"
+ "shra_r.w %[temp3], %[temp3], 14 \n\t"
+ "b 4f \n\t"
+ " nop \n\t"
+ "2: \n\t"
+ "addu %[temp1], $zero, $zero \n\t"
+ "addu %[temp2], $zero, $zero \n\t"
+ "addu %[temp3], $zero, $zero \n\t"
+ "b 1f \n\t"
+ " nop \n\t"
+ "3: \n\t"
+ "addiu %[temp1], $0, 0x4000 \n\t"
+ "1: \n\t"
+ "sh %[temp1], 0(%[ptr]) \n\t"
+ "4: \n\t"
+ "sh %[temp2], 0(%[er_ptr]) \n\t"
+ "sh %[temp3], 2(%[er_ptr]) \n\t"
+ "addiu %[ptr], %[ptr], 2 \n\t"
+ "addiu %[er_ptr], %[er_ptr], 4 \n\t"
+ ".set pop \n\t"
+ : [temp1] "=&r"(temp1), [temp2] "=&r"(temp2), [temp3] "=&r"(temp3),
+ [temp4] "=&r"(temp4), [temp5] "=&r"(temp5), [ptr] "+r"(ptr),
+ [er_ptr] "+r"(er_ptr), [dr_ptr] "+r"(dr_ptr)
+ :
+ : "memory", "hi", "lo");
#else
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "lh %[temp1], 0(%[ptr]) \n\t"
- "lh %[temp2], 0(%[dr_ptr]) \n\t"
- "slti %[temp4], %[temp1], 0x4001 \n\t"
- "beqz %[temp4], 3f \n\t"
- " lh %[temp3], 2(%[dr_ptr]) \n\t"
- "slti %[temp5], %[temp1], 3277 \n\t"
- "bnez %[temp5], 2f \n\t"
- " addiu %[dr_ptr], %[dr_ptr], 4 \n\t"
- "mul %[temp2], %[temp2], %[temp1] \n\t"
- "mul %[temp3], %[temp3], %[temp1] \n\t"
- "addiu %[temp2], %[temp2], 0x2000 \n\t"
- "addiu %[temp3], %[temp3], 0x2000 \n\t"
- "sra %[temp2], %[temp2], 14 \n\t"
- "sra %[temp3], %[temp3], 14 \n\t"
- "b 4f \n\t"
- " nop \n\t"
- "2: \n\t"
- "addu %[temp1], $zero, $zero \n\t"
- "addu %[temp2], $zero, $zero \n\t"
- "addu %[temp3], $zero, $zero \n\t"
- "b 1f \n\t"
- " nop \n\t"
- "3: \n\t"
- "addiu %[temp1], $0, 0x4000 \n\t"
- "1: \n\t"
- "sh %[temp1], 0(%[ptr]) \n\t"
- "4: \n\t"
- "sh %[temp2], 0(%[er_ptr]) \n\t"
- "sh %[temp3], 2(%[er_ptr]) \n\t"
- "addiu %[ptr], %[ptr], 2 \n\t"
- "addiu %[er_ptr], %[er_ptr], 4 \n\t"
- ".set pop \n\t"
- : [temp1] "=&r" (temp1), [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
- [temp4] "=&r" (temp4), [temp5] "=&r" (temp5), [ptr] "+r" (ptr),
- [er_ptr] "+r" (er_ptr), [dr_ptr] "+r" (dr_ptr)
- :
- : "memory", "hi", "lo"
- );
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "lh %[temp1], 0(%[ptr]) \n\t"
+ "lh %[temp2], 0(%[dr_ptr]) \n\t"
+ "slti %[temp4], %[temp1], 0x4001 \n\t"
+ "beqz %[temp4], 3f \n\t"
+ " lh %[temp3], 2(%[dr_ptr]) \n\t"
+ "slti %[temp5], %[temp1], 3277 \n\t"
+ "bnez %[temp5], 2f \n\t"
+ " addiu %[dr_ptr], %[dr_ptr], 4 \n\t"
+ "mul %[temp2], %[temp2], %[temp1] \n\t"
+ "mul %[temp3], %[temp3], %[temp1] \n\t"
+ "addiu %[temp2], %[temp2], 0x2000 \n\t"
+ "addiu %[temp3], %[temp3], 0x2000 \n\t"
+ "sra %[temp2], %[temp2], 14 \n\t"
+ "sra %[temp3], %[temp3], 14 \n\t"
+ "b 4f \n\t"
+ " nop \n\t"
+ "2: \n\t"
+ "addu %[temp1], $zero, $zero \n\t"
+ "addu %[temp2], $zero, $zero \n\t"
+ "addu %[temp3], $zero, $zero \n\t"
+ "b 1f \n\t"
+ " nop \n\t"
+ "3: \n\t"
+ "addiu %[temp1], $0, 0x4000 \n\t"
+ "1: \n\t"
+ "sh %[temp1], 0(%[ptr]) \n\t"
+ "4: \n\t"
+ "sh %[temp2], 0(%[er_ptr]) \n\t"
+ "sh %[temp3], 2(%[er_ptr]) \n\t"
+ "addiu %[ptr], %[ptr], 2 \n\t"
+ "addiu %[er_ptr], %[er_ptr], 4 \n\t"
+ ".set pop \n\t"
+ : [temp1] "=&r"(temp1), [temp2] "=&r"(temp2), [temp3] "=&r"(temp3),
+ [temp4] "=&r"(temp4), [temp5] "=&r"(temp5), [ptr] "+r"(ptr),
+ [er_ptr] "+r"(er_ptr), [dr_ptr] "+r"(dr_ptr)
+ :
+ : "memory", "hi", "lo");
#endif
}
}
- }
- else {
+ } else {
// multiply with Wiener coefficients
for (i = 0; i < PART_LEN1; i++) {
- efw[i].real = (int16_t)
- (WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real,
- hnl[i],
- 14));
- efw[i].imag = (int16_t)
- (WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag,
- hnl[i],
- 14));
+ efw[i].real = (int16_t)(
+ WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real, hnl[i], 14));
+ efw[i].imag = (int16_t)(
+ WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag, hnl[i], 14));
}
}
@@ -1284,26 +1380,25 @@
// Generate a uniform random array on [0 2^15-1].
WebRtcSpl_RandUArray(randW16, PART_LEN, &aecm->seed);
int16_t* randW16p = (int16_t*)randW16;
-#if defined (MIPS_DSP_R1_LE)
+#if defined(MIPS_DSP_R1_LE)
int16_t* kCosTablep = (int16_t*)WebRtcAecm_kCosTable;
int16_t* kSinTablep = (int16_t*)WebRtcAecm_kSinTable;
-#endif // #if defined(MIPS_DSP_R1_LE)
+#endif // #if defined(MIPS_DSP_R1_LE)
tmp1 = (int32_t*)aecm->noiseEst + 1;
dfap = (int16_t*)dfa + 1;
lambdap = (int16_t*)lambda + 1;
// Estimate noise power.
- for (i = 1; i < PART_LEN1; i+=2) {
- // Shift to the noise domain.
- __asm __volatile (
- "lh %[tmp32], 0(%[dfap]) \n\t"
- "lw %[tnoise], 0(%[tmp1]) \n\t"
- "sllv %[outLShift32], %[tmp32], %[shiftFromNearToNoise] \n\t"
- : [tmp32] "=&r" (tmp32), [outLShift32] "=r" (outLShift32),
- [tnoise] "=&r" (tnoise)
- : [tmp1] "r" (tmp1), [dfap] "r" (dfap),
- [shiftFromNearToNoise] "r" (shiftFromNearToNoise)
- : "memory"
- );
+ for (i = 1; i < PART_LEN1; i += 2) {
+ // Shift to the noise domain.
+ __asm __volatile(
+ "lh %[tmp32], 0(%[dfap]) \n\t"
+ "lw %[tnoise], 0(%[tmp1]) \n\t"
+ "sllv %[outLShift32], %[tmp32], %[shiftFromNearToNoise] \n\t"
+ : [tmp32] "=&r"(tmp32), [outLShift32] "=r"(outLShift32),
+ [tnoise] "=&r"(tnoise)
+ : [tmp1] "r"(tmp1), [dfap] "r"(dfap),
+ [shiftFromNearToNoise] "r"(shiftFromNearToNoise)
+ : "memory");
if (outLShift32 < tnoise) {
// Reset "too low" counter
@@ -1319,13 +1414,13 @@
aecm->noiseEstTooHighCtr[i] = 0; // Reset the counter
}
} else {
- __asm __volatile (
- "subu %[tmp32], %[tnoise], %[outLShift32] \n\t"
- "srav %[tmp32], %[tmp32], %[minTrackShift] \n\t"
- "subu %[tnoise], %[tnoise], %[tmp32] \n\t"
- : [tmp32] "=&r" (tmp32), [tnoise] "+r" (tnoise)
- : [outLShift32] "r" (outLShift32), [minTrackShift] "r" (minTrackShift)
- );
+ __asm __volatile(
+ "subu %[tmp32], %[tnoise], %[outLShift32] \n\t"
+ "srav %[tmp32], %[tmp32], %[minTrackShift] \n\t"
+ "subu %[tnoise], %[tnoise], %[tmp32] \n\t"
+ : [tmp32] "=&r"(tmp32), [tnoise] "+r"(tnoise)
+ :
+ [outLShift32] "r"(outLShift32), [minTrackShift] "r"(minTrackShift));
}
} else {
// Reset "too high" counter
@@ -1334,53 +1429,49 @@
if ((tnoise >> 19) <= 0) {
if ((tnoise >> 11) > 0) {
// Large enough for relative increase
- __asm __volatile (
- "mul %[tnoise], %[tnoise], %[c2049] \n\t"
- "sra %[tnoise], %[tnoise], 11 \n\t"
- : [tnoise] "+r" (tnoise)
- : [c2049] "r" (c2049)
- : "hi", "lo"
- );
+ __asm __volatile(
+ "mul %[tnoise], %[tnoise], %[c2049] \n\t"
+ "sra %[tnoise], %[tnoise], 11 \n\t"
+ : [tnoise] "+r"(tnoise)
+ : [c2049] "r"(c2049)
+ : "hi", "lo");
} else {
// Make incremental increases based on size every
// |kNoiseEstIncCount| block
aecm->noiseEstTooLowCtr[i]++;
if (aecm->noiseEstTooLowCtr[i] >= kNoiseEstIncCount) {
- __asm __volatile (
- "sra %[tmp32], %[tnoise], 9 \n\t"
- "addi %[tnoise], %[tnoise], 1 \n\t"
- "addu %[tnoise], %[tnoise], %[tmp32] \n\t"
- : [tnoise] "+r" (tnoise), [tmp32] "=&r" (tmp32)
- :
- );
- aecm->noiseEstTooLowCtr[i] = 0; // Reset counter
+ __asm __volatile(
+ "sra %[tmp32], %[tnoise], 9 \n\t"
+ "addi %[tnoise], %[tnoise], 1 \n\t"
+ "addu %[tnoise], %[tnoise], %[tmp32] \n\t"
+ : [tnoise] "+r"(tnoise), [tmp32] "=&r"(tmp32)
+ :);
+ aecm->noiseEstTooLowCtr[i] = 0; // Reset counter
}
}
} else {
// Avoid overflow.
// Multiplication with 2049 will cause wrap around. Scale
// down first and then multiply
- __asm __volatile (
- "sra %[tnoise], %[tnoise], 11 \n\t"
- "mul %[tnoise], %[tnoise], %[c2049] \n\t"
- : [tnoise] "+r" (tnoise)
- : [c2049] "r" (c2049)
- : "hi", "lo"
- );
+ __asm __volatile(
+ "sra %[tnoise], %[tnoise], 11 \n\t"
+ "mul %[tnoise], %[tnoise], %[c2049] \n\t"
+ : [tnoise] "+r"(tnoise)
+ : [c2049] "r"(c2049)
+ : "hi", "lo");
}
}
// Shift to the noise domain.
- __asm __volatile (
- "lh %[tmp32], 2(%[dfap]) \n\t"
- "lw %[tnoise1], 4(%[tmp1]) \n\t"
- "addiu %[dfap], %[dfap], 4 \n\t"
- "sllv %[outLShift32], %[tmp32], %[shiftFromNearToNoise] \n\t"
- : [tmp32] "=&r" (tmp32), [dfap] "+r" (dfap),
- [outLShift32] "=r" (outLShift32), [tnoise1] "=&r" (tnoise1)
- : [tmp1] "r" (tmp1), [shiftFromNearToNoise] "r" (shiftFromNearToNoise)
- : "memory"
- );
+ __asm __volatile(
+ "lh %[tmp32], 2(%[dfap]) \n\t"
+ "lw %[tnoise1], 4(%[tmp1]) \n\t"
+ "addiu %[dfap], %[dfap], 4 \n\t"
+ "sllv %[outLShift32], %[tmp32], %[shiftFromNearToNoise] \n\t"
+ : [tmp32] "=&r"(tmp32), [dfap] "+r"(dfap),
+ [outLShift32] "=r"(outLShift32), [tnoise1] "=&r"(tnoise1)
+ : [tmp1] "r"(tmp1), [shiftFromNearToNoise] "r"(shiftFromNearToNoise)
+ : "memory");
if (outLShift32 < tnoise1) {
// Reset "too low" counter
@@ -1393,16 +1484,16 @@
aecm->noiseEstTooHighCtr[i + 1]++;
if (aecm->noiseEstTooHighCtr[i + 1] >= kNoiseEstIncCount) {
tnoise1--;
- aecm->noiseEstTooHighCtr[i + 1] = 0; // Reset the counter
+ aecm->noiseEstTooHighCtr[i + 1] = 0; // Reset the counter
}
} else {
- __asm __volatile (
- "subu %[tmp32], %[tnoise1], %[outLShift32] \n\t"
- "srav %[tmp32], %[tmp32], %[minTrackShift] \n\t"
- "subu %[tnoise1], %[tnoise1], %[tmp32] \n\t"
- : [tmp32] "=&r" (tmp32), [tnoise1] "+r" (tnoise1)
- : [outLShift32] "r" (outLShift32), [minTrackShift] "r" (minTrackShift)
- );
+ __asm __volatile(
+ "subu %[tmp32], %[tnoise1], %[outLShift32] \n\t"
+ "srav %[tmp32], %[tmp32], %[minTrackShift] \n\t"
+ "subu %[tnoise1], %[tnoise1], %[tmp32] \n\t"
+ : [tmp32] "=&r"(tmp32), [tnoise1] "+r"(tnoise1)
+ :
+ [outLShift32] "r"(outLShift32), [minTrackShift] "r"(minTrackShift));
}
} else {
// Reset "too high" counter
@@ -1411,59 +1502,55 @@
if ((tnoise1 >> 19) <= 0) {
if ((tnoise1 >> 11) > 0) {
// Large enough for relative increase
- __asm __volatile (
- "mul %[tnoise1], %[tnoise1], %[c2049] \n\t"
- "sra %[tnoise1], %[tnoise1], 11 \n\t"
- : [tnoise1] "+r" (tnoise1)
- : [c2049] "r" (c2049)
- : "hi", "lo"
- );
+ __asm __volatile(
+ "mul %[tnoise1], %[tnoise1], %[c2049] \n\t"
+ "sra %[tnoise1], %[tnoise1], 11 \n\t"
+ : [tnoise1] "+r"(tnoise1)
+ : [c2049] "r"(c2049)
+ : "hi", "lo");
} else {
// Make incremental increases based on size every
// |kNoiseEstIncCount| block
aecm->noiseEstTooLowCtr[i + 1]++;
if (aecm->noiseEstTooLowCtr[i + 1] >= kNoiseEstIncCount) {
- __asm __volatile (
- "sra %[tmp32], %[tnoise1], 9 \n\t"
- "addi %[tnoise1], %[tnoise1], 1 \n\t"
- "addu %[tnoise1], %[tnoise1], %[tmp32] \n\t"
- : [tnoise1] "+r" (tnoise1), [tmp32] "=&r" (tmp32)
- :
- );
- aecm->noiseEstTooLowCtr[i + 1] = 0; // Reset counter
+ __asm __volatile(
+ "sra %[tmp32], %[tnoise1], 9 \n\t"
+ "addi %[tnoise1], %[tnoise1], 1 \n\t"
+ "addu %[tnoise1], %[tnoise1], %[tmp32] \n\t"
+ : [tnoise1] "+r"(tnoise1), [tmp32] "=&r"(tmp32)
+ :);
+ aecm->noiseEstTooLowCtr[i + 1] = 0; // Reset counter
}
}
} else {
// Avoid overflow.
// Multiplication with 2049 will cause wrap around. Scale
// down first and then multiply
- __asm __volatile (
- "sra %[tnoise1], %[tnoise1], 11 \n\t"
- "mul %[tnoise1], %[tnoise1], %[c2049] \n\t"
- : [tnoise1] "+r" (tnoise1)
- : [c2049] "r" (c2049)
- : "hi", "lo"
- );
+ __asm __volatile(
+ "sra %[tnoise1], %[tnoise1], 11 \n\t"
+ "mul %[tnoise1], %[tnoise1], %[c2049] \n\t"
+ : [tnoise1] "+r"(tnoise1)
+ : [c2049] "r"(c2049)
+ : "hi", "lo");
}
}
- __asm __volatile (
- "lh %[tmp16], 0(%[lambdap]) \n\t"
- "lh %[tmp161], 2(%[lambdap]) \n\t"
- "sw %[tnoise], 0(%[tmp1]) \n\t"
- "sw %[tnoise1], 4(%[tmp1]) \n\t"
- "subu %[tmp16], %[c114], %[tmp16] \n\t"
- "subu %[tmp161], %[c114], %[tmp161] \n\t"
- "srav %[tmp32], %[tnoise], %[shiftFromNearToNoise] \n\t"
- "srav %[tmp321], %[tnoise1], %[shiftFromNearToNoise] \n\t"
- "addiu %[lambdap], %[lambdap], 4 \n\t"
- "addiu %[tmp1], %[tmp1], 8 \n\t"
- : [tmp16] "=&r" (tmp16), [tmp161] "=&r" (tmp161), [tmp1] "+r" (tmp1),
- [tmp32] "=&r" (tmp32), [tmp321] "=&r" (tmp321), [lambdap] "+r" (lambdap)
- : [tnoise] "r" (tnoise), [tnoise1] "r" (tnoise1), [c114] "r" (c114),
- [shiftFromNearToNoise] "r" (shiftFromNearToNoise)
- : "memory"
- );
+ __asm __volatile(
+ "lh %[tmp16], 0(%[lambdap]) \n\t"
+ "lh %[tmp161], 2(%[lambdap]) \n\t"
+ "sw %[tnoise], 0(%[tmp1]) \n\t"
+ "sw %[tnoise1], 4(%[tmp1]) \n\t"
+ "subu %[tmp16], %[c114], %[tmp16] \n\t"
+ "subu %[tmp161], %[c114], %[tmp161] \n\t"
+ "srav %[tmp32], %[tnoise], %[shiftFromNearToNoise] \n\t"
+ "srav %[tmp321], %[tnoise1], %[shiftFromNearToNoise] \n\t"
+ "addiu %[lambdap], %[lambdap], 4 \n\t"
+ "addiu %[tmp1], %[tmp1], 8 \n\t"
+ : [tmp16] "=&r"(tmp16), [tmp161] "=&r"(tmp161), [tmp1] "+r"(tmp1),
+ [tmp32] "=&r"(tmp32), [tmp321] "=&r"(tmp321), [lambdap] "+r"(lambdap)
+ : [tnoise] "r"(tnoise), [tnoise1] "r"(tnoise1), [c114] "r"(c114),
+ [shiftFromNearToNoise] "r"(shiftFromNearToNoise)
+ : "memory");
if (tmp32 > 32767) {
tmp32 = 32767;
@@ -1471,33 +1558,31 @@
}
if (tmp321 > 32767) {
tmp321 = 32767;
- aecm->noiseEst[i+1] = tmp321 << shiftFromNearToNoise;
+ aecm->noiseEst[i + 1] = tmp321 << shiftFromNearToNoise;
}
- __asm __volatile (
- "mul %[tmp32], %[tmp32], %[tmp16] \n\t"
- "mul %[tmp321], %[tmp321], %[tmp161] \n\t"
- "sra %[nrsh1], %[tmp32], 14 \n\t"
- "sra %[nrsh2], %[tmp321], 14 \n\t"
- : [nrsh1] "=&r" (nrsh1), [nrsh2] "=r" (nrsh2)
- : [tmp16] "r" (tmp16), [tmp161] "r" (tmp161), [tmp32] "r" (tmp32),
- [tmp321] "r" (tmp321)
- : "memory", "hi", "lo"
- );
+ __asm __volatile(
+ "mul %[tmp32], %[tmp32], %[tmp16] \n\t"
+ "mul %[tmp321], %[tmp321], %[tmp161] \n\t"
+ "sra %[nrsh1], %[tmp32], 14 \n\t"
+ "sra %[nrsh2], %[tmp321], 14 \n\t"
+ : [nrsh1] "=&r"(nrsh1), [nrsh2] "=r"(nrsh2)
+ : [tmp16] "r"(tmp16), [tmp161] "r"(tmp161), [tmp32] "r"(tmp32),
+ [tmp321] "r"(tmp321)
+ : "memory", "hi", "lo");
- __asm __volatile (
- "lh %[tmp32], 0(%[randW16p]) \n\t"
- "lh %[tmp321], 2(%[randW16p]) \n\t"
- "addiu %[randW16p], %[randW16p], 4 \n\t"
- "mul %[tmp32], %[tmp32], %[c359] \n\t"
- "mul %[tmp321], %[tmp321], %[c359] \n\t"
- "sra %[tmp16], %[tmp32], 15 \n\t"
- "sra %[tmp161], %[tmp321], 15 \n\t"
- : [randW16p] "+r" (randW16p), [tmp32] "=&r" (tmp32),
- [tmp16] "=r" (tmp16), [tmp161] "=r" (tmp161), [tmp321] "=&r" (tmp321)
- : [c359] "r" (c359)
- : "memory", "hi", "lo"
- );
+ __asm __volatile(
+ "lh %[tmp32], 0(%[randW16p]) \n\t"
+ "lh %[tmp321], 2(%[randW16p]) \n\t"
+ "addiu %[randW16p], %[randW16p], 4 \n\t"
+ "mul %[tmp32], %[tmp32], %[c359] \n\t"
+ "mul %[tmp321], %[tmp321], %[c359] \n\t"
+ "sra %[tmp16], %[tmp32], 15 \n\t"
+ "sra %[tmp161], %[tmp321], 15 \n\t"
+ : [randW16p] "+r"(randW16p), [tmp32] "=&r"(tmp32), [tmp16] "=r"(tmp16),
+ [tmp161] "=r"(tmp161), [tmp321] "=&r"(tmp321)
+ : [c359] "r"(c359)
+ : "memory", "hi", "lo");
#if !defined(MIPS_DSP_R1_LE)
tmp32 = WebRtcAecm_kCosTable[tmp16];
@@ -1505,36 +1590,34 @@
tmp322 = WebRtcAecm_kCosTable[tmp161];
tmp323 = WebRtcAecm_kSinTable[tmp161];
#else
- __asm __volatile (
- "sll %[tmp16], %[tmp16], 1 \n\t"
- "sll %[tmp161], %[tmp161], 1 \n\t"
- "lhx %[tmp32], %[tmp16](%[kCosTablep]) \n\t"
- "lhx %[tmp321], %[tmp16](%[kSinTablep]) \n\t"
- "lhx %[tmp322], %[tmp161](%[kCosTablep]) \n\t"
- "lhx %[tmp323], %[tmp161](%[kSinTablep]) \n\t"
- : [tmp32] "=&r" (tmp32), [tmp321] "=&r" (tmp321),
- [tmp322] "=&r" (tmp322), [tmp323] "=&r" (tmp323)
- : [kCosTablep] "r" (kCosTablep), [tmp16] "r" (tmp16),
- [tmp161] "r" (tmp161), [kSinTablep] "r" (kSinTablep)
- : "memory"
- );
+ __asm __volatile(
+ "sll %[tmp16], %[tmp16], 1 \n\t"
+ "sll %[tmp161], %[tmp161], 1 \n\t"
+ "lhx %[tmp32], %[tmp16](%[kCosTablep]) \n\t"
+ "lhx %[tmp321], %[tmp16](%[kSinTablep]) \n\t"
+ "lhx %[tmp322], %[tmp161](%[kCosTablep]) \n\t"
+ "lhx %[tmp323], %[tmp161](%[kSinTablep]) \n\t"
+ : [tmp32] "=&r"(tmp32), [tmp321] "=&r"(tmp321), [tmp322] "=&r"(tmp322),
+ [tmp323] "=&r"(tmp323)
+ : [kCosTablep] "r"(kCosTablep), [tmp16] "r"(tmp16),
+ [tmp161] "r"(tmp161), [kSinTablep] "r"(kSinTablep)
+ : "memory");
#endif
- __asm __volatile (
- "mul %[tmp32], %[tmp32], %[nrsh1] \n\t"
- "negu %[tmp162], %[nrsh1] \n\t"
- "mul %[tmp322], %[tmp322], %[nrsh2] \n\t"
- "negu %[tmp163], %[nrsh2] \n\t"
- "sra %[tmp32], %[tmp32], 13 \n\t"
- "mul %[tmp321], %[tmp321], %[tmp162] \n\t"
- "sra %[tmp322], %[tmp322], 13 \n\t"
- "mul %[tmp323], %[tmp323], %[tmp163] \n\t"
- "sra %[tmp321], %[tmp321], 13 \n\t"
- "sra %[tmp323], %[tmp323], 13 \n\t"
- : [tmp32] "+r" (tmp32), [tmp321] "+r" (tmp321), [tmp162] "=&r" (tmp162),
- [tmp322] "+r" (tmp322), [tmp323] "+r" (tmp323), [tmp163] "=&r" (tmp163)
- : [nrsh1] "r" (nrsh1), [nrsh2] "r" (nrsh2)
- : "hi", "lo"
- );
+ __asm __volatile(
+ "mul %[tmp32], %[tmp32], %[nrsh1] \n\t"
+ "negu %[tmp162], %[nrsh1] \n\t"
+ "mul %[tmp322], %[tmp322], %[nrsh2] \n\t"
+ "negu %[tmp163], %[nrsh2] \n\t"
+ "sra %[tmp32], %[tmp32], 13 \n\t"
+ "mul %[tmp321], %[tmp321], %[tmp162] \n\t"
+ "sra %[tmp322], %[tmp322], 13 \n\t"
+ "mul %[tmp323], %[tmp323], %[tmp163] \n\t"
+ "sra %[tmp321], %[tmp321], 13 \n\t"
+ "sra %[tmp323], %[tmp323], 13 \n\t"
+ : [tmp32] "+r"(tmp32), [tmp321] "+r"(tmp321), [tmp162] "=&r"(tmp162),
+ [tmp322] "+r"(tmp322), [tmp323] "+r"(tmp323), [tmp163] "=&r"(tmp163)
+ : [nrsh1] "r"(nrsh1), [nrsh2] "r"(nrsh2)
+ : "hi", "lo");
// Tables are in Q13.
uReal[i] = (int16_t)tmp32;
uImag[i] = (int16_t)tmp321;
diff --git a/modules/audio_processing/aecm/aecm_core_neon.cc b/modules/audio_processing/aecm/aecm_core_neon.cc
index ca7211f..a2153a2 100644
--- a/modules/audio_processing/aecm/aecm_core_neon.cc
+++ b/modules/audio_processing/aecm/aecm_core_neon.cc
@@ -77,12 +77,12 @@
echo_stored_v = vaddq_u32(echo_est_v_low, echo_stored_v);
echo_stored_v = vaddq_u32(echo_est_v_high, echo_stored_v);
- echo_adapt_v = vmlal_u16(echo_adapt_v,
- vreinterpret_u16_s16(vget_low_s16(adapt_v)),
- vget_low_u16(spectrum_v));
- echo_adapt_v = vmlal_u16(echo_adapt_v,
- vreinterpret_u16_s16(vget_high_s16(adapt_v)),
- vget_high_u16(spectrum_v));
+ echo_adapt_v =
+ vmlal_u16(echo_adapt_v, vreinterpret_u16_s16(vget_low_s16(adapt_v)),
+ vget_low_u16(spectrum_v));
+ echo_adapt_v =
+ vmlal_u16(echo_adapt_v, vreinterpret_u16_s16(vget_high_s16(adapt_v)),
+ vget_high_u16(spectrum_v));
start_stored_p += 8;
start_adapt_p += 8;
diff --git a/modules/audio_processing/aecm/aecm_defines.h b/modules/audio_processing/aecm/aecm_defines.h
index ae2d2bc..5805549 100644
--- a/modules/audio_processing/aecm/aecm_defines.h
+++ b/modules/audio_processing/aecm/aecm_defines.h
@@ -11,77 +11,77 @@
#ifndef MODULES_AUDIO_PROCESSING_AECM_AECM_DEFINES_H_
#define MODULES_AUDIO_PROCESSING_AECM_AECM_DEFINES_H_
-#define AECM_DYNAMIC_Q /* Turn on/off dynamic Q-domain. */
+#define AECM_DYNAMIC_Q /* Turn on/off dynamic Q-domain. */
/* Algorithm parameters */
-#define FRAME_LEN 80 /* Total frame length, 10 ms. */
+#define FRAME_LEN 80 /* Total frame length, 10 ms. */
-#define PART_LEN 64 /* Length of partition. */
-#define PART_LEN_SHIFT 7 /* Length of (PART_LEN * 2) in base 2. */
+#define PART_LEN 64 /* Length of partition. */
+#define PART_LEN_SHIFT 7 /* Length of (PART_LEN * 2) in base 2. */
-#define PART_LEN1 (PART_LEN + 1) /* Unique fft coefficients. */
-#define PART_LEN2 (PART_LEN << 1) /* Length of partition * 2. */
-#define PART_LEN4 (PART_LEN << 2) /* Length of partition * 4. */
-#define FAR_BUF_LEN PART_LEN4 /* Length of buffers. */
-#define MAX_DELAY 100
+#define PART_LEN1 (PART_LEN + 1) /* Unique fft coefficients. */
+#define PART_LEN2 (PART_LEN << 1) /* Length of partition * 2. */
+#define PART_LEN4 (PART_LEN << 2) /* Length of partition * 4. */
+#define FAR_BUF_LEN PART_LEN4 /* Length of buffers. */
+#define MAX_DELAY 100
/* Counter parameters */
-#define CONV_LEN 512 /* Convergence length used at startup. */
-#define CONV_LEN2 (CONV_LEN << 1) /* Used at startup. */
+#define CONV_LEN 512 /* Convergence length used at startup. */
+#define CONV_LEN2 (CONV_LEN << 1) /* Used at startup. */
/* Energy parameters */
-#define MAX_BUF_LEN 64 /* History length of energy signals. */
-#define FAR_ENERGY_MIN 1025 /* Lowest Far energy level: At least 2 */
- /* in energy. */
-#define FAR_ENERGY_DIFF 929 /* Allowed difference between max */
- /* and min. */
-#define ENERGY_DEV_OFFSET 0 /* The energy error offset in Q8. */
-#define ENERGY_DEV_TOL 400 /* The energy estimation tolerance (Q8). */
-#define FAR_ENERGY_VAD_REGION 230 /* Far VAD tolerance region. */
+#define MAX_BUF_LEN 64 /* History length of energy signals. */
+#define FAR_ENERGY_MIN 1025 /* Lowest Far energy level: At least 2 */
+ /* in energy. */
+#define FAR_ENERGY_DIFF 929 /* Allowed difference between max */
+ /* and min. */
+#define ENERGY_DEV_OFFSET 0 /* The energy error offset in Q8. */
+#define ENERGY_DEV_TOL 400 /* The energy estimation tolerance (Q8). */
+#define FAR_ENERGY_VAD_REGION 230 /* Far VAD tolerance region. */
/* Stepsize parameters */
-#define MU_MIN 10 /* Min stepsize 2^-MU_MIN (far end energy */
- /* dependent). */
-#define MU_MAX 1 /* Max stepsize 2^-MU_MAX (far end energy */
- /* dependent). */
-#define MU_DIFF 9 /* MU_MIN - MU_MAX */
+#define MU_MIN 10 /* Min stepsize 2^-MU_MIN (far end energy */
+ /* dependent). */
+#define MU_MAX 1 /* Max stepsize 2^-MU_MAX (far end energy */
+ /* dependent). */
+#define MU_DIFF 9 /* MU_MIN - MU_MAX */
/* Channel parameters */
-#define MIN_MSE_COUNT 20 /* Min number of consecutive blocks with enough */
- /* far end energy to compare channel estimates. */
-#define MIN_MSE_DIFF 29 /* The ratio between adapted and stored channel to */
- /* accept a new storage (0.8 in Q-MSE_RESOLUTION). */
-#define MSE_RESOLUTION 5 /* MSE parameter resolution. */
-#define RESOLUTION_CHANNEL16 12 /* W16 Channel in Q-RESOLUTION_CHANNEL16. */
-#define RESOLUTION_CHANNEL32 28 /* W32 Channel in Q-RESOLUTION_CHANNEL. */
-#define CHANNEL_VAD 16 /* Minimum energy in frequency band */
- /* to update channel. */
+#define MIN_MSE_COUNT 20 /* Min number of consecutive blocks with enough */
+ /* far end energy to compare channel estimates. */
+#define MIN_MSE_DIFF 29 /* The ratio between adapted and stored channel to */
+ /* accept a new storage (0.8 in Q-MSE_RESOLUTION). */
+#define MSE_RESOLUTION 5 /* MSE parameter resolution. */
+#define RESOLUTION_CHANNEL16 12 /* W16 Channel in Q-RESOLUTION_CHANNEL16. */
+#define RESOLUTION_CHANNEL32 28 /* W32 Channel in Q-RESOLUTION_CHANNEL. */
+#define CHANNEL_VAD 16 /* Minimum energy in frequency band */
+ /* to update channel. */
/* Suppression gain parameters: SUPGAIN parameters in Q-(RESOLUTION_SUPGAIN). */
-#define RESOLUTION_SUPGAIN 8 /* Channel in Q-(RESOLUTION_SUPGAIN). */
-#define SUPGAIN_DEFAULT (1 << RESOLUTION_SUPGAIN) /* Default. */
-#define SUPGAIN_ERROR_PARAM_A 3072 /* Estimation error parameter */
- /* (Maximum gain) (8 in Q8). */
-#define SUPGAIN_ERROR_PARAM_B 1536 /* Estimation error parameter */
- /* (Gain before going down). */
-#define SUPGAIN_ERROR_PARAM_D SUPGAIN_DEFAULT /* Estimation error parameter */
- /* (Should be the same as Default) (1 in Q8). */
-#define SUPGAIN_EPC_DT 200 /* SUPGAIN_ERROR_PARAM_C * ENERGY_DEV_TOL */
+#define RESOLUTION_SUPGAIN 8 /* Channel in Q-(RESOLUTION_SUPGAIN). */
+#define SUPGAIN_DEFAULT (1 << RESOLUTION_SUPGAIN) /* Default. */
+#define SUPGAIN_ERROR_PARAM_A 3072 /* Estimation error parameter */
+ /* (Maximum gain) (8 in Q8). */
+#define SUPGAIN_ERROR_PARAM_B 1536 /* Estimation error parameter */
+ /* (Gain before going down). */
+#define SUPGAIN_ERROR_PARAM_D SUPGAIN_DEFAULT /* Estimation error parameter */
+/* (Should be the same as Default) (1 in Q8). */
+#define SUPGAIN_EPC_DT 200 /* SUPGAIN_ERROR_PARAM_C * ENERGY_DEV_TOL */
/* Defines for "check delay estimation" */
-#define CORR_WIDTH 31 /* Number of samples to correlate over. */
-#define CORR_MAX 16 /* Maximum correlation offset. */
-#define CORR_MAX_BUF 63
-#define CORR_DEV 4
-#define CORR_MAX_LEVEL 20
-#define CORR_MAX_LOW 4
-#define CORR_BUF_LEN (CORR_MAX << 1) + 1
+#define CORR_WIDTH 31 /* Number of samples to correlate over. */
+#define CORR_MAX 16 /* Maximum correlation offset. */
+#define CORR_MAX_BUF 63
+#define CORR_DEV 4
+#define CORR_MAX_LEVEL 20
+#define CORR_MAX_LOW 4
+#define CORR_BUF_LEN (CORR_MAX << 1) + 1
/* Note that CORR_WIDTH + 2*CORR_MAX <= MAX_BUF_LEN. */
-#define ONE_Q14 (1 << 14)
+#define ONE_Q14 (1 << 14)
/* NLP defines */
-#define NLP_COMP_LOW 3277 /* 0.2 in Q14 */
-#define NLP_COMP_HIGH ONE_Q14 /* 1 in Q14 */
+#define NLP_COMP_LOW 3277 /* 0.2 in Q14 */
+#define NLP_COMP_HIGH ONE_Q14 /* 1 in Q14 */
#endif
diff --git a/modules/audio_processing/aecm/echo_control_mobile.cc b/modules/audio_processing/aecm/echo_control_mobile.cc
index 36e2271..c947563 100644
--- a/modules/audio_processing/aecm/echo_control_mobile.cc
+++ b/modules/audio_processing/aecm/echo_control_mobile.cc
@@ -21,56 +21,56 @@
}
#include "modules/audio_processing/aecm/aecm_core.h"
-#define BUF_SIZE_FRAMES 50 // buffer size (frames)
+#define BUF_SIZE_FRAMES 50 // buffer size (frames)
// Maximum length of resampled signal. Must be an integer multiple of frames
// (ceil(1/(1 + MIN_SKEW)*2) + 1)*FRAME_LEN
// The factor of 2 handles wb, and the + 1 is as a safety margin
#define MAX_RESAMP_LEN (5 * FRAME_LEN)
-static const size_t kBufSizeSamp = BUF_SIZE_FRAMES * FRAME_LEN; // buffer size (samples)
-static const int kSampMsNb = 8; // samples per ms in nb
+static const size_t kBufSizeSamp =
+ BUF_SIZE_FRAMES * FRAME_LEN; // buffer size (samples)
+static const int kSampMsNb = 8; // samples per ms in nb
// Target suppression levels for nlp modes
// log{0.001, 0.00001, 0.00000001}
static const int kInitCheck = 42;
-typedef struct
-{
- int sampFreq;
- int scSampFreq;
- short bufSizeStart;
- int knownDelay;
+typedef struct {
+ int sampFreq;
+ int scSampFreq;
+ short bufSizeStart;
+ int knownDelay;
- // Stores the last frame added to the farend buffer
- short farendOld[2][FRAME_LEN];
- short initFlag; // indicates if AEC has been initialized
+ // Stores the last frame added to the farend buffer
+ short farendOld[2][FRAME_LEN];
+ short initFlag; // indicates if AEC has been initialized
- // Variables used for averaging far end buffer size
- short counter;
- short sum;
- short firstVal;
- short checkBufSizeCtr;
+ // Variables used for averaging far end buffer size
+ short counter;
+ short sum;
+ short firstVal;
+ short checkBufSizeCtr;
- // Variables used for delay shifts
- short msInSndCardBuf;
- short filtDelay;
- int timeForDelayChange;
- int ECstartup;
- int checkBuffSize;
- int delayChange;
- short lastDelayDiff;
+ // Variables used for delay shifts
+ short msInSndCardBuf;
+ short filtDelay;
+ int timeForDelayChange;
+ int ECstartup;
+ int checkBuffSize;
+ int delayChange;
+ short lastDelayDiff;
- int16_t echoMode;
+ int16_t echoMode;
#ifdef AEC_DEBUG
- FILE *bufFile;
- FILE *delayFile;
- FILE *preCompFile;
- FILE *postCompFile;
-#endif // AEC_DEBUG
- // Structures
- RingBuffer *farendBuf;
+ FILE* bufFile;
+ FILE* delayFile;
+ FILE* preCompFile;
+ FILE* postCompFile;
+#endif // AEC_DEBUG
+ // Structures
+ RingBuffer* farendBuf;
- AecmCore* aecmCore;
+ AecmCore* aecmCore;
} AecMobile;
// Estimates delay to set the position of the farend buffer read pointer
@@ -81,123 +81,117 @@
static int WebRtcAecm_DelayComp(AecMobile* aecm);
void* WebRtcAecm_Create() {
- AecMobile* aecm = static_cast<AecMobile*>(malloc(sizeof(AecMobile)));
+ AecMobile* aecm = static_cast<AecMobile*>(malloc(sizeof(AecMobile)));
- WebRtcSpl_Init();
+ WebRtcSpl_Init();
- aecm->aecmCore = WebRtcAecm_CreateCore();
- if (!aecm->aecmCore) {
- WebRtcAecm_Free(aecm);
- return NULL;
- }
+ aecm->aecmCore = WebRtcAecm_CreateCore();
+ if (!aecm->aecmCore) {
+ WebRtcAecm_Free(aecm);
+ return NULL;
+ }
- aecm->farendBuf = WebRtc_CreateBuffer(kBufSizeSamp,
- sizeof(int16_t));
- if (!aecm->farendBuf)
- {
- WebRtcAecm_Free(aecm);
- return NULL;
- }
+ aecm->farendBuf = WebRtc_CreateBuffer(kBufSizeSamp, sizeof(int16_t));
+ if (!aecm->farendBuf) {
+ WebRtcAecm_Free(aecm);
+ return NULL;
+ }
- aecm->initFlag = 0;
+ aecm->initFlag = 0;
#ifdef AEC_DEBUG
- aecm->aecmCore->farFile = fopen("aecFar.pcm","wb");
- aecm->aecmCore->nearFile = fopen("aecNear.pcm","wb");
- aecm->aecmCore->outFile = fopen("aecOut.pcm","wb");
- //aecm->aecmCore->outLpFile = fopen("aecOutLp.pcm","wb");
+ aecm->aecmCore->farFile = fopen("aecFar.pcm", "wb");
+ aecm->aecmCore->nearFile = fopen("aecNear.pcm", "wb");
+ aecm->aecmCore->outFile = fopen("aecOut.pcm", "wb");
+ // aecm->aecmCore->outLpFile = fopen("aecOutLp.pcm","wb");
- aecm->bufFile = fopen("aecBuf.dat", "wb");
- aecm->delayFile = fopen("aecDelay.dat", "wb");
- aecm->preCompFile = fopen("preComp.pcm", "wb");
- aecm->postCompFile = fopen("postComp.pcm", "wb");
-#endif // AEC_DEBUG
- return aecm;
+ aecm->bufFile = fopen("aecBuf.dat", "wb");
+ aecm->delayFile = fopen("aecDelay.dat", "wb");
+ aecm->preCompFile = fopen("preComp.pcm", "wb");
+ aecm->postCompFile = fopen("postComp.pcm", "wb");
+#endif // AEC_DEBUG
+ return aecm;
}
void WebRtcAecm_Free(void* aecmInst) {
AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
- if (aecm == NULL) {
- return;
- }
+ if (aecm == NULL) {
+ return;
+ }
#ifdef AEC_DEBUG
- fclose(aecm->aecmCore->farFile);
- fclose(aecm->aecmCore->nearFile);
- fclose(aecm->aecmCore->outFile);
- //fclose(aecm->aecmCore->outLpFile);
+ fclose(aecm->aecmCore->farFile);
+ fclose(aecm->aecmCore->nearFile);
+ fclose(aecm->aecmCore->outFile);
+ // fclose(aecm->aecmCore->outLpFile);
- fclose(aecm->bufFile);
- fclose(aecm->delayFile);
- fclose(aecm->preCompFile);
- fclose(aecm->postCompFile);
-#endif // AEC_DEBUG
- WebRtcAecm_FreeCore(aecm->aecmCore);
- WebRtc_FreeBuffer(aecm->farendBuf);
- free(aecm);
+ fclose(aecm->bufFile);
+ fclose(aecm->delayFile);
+ fclose(aecm->preCompFile);
+ fclose(aecm->postCompFile);
+#endif // AEC_DEBUG
+ WebRtcAecm_FreeCore(aecm->aecmCore);
+ WebRtc_FreeBuffer(aecm->farendBuf);
+ free(aecm);
}
-int32_t WebRtcAecm_Init(void *aecmInst, int32_t sampFreq)
-{
- AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
- AecmConfig aecConfig;
+int32_t WebRtcAecm_Init(void* aecmInst, int32_t sampFreq) {
+ AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
+ AecmConfig aecConfig;
- if (aecm == NULL)
- {
- return -1;
- }
+ if (aecm == NULL) {
+ return -1;
+ }
- if (sampFreq != 8000 && sampFreq != 16000)
- {
- return AECM_BAD_PARAMETER_ERROR;
- }
- aecm->sampFreq = sampFreq;
+ if (sampFreq != 8000 && sampFreq != 16000) {
+ return AECM_BAD_PARAMETER_ERROR;
+ }
+ aecm->sampFreq = sampFreq;
- // Initialize AECM core
- if (WebRtcAecm_InitCore(aecm->aecmCore, aecm->sampFreq) == -1)
- {
- return AECM_UNSPECIFIED_ERROR;
- }
+ // Initialize AECM core
+ if (WebRtcAecm_InitCore(aecm->aecmCore, aecm->sampFreq) == -1) {
+ return AECM_UNSPECIFIED_ERROR;
+ }
- // Initialize farend buffer
- WebRtc_InitBuffer(aecm->farendBuf);
+ // Initialize farend buffer
+ WebRtc_InitBuffer(aecm->farendBuf);
- aecm->initFlag = kInitCheck; // indicates that initialization has been done
+ aecm->initFlag = kInitCheck; // indicates that initialization has been done
- aecm->delayChange = 1;
+ aecm->delayChange = 1;
- aecm->sum = 0;
- aecm->counter = 0;
- aecm->checkBuffSize = 1;
- aecm->firstVal = 0;
+ aecm->sum = 0;
+ aecm->counter = 0;
+ aecm->checkBuffSize = 1;
+ aecm->firstVal = 0;
- aecm->ECstartup = 1;
- aecm->bufSizeStart = 0;
- aecm->checkBufSizeCtr = 0;
- aecm->filtDelay = 0;
- aecm->timeForDelayChange = 0;
- aecm->knownDelay = 0;
- aecm->lastDelayDiff = 0;
+ aecm->ECstartup = 1;
+ aecm->bufSizeStart = 0;
+ aecm->checkBufSizeCtr = 0;
+ aecm->filtDelay = 0;
+ aecm->timeForDelayChange = 0;
+ aecm->knownDelay = 0;
+ aecm->lastDelayDiff = 0;
- memset(&aecm->farendOld, 0, sizeof(aecm->farendOld));
+ memset(&aecm->farendOld, 0, sizeof(aecm->farendOld));
- // Default settings.
- aecConfig.cngMode = AecmTrue;
- aecConfig.echoMode = 3;
+ // Default settings.
+ aecConfig.cngMode = AecmTrue;
+ aecConfig.echoMode = 3;
- if (WebRtcAecm_set_config(aecm, aecConfig) == -1)
- {
- return AECM_UNSPECIFIED_ERROR;
- }
+ if (WebRtcAecm_set_config(aecm, aecConfig) == -1) {
+ return AECM_UNSPECIFIED_ERROR;
+ }
- return 0;
+ return 0;
}
// Returns any error that is caused when buffering the
// farend signal.
-int32_t WebRtcAecm_GetBufferFarendError(void *aecmInst, const int16_t *farend,
- size_t nrOfSamples) {
+int32_t WebRtcAecm_GetBufferFarendError(void* aecmInst,
+ const int16_t* farend,
+ size_t nrOfSamples) {
AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
if (aecm == NULL)
@@ -215,8 +209,8 @@
return 0;
}
-
-int32_t WebRtcAecm_BufferFarend(void *aecmInst, const int16_t *farend,
+int32_t WebRtcAecm_BufferFarend(void* aecmInst,
+ const int16_t* farend,
size_t nrOfSamples) {
AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
@@ -227,8 +221,7 @@
return err;
// TODO(unknown): Is this really a good idea?
- if (!aecm->ECstartup)
- {
+ if (!aecm->ECstartup) {
WebRtcAecm_DelayComp(aecm);
}
@@ -237,412 +230,363 @@
return 0;
}
-int32_t WebRtcAecm_Process(void *aecmInst, const int16_t *nearendNoisy,
- const int16_t *nearendClean, int16_t *out,
- size_t nrOfSamples, int16_t msInSndCardBuf)
-{
- AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
- int32_t retVal = 0;
- size_t i;
- short nmbrOfFilledBuffers;
- size_t nBlocks10ms;
- size_t nFrames;
+int32_t WebRtcAecm_Process(void* aecmInst,
+ const int16_t* nearendNoisy,
+ const int16_t* nearendClean,
+ int16_t* out,
+ size_t nrOfSamples,
+ int16_t msInSndCardBuf) {
+ AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
+ int32_t retVal = 0;
+ size_t i;
+ short nmbrOfFilledBuffers;
+ size_t nBlocks10ms;
+ size_t nFrames;
#ifdef AEC_DEBUG
- short msInAECBuf;
+ short msInAECBuf;
#endif
- if (aecm == NULL)
- {
+ if (aecm == NULL) {
+ return -1;
+ }
+
+ if (nearendNoisy == NULL) {
+ return AECM_NULL_POINTER_ERROR;
+ }
+
+ if (out == NULL) {
+ return AECM_NULL_POINTER_ERROR;
+ }
+
+ if (aecm->initFlag != kInitCheck) {
+ return AECM_UNINITIALIZED_ERROR;
+ }
+
+ if (nrOfSamples != 80 && nrOfSamples != 160) {
+ return AECM_BAD_PARAMETER_ERROR;
+ }
+
+ if (msInSndCardBuf < 0) {
+ msInSndCardBuf = 0;
+ retVal = AECM_BAD_PARAMETER_WARNING;
+ } else if (msInSndCardBuf > 500) {
+ msInSndCardBuf = 500;
+ retVal = AECM_BAD_PARAMETER_WARNING;
+ }
+ msInSndCardBuf += 10;
+ aecm->msInSndCardBuf = msInSndCardBuf;
+
+ nFrames = nrOfSamples / FRAME_LEN;
+ nBlocks10ms = nFrames / aecm->aecmCore->mult;
+
+ if (aecm->ECstartup) {
+ if (nearendClean == NULL) {
+ if (out != nearendNoisy) {
+ memcpy(out, nearendNoisy, sizeof(short) * nrOfSamples);
+ }
+ } else if (out != nearendClean) {
+ memcpy(out, nearendClean, sizeof(short) * nrOfSamples);
+ }
+
+ nmbrOfFilledBuffers =
+ (short)WebRtc_available_read(aecm->farendBuf) / FRAME_LEN;
+ // The AECM is in the start up mode
+ // AECM is disabled until the soundcard buffer and farend buffers are OK
+
+ // Mechanism to ensure that the soundcard buffer is reasonably stable.
+ if (aecm->checkBuffSize) {
+ aecm->checkBufSizeCtr++;
+ // Before we fill up the far end buffer we require the amount of data on
+ // the sound card to be stable (+/-8 ms) compared to the first value. This
+ // comparison is made during the following 4 consecutive frames. If it
+ // seems to be stable then we start to fill up the far end buffer.
+
+ if (aecm->counter == 0) {
+ aecm->firstVal = aecm->msInSndCardBuf;
+ aecm->sum = 0;
+ }
+
+ if (abs(aecm->firstVal - aecm->msInSndCardBuf) <
+ WEBRTC_SPL_MAX(0.2 * aecm->msInSndCardBuf, kSampMsNb)) {
+ aecm->sum += aecm->msInSndCardBuf;
+ aecm->counter++;
+ } else {
+ aecm->counter = 0;
+ }
+
+ if (aecm->counter * nBlocks10ms >= 6) {
+ // The farend buffer size is determined in blocks of 80 samples
+ // Use 75% of the average value of the soundcard buffer
+ aecm->bufSizeStart = WEBRTC_SPL_MIN(
+ (3 * aecm->sum * aecm->aecmCore->mult) / (aecm->counter * 40),
+ BUF_SIZE_FRAMES);
+ // buffersize has now been determined
+ aecm->checkBuffSize = 0;
+ }
+
+ if (aecm->checkBufSizeCtr * nBlocks10ms > 50) {
+ // for really bad sound cards, don't disable echocanceller for more than
+ // 0.5 sec
+ aecm->bufSizeStart = WEBRTC_SPL_MIN(
+ (3 * aecm->msInSndCardBuf * aecm->aecmCore->mult) / 40,
+ BUF_SIZE_FRAMES);
+ aecm->checkBuffSize = 0;
+ }
+ }
+
+ // if checkBuffSize changed in the if-statement above
+ if (!aecm->checkBuffSize) {
+ // soundcard buffer is now reasonably stable
+ // When the far end buffer is filled with approximately the same amount of
+ // data as the amount on the sound card we end the start up phase and
+ // start to cancel echoes.
+
+ if (nmbrOfFilledBuffers == aecm->bufSizeStart) {
+ aecm->ECstartup = 0; // Enable the AECM
+ } else if (nmbrOfFilledBuffers > aecm->bufSizeStart) {
+ WebRtc_MoveReadPtr(aecm->farendBuf,
+ (int)WebRtc_available_read(aecm->farendBuf) -
+ (int)aecm->bufSizeStart * FRAME_LEN);
+ aecm->ECstartup = 0;
+ }
+ }
+
+ } else {
+ // AECM is enabled
+
+ // Note only 1 block supported for nb and 2 blocks for wb
+ for (i = 0; i < nFrames; i++) {
+ int16_t farend[FRAME_LEN];
+ const int16_t* farend_ptr = NULL;
+
+ nmbrOfFilledBuffers =
+ (short)WebRtc_available_read(aecm->farendBuf) / FRAME_LEN;
+
+ // Check that there is data in the far end buffer
+ if (nmbrOfFilledBuffers > 0) {
+ // Get the next 80 samples from the farend buffer
+ WebRtc_ReadBuffer(aecm->farendBuf, (void**)&farend_ptr, farend,
+ FRAME_LEN);
+
+ // Always store the last frame for use when we run out of data
+ memcpy(&(aecm->farendOld[i][0]), farend_ptr, FRAME_LEN * sizeof(short));
+ } else {
+ // We have no data so we use the last played frame
+ memcpy(farend, &(aecm->farendOld[i][0]), FRAME_LEN * sizeof(short));
+ farend_ptr = farend;
+ }
+
+ // Call buffer delay estimator when all data is extracted,
+ // i,e. i = 0 for NB and i = 1 for WB
+ if ((i == 0 && aecm->sampFreq == 8000) ||
+ (i == 1 && aecm->sampFreq == 16000)) {
+ WebRtcAecm_EstBufDelay(aecm, aecm->msInSndCardBuf);
+ }
+
+ // Call the AECM
+ /*WebRtcAecm_ProcessFrame(aecm->aecmCore, farend, &nearend[FRAME_LEN * i],
+ &out[FRAME_LEN * i], aecm->knownDelay);*/
+ if (WebRtcAecm_ProcessFrame(
+ aecm->aecmCore, farend_ptr, &nearendNoisy[FRAME_LEN * i],
+ (nearendClean ? &nearendClean[FRAME_LEN * i] : NULL),
+ &out[FRAME_LEN * i]) == -1)
return -1;
}
-
- if (nearendNoisy == NULL)
- {
- return AECM_NULL_POINTER_ERROR;
- }
-
- if (out == NULL)
- {
- return AECM_NULL_POINTER_ERROR;
- }
-
- if (aecm->initFlag != kInitCheck)
- {
- return AECM_UNINITIALIZED_ERROR;
- }
-
- if (nrOfSamples != 80 && nrOfSamples != 160)
- {
- return AECM_BAD_PARAMETER_ERROR;
- }
-
- if (msInSndCardBuf < 0)
- {
- msInSndCardBuf = 0;
- retVal = AECM_BAD_PARAMETER_WARNING;
- } else if (msInSndCardBuf > 500)
- {
- msInSndCardBuf = 500;
- retVal = AECM_BAD_PARAMETER_WARNING;
- }
- msInSndCardBuf += 10;
- aecm->msInSndCardBuf = msInSndCardBuf;
-
- nFrames = nrOfSamples / FRAME_LEN;
- nBlocks10ms = nFrames / aecm->aecmCore->mult;
-
- if (aecm->ECstartup)
- {
- if (nearendClean == NULL)
- {
- if (out != nearendNoisy)
- {
- memcpy(out, nearendNoisy, sizeof(short) * nrOfSamples);
- }
- } else if (out != nearendClean)
- {
- memcpy(out, nearendClean, sizeof(short) * nrOfSamples);
- }
-
- nmbrOfFilledBuffers =
- (short) WebRtc_available_read(aecm->farendBuf) / FRAME_LEN;
- // The AECM is in the start up mode
- // AECM is disabled until the soundcard buffer and farend buffers are OK
-
- // Mechanism to ensure that the soundcard buffer is reasonably stable.
- if (aecm->checkBuffSize)
- {
- aecm->checkBufSizeCtr++;
- // Before we fill up the far end buffer we require the amount of data on the
- // sound card to be stable (+/-8 ms) compared to the first value. This
- // comparison is made during the following 4 consecutive frames. If it seems
- // to be stable then we start to fill up the far end buffer.
-
- if (aecm->counter == 0)
- {
- aecm->firstVal = aecm->msInSndCardBuf;
- aecm->sum = 0;
- }
-
- if (abs(aecm->firstVal - aecm->msInSndCardBuf)
- < WEBRTC_SPL_MAX(0.2 * aecm->msInSndCardBuf, kSampMsNb))
- {
- aecm->sum += aecm->msInSndCardBuf;
- aecm->counter++;
- } else
- {
- aecm->counter = 0;
- }
-
- if (aecm->counter * nBlocks10ms >= 6)
- {
- // The farend buffer size is determined in blocks of 80 samples
- // Use 75% of the average value of the soundcard buffer
- aecm->bufSizeStart
- = WEBRTC_SPL_MIN((3 * aecm->sum
- * aecm->aecmCore->mult) / (aecm->counter * 40), BUF_SIZE_FRAMES);
- // buffersize has now been determined
- aecm->checkBuffSize = 0;
- }
-
- if (aecm->checkBufSizeCtr * nBlocks10ms > 50)
- {
- // for really bad sound cards, don't disable echocanceller for more than 0.5 sec
- aecm->bufSizeStart = WEBRTC_SPL_MIN((3 * aecm->msInSndCardBuf
- * aecm->aecmCore->mult) / 40, BUF_SIZE_FRAMES);
- aecm->checkBuffSize = 0;
- }
- }
-
- // if checkBuffSize changed in the if-statement above
- if (!aecm->checkBuffSize)
- {
- // soundcard buffer is now reasonably stable
- // When the far end buffer is filled with approximately the same amount of
- // data as the amount on the sound card we end the start up phase and start
- // to cancel echoes.
-
- if (nmbrOfFilledBuffers == aecm->bufSizeStart)
- {
- aecm->ECstartup = 0; // Enable the AECM
- } else if (nmbrOfFilledBuffers > aecm->bufSizeStart)
- {
- WebRtc_MoveReadPtr(aecm->farendBuf,
- (int) WebRtc_available_read(aecm->farendBuf)
- - (int) aecm->bufSizeStart * FRAME_LEN);
- aecm->ECstartup = 0;
- }
- }
-
- } else
- {
- // AECM is enabled
-
- // Note only 1 block supported for nb and 2 blocks for wb
- for (i = 0; i < nFrames; i++)
- {
- int16_t farend[FRAME_LEN];
- const int16_t* farend_ptr = NULL;
-
- nmbrOfFilledBuffers =
- (short) WebRtc_available_read(aecm->farendBuf) / FRAME_LEN;
-
- // Check that there is data in the far end buffer
- if (nmbrOfFilledBuffers > 0)
- {
- // Get the next 80 samples from the farend buffer
- WebRtc_ReadBuffer(aecm->farendBuf, (void**) &farend_ptr, farend,
- FRAME_LEN);
-
- // Always store the last frame for use when we run out of data
- memcpy(&(aecm->farendOld[i][0]), farend_ptr,
- FRAME_LEN * sizeof(short));
- } else
- {
- // We have no data so we use the last played frame
- memcpy(farend, &(aecm->farendOld[i][0]), FRAME_LEN * sizeof(short));
- farend_ptr = farend;
- }
-
- // Call buffer delay estimator when all data is extracted,
- // i,e. i = 0 for NB and i = 1 for WB
- if ((i == 0 && aecm->sampFreq == 8000) || (i == 1 && aecm->sampFreq == 16000))
- {
- WebRtcAecm_EstBufDelay(aecm, aecm->msInSndCardBuf);
- }
-
- // Call the AECM
- /*WebRtcAecm_ProcessFrame(aecm->aecmCore, farend, &nearend[FRAME_LEN * i],
- &out[FRAME_LEN * i], aecm->knownDelay);*/
- if (WebRtcAecm_ProcessFrame(aecm->aecmCore,
- farend_ptr,
- &nearendNoisy[FRAME_LEN * i],
- (nearendClean
- ? &nearendClean[FRAME_LEN * i]
- : NULL),
- &out[FRAME_LEN * i]) == -1)
- return -1;
- }
- }
+ }
#ifdef AEC_DEBUG
- msInAECBuf = (short) WebRtc_available_read(aecm->farendBuf) /
- (kSampMsNb * aecm->aecmCore->mult);
- fwrite(&msInAECBuf, 2, 1, aecm->bufFile);
- fwrite(&(aecm->knownDelay), sizeof(aecm->knownDelay), 1, aecm->delayFile);
+ msInAECBuf = (short)WebRtc_available_read(aecm->farendBuf) /
+ (kSampMsNb * aecm->aecmCore->mult);
+ fwrite(&msInAECBuf, 2, 1, aecm->bufFile);
+ fwrite(&(aecm->knownDelay), sizeof(aecm->knownDelay), 1, aecm->delayFile);
#endif
- return retVal;
+ return retVal;
}
-int32_t WebRtcAecm_set_config(void *aecmInst, AecmConfig config)
-{
- AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
+int32_t WebRtcAecm_set_config(void* aecmInst, AecmConfig config) {
+ AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
- if (aecm == NULL)
- {
- return -1;
- }
+ if (aecm == NULL) {
+ return -1;
+ }
- if (aecm->initFlag != kInitCheck)
- {
- return AECM_UNINITIALIZED_ERROR;
- }
+ if (aecm->initFlag != kInitCheck) {
+ return AECM_UNINITIALIZED_ERROR;
+ }
- if (config.cngMode != AecmFalse && config.cngMode != AecmTrue)
- {
- return AECM_BAD_PARAMETER_ERROR;
- }
- aecm->aecmCore->cngMode = config.cngMode;
+ if (config.cngMode != AecmFalse && config.cngMode != AecmTrue) {
+ return AECM_BAD_PARAMETER_ERROR;
+ }
+ aecm->aecmCore->cngMode = config.cngMode;
- if (config.echoMode < 0 || config.echoMode > 4)
- {
- return AECM_BAD_PARAMETER_ERROR;
- }
- aecm->echoMode = config.echoMode;
+ if (config.echoMode < 0 || config.echoMode > 4) {
+ return AECM_BAD_PARAMETER_ERROR;
+ }
+ aecm->echoMode = config.echoMode;
- if (aecm->echoMode == 0)
- {
- aecm->aecmCore->supGain = SUPGAIN_DEFAULT >> 3;
- aecm->aecmCore->supGainOld = SUPGAIN_DEFAULT >> 3;
- aecm->aecmCore->supGainErrParamA = SUPGAIN_ERROR_PARAM_A >> 3;
- aecm->aecmCore->supGainErrParamD = SUPGAIN_ERROR_PARAM_D >> 3;
- aecm->aecmCore->supGainErrParamDiffAB = (SUPGAIN_ERROR_PARAM_A >> 3)
- - (SUPGAIN_ERROR_PARAM_B >> 3);
- aecm->aecmCore->supGainErrParamDiffBD = (SUPGAIN_ERROR_PARAM_B >> 3)
- - (SUPGAIN_ERROR_PARAM_D >> 3);
- } else if (aecm->echoMode == 1)
- {
- aecm->aecmCore->supGain = SUPGAIN_DEFAULT >> 2;
- aecm->aecmCore->supGainOld = SUPGAIN_DEFAULT >> 2;
- aecm->aecmCore->supGainErrParamA = SUPGAIN_ERROR_PARAM_A >> 2;
- aecm->aecmCore->supGainErrParamD = SUPGAIN_ERROR_PARAM_D >> 2;
- aecm->aecmCore->supGainErrParamDiffAB = (SUPGAIN_ERROR_PARAM_A >> 2)
- - (SUPGAIN_ERROR_PARAM_B >> 2);
- aecm->aecmCore->supGainErrParamDiffBD = (SUPGAIN_ERROR_PARAM_B >> 2)
- - (SUPGAIN_ERROR_PARAM_D >> 2);
- } else if (aecm->echoMode == 2)
- {
- aecm->aecmCore->supGain = SUPGAIN_DEFAULT >> 1;
- aecm->aecmCore->supGainOld = SUPGAIN_DEFAULT >> 1;
- aecm->aecmCore->supGainErrParamA = SUPGAIN_ERROR_PARAM_A >> 1;
- aecm->aecmCore->supGainErrParamD = SUPGAIN_ERROR_PARAM_D >> 1;
- aecm->aecmCore->supGainErrParamDiffAB = (SUPGAIN_ERROR_PARAM_A >> 1)
- - (SUPGAIN_ERROR_PARAM_B >> 1);
- aecm->aecmCore->supGainErrParamDiffBD = (SUPGAIN_ERROR_PARAM_B >> 1)
- - (SUPGAIN_ERROR_PARAM_D >> 1);
- } else if (aecm->echoMode == 3)
- {
- aecm->aecmCore->supGain = SUPGAIN_DEFAULT;
- aecm->aecmCore->supGainOld = SUPGAIN_DEFAULT;
- aecm->aecmCore->supGainErrParamA = SUPGAIN_ERROR_PARAM_A;
- aecm->aecmCore->supGainErrParamD = SUPGAIN_ERROR_PARAM_D;
- aecm->aecmCore->supGainErrParamDiffAB = SUPGAIN_ERROR_PARAM_A - SUPGAIN_ERROR_PARAM_B;
- aecm->aecmCore->supGainErrParamDiffBD = SUPGAIN_ERROR_PARAM_B - SUPGAIN_ERROR_PARAM_D;
- } else if (aecm->echoMode == 4)
- {
- aecm->aecmCore->supGain = SUPGAIN_DEFAULT << 1;
- aecm->aecmCore->supGainOld = SUPGAIN_DEFAULT << 1;
- aecm->aecmCore->supGainErrParamA = SUPGAIN_ERROR_PARAM_A << 1;
- aecm->aecmCore->supGainErrParamD = SUPGAIN_ERROR_PARAM_D << 1;
- aecm->aecmCore->supGainErrParamDiffAB = (SUPGAIN_ERROR_PARAM_A << 1)
- - (SUPGAIN_ERROR_PARAM_B << 1);
- aecm->aecmCore->supGainErrParamDiffBD = (SUPGAIN_ERROR_PARAM_B << 1)
- - (SUPGAIN_ERROR_PARAM_D << 1);
- }
+ if (aecm->echoMode == 0) {
+ aecm->aecmCore->supGain = SUPGAIN_DEFAULT >> 3;
+ aecm->aecmCore->supGainOld = SUPGAIN_DEFAULT >> 3;
+ aecm->aecmCore->supGainErrParamA = SUPGAIN_ERROR_PARAM_A >> 3;
+ aecm->aecmCore->supGainErrParamD = SUPGAIN_ERROR_PARAM_D >> 3;
+ aecm->aecmCore->supGainErrParamDiffAB =
+ (SUPGAIN_ERROR_PARAM_A >> 3) - (SUPGAIN_ERROR_PARAM_B >> 3);
+ aecm->aecmCore->supGainErrParamDiffBD =
+ (SUPGAIN_ERROR_PARAM_B >> 3) - (SUPGAIN_ERROR_PARAM_D >> 3);
+ } else if (aecm->echoMode == 1) {
+ aecm->aecmCore->supGain = SUPGAIN_DEFAULT >> 2;
+ aecm->aecmCore->supGainOld = SUPGAIN_DEFAULT >> 2;
+ aecm->aecmCore->supGainErrParamA = SUPGAIN_ERROR_PARAM_A >> 2;
+ aecm->aecmCore->supGainErrParamD = SUPGAIN_ERROR_PARAM_D >> 2;
+ aecm->aecmCore->supGainErrParamDiffAB =
+ (SUPGAIN_ERROR_PARAM_A >> 2) - (SUPGAIN_ERROR_PARAM_B >> 2);
+ aecm->aecmCore->supGainErrParamDiffBD =
+ (SUPGAIN_ERROR_PARAM_B >> 2) - (SUPGAIN_ERROR_PARAM_D >> 2);
+ } else if (aecm->echoMode == 2) {
+ aecm->aecmCore->supGain = SUPGAIN_DEFAULT >> 1;
+ aecm->aecmCore->supGainOld = SUPGAIN_DEFAULT >> 1;
+ aecm->aecmCore->supGainErrParamA = SUPGAIN_ERROR_PARAM_A >> 1;
+ aecm->aecmCore->supGainErrParamD = SUPGAIN_ERROR_PARAM_D >> 1;
+ aecm->aecmCore->supGainErrParamDiffAB =
+ (SUPGAIN_ERROR_PARAM_A >> 1) - (SUPGAIN_ERROR_PARAM_B >> 1);
+ aecm->aecmCore->supGainErrParamDiffBD =
+ (SUPGAIN_ERROR_PARAM_B >> 1) - (SUPGAIN_ERROR_PARAM_D >> 1);
+ } else if (aecm->echoMode == 3) {
+ aecm->aecmCore->supGain = SUPGAIN_DEFAULT;
+ aecm->aecmCore->supGainOld = SUPGAIN_DEFAULT;
+ aecm->aecmCore->supGainErrParamA = SUPGAIN_ERROR_PARAM_A;
+ aecm->aecmCore->supGainErrParamD = SUPGAIN_ERROR_PARAM_D;
+ aecm->aecmCore->supGainErrParamDiffAB =
+ SUPGAIN_ERROR_PARAM_A - SUPGAIN_ERROR_PARAM_B;
+ aecm->aecmCore->supGainErrParamDiffBD =
+ SUPGAIN_ERROR_PARAM_B - SUPGAIN_ERROR_PARAM_D;
+ } else if (aecm->echoMode == 4) {
+ aecm->aecmCore->supGain = SUPGAIN_DEFAULT << 1;
+ aecm->aecmCore->supGainOld = SUPGAIN_DEFAULT << 1;
+ aecm->aecmCore->supGainErrParamA = SUPGAIN_ERROR_PARAM_A << 1;
+ aecm->aecmCore->supGainErrParamD = SUPGAIN_ERROR_PARAM_D << 1;
+ aecm->aecmCore->supGainErrParamDiffAB =
+ (SUPGAIN_ERROR_PARAM_A << 1) - (SUPGAIN_ERROR_PARAM_B << 1);
+ aecm->aecmCore->supGainErrParamDiffBD =
+ (SUPGAIN_ERROR_PARAM_B << 1) - (SUPGAIN_ERROR_PARAM_D << 1);
+ }
- return 0;
+ return 0;
}
int32_t WebRtcAecm_InitEchoPath(void* aecmInst,
const void* echo_path,
- size_t size_bytes)
-{
- AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
- const int16_t* echo_path_ptr = static_cast<const int16_t*>(echo_path);
+ size_t size_bytes) {
+ AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
+ const int16_t* echo_path_ptr = static_cast<const int16_t*>(echo_path);
- if (aecmInst == NULL) {
- return -1;
- }
- if (echo_path == NULL) {
- return AECM_NULL_POINTER_ERROR;
- }
- if (size_bytes != WebRtcAecm_echo_path_size_bytes())
- {
- // Input channel size does not match the size of AECM
- return AECM_BAD_PARAMETER_ERROR;
- }
- if (aecm->initFlag != kInitCheck)
- {
- return AECM_UNINITIALIZED_ERROR;
- }
+ if (aecmInst == NULL) {
+ return -1;
+ }
+ if (echo_path == NULL) {
+ return AECM_NULL_POINTER_ERROR;
+ }
+ if (size_bytes != WebRtcAecm_echo_path_size_bytes()) {
+ // Input channel size does not match the size of AECM
+ return AECM_BAD_PARAMETER_ERROR;
+ }
+ if (aecm->initFlag != kInitCheck) {
+ return AECM_UNINITIALIZED_ERROR;
+ }
- WebRtcAecm_InitEchoPathCore(aecm->aecmCore, echo_path_ptr);
+ WebRtcAecm_InitEchoPathCore(aecm->aecmCore, echo_path_ptr);
- return 0;
+ return 0;
}
int32_t WebRtcAecm_GetEchoPath(void* aecmInst,
void* echo_path,
- size_t size_bytes)
-{
- AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
- int16_t* echo_path_ptr = static_cast<int16_t*>(echo_path);
+ size_t size_bytes) {
+ AecMobile* aecm = static_cast<AecMobile*>(aecmInst);
+ int16_t* echo_path_ptr = static_cast<int16_t*>(echo_path);
- if (aecmInst == NULL) {
- return -1;
- }
- if (echo_path == NULL) {
- return AECM_NULL_POINTER_ERROR;
- }
- if (size_bytes != WebRtcAecm_echo_path_size_bytes())
- {
- // Input channel size does not match the size of AECM
- return AECM_BAD_PARAMETER_ERROR;
- }
- if (aecm->initFlag != kInitCheck)
- {
- return AECM_UNINITIALIZED_ERROR;
- }
+ if (aecmInst == NULL) {
+ return -1;
+ }
+ if (echo_path == NULL) {
+ return AECM_NULL_POINTER_ERROR;
+ }
+ if (size_bytes != WebRtcAecm_echo_path_size_bytes()) {
+ // Input channel size does not match the size of AECM
+ return AECM_BAD_PARAMETER_ERROR;
+ }
+ if (aecm->initFlag != kInitCheck) {
+ return AECM_UNINITIALIZED_ERROR;
+ }
- memcpy(echo_path_ptr, aecm->aecmCore->channelStored, size_bytes);
- return 0;
+ memcpy(echo_path_ptr, aecm->aecmCore->channelStored, size_bytes);
+ return 0;
}
-size_t WebRtcAecm_echo_path_size_bytes()
-{
- return (PART_LEN1 * sizeof(int16_t));
+size_t WebRtcAecm_echo_path_size_bytes() {
+ return (PART_LEN1 * sizeof(int16_t));
}
-
static int WebRtcAecm_EstBufDelay(AecMobile* aecm, short msInSndCardBuf) {
- short delayNew, nSampSndCard;
- short nSampFar = (short) WebRtc_available_read(aecm->farendBuf);
- short diff;
+ short delayNew, nSampSndCard;
+ short nSampFar = (short)WebRtc_available_read(aecm->farendBuf);
+ short diff;
- nSampSndCard = msInSndCardBuf * kSampMsNb * aecm->aecmCore->mult;
+ nSampSndCard = msInSndCardBuf * kSampMsNb * aecm->aecmCore->mult;
- delayNew = nSampSndCard - nSampFar;
+ delayNew = nSampSndCard - nSampFar;
- if (delayNew < FRAME_LEN)
- {
- WebRtc_MoveReadPtr(aecm->farendBuf, FRAME_LEN);
- delayNew += FRAME_LEN;
+ if (delayNew < FRAME_LEN) {
+ WebRtc_MoveReadPtr(aecm->farendBuf, FRAME_LEN);
+ delayNew += FRAME_LEN;
+ }
+
+ aecm->filtDelay =
+ WEBRTC_SPL_MAX(0, (8 * aecm->filtDelay + 2 * delayNew) / 10);
+
+ diff = aecm->filtDelay - aecm->knownDelay;
+ if (diff > 224) {
+ if (aecm->lastDelayDiff < 96) {
+ aecm->timeForDelayChange = 0;
+ } else {
+ aecm->timeForDelayChange++;
}
-
- aecm->filtDelay = WEBRTC_SPL_MAX(0, (8 * aecm->filtDelay + 2 * delayNew) / 10);
-
- diff = aecm->filtDelay - aecm->knownDelay;
- if (diff > 224)
- {
- if (aecm->lastDelayDiff < 96)
- {
- aecm->timeForDelayChange = 0;
- } else
- {
- aecm->timeForDelayChange++;
- }
- } else if (diff < 96 && aecm->knownDelay > 0)
- {
- if (aecm->lastDelayDiff > 224)
- {
- aecm->timeForDelayChange = 0;
- } else
- {
- aecm->timeForDelayChange++;
- }
- } else
- {
- aecm->timeForDelayChange = 0;
+ } else if (diff < 96 && aecm->knownDelay > 0) {
+ if (aecm->lastDelayDiff > 224) {
+ aecm->timeForDelayChange = 0;
+ } else {
+ aecm->timeForDelayChange++;
}
- aecm->lastDelayDiff = diff;
+ } else {
+ aecm->timeForDelayChange = 0;
+ }
+ aecm->lastDelayDiff = diff;
- if (aecm->timeForDelayChange > 25)
- {
- aecm->knownDelay = WEBRTC_SPL_MAX((int)aecm->filtDelay - 160, 0);
- }
- return 0;
+ if (aecm->timeForDelayChange > 25) {
+ aecm->knownDelay = WEBRTC_SPL_MAX((int)aecm->filtDelay - 160, 0);
+ }
+ return 0;
}
static int WebRtcAecm_DelayComp(AecMobile* aecm) {
- int nSampFar = (int) WebRtc_available_read(aecm->farendBuf);
- int nSampSndCard, delayNew, nSampAdd;
- const int maxStuffSamp = 10 * FRAME_LEN;
+ int nSampFar = (int)WebRtc_available_read(aecm->farendBuf);
+ int nSampSndCard, delayNew, nSampAdd;
+ const int maxStuffSamp = 10 * FRAME_LEN;
- nSampSndCard = aecm->msInSndCardBuf * kSampMsNb * aecm->aecmCore->mult;
- delayNew = nSampSndCard - nSampFar;
+ nSampSndCard = aecm->msInSndCardBuf * kSampMsNb * aecm->aecmCore->mult;
+ delayNew = nSampSndCard - nSampFar;
- if (delayNew > FAR_BUF_LEN - FRAME_LEN * aecm->aecmCore->mult)
- {
- // The difference of the buffer sizes is larger than the maximum
- // allowed known delay. Compensate by stuffing the buffer.
- nSampAdd = (int)(WEBRTC_SPL_MAX(((nSampSndCard >> 1) - nSampFar),
- FRAME_LEN));
- nSampAdd = WEBRTC_SPL_MIN(nSampAdd, maxStuffSamp);
+ if (delayNew > FAR_BUF_LEN - FRAME_LEN * aecm->aecmCore->mult) {
+ // The difference of the buffer sizes is larger than the maximum
+ // allowed known delay. Compensate by stuffing the buffer.
+ nSampAdd =
+ (int)(WEBRTC_SPL_MAX(((nSampSndCard >> 1) - nSampFar), FRAME_LEN));
+ nSampAdd = WEBRTC_SPL_MIN(nSampAdd, maxStuffSamp);
- WebRtc_MoveReadPtr(aecm->farendBuf, -nSampAdd);
- aecm->delayChange = 1; // the delay needs to be updated
- }
+ WebRtc_MoveReadPtr(aecm->farendBuf, -nSampAdd);
+ aecm->delayChange = 1; // the delay needs to be updated
+ }
- return 0;
+ return 0;
}
diff --git a/modules/audio_processing/aecm/echo_control_mobile.h b/modules/audio_processing/aecm/echo_control_mobile.h
index e0091c3..576cf19 100644
--- a/modules/audio_processing/aecm/echo_control_mobile.h
+++ b/modules/audio_processing/aecm/echo_control_mobile.h
@@ -15,24 +15,21 @@
#include "typedefs.h" // NOLINT(build/include)
-enum {
- AecmFalse = 0,
- AecmTrue
-};
+enum { AecmFalse = 0, AecmTrue };
// Errors
-#define AECM_UNSPECIFIED_ERROR 12000
-#define AECM_UNSUPPORTED_FUNCTION_ERROR 12001
-#define AECM_UNINITIALIZED_ERROR 12002
-#define AECM_NULL_POINTER_ERROR 12003
-#define AECM_BAD_PARAMETER_ERROR 12004
+#define AECM_UNSPECIFIED_ERROR 12000
+#define AECM_UNSUPPORTED_FUNCTION_ERROR 12001
+#define AECM_UNINITIALIZED_ERROR 12002
+#define AECM_NULL_POINTER_ERROR 12003
+#define AECM_BAD_PARAMETER_ERROR 12004
// Warnings
-#define AECM_BAD_PARAMETER_WARNING 12100
+#define AECM_BAD_PARAMETER_WARNING 12100
typedef struct {
- int16_t cngMode; // AECM_FALSE, AECM_TRUE (default)
- int16_t echoMode; // 0, 1, 2, 3 (default), 4
+ int16_t cngMode; // AECM_FALSE, AECM_TRUE (default)
+ int16_t echoMode; // 0, 1, 2, 3 (default), 4
} AecmConfig;
#ifdef __cplusplus
@@ -202,7 +199,6 @@
*/
size_t WebRtcAecm_echo_path_size_bytes();
-
#ifdef __cplusplus
}
#endif
diff --git a/modules/audio_processing/agc/agc_manager_direct.cc b/modules/audio_processing/agc/agc_manager_direct.cc
index 2d6ee81..9714b4c 100644
--- a/modules/audio_processing/agc/agc_manager_direct.cc
+++ b/modules/audio_processing/agc/agc_manager_direct.cc
@@ -69,12 +69,12 @@
int new_level = level;
if (gain_error > 0) {
while (kGainMap[new_level] - kGainMap[level] < gain_error &&
- new_level < kMaxMicLevel) {
+ new_level < kMaxMicLevel) {
++new_level;
}
} else {
while (kGainMap[new_level] - kGainMap[level] > gain_error &&
- new_level > kMinMicLevel) {
+ new_level > kMinMicLevel) {
--new_level;
}
}
@@ -88,26 +88,21 @@
class DebugFile {
#ifdef WEBRTC_AGC_DEBUG_DUMP
public:
- explicit DebugFile(const char* filename)
- : file_(fopen(filename, "wb")) {
+ explicit DebugFile(const char* filename) : file_(fopen(filename, "wb")) {
RTC_DCHECK(file_);
}
- ~DebugFile() {
- fclose(file_);
- }
+ ~DebugFile() { fclose(file_); }
void Write(const int16_t* data, size_t length_samples) {
fwrite(data, 1, length_samples * sizeof(int16_t), file_);
}
+
private:
FILE* file_;
#else
public:
- explicit DebugFile(const char* filename) {
- }
- ~DebugFile() {
- }
- void Write(const int16_t* data, size_t length_samples) {
- }
+ explicit DebugFile(const char* filename) {}
+ ~DebugFile() {}
+ void Write(const int16_t* data, size_t length_samples) {}
#endif // WEBRTC_AGC_DEBUG_DUMP
};
@@ -272,7 +267,8 @@
if (voe_level > level_ + kLevelQuantizationSlack ||
voe_level < level_ - kLevelQuantizationSlack) {
RTC_DLOG(LS_INFO) << "[agc] Mic volume was manually adjusted. Updating "
- "stored level from " << level_ << " to " << voe_level;
+ "stored level from "
+ << level_ << " to " << voe_level;
level_ = voe_level;
// Always allow the user to increase the volume.
if (level_ > max_level_) {
@@ -383,15 +379,15 @@
// target and the newly received target. This serves to soften perceptible
// intra-talkspurt adjustments, at the cost of some adaptation speed.
if ((raw_compression == max_compression_gain_ &&
- target_compression_ == max_compression_gain_ - 1) ||
+ target_compression_ == max_compression_gain_ - 1) ||
(raw_compression == kMinCompressionGain &&
- target_compression_ == kMinCompressionGain + 1)) {
+ target_compression_ == kMinCompressionGain + 1)) {
// Special case to allow the target to reach the endpoints of the
// compression range. The deemphasis would otherwise halt it at 1 dB shy.
target_compression_ = raw_compression;
} else {
- target_compression_ = (raw_compression - target_compression_) / 2
- + target_compression_;
+ target_compression_ =
+ (raw_compression - target_compression_) / 2 + target_compression_;
}
// Residual error will be handled by adjusting the volume slider. Use the
diff --git a/modules/audio_processing/agc/gain_map_internal.h b/modules/audio_processing/agc/gain_map_internal.h
index f09c748..63d9b51 100644
--- a/modules/audio_processing/agc/gain_map_internal.h
+++ b/modules/audio_processing/agc/gain_map_internal.h
@@ -14,262 +14,23 @@
static const int kGainMapSize = 256;
// Uses parameters: si = 2, sf = 0.25, D = 8/256
static const int kGainMap[kGainMapSize] = {
- -56,
- -54,
- -52,
- -50,
- -48,
- -47,
- -45,
- -43,
- -42,
- -40,
- -38,
- -37,
- -35,
- -34,
- -33,
- -31,
- -30,
- -29,
- -27,
- -26,
- -25,
- -24,
- -23,
- -22,
- -20,
- -19,
- -18,
- -17,
- -16,
- -15,
- -14,
- -14,
- -13,
- -12,
- -11,
- -10,
- -9,
- -8,
- -8,
- -7,
- -6,
- -5,
- -5,
- -4,
- -3,
- -2,
- -2,
- -1,
- 0,
- 0,
- 1,
- 1,
- 2,
- 3,
- 3,
- 4,
- 4,
- 5,
- 5,
- 6,
- 6,
- 7,
- 7,
- 8,
- 8,
- 9,
- 9,
- 10,
- 10,
- 11,
- 11,
- 12,
- 12,
- 13,
- 13,
- 13,
- 14,
- 14,
- 15,
- 15,
- 15,
- 16,
- 16,
- 17,
- 17,
- 17,
- 18,
- 18,
- 18,
- 19,
- 19,
- 19,
- 20,
- 20,
- 21,
- 21,
- 21,
- 22,
- 22,
- 22,
- 23,
- 23,
- 23,
- 24,
- 24,
- 24,
- 24,
- 25,
- 25,
- 25,
- 26,
- 26,
- 26,
- 27,
- 27,
- 27,
- 28,
- 28,
- 28,
- 28,
- 29,
- 29,
- 29,
- 30,
- 30,
- 30,
- 30,
- 31,
- 31,
- 31,
- 32,
- 32,
- 32,
- 32,
- 33,
- 33,
- 33,
- 33,
- 34,
- 34,
- 34,
- 35,
- 35,
- 35,
- 35,
- 36,
- 36,
- 36,
- 36,
- 37,
- 37,
- 37,
- 38,
- 38,
- 38,
- 38,
- 39,
- 39,
- 39,
- 39,
- 40,
- 40,
- 40,
- 40,
- 41,
- 41,
- 41,
- 41,
- 42,
- 42,
- 42,
- 42,
- 43,
- 43,
- 43,
- 44,
- 44,
- 44,
- 44,
- 45,
- 45,
- 45,
- 45,
- 46,
- 46,
- 46,
- 46,
- 47,
- 47,
- 47,
- 47,
- 48,
- 48,
- 48,
- 48,
- 49,
- 49,
- 49,
- 49,
- 50,
- 50,
- 50,
- 50,
- 51,
- 51,
- 51,
- 51,
- 52,
- 52,
- 52,
- 52,
- 53,
- 53,
- 53,
- 53,
- 54,
- 54,
- 54,
- 54,
- 55,
- 55,
- 55,
- 55,
- 56,
- 56,
- 56,
- 56,
- 57,
- 57,
- 57,
- 57,
- 58,
- 58,
- 58,
- 58,
- 59,
- 59,
- 59,
- 59,
- 60,
- 60,
- 60,
- 60,
- 61,
- 61,
- 61,
- 61,
- 62,
- 62,
- 62,
- 62,
- 63,
- 63,
- 63,
- 63,
- 64
-};
+ -56, -54, -52, -50, -48, -47, -45, -43, -42, -40, -38, -37, -35, -34, -33,
+ -31, -30, -29, -27, -26, -25, -24, -23, -22, -20, -19, -18, -17, -16, -15,
+ -14, -14, -13, -12, -11, -10, -9, -8, -8, -7, -6, -5, -5, -4, -3,
+ -2, -2, -1, 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6,
+ 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13,
+ 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 18, 19,
+ 19, 19, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24,
+ 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28,
+ 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33,
+ 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37,
+ 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41,
+ 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 44, 44, 44, 44, 45,
+ 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48,
+ 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52,
+ 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56,
+ 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60,
+ 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63,
+ 64};
#endif // MODULES_AUDIO_PROCESSING_AGC_GAIN_MAP_INTERNAL_H_
diff --git a/modules/audio_processing/agc/mock_agc.h b/modules/audio_processing/agc/mock_agc.h
index cf2a859..ff1e9fd 100644
--- a/modules/audio_processing/agc/mock_agc.h
+++ b/modules/audio_processing/agc/mock_agc.h
@@ -20,8 +20,8 @@
class MockAgc : public Agc {
public:
MOCK_METHOD2(AnalyzePreproc, float(const int16_t* audio, size_t length));
- MOCK_METHOD3(Process, void(const int16_t* audio, size_t length,
- int sample_rate_hz));
+ MOCK_METHOD3(Process,
+ void(const int16_t* audio, size_t length, int sample_rate_hz));
MOCK_METHOD1(GetRmsErrorDb, bool(int* error));
MOCK_METHOD0(Reset, void());
MOCK_METHOD1(set_target_level_dbfs, int(int level));
diff --git a/modules/audio_processing/agc2/agc2_common.h b/modules/audio_processing/agc2/agc2_common.h
index a0919c8..3ed88a3 100644
--- a/modules/audio_processing/agc2/agc2_common.h
+++ b/modules/audio_processing/agc2/agc2_common.h
@@ -15,7 +15,6 @@
#include <cmath>
-
namespace webrtc {
constexpr float kMinFloatS16Value = -32768.f;
diff --git a/modules/audio_processing/agc2/gain_applier_unittest.cc b/modules/audio_processing/agc2/gain_applier_unittest.cc
index bbf3a85..3296345 100644
--- a/modules/audio_processing/agc2/gain_applier_unittest.cc
+++ b/modules/audio_processing/agc2/gain_applier_unittest.cc
@@ -72,8 +72,7 @@
float last_signal_level = initial_signal_level;
for (const auto sample : fake_audio.float_frame_view().channel(channel)) {
const float current_change = fabs(last_signal_level - sample);
- max_signal_change =
- std::max(max_signal_change, current_change);
+ max_signal_change = std::max(max_signal_change, current_change);
last_signal_level = sample;
}
const float total_gain_change =
diff --git a/modules/audio_processing/audio_buffer.cc b/modules/audio_processing/audio_buffer.cc
index 16f1174..f163f5a 100644
--- a/modules/audio_processing/audio_buffer.cc
+++ b/modules/audio_processing/audio_buffer.cc
@@ -49,20 +49,20 @@
size_t process_num_frames,
size_t num_process_channels,
size_t output_num_frames)
- : input_num_frames_(input_num_frames),
- num_input_channels_(num_input_channels),
- proc_num_frames_(process_num_frames),
- num_proc_channels_(num_process_channels),
- output_num_frames_(output_num_frames),
- num_channels_(num_process_channels),
- num_bands_(NumBandsFromSamplesPerChannel(proc_num_frames_)),
- num_split_frames_(rtc::CheckedDivExact(proc_num_frames_, num_bands_)),
- mixed_low_pass_valid_(false),
- reference_copied_(false),
- activity_(AudioFrame::kVadUnknown),
- keyboard_data_(NULL),
- data_(new IFChannelBuffer(proc_num_frames_, num_proc_channels_)),
- output_buffer_(new IFChannelBuffer(output_num_frames_, num_channels_)) {
+ : input_num_frames_(input_num_frames),
+ num_input_channels_(num_input_channels),
+ proc_num_frames_(process_num_frames),
+ num_proc_channels_(num_process_channels),
+ output_num_frames_(output_num_frames),
+ num_channels_(num_process_channels),
+ num_bands_(NumBandsFromSamplesPerChannel(proc_num_frames_)),
+ num_split_frames_(rtc::CheckedDivExact(proc_num_frames_, num_bands_)),
+ mixed_low_pass_valid_(false),
+ reference_copied_(false),
+ activity_(AudioFrame::kVadUnknown),
+ keyboard_data_(NULL),
+ data_(new IFChannelBuffer(proc_num_frames_, num_proc_channels_)),
+ output_buffer_(new IFChannelBuffer(output_num_frames_, num_channels_)) {
RTC_DCHECK_GT(input_num_frames_, 0);
RTC_DCHECK_GT(proc_num_frames_, 0);
RTC_DCHECK_GT(output_num_frames_, 0);
@@ -73,8 +73,8 @@
if (input_num_frames_ != proc_num_frames_ ||
output_num_frames_ != proc_num_frames_) {
// Create an intermediate buffer for resampling.
- process_buffer_.reset(new ChannelBuffer<float>(proc_num_frames_,
- num_proc_channels_));
+ process_buffer_.reset(
+ new ChannelBuffer<float>(proc_num_frames_, num_proc_channels_));
if (input_num_frames_ != proc_num_frames_) {
for (size_t i = 0; i < num_proc_channels_; ++i) {
@@ -92,12 +92,10 @@
}
if (num_bands_ > 1) {
- split_data_.reset(new IFChannelBuffer(proc_num_frames_,
- num_proc_channels_,
- num_bands_));
- splitting_filter_.reset(new SplittingFilter(num_proc_channels_,
- num_bands_,
- proc_num_frames_));
+ split_data_.reset(
+ new IFChannelBuffer(proc_num_frames_, num_proc_channels_, num_bands_));
+ splitting_filter_.reset(
+ new SplittingFilter(num_proc_channels_, num_bands_, proc_num_frames_));
}
}
@@ -132,8 +130,7 @@
// Resample.
if (input_num_frames_ != proc_num_frames_) {
for (size_t i = 0; i < num_proc_channels_; ++i) {
- input_resamplers_[i]->Resample(data_ptr[i],
- input_num_frames_,
+ input_resamplers_[i]->Resample(data_ptr[i], input_num_frames_,
process_buffer_->channels()[i],
proc_num_frames_);
}
@@ -142,8 +139,7 @@
// Convert to the S16 range.
for (size_t i = 0; i < num_proc_channels_; ++i) {
- FloatToFloatS16(data_ptr[i],
- proc_num_frames_,
+ FloatToFloatS16(data_ptr[i], proc_num_frames_,
data_->fbuf()->channels()[i]);
}
}
@@ -161,17 +157,14 @@
data_ptr = process_buffer_->channels();
}
for (size_t i = 0; i < num_channels_; ++i) {
- FloatS16ToFloat(data_->fbuf()->channels()[i],
- proc_num_frames_,
+ FloatS16ToFloat(data_->fbuf()->channels()[i], proc_num_frames_,
data_ptr[i]);
}
// Resample.
if (output_num_frames_ != proc_num_frames_) {
for (size_t i = 0; i < num_channels_; ++i) {
- output_resamplers_[i]->Resample(data_ptr[i],
- proc_num_frames_,
- data[i],
+ output_resamplers_[i]->Resample(data_ptr[i], proc_num_frames_, data[i],
output_num_frames_);
}
}
@@ -204,16 +197,14 @@
}
const int16_t* const* AudioBuffer::split_bands_const(size_t channel) const {
- return split_data_.get() ?
- split_data_->ibuf_const()->bands(channel) :
- data_->ibuf_const()->bands(channel);
+ return split_data_.get() ? split_data_->ibuf_const()->bands(channel)
+ : data_->ibuf_const()->bands(channel);
}
int16_t* const* AudioBuffer::split_bands(size_t channel) {
mixed_low_pass_valid_ = false;
- return split_data_.get() ?
- split_data_->ibuf()->bands(channel) :
- data_->ibuf()->bands(channel);
+ return split_data_.get() ? split_data_->ibuf()->bands(channel)
+ : data_->ibuf()->bands(channel);
}
const int16_t* const* AudioBuffer::split_channels_const(Band band) const {
@@ -261,16 +252,14 @@
}
const float* const* AudioBuffer::split_bands_const_f(size_t channel) const {
- return split_data_.get() ?
- split_data_->fbuf_const()->bands(channel) :
- data_->fbuf_const()->bands(channel);
+ return split_data_.get() ? split_data_->fbuf_const()->bands(channel)
+ : data_->fbuf_const()->bands(channel);
}
float* const* AudioBuffer::split_bands_f(size_t channel) {
mixed_low_pass_valid_ = false;
- return split_data_.get() ?
- split_data_->fbuf()->bands(channel) :
- data_->fbuf()->bands(channel);
+ return split_data_.get() ? split_data_->fbuf()->bands(channel)
+ : data_->fbuf()->bands(channel);
}
const float* const* AudioBuffer::split_channels_const_f(Band band) const {
@@ -401,19 +390,16 @@
num_input_channels_, deinterleaved[0]);
} else {
RTC_DCHECK_EQ(num_proc_channels_, num_input_channels_);
- Deinterleave(frame->data(),
- input_num_frames_,
- num_proc_channels_,
+ Deinterleave(frame->data(), input_num_frames_, num_proc_channels_,
deinterleaved);
}
// Resample.
if (input_num_frames_ != proc_num_frames_) {
for (size_t i = 0; i < num_proc_channels_; ++i) {
- input_resamplers_[i]->Resample(input_buffer_->fbuf_const()->channels()[i],
- input_num_frames_,
- data_->fbuf()->channels()[i],
- proc_num_frames_);
+ input_resamplers_[i]->Resample(
+ input_buffer_->fbuf_const()->channels()[i], input_num_frames_,
+ data_->fbuf()->channels()[i], proc_num_frames_);
}
}
}
@@ -453,8 +439,7 @@
if (!low_pass_reference_channels_.get() ||
low_pass_reference_channels_->num_channels() != num_channels_) {
low_pass_reference_channels_.reset(
- new ChannelBuffer<int16_t>(num_split_frames_,
- num_proc_channels_));
+ new ChannelBuffer<int16_t>(num_split_frames_, num_proc_channels_));
}
for (size_t i = 0; i < num_proc_channels_; i++) {
memcpy(low_pass_reference_channels_->channels()[i],
diff --git a/modules/audio_processing/audio_buffer.h b/modules/audio_processing/audio_buffer.h
index 508f96f..3d7c4a8 100644
--- a/modules/audio_processing/audio_buffer.h
+++ b/modules/audio_processing/audio_buffer.h
@@ -25,11 +25,7 @@
class PushSincResampler;
class IFChannelBuffer;
-enum Band {
- kBand0To8kHz = 0,
- kBand8To16kHz = 1,
- kBand16To24kHz = 2
-};
+enum Band { kBand0To8kHz = 0, kBand8To16kHz = 1, kBand16To24kHz = 2 };
class AudioBuffer {
public:
@@ -152,11 +148,11 @@
std::unique_ptr<IFChannelBuffer> data_;
std::unique_ptr<IFChannelBuffer> split_data_;
std::unique_ptr<SplittingFilter> splitting_filter_;
- std::unique_ptr<ChannelBuffer<int16_t> > mixed_low_pass_channels_;
- std::unique_ptr<ChannelBuffer<int16_t> > low_pass_reference_channels_;
+ std::unique_ptr<ChannelBuffer<int16_t>> mixed_low_pass_channels_;
+ std::unique_ptr<ChannelBuffer<int16_t>> low_pass_reference_channels_;
std::unique_ptr<IFChannelBuffer> input_buffer_;
std::unique_ptr<IFChannelBuffer> output_buffer_;
- std::unique_ptr<ChannelBuffer<float> > process_buffer_;
+ std::unique_ptr<ChannelBuffer<float>> process_buffer_;
std::vector<std::unique_ptr<PushSincResampler>> input_resamplers_;
std::vector<std::unique_ptr<PushSincResampler>> output_resamplers_;
};
diff --git a/modules/audio_processing/audio_processing_impl_locking_unittest.cc b/modules/audio_processing/audio_processing_impl_locking_unittest.cc
index 39f8b8b..b770fef 100644
--- a/modules/audio_processing/audio_processing_impl_locking_unittest.cc
+++ b/modules/audio_processing/audio_processing_impl_locking_unittest.cc
@@ -146,8 +146,7 @@
// Create test config for the first processing API function set.
test_configs.push_back(test_config);
- test_config.render_api_function =
- RenderApiImpl::AnalyzeReverseStreamImpl;
+ test_config.render_api_function = RenderApiImpl::AnalyzeReverseStreamImpl;
test_config.capture_api_function = CaptureApiImpl::ProcessStreamImpl3;
test_configs.push_back(test_config);
}
@@ -482,8 +481,7 @@
for (size_t k = 0; k < frame->samples_per_channel_; k++) {
// Store random 16 bit number between -(amplitude+1) and
// amplitude.
- frame_data[k * ch] =
- rand_gen->RandInt(2 * amplitude + 1) - amplitude - 1;
+ frame_data[k * ch] = rand_gen->RandInt(2 * amplitude + 1) - amplitude - 1;
}
}
}
diff --git a/modules/audio_processing/audio_processing_impl_unittest.cc b/modules/audio_processing/audio_processing_impl_unittest.cc
index 2ea0159..3ac5e71 100644
--- a/modules/audio_processing/audio_processing_impl_unittest.cc
+++ b/modules/audio_processing/audio_processing_impl_unittest.cc
@@ -72,15 +72,13 @@
// New sample rate. (Only impacts ProcessStream).
SetFrameSampleRate(&frame, 32000);
- EXPECT_CALL(mock, InitializeLocked())
- .Times(1);
+ EXPECT_CALL(mock, InitializeLocked()).Times(1);
EXPECT_NOERR(mock.ProcessStream(&frame));
// New number of channels.
// TODO(peah): Investigate why this causes 2 inits.
frame.num_channels_ = 2;
- EXPECT_CALL(mock, InitializeLocked())
- .Times(2);
+ EXPECT_CALL(mock, InitializeLocked()).Times(2);
EXPECT_NOERR(mock.ProcessStream(&frame));
// ProcessStream sets num_channels_ == num_output_channels.
frame.num_channels_ = 2;
diff --git a/modules/audio_processing/audio_processing_performance_unittest.cc b/modules/audio_processing/audio_processing_performance_unittest.cc
index 2e985ce..56615cb 100644
--- a/modules/audio_processing/audio_processing_performance_unittest.cc
+++ b/modules/audio_processing/audio_processing_performance_unittest.cc
@@ -160,13 +160,9 @@
// Handler for the frame counters.
class FrameCounters {
public:
- void IncreaseRenderCounter() {
- rtc::AtomicOps::Increment(&render_count_);
- }
+ void IncreaseRenderCounter() { rtc::AtomicOps::Increment(&render_count_); }
- void IncreaseCaptureCounter() {
- rtc::AtomicOps::Increment(&capture_count_);
- }
+ void IncreaseCaptureCounter() { rtc::AtomicOps::Increment(&capture_count_); }
int CaptureMinusRenderCounters() const {
// The return value will be approximate, but that's good enough since
@@ -196,9 +192,7 @@
// Class that represents a flag that can only be raised.
class LockedFlag {
public:
- bool get_flag() const {
- return rtc::AtomicOps::AcquireLoad(&flag_);
- }
+ bool get_flag() const { return rtc::AtomicOps::AcquireLoad(&flag_); }
void set_flag() {
if (!get_flag()) // read-only operation to avoid affecting the cache-line.
@@ -248,9 +242,8 @@
"_" + std::to_string(simulation_config_->sample_rate_hz) + "Hz";
webrtc::test::PrintResultMeanAndError(
- "apm_timing", sample_rate_name, processor_name,
- GetDurationAverage(), GetDurationStandardDeviation(),
- "us", false);
+ "apm_timing", sample_rate_name, processor_name, GetDurationAverage(),
+ GetDurationStandardDeviation(), "us", false);
if (kPrintAllDurations) {
webrtc::test::PrintResultList("apm_call_durations", sample_rate_name,
diff --git a/modules/audio_processing/beamformer/array_util.h b/modules/audio_processing/beamformer/array_util.h
index 8e69f81..9bdbecb 100644
--- a/modules/audio_processing/beamformer/array_util.h
+++ b/modules/audio_processing/beamformer/array_util.h
@@ -24,7 +24,7 @@
// y: the depth dimension, with positive forward from the camera's
// perspective.
// z: the vertical dimension, with positive upwards.
-template<typename T>
+template <typename T>
struct CartesianPoint {
CartesianPoint() {
c[0] = 0;
@@ -74,7 +74,7 @@
// The resulting Point will be in the xy-plane.
Point AzimuthToPoint(float azimuth);
-template<typename T>
+template <typename T>
float Distance(CartesianPoint<T> a, CartesianPoint<T> b) {
return std::sqrt((a.x() - b.x()) * (a.x() - b.x()) +
(a.y() - b.y()) * (a.y() - b.y()) +
diff --git a/modules/audio_processing/beamformer/complex_matrix_unittest.cc b/modules/audio_processing/beamformer/complex_matrix_unittest.cc
index e11dfd2..f9c7ea5 100644
--- a/modules/audio_processing/beamformer/complex_matrix_unittest.cc
+++ b/modules/audio_processing/beamformer/complex_matrix_unittest.cc
@@ -61,10 +61,10 @@
{complex<float>(3.3f, -3.3f), complex<float>(7.7f, -7.7f)},
{complex<float>(4.4f, -4.4f), complex<float>(8.8f, -8.8f)}};
- ComplexMatrix<float> initial_mat(
- *kValuesInitial, kNumInitialRows, kNumInitialCols);
- ComplexMatrix<float> expected_result(
- *kValuesExpected, kNumResultRows, kNumResultCols);
+ ComplexMatrix<float> initial_mat(*kValuesInitial, kNumInitialRows,
+ kNumInitialCols);
+ ComplexMatrix<float> expected_result(*kValuesExpected, kNumResultRows,
+ kNumResultCols);
ComplexMatrix<float> actual_result(kNumResultRows, kNumResultCols);
actual_result.ConjugateTranspose(initial_mat);
diff --git a/modules/audio_processing/beamformer/covariance_matrix_generator.cc b/modules/audio_processing/beamformer/covariance_matrix_generator.cc
index df36d59..afc6ddd 100644
--- a/modules/audio_processing/beamformer/covariance_matrix_generator.cc
+++ b/modules/audio_processing/beamformer/covariance_matrix_generator.cc
@@ -73,13 +73,8 @@
ComplexMatrix<float> interf_cov_vector(1, geometry.size());
ComplexMatrix<float> interf_cov_vector_transposed(geometry.size(), 1);
- PhaseAlignmentMasks(frequency_bin,
- fft_size,
- sample_rate,
- sound_speed,
- geometry,
- angle,
- &interf_cov_vector);
+ PhaseAlignmentMasks(frequency_bin, fft_size, sample_rate, sound_speed,
+ geometry, angle, &interf_cov_vector);
interf_cov_vector.Scale(1.f / Norm(interf_cov_vector));
interf_cov_vector_transposed.Transpose(interf_cov_vector);
interf_cov_vector.PointwiseConjugate();
diff --git a/modules/audio_processing/beamformer/covariance_matrix_generator.h b/modules/audio_processing/beamformer/covariance_matrix_generator.h
index 6a5841f..d26ed2f 100644
--- a/modules/audio_processing/beamformer/covariance_matrix_generator.h
+++ b/modules/audio_processing/beamformer/covariance_matrix_generator.h
@@ -11,8 +11,8 @@
#ifndef MODULES_AUDIO_PROCESSING_BEAMFORMER_COVARIANCE_MATRIX_GENERATOR_H_
#define MODULES_AUDIO_PROCESSING_BEAMFORMER_COVARIANCE_MATRIX_GENERATOR_H_
-#include "modules/audio_processing/beamformer/complex_matrix.h"
#include "modules/audio_processing/beamformer/array_util.h"
+#include "modules/audio_processing/beamformer/complex_matrix.h"
namespace webrtc {
diff --git a/modules/audio_processing/beamformer/covariance_matrix_generator_unittest.cc b/modules/audio_processing/beamformer/covariance_matrix_generator_unittest.cc
index a6518e5..4f77744 100644
--- a/modules/audio_processing/beamformer/covariance_matrix_generator_unittest.cc
+++ b/modules/audio_processing/beamformer/covariance_matrix_generator_unittest.cc
@@ -32,8 +32,7 @@
geometry.push_back(Point(i * kMicSpacing - first_mic, 0.f, 0.f));
}
ComplexMatrix<float> actual_covariance_matrix(kNumberMics, kNumberMics);
- CovarianceMatrixGenerator::UniformCovarianceMatrix(kWaveNumber,
- geometry,
+ CovarianceMatrixGenerator::UniformCovarianceMatrix(kWaveNumber, geometry,
&actual_covariance_matrix);
complex<float>* const* actual_els = actual_covariance_matrix.elements();
@@ -60,8 +59,7 @@
geometry.push_back(Point(i * kMicSpacing - first_mic, 0.f, 0.f));
}
ComplexMatrix<float> actual_covariance_matrix(kNumberMics, kNumberMics);
- CovarianceMatrixGenerator::UniformCovarianceMatrix(kWaveNumber,
- geometry,
+ CovarianceMatrixGenerator::UniformCovarianceMatrix(kWaveNumber, geometry,
&actual_covariance_matrix);
complex<float>* const* actual_els = actual_covariance_matrix.elements();
@@ -97,8 +95,7 @@
geometry.push_back(Point(-0.025f, 0.15f, -0.075f));
geometry.push_back(Point(-0.025f, -0.05f, 0.225f));
ComplexMatrix<float> actual_covariance_matrix(kNumberMics, kNumberMics);
- CovarianceMatrixGenerator::UniformCovarianceMatrix(kWaveNumber,
- geometry,
+ CovarianceMatrixGenerator::UniformCovarianceMatrix(kWaveNumber, geometry,
&actual_covariance_matrix);
complex<float>* const* actual_els = actual_covariance_matrix.elements();
@@ -154,14 +151,9 @@
geometry.push_back(Point(i * kMicSpacing - first_mic, 0.f, 0.f));
}
ComplexMatrix<float> actual_covariance_matrix(kNumberMics, kNumberMics);
- CovarianceMatrixGenerator::AngledCovarianceMatrix(kSpeedOfSound,
- kAngle,
- kFrequencyBin,
- kFftSize,
- kNumberFrequencyBins,
- kSampleRate,
- geometry,
- &actual_covariance_matrix);
+ CovarianceMatrixGenerator::AngledCovarianceMatrix(
+ kSpeedOfSound, kAngle, kFrequencyBin, kFftSize, kNumberFrequencyBins,
+ kSampleRate, geometry, &actual_covariance_matrix);
complex<float>* const* actual_els = actual_covariance_matrix.elements();
@@ -192,14 +184,9 @@
geometry.push_back(Point(i * kMicSpacing - first_mic, 0.f, 0.f));
}
ComplexMatrix<float> actual_covariance_matrix(kNumberMics, kNumberMics);
- CovarianceMatrixGenerator::AngledCovarianceMatrix(kSpeedOfSound,
- kAngle,
- kFrequencyBin,
- kFftSize,
- kNumberFrequencyBins,
- kSampleRate,
- geometry,
- &actual_covariance_matrix);
+ CovarianceMatrixGenerator::AngledCovarianceMatrix(
+ kSpeedOfSound, kAngle, kFrequencyBin, kFftSize, kNumberFrequencyBins,
+ kSampleRate, geometry, &actual_covariance_matrix);
complex<float>* const* actual_els = actual_covariance_matrix.elements();
diff --git a/modules/audio_processing/beamformer/matrix.h b/modules/audio_processing/beamformer/matrix.h
index bf94c25..3d1a709 100644
--- a/modules/audio_processing/beamformer/matrix.h
+++ b/modules/audio_processing/beamformer/matrix.h
@@ -33,7 +33,7 @@
std::complex<S> sqrt_wrapper(std::complex<S> x) {
return sqrt(x);
}
-} // namespace
+} // namespace
namespace webrtc {
diff --git a/modules/audio_processing/beamformer/matrix_test_helpers.h b/modules/audio_processing/beamformer/matrix_test_helpers.h
index 62b4708..e7b2f09 100644
--- a/modules/audio_processing/beamformer/matrix_test_helpers.h
+++ b/modules/audio_processing/beamformer/matrix_test_helpers.h
@@ -66,11 +66,9 @@
for (size_t i = 0; i < expected.num_rows(); ++i) {
for (size_t j = 0; j < expected.num_columns(); ++j) {
EXPECT_NEAR(expected_elements[i][j].real(),
- actual_elements[i][j].real(),
- kTolerance);
+ actual_elements[i][j].real(), kTolerance);
EXPECT_NEAR(expected_elements[i][j].imag(),
- actual_elements[i][j].imag(),
- kTolerance);
+ actual_elements[i][j].imag(), kTolerance);
}
}
}
@@ -87,11 +85,9 @@
for (size_t i = 0; i < expected.num_rows(); ++i) {
for (size_t j = 0; j < expected.num_columns(); ++j) {
EXPECT_NEAR(expected_elements[i][j].real(),
- actual_elements[i][j].real(),
- tolerance);
+ actual_elements[i][j].real(), tolerance);
EXPECT_NEAR(expected_elements[i][j].imag(),
- actual_elements[i][j].imag(),
- tolerance);
+ actual_elements[i][j].imag(), tolerance);
}
}
}
diff --git a/modules/audio_processing/beamformer/matrix_unittest.cc b/modules/audio_processing/beamformer/matrix_unittest.cc
index 4badfd0..4dcf91b 100644
--- a/modules/audio_processing/beamformer/matrix_unittest.cc
+++ b/modules/audio_processing/beamformer/matrix_unittest.cc
@@ -74,8 +74,8 @@
{1.1f, 5.5f}, {2.2f, 6.6f}, {3.3f, 7.7f}, {4.4f, 8.8f}};
Matrix<float> initial_mat(*kValuesInitial, kNumInitialRows, kNumInitialCols);
- Matrix<float> expected_result(
- *kValuesExpected, kNumResultRows, kNumResultCols);
+ Matrix<float> expected_result(*kValuesExpected, kNumResultRows,
+ kNumResultCols);
Matrix<float> actual_result(kNumResultRows, kNumResultCols);
actual_result.Transpose(initial_mat);
@@ -300,10 +300,10 @@
Matrix<complex<float> > lh_mat(*kValuesLeft, kNumRows, kNumCols);
Matrix<complex<float> > rh_mat(*kValuesRight, kNumRows, kNumCols);
- Matrix<complex<float> > expected_result_add(
- *kValuesExpectedAdd, kNumRows, kNumCols);
- Matrix<complex<float> > expected_result_multiply(
- *kValuesExpectedMultiply, kNumRows, kNumCols);
+ Matrix<complex<float> > expected_result_add(*kValuesExpectedAdd, kNumRows,
+ kNumCols);
+ Matrix<complex<float> > expected_result_multiply(*kValuesExpectedMultiply,
+ kNumRows, kNumCols);
Matrix<complex<float> > expected_result_pointwise_divide(
*kValuesExpectedPointwiseDivide, kNumRows, kNumCols);
Matrix<complex<float> > actual_result_add;
diff --git a/modules/audio_processing/beamformer/nonlinear_beamformer.cc b/modules/audio_processing/beamformer/nonlinear_beamformer.cc
index 12f6d2f..89dc44c 100644
--- a/modules/audio_processing/beamformer/nonlinear_beamformer.cc
+++ b/modules/audio_processing/beamformer/nonlinear_beamformer.cc
@@ -234,13 +234,9 @@
hold_target_blocks_ = kHoldTargetSeconds * 2 * sample_rate_hz / kFftSize;
interference_blocks_count_ = hold_target_blocks_;
- process_transform_.reset(new LappedTransform(num_input_channels_,
- 0u,
- chunk_length_,
- window_,
- kFftSize,
- kFftSize / 2,
- this));
+ process_transform_.reset(new LappedTransform(num_input_channels_, 0u,
+ chunk_length_, window_, kFftSize,
+ kFftSize / 2, this));
postfilter_transform_.reset(new PostFilterTransform(
num_postfilter_channels_, chunk_length_, window_, kFftSize));
const float wave_number_step =
@@ -267,10 +263,10 @@
// low_mean_end_bin_ high_mean_end_bin_
//
void NonlinearBeamformer::InitLowFrequencyCorrectionRanges() {
- low_mean_start_bin_ = Round(static_cast<float>(kLowMeanStartHz) *
- kFftSize / sample_rate_hz_);
- low_mean_end_bin_ = Round(static_cast<float>(kLowMeanEndHz) *
- kFftSize / sample_rate_hz_);
+ low_mean_start_bin_ =
+ Round(static_cast<float>(kLowMeanStartHz) * kFftSize / sample_rate_hz_);
+ low_mean_end_bin_ =
+ Round(static_cast<float>(kLowMeanEndHz) * kFftSize / sample_rate_hz_);
RTC_DCHECK_GT(low_mean_start_bin_, 0U);
RTC_DCHECK_LT(low_mean_start_bin_, low_mean_end_bin_);
@@ -280,10 +276,10 @@
const float kAliasingFreqHz =
kSpeedOfSoundMeterSeconds /
(min_mic_spacing_ * (1.f + std::abs(std::cos(target_angle_radians_))));
- const float kHighMeanStartHz = std::min(0.5f * kAliasingFreqHz,
- sample_rate_hz_ / 2.f);
- const float kHighMeanEndHz = std::min(0.75f * kAliasingFreqHz,
- sample_rate_hz_ / 2.f);
+ const float kHighMeanStartHz =
+ std::min(0.5f * kAliasingFreqHz, sample_rate_hz_ / 2.f);
+ const float kHighMeanEndHz =
+ std::min(0.75f * kAliasingFreqHz, sample_rate_hz_ / 2.f);
high_mean_start_bin_ = Round(kHighMeanStartHz * kFftSize / sample_rate_hz_);
high_mean_end_bin_ = Round(kHighMeanEndHz * kFftSize / sample_rate_hz_);
@@ -366,14 +362,8 @@
new ComplexMatrixF(num_input_channels_, num_input_channels_)));
ComplexMatrixF angled_cov_mat(num_input_channels_, num_input_channels_);
CovarianceMatrixGenerator::AngledCovarianceMatrix(
- kSpeedOfSoundMeterSeconds,
- interf_angles_radians_[j],
- i,
- kFftSize,
- kNumFreqBins,
- sample_rate_hz_,
- array_geometry_,
- &angled_cov_mat);
+ kSpeedOfSoundMeterSeconds, interf_angles_radians_[j], i, kFftSize,
+ kNumFreqBins, sample_rate_hz_, array_geometry_, &angled_cov_mat);
// Normalize matrices before averaging them.
complex_f normalization_factor = angled_cov_mat.elements()[0][0];
angled_cov_mat.Scale(1.f / normalization_factor);
@@ -442,7 +432,9 @@
kHalfBeamWidthRadians;
}
-bool NonlinearBeamformer::is_target_present() { return is_target_present_; }
+bool NonlinearBeamformer::is_target_present() {
+ return is_target_present_;
+}
void NonlinearBeamformer::ProcessAudioBlock(const complex_f* const* input,
size_t num_input_channels,
@@ -473,15 +465,11 @@
rmw *= rmw;
float rmw_r = rmw.real();
- new_mask_[i] = CalculatePostfilterMask(*interf_cov_mats_[i][0],
- rpsiws_[i][0],
- ratio_rxiw_rxim,
- rmw_r);
+ new_mask_[i] = CalculatePostfilterMask(
+ *interf_cov_mats_[i][0], rpsiws_[i][0], ratio_rxiw_rxim, rmw_r);
for (size_t j = 1; j < interf_angles_radians_.size(); ++j) {
- float tmp_mask = CalculatePostfilterMask(*interf_cov_mats_[i][j],
- rpsiws_[i][j],
- ratio_rxiw_rxim,
- rmw_r);
+ float tmp_mask = CalculatePostfilterMask(
+ *interf_cov_mats_[i][j], rpsiws_[i][j], ratio_rxiw_rxim, rmw_r);
if (tmp_mask < new_mask_[i]) {
new_mask_[i] = tmp_mask;
}
@@ -577,8 +565,8 @@
// Compute mean over the given range of time_smooth_mask_, [first, last).
float NonlinearBeamformer::MaskRangeMean(size_t first, size_t last) {
RTC_DCHECK_GT(last, first);
- const float sum = std::accumulate(time_smooth_mask_ + first,
- time_smooth_mask_ + last, 0.f);
+ const float sum =
+ std::accumulate(time_smooth_mask_ + first, time_smooth_mask_ + last, 0.f);
return sum / (last - first);
}
diff --git a/modules/audio_processing/beamformer/nonlinear_beamformer.h b/modules/audio_processing/beamformer/nonlinear_beamformer.h
index 9ae28ed..b58165f 100644
--- a/modules/audio_processing/beamformer/nonlinear_beamformer.h
+++ b/modules/audio_processing/beamformer/nonlinear_beamformer.h
@@ -21,8 +21,8 @@
#include <memory>
#include <vector>
-#include "common_audio/lapped_transform.h"
#include "common_audio/channel_buffer.h"
+#include "common_audio/lapped_transform.h"
#include "modules/audio_processing/beamformer/array_util.h"
#include "modules/audio_processing/beamformer/complex_matrix.h"
diff --git a/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc b/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc
index 7db5b9f..10f5cc0 100644
--- a/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc
+++ b/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc
@@ -20,10 +20,11 @@
DEFINE_string(i, "", "The name of the input file to read from.");
DEFINE_string(o, "out.wav", "Name of the output file to write to.");
-DEFINE_string(mic_positions, "",
- "Space delimited cartesian coordinates of microphones in meters. "
- "The coordinates of each point are contiguous. "
- "For a two element array: \"x1 y1 z1 x2 y2 z2\"");
+DEFINE_string(mic_positions,
+ "",
+ "Space delimited cartesian coordinates of microphones in meters. "
+ "The coordinates of each point are contiguous. "
+ "For a two element array: \"x1 y1 z1 x2 y2 z2\"");
DEFINE_bool(help, false, "Prints this message.");
namespace webrtc {
@@ -63,8 +64,8 @@
} // namespace
int main(int argc, char* argv[]) {
- if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) ||
- FLAG_help || argc != 1) {
+ if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) || FLAG_help ||
+ argc != 1) {
printf("%s", kUsage);
if (FLAG_help) {
rtc::FlagList::Print(nullptr, false);
@@ -84,8 +85,8 @@
NonlinearBeamformer bf(array_geometry, array_geometry.size());
bf.Initialize(kChunkSizeMs, in_file.sample_rate());
- printf("Input file: %s\nChannels: %" PRIuS ", Sample rate: %d Hz\n\n",
- FLAG_i, in_file.num_channels(), in_file.sample_rate());
+ printf("Input file: %s\nChannels: %" PRIuS ", Sample rate: %d Hz\n\n", FLAG_i,
+ in_file.num_channels(), in_file.sample_rate());
printf("Output file: %s\nChannels: %" PRIuS ", Sample rate: %d Hz\n\n",
FLAG_o, out_file.num_channels(), out_file.sample_rate());
@@ -94,17 +95,17 @@
in_file.num_channels());
std::vector<float> interleaved(buf.size());
- while (in_file.ReadSamples(interleaved.size(),
- &interleaved[0]) == interleaved.size()) {
+ while (in_file.ReadSamples(interleaved.size(), &interleaved[0]) ==
+ interleaved.size()) {
FloatS16ToFloat(&interleaved[0], interleaved.size(), &interleaved[0]);
- Deinterleave(&interleaved[0], buf.num_frames(),
- buf.num_channels(), buf.channels());
+ Deinterleave(&interleaved[0], buf.num_frames(), buf.num_channels(),
+ buf.channels());
bf.AnalyzeChunk(buf);
bf.PostFilter(&buf);
- Interleave(buf.channels(), buf.num_frames(),
- buf.num_channels(), &interleaved[0]);
+ Interleave(buf.channels(), buf.num_frames(), buf.num_channels(),
+ &interleaved[0]);
FloatToFloatS16(&interleaved[0], interleaved.size(), &interleaved[0]);
out_file.WriteSamples(&interleaved[0], interleaved.size());
}
diff --git a/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc b/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc
index 78b2f0a..7d81b88 100644
--- a/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc
+++ b/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc
@@ -260,8 +260,7 @@
TargetDirection1, kOutputReference);
}
-TEST(BeamformerBitExactnessTest,
- Stereo16kHz_ArrayGeometry1_TargetDirection1) {
+TEST(BeamformerBitExactnessTest, Stereo16kHz_ArrayGeometry1_TargetDirection1) {
const float kOutputReference[] = {-0.000077f, -0.000147f, -0.000138f,
-0.000077f, -0.000147f, -0.000138f};
@@ -269,8 +268,7 @@
TargetDirection1, kOutputReference);
}
-TEST(BeamformerBitExactnessTest,
- Stereo32kHz_ArrayGeometry1_TargetDirection1) {
+TEST(BeamformerBitExactnessTest, Stereo32kHz_ArrayGeometry1_TargetDirection1) {
const float kOutputReference[] = {-0.000061f, -0.000061f, -0.000061f,
-0.000061f, -0.000061f, -0.000061f};
@@ -278,8 +276,7 @@
TargetDirection1, kOutputReference);
}
-TEST(BeamformerBitExactnessTest,
- Stereo48kHz_ArrayGeometry1_TargetDirection1) {
+TEST(BeamformerBitExactnessTest, Stereo48kHz_ArrayGeometry1_TargetDirection1) {
const float kOutputReference[] = {0.000450f, 0.000436f, 0.000433f,
0.000450f, 0.000436f, 0.000433f};
@@ -298,8 +295,7 @@
TargetDirection2, kOutputReference);
}
-TEST(BeamformerBitExactnessTest,
- Stereo16kHz_ArrayGeometry1_TargetDirection2) {
+TEST(BeamformerBitExactnessTest, Stereo16kHz_ArrayGeometry1_TargetDirection2) {
const float kOutputReference[] = {0.000221f, -0.000249f, 0.000140f,
0.000221f, -0.000249f, 0.000140f};
@@ -307,8 +303,7 @@
TargetDirection2, kOutputReference);
}
-TEST(BeamformerBitExactnessTest,
- Stereo32kHz_ArrayGeometry1_TargetDirection2) {
+TEST(BeamformerBitExactnessTest, Stereo32kHz_ArrayGeometry1_TargetDirection2) {
const float kOutputReference[] = {0.000763f, -0.000336f, 0.000549f,
0.000763f, -0.000336f, 0.000549f};
@@ -316,8 +311,7 @@
TargetDirection2, kOutputReference);
}
-TEST(BeamformerBitExactnessTest,
- Stereo48kHz_ArrayGeometry1_TargetDirection2) {
+TEST(BeamformerBitExactnessTest, Stereo48kHz_ArrayGeometry1_TargetDirection2) {
const float kOutputReference[] = {-0.000004f, -0.000494f, 0.000255f,
-0.000004f, -0.000494f, 0.000255f};
@@ -325,8 +319,7 @@
TargetDirection2, kOutputReference);
}
-TEST(BeamformerBitExactnessTest,
- Stereo8kHz_ArrayGeometry2_TargetDirection2) {
+TEST(BeamformerBitExactnessTest, Stereo8kHz_ArrayGeometry2_TargetDirection2) {
const float kOutputReference[] = {-0.000914f, 0.002170f, -0.002382f,
-0.000914f, 0.002170f, -0.002382f};
@@ -334,8 +327,7 @@
TargetDirection2, kOutputReference);
}
-TEST(BeamformerBitExactnessTest,
- Stereo16kHz_ArrayGeometry2_TargetDirection2) {
+TEST(BeamformerBitExactnessTest, Stereo16kHz_ArrayGeometry2_TargetDirection2) {
const float kOutputReference[] = {0.000179f, -0.000179f, 0.000081f,
0.000179f, -0.000179f, 0.000081f};
@@ -343,8 +335,7 @@
TargetDirection2, kOutputReference);
}
-TEST(BeamformerBitExactnessTest,
- Stereo32kHz_ArrayGeometry2_TargetDirection2) {
+TEST(BeamformerBitExactnessTest, Stereo32kHz_ArrayGeometry2_TargetDirection2) {
const float kOutputReference[] = {0.000549f, -0.000214f, 0.000366f,
0.000549f, -0.000214f, 0.000366f};
@@ -352,8 +343,7 @@
TargetDirection2, kOutputReference);
}
-TEST(BeamformerBitExactnessTest,
- Stereo48kHz_ArrayGeometry2_TargetDirection2) {
+TEST(BeamformerBitExactnessTest, Stereo48kHz_ArrayGeometry2_TargetDirection2) {
const float kOutputReference[] = {0.000019f, -0.000310f, 0.000182f,
0.000019f, -0.000310f, 0.000182f};
diff --git a/modules/audio_processing/config_unittest.cc b/modules/audio_processing/config_unittest.cc
index 8776ee3..19e9ab3 100644
--- a/modules/audio_processing/config_unittest.cc
+++ b/modules/audio_processing/config_unittest.cc
@@ -19,11 +19,9 @@
static const int kDefaultFactor;
static const int kDefaultOffset;
- MyExperiment()
- : factor(kDefaultFactor), offset(kDefaultOffset) {}
+ MyExperiment() : factor(kDefaultFactor), offset(kDefaultOffset) {}
- MyExperiment(int factor, int offset)
- : factor(factor), offset(offset) {}
+ MyExperiment(int factor, int offset) : factor(factor), offset(offset) {}
int factor;
int offset;
@@ -61,17 +59,13 @@
ConfigOptionID::kAlgo1CostFunctionForTest;
Algo1_CostFunction() {}
- virtual int cost(int x) const {
- return x;
- }
+ virtual int cost(int x) const { return x; }
virtual ~Algo1_CostFunction() {}
};
struct SqrCost : Algo1_CostFunction {
- virtual int cost(int x) const {
- return x*x;
- }
+ virtual int cost(int x) const { return x * x; }
};
TEST(Config, SupportsPolymorphism) {
diff --git a/modules/audio_processing/echo_cancellation_impl.cc b/modules/audio_processing/echo_cancellation_impl.cc
index 99f676c..15cd0db 100644
--- a/modules/audio_processing/echo_cancellation_impl.cc
+++ b/modules/audio_processing/echo_cancellation_impl.cc
@@ -147,7 +147,6 @@
}
}
-
int EchoCancellationImpl::ProcessCaptureAudio(AudioBuffer* audio,
int stream_delay_ms) {
rtc::CritScope cs_capture(crit_capture_);
@@ -376,7 +375,8 @@
return GetDelayMetrics(median, std, &fraction_poor_delays);
}
-int EchoCancellationImpl::GetDelayMetrics(int* median, int* std,
+int EchoCancellationImpl::GetDelayMetrics(int* median,
+ int* std,
float* fraction_poor_delays) {
rtc::CritScope cs(crit_capture_);
if (median == NULL) {
@@ -445,8 +445,7 @@
rtc::CritScope cs(crit_capture_);
RTC_DCHECK(enabled_);
// Report the delay for the first AEC component.
- return WebRtcAec_system_delay(
- WebRtcAec_aec_core(cancellers_[0]->state()));
+ return WebRtcAec_system_delay(WebRtcAec_aec_core(cancellers_[0]->state()));
}
void EchoCancellationImpl::PackRenderAudioBuffer(
diff --git a/modules/audio_processing/echo_control_mobile_impl.cc b/modules/audio_processing/echo_control_mobile_impl.cc
index 0ff1bce..841364f 100644
--- a/modules/audio_processing/echo_control_mobile_impl.cc
+++ b/modules/audio_processing/echo_control_mobile_impl.cc
@@ -120,10 +120,10 @@
}
EchoControlMobileImpl::~EchoControlMobileImpl() {
- if (external_echo_path_ != NULL) {
- delete [] external_echo_path_;
- external_echo_path_ = NULL;
- }
+ if (external_echo_path_ != NULL) {
+ delete[] external_echo_path_;
+ external_echo_path_ = NULL;
+ }
}
void EchoControlMobileImpl::ProcessRenderAudio(
@@ -218,8 +218,7 @@
++handle_index;
}
for (size_t band = 1u; band < audio->num_bands(); ++band) {
- memset(audio->split_bands(capture)[band],
- 0,
+ memset(audio->split_bands(capture)[band], 0,
audio->num_frames_per_band() *
sizeof(audio->split_bands(capture)[band][0]));
}
@@ -269,8 +268,7 @@
return Configure();
}
-EchoControlMobile::RoutingMode EchoControlMobileImpl::routing_mode()
- const {
+EchoControlMobile::RoutingMode EchoControlMobileImpl::routing_mode() const {
rtc::CritScope cs(crit_capture_);
return routing_mode_;
}
diff --git a/modules/audio_processing/gain_control_impl.cc b/modules/audio_processing/gain_control_impl.cc
index 8be261c..685a27f 100644
--- a/modules/audio_processing/gain_control_impl.cc
+++ b/modules/audio_processing/gain_control_impl.cc
@@ -67,9 +67,7 @@
set_capture_level(capture_level);
}
- void set_capture_level(int capture_level) {
- capture_level_ = capture_level;
- }
+ void set_capture_level(int capture_level) { capture_level_ = capture_level; }
int get_capture_level() {
RTC_DCHECK(capture_level_);
@@ -259,7 +257,7 @@
data_dumper_->DumpRaw("gain_control_stream_analog_level", 1,
&analog_capture_level_);
// TODO(ajm): enable this assertion?
- //RTC_DCHECK_EQ(kAdaptiveAnalog, mode_);
+ // RTC_DCHECK_EQ(kAdaptiveAnalog, mode_);
return analog_capture_level_;
}
@@ -303,8 +301,7 @@
return mode_;
}
-int GainControlImpl::set_analog_level_limits(int minimum,
- int maximum) {
+int GainControlImpl::set_analog_level_limits(int minimum, int maximum) {
if (minimum < 0) {
return AudioProcessing::kBadParameterError;
}
@@ -419,11 +416,10 @@
WebRtcAgcConfig config;
// TODO(ajm): Flip the sign here (since AGC expects a positive value) if we
// change the interface.
- //RTC_DCHECK_LE(target_level_dbfs_, 0);
- //config.targetLevelDbfs = static_cast<int16_t>(-target_level_dbfs_);
+ // RTC_DCHECK_LE(target_level_dbfs_, 0);
+ // config.targetLevelDbfs = static_cast<int16_t>(-target_level_dbfs_);
config.targetLevelDbfs = static_cast<int16_t>(target_level_dbfs_);
- config.compressionGaindB =
- static_cast<int16_t>(compression_gain_db_);
+ config.compressionGaindB = static_cast<int16_t>(compression_gain_db_);
config.limiterEnable = limiter_enabled_;
int error = AudioProcessing::kNoError;
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index d5bdeea..38a97ca 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -18,7 +18,7 @@
#include <math.h>
#include <stddef.h> // size_t
-#include <stdio.h> // FILE
+#include <stdio.h> // FILE
#include <string.h>
#include <vector>
@@ -743,8 +743,8 @@
private:
static size_t calculate_frames(int sample_rate_hz) {
- return static_cast<size_t>(
- AudioProcessing::kChunkSizeMs * sample_rate_hz / 1000);
+ return static_cast<size_t>(AudioProcessing::kChunkSizeMs * sample_rate_hz /
+ 1000);
}
int sample_rate_hz_;
@@ -893,7 +893,8 @@
// Deprecated. Use GetStatistics on the AudioProcessing interface instead.
virtual int GetDelayMetrics(int* median, int* std) = 0;
// Deprecated. Use GetStatistics on the AudioProcessing interface instead.
- virtual int GetDelayMetrics(int* median, int* std,
+ virtual int GetDelayMetrics(int* median,
+ int* std,
float* fraction_poor_delays) = 0;
// Returns a pointer to the low level AEC component. In case of multiple
@@ -1037,8 +1038,7 @@
// Sets the |minimum| and |maximum| analog levels of the audio capture device.
// Must be set if and only if an analog mode is used. Limited to [0, 65535].
- virtual int set_analog_level_limits(int minimum,
- int maximum) = 0;
+ virtual int set_analog_level_limits(int minimum, int maximum) = 0;
virtual int analog_level_minimum() const = 0;
virtual int analog_level_maximum() const = 0;
@@ -1097,12 +1097,7 @@
// Determines the aggressiveness of the suppression. Increasing the level
// will reduce the noise level at the expense of a higher speech distortion.
- enum Level {
- kLow,
- kModerate,
- kHigh,
- kVeryHigh
- };
+ enum Level { kLow, kModerate, kHigh, kVeryHigh };
virtual int set_level(Level level) = 0;
virtual Level level() const = 0;
diff --git a/modules/audio_processing/include/config.h b/modules/audio_processing/include/config.h
index 4e318c9..9232b2e 100644
--- a/modules/audio_processing/include/config.h
+++ b/modules/audio_processing/include/config.h
@@ -64,11 +64,13 @@
// Returned references are owned by this.
//
// Requires std::is_default_constructible<T>
- template<typename T> const T& Get() const;
+ template <typename T>
+ const T& Get() const;
// Set the option, deleting any previous instance of the same.
// This instance gets ownership of the newly set value.
- template<typename T> void Set(T* value);
+ template <typename T>
+ void Set(T* value);
Config();
~Config();
@@ -78,16 +80,14 @@
virtual ~BaseOption() {}
};
- template<typename T>
+ template <typename T>
struct Option : BaseOption {
- explicit Option(T* v): value(v) {}
- ~Option() {
- delete value;
- }
+ explicit Option(T* v) : value(v) {}
+ ~Option() { delete value; }
T* value;
};
- template<typename T>
+ template <typename T>
static ConfigOptionID identifier() {
return T::identifier;
}
@@ -95,7 +95,7 @@
// Used to instantiate a default constructed object that doesn't needs to be
// owned. This allows Get<T> to be implemented without requiring explicitly
// locks.
- template<typename T>
+ template <typename T>
static const T& default_value() {
static const T* const def = new T();
return *def;
@@ -109,7 +109,7 @@
void operator=(const Config&);
};
-template<typename T>
+template <typename T>
const T& Config::Get() const {
OptionMap::const_iterator it = options_.find(identifier<T>());
if (it != options_.end()) {
@@ -121,7 +121,7 @@
return default_value<T>();
}
-template<typename T>
+template <typename T>
void Config::Set(T* value) {
BaseOption*& it = options_[identifier<T>()];
delete it;
diff --git a/modules/audio_processing/include/mock_audio_processing.h b/modules/audio_processing/include/mock_audio_processing.h
index b3253e9..9ceee10 100644
--- a/modules/audio_processing/include/mock_audio_processing.h
+++ b/modules/audio_processing/include/mock_audio_processing.h
@@ -40,8 +40,8 @@
MOCK_METHOD1(enable_delay_logging, int(bool enable));
MOCK_CONST_METHOD0(is_delay_logging_enabled, bool());
MOCK_METHOD2(GetDelayMetrics, int(int* median, int* std));
- MOCK_METHOD3(GetDelayMetrics, int(int* median, int* std,
- float* fraction_poor_delays));
+ MOCK_METHOD3(GetDelayMetrics,
+ int(int* median, int* std, float* fraction_poor_delays));
MOCK_CONST_METHOD0(aec_core, struct AecCore*());
};
@@ -148,18 +148,18 @@
high_pass_filter_(new testing::NiceMock<MockHighPassFilter>()),
level_estimator_(new testing::NiceMock<MockLevelEstimator>()),
noise_suppression_(new testing::NiceMock<MockNoiseSuppression>()),
- voice_detection_(new testing::NiceMock<MockVoiceDetection>()) {
- }
+ voice_detection_(new testing::NiceMock<MockVoiceDetection>()) {}
virtual ~MockAudioProcessing() {}
MOCK_METHOD0(Initialize, int());
- MOCK_METHOD6(Initialize, int(int capture_input_sample_rate_hz,
- int capture_output_sample_rate_hz,
- int render_sample_rate_hz,
- ChannelLayout capture_input_layout,
- ChannelLayout capture_output_layout,
- ChannelLayout render_input_layout));
+ MOCK_METHOD6(Initialize,
+ int(int capture_input_sample_rate_hz,
+ int capture_output_sample_rate_hz,
+ int render_sample_rate_hz,
+ ChannelLayout capture_input_layout,
+ ChannelLayout capture_output_layout,
+ ChannelLayout render_input_layout));
MOCK_METHOD1(Initialize, int(const ProcessingConfig& processing_config));
MOCK_METHOD1(ApplyConfig, void(const Config& config));
MOCK_METHOD1(SetExtraOptions, void(const webrtc::Config& config));
@@ -172,26 +172,30 @@
MOCK_METHOD1(set_output_will_be_muted, void(bool muted));
MOCK_METHOD1(SetRuntimeSetting, void(RuntimeSetting setting));
MOCK_METHOD1(ProcessStream, int(AudioFrame* frame));
- MOCK_METHOD7(ProcessStream, int(const float* const* src,
- size_t samples_per_channel,
- int input_sample_rate_hz,
- ChannelLayout input_layout,
- int output_sample_rate_hz,
- ChannelLayout output_layout,
- float* const* dest));
- MOCK_METHOD4(ProcessStream, int(const float* const* src,
- const StreamConfig& input_config,
- const StreamConfig& output_config,
- float* const* dest));
+ MOCK_METHOD7(ProcessStream,
+ int(const float* const* src,
+ size_t samples_per_channel,
+ int input_sample_rate_hz,
+ ChannelLayout input_layout,
+ int output_sample_rate_hz,
+ ChannelLayout output_layout,
+ float* const* dest));
+ MOCK_METHOD4(ProcessStream,
+ int(const float* const* src,
+ const StreamConfig& input_config,
+ const StreamConfig& output_config,
+ float* const* dest));
MOCK_METHOD1(ProcessReverseStream, int(AudioFrame* frame));
- MOCK_METHOD4(AnalyzeReverseStream, int(const float* const* data,
- size_t samples_per_channel,
- int sample_rate_hz,
- ChannelLayout layout));
- MOCK_METHOD4(ProcessReverseStream, int(const float* const* src,
- const StreamConfig& input_config,
- const StreamConfig& output_config,
- float* const* dest));
+ MOCK_METHOD4(AnalyzeReverseStream,
+ int(const float* const* data,
+ size_t samples_per_channel,
+ int sample_rate_hz,
+ ChannelLayout layout));
+ MOCK_METHOD4(ProcessReverseStream,
+ int(const float* const* src,
+ const StreamConfig& input_config,
+ const StreamConfig& output_config,
+ float* const* dest));
MOCK_METHOD1(set_stream_delay_ms, int(int delay));
MOCK_CONST_METHOD0(stream_delay_ms, int());
MOCK_CONST_METHOD0(was_stream_delay_set, bool());
@@ -215,9 +219,7 @@
virtual MockEchoControlMobile* echo_control_mobile() const {
return echo_control_mobile_.get();
}
- virtual MockGainControl* gain_control() const {
- return gain_control_.get();
- }
+ virtual MockGainControl* gain_control() const { return gain_control_.get(); }
virtual MockHighPassFilter* high_pass_filter() const {
return high_pass_filter_.get();
}
diff --git a/modules/audio_processing/intelligibility/intelligibility_enhancer.cc b/modules/audio_processing/intelligibility/intelligibility_enhancer.cc
index 0e696d9..0f7b118 100644
--- a/modules/audio_processing/intelligibility/intelligibility_enhancer.cc
+++ b/modules/audio_processing/intelligibility/intelligibility_enhancer.cc
@@ -31,16 +31,16 @@
const int kChunkSizeMs = 10; // Size provided by APM.
const float kClipFreqKhz = 0.2f;
const float kKbdAlpha = 1.5f;
-const float kLambdaBot = -1.f; // Extreme values in bisection
-const float kLambdaTop = -1e-5f; // search for lamda.
+const float kLambdaBot = -1.f; // Extreme values in bisection
+const float kLambdaTop = -1e-5f; // search for lamda.
const float kVoiceProbabilityThreshold = 0.5f;
// Number of chunks after voice activity which is still considered speech.
const size_t kSpeechOffsetDelay = 10;
-const float kDecayRate = 0.995f; // Power estimation decay rate.
+const float kDecayRate = 0.995f; // Power estimation decay rate.
const float kMaxRelativeGainChange = 0.005f;
const float kRho = 0.0004f; // Default production and interpretation SNR.
const float kPowerNormalizationFactor = 1.f / (1 << 30);
-const float kMaxActiveSNR = 128.f; // 21dB
+const float kMaxActiveSNR = 128.f; // 21dB
const float kMinInactiveSNR = 32.f; // 15dB
const size_t kGainUpdatePeriod = 10u;
@@ -133,8 +133,8 @@
}
}
-void IntelligibilityEnhancer::SetCaptureNoiseEstimate(
- std::vector<float> noise, float gain) {
+void IntelligibilityEnhancer::SetCaptureNoiseEstimate(std::vector<float> noise,
+ float gain) {
RTC_DCHECK_EQ(noise.size(), num_noise_bins_);
for (auto& bin : noise) {
bin *= gain;
@@ -176,10 +176,9 @@
MapToErbBands(noise_power_estimator_.power().data(), capture_filter_bank_,
filtered_noise_pow_.data());
SolveForGainsGivenLambda(kLambdaTop, start_freq_, gains_eq_.data());
- const float power_target = std::accumulate(
- filtered_clear_pow_.data(),
- filtered_clear_pow_.data() + bank_size_,
- 0.f);
+ const float power_target =
+ std::accumulate(filtered_clear_pow_.data(),
+ filtered_clear_pow_.data() + bank_size_, 0.f);
const float power_top =
DotProduct(gains_eq_.data(), filtered_clear_pow_.data(), bank_size_);
SolveForGainsGivenLambda(kLambdaBot, start_freq_, gains_eq_.data());
@@ -199,12 +198,11 @@
void IntelligibilityEnhancer::SnrBasedEffectActivation() {
const float* clear_psd = clear_power_estimator_.power().data();
const float* noise_psd = noise_power_estimator_.power().data();
- const float clear_power =
- std::accumulate(clear_psd, clear_psd + freqs_, 0.f);
- const float noise_power =
- std::accumulate(noise_psd, noise_psd + freqs_, 0.f);
- snr_ = kDecayRate * snr_ + (1.f - kDecayRate) * clear_power /
- (noise_power + std::numeric_limits<float>::epsilon());
+ const float clear_power = std::accumulate(clear_psd, clear_psd + freqs_, 0.f);
+ const float noise_power = std::accumulate(noise_psd, noise_psd + freqs_, 0.f);
+ snr_ = kDecayRate * snr_ +
+ (1.f - kDecayRate) * clear_power /
+ (noise_power + std::numeric_limits<float>::epsilon());
if (is_active_) {
if (snr_ > kMaxActiveSNR) {
RTC_LOG(LS_INFO) << "Intelligibility Enhancer was deactivated at chunk "
diff --git a/modules/audio_processing/intelligibility/intelligibility_enhancer.h b/modules/audio_processing/intelligibility/intelligibility_enhancer.h
index 3e0e269..3513092 100644
--- a/modules/audio_processing/intelligibility/intelligibility_enhancer.h
+++ b/modules/audio_processing/intelligibility/intelligibility_enhancer.h
@@ -93,7 +93,7 @@
static const size_t kMaxNumNoiseEstimatesToBuffer = 5;
- const size_t freqs_; // Num frequencies in frequency domain.
+ const size_t freqs_; // Num frequencies in frequency domain.
const size_t num_noise_bins_;
const size_t chunk_length_; // Chunk size in samples.
const size_t bank_size_; // Num ERB filters.
diff --git a/modules/audio_processing/intelligibility/intelligibility_utils.cc b/modules/audio_processing/intelligibility/intelligibility_utils.cc
index b6917f4..b606d95 100644
--- a/modules/audio_processing/intelligibility/intelligibility_utils.cc
+++ b/modules/audio_processing/intelligibility/intelligibility_utils.cc
@@ -37,11 +37,11 @@
} // namespace
-template<typename T>
+template <typename T>
PowerEstimator<T>::PowerEstimator(size_t num_freqs, float decay)
: power_(num_freqs, 0.f), decay_(decay) {}
-template<typename T>
+template <typename T>
void PowerEstimator<T>::Step(const T* data) {
for (size_t i = 0; i < power_.size(); ++i) {
power_[i] = decay_ * power_[i] +
diff --git a/modules/audio_processing/low_cut_filter_unittest.cc b/modules/audio_processing/low_cut_filter_unittest.cc
index d98d665..d7b3cb9 100644
--- a/modules/audio_processing/low_cut_filter_unittest.cc
+++ b/modules/audio_processing/low_cut_filter_unittest.cc
@@ -51,12 +51,10 @@
(stream_config.num_frames() * stream_config.num_channels());
for (size_t frame_no = 0; frame_no < num_frames_to_process; ++frame_no) {
std::vector<float> frame_input(
- input.begin() +
- stream_config.num_frames() * stream_config.num_channels() *
- frame_no,
- input.begin() +
- stream_config.num_frames() * stream_config.num_channels() *
- (frame_no + 1));
+ input.begin() + stream_config.num_frames() *
+ stream_config.num_channels() * frame_no,
+ input.begin() + stream_config.num_frames() *
+ stream_config.num_channels() * (frame_no + 1));
output = ProcessOneFrame(frame_input, stream_config, &low_cut_filter);
}
diff --git a/modules/audio_processing/noise_suppression_impl.cc b/modules/audio_processing/noise_suppression_impl.cc
index 8dd713f..15d4043 100644
--- a/modules/audio_processing/noise_suppression_impl.cc
+++ b/modules/audio_processing/noise_suppression_impl.cc
@@ -37,10 +37,9 @@
int error = NS_INIT(state_, sample_rate_hz);
RTC_DCHECK_EQ(0, error);
}
- ~Suppressor() {
- NS_FREE(state_);
- }
+ ~Suppressor() { NS_FREE(state_); }
NsState* state() { return state_; }
+
private:
NsState* state_ = nullptr;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Suppressor);
@@ -96,15 +95,11 @@
RTC_DCHECK_EQ(suppressors_.size(), audio->num_channels());
for (size_t i = 0; i < suppressors_.size(); i++) {
#if defined(WEBRTC_NS_FLOAT)
- WebRtcNs_Process(suppressors_[i]->state(),
- audio->split_bands_const_f(i),
- audio->num_bands(),
- audio->split_bands_f(i));
+ WebRtcNs_Process(suppressors_[i]->state(), audio->split_bands_const_f(i),
+ audio->num_bands(), audio->split_bands_f(i));
#elif defined(WEBRTC_NS_FIXED)
- WebRtcNsx_Process(suppressors_[i]->state(),
- audio->split_bands_const(i),
- audio->num_bands(),
- audio->split_bands(i));
+ WebRtcNsx_Process(suppressors_[i]->state(), audio->split_bands_const(i),
+ audio->num_bands(), audio->split_bands(i));
#endif
}
}
@@ -190,8 +185,8 @@
noise_estimate.assign(WebRtcNsx_num_freq(), 0.f);
for (auto& suppressor : suppressors_) {
int q_noise;
- const uint32_t* noise = WebRtcNsx_noise_estimate(suppressor->state(),
- &q_noise);
+ const uint32_t* noise =
+ WebRtcNsx_noise_estimate(suppressor->state(), &q_noise);
const float kNormalizationFactor =
1.f / ((1 << q_noise) * suppressors_.size());
for (size_t i = 0; i < noise_estimate.size(); ++i) {
diff --git a/modules/audio_processing/noise_suppression_unittest.cc b/modules/audio_processing/noise_suppression_unittest.cc
index 0b734fd..b207485 100644
--- a/modules/audio_processing/noise_suppression_unittest.cc
+++ b/modules/audio_processing/noise_suppression_unittest.cc
@@ -97,18 +97,18 @@
TEST(NoiseSuppresionBitExactnessTest, Mono8kHzLow) {
#if defined(WEBRTC_ARCH_ARM64)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {1432.341431f, 3321.919922f, 7677.521973f};
+ const float kNoiseEstimateReference[] = {1432.341431f, 3321.919922f,
+ 7677.521973f};
const float kOutputReference[] = {0.003510f, 0.004517f, 0.004669f};
#elif defined(WEBRTC_ARCH_ARM)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {1432.341431f, 3321.919922f, 7677.521973f};
+ const float kNoiseEstimateReference[] = {1432.341431f, 3321.919922f,
+ 7677.521973f};
const float kOutputReference[] = {0.003510f, 0.004517f, 0.004669f};
#else
const float kSpeechProbabilityReference = 0.73421317f;
- const float kNoiseEstimateReference[] =
- {1175.266113f, 3289.305908f, 7532.991211f};
+ const float kNoiseEstimateReference[] = {1175.266113f, 3289.305908f,
+ 7532.991211f};
const float kOutputReference[] = {0.003263f, 0.004402f, 0.004537f};
#endif
@@ -120,18 +120,18 @@
TEST(NoiseSuppresionBitExactnessTest, Mono16kHzLow) {
#if defined(WEBRTC_ARCH_ARM64)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2534.461914f, 6277.638672f, 14367.499023f};
+ const float kNoiseEstimateReference[] = {2534.461914f, 6277.638672f,
+ 14367.499023f};
const float kOutputReference[] = {0.003449f, 0.004334f, 0.004303f};
#elif defined(WEBRTC_ARCH_ARM)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2534.461914f, 6277.638672f, 14367.499023f};
+ const float kNoiseEstimateReference[] = {2534.461914f, 6277.638672f,
+ 14367.499023f};
const float kOutputReference[] = {0.003449f, 0.004334f, 0.004303f};
#else
const float kSpeechProbabilityReference = 0.71672988f;
- const float kNoiseEstimateReference[] =
- {2151.313965f, 6509.765137f, 15658.848633f};
+ const float kNoiseEstimateReference[] = {2151.313965f, 6509.765137f,
+ 15658.848633f};
const float kOutputReference[] = {0.003574f, 0.004494f, 0.004499f};
#endif
@@ -143,18 +143,18 @@
TEST(NoiseSuppresionBitExactnessTest, Mono32kHzLow) {
#if defined(WEBRTC_ARCH_ARM64)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2540.059082f, 6317.822754f, 14440.845703f};
+ const float kNoiseEstimateReference[] = {2540.059082f, 6317.822754f,
+ 14440.845703f};
const float kOutputReference[] = {0.001679f, 0.002411f, 0.002594f};
#elif defined(WEBRTC_ARCH_ARM)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2540.059082f, 6317.822754f, 14440.845703f};
+ const float kNoiseEstimateReference[] = {2540.059082f, 6317.822754f,
+ 14440.845703f};
const float kOutputReference[] = {0.001679f, 0.002411f, 0.002594f};
#else
const float kSpeechProbabilityReference = 0.67999554f;
- const float kNoiseEstimateReference[] =
- {2149.780518f, 7076.936035f, 14939.945312f};
+ const float kNoiseEstimateReference[] = {2149.780518f, 7076.936035f,
+ 14939.945312f};
const float kOutputReference[] = {0.001221f, 0.001984f, 0.002228f};
#endif
@@ -166,18 +166,18 @@
TEST(NoiseSuppresionBitExactnessTest, Mono48kHzLow) {
#if defined(WEBRTC_ARCH_ARM64)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2564.605713f, 6213.656250f, 13372.284180f};
+ const float kNoiseEstimateReference[] = {2564.605713f, 6213.656250f,
+ 13372.284180f};
const float kOutputReference[] = {-0.013185f, -0.012769f, -0.012023f};
#elif defined(WEBRTC_ARCH_ARM)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2564.605713f, 6213.656250f, 13372.284180f};
+ const float kNoiseEstimateReference[] = {2564.605713f, 6213.656250f,
+ 13372.284180f};
const float kOutputReference[] = {-0.013185f, -0.012769f, -0.012023f};
#else
const float kSpeechProbabilityReference = 0.70645678f;
- const float kNoiseEstimateReference[] =
- {2168.783203f, 6902.895508f, 13190.677734f};
+ const float kNoiseEstimateReference[] = {2168.783203f, 6902.895508f,
+ 13190.677734f};
const float kOutputReference[] = {-0.013062f, -0.012657f, -0.011934f};
#endif
@@ -189,20 +189,20 @@
TEST(NoiseSuppresionBitExactnessTest, Stereo16kHzLow) {
#if defined(WEBRTC_ARCH_ARM64)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {9992.127930f, 12689.569336f, 11589.296875f};
+ const float kNoiseEstimateReference[] = {9992.127930f, 12689.569336f,
+ 11589.296875f};
const float kOutputReference[] = {-0.011108f, -0.007904f, -0.012390f,
-0.002441f, 0.000855f, -0.003204f};
#elif defined(WEBRTC_ARCH_ARM)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {10321.353516f, 12133.852539f, 10923.060547f};
+ const float kNoiseEstimateReference[] = {10321.353516f, 12133.852539f,
+ 10923.060547f};
const float kOutputReference[] = {-0.011108f, -0.007904f, -0.012390f,
-0.002472f, 0.000916f, -0.003235f};
#else
const float kSpeechProbabilityReference = 0.67230678f;
- const float kNoiseEstimateReference[] =
- {9771.250000f, 11329.377930f, 10503.052734f};
+ const float kNoiseEstimateReference[] = {9771.250000f, 11329.377930f,
+ 10503.052734f};
const float kOutputReference[] = {-0.011459f, -0.008110f, -0.012728f,
-0.002399f, 0.001018f, -0.003189f};
#endif
@@ -215,18 +215,18 @@
TEST(NoiseSuppresionBitExactnessTest, Mono16kHzModerate) {
#if defined(WEBRTC_ARCH_ARM64)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2057.085938f, 7601.055176f, 19666.187500f};
+ const float kNoiseEstimateReference[] = {2057.085938f, 7601.055176f,
+ 19666.187500f};
const float kOutputReference[] = {0.004669f, 0.005524f, 0.005432f};
#elif defined(WEBRTC_ARCH_ARM)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2244.497803f, 6864.164062f, 16726.523438f};
+ const float kNoiseEstimateReference[] = {2244.497803f, 6864.164062f,
+ 16726.523438f};
const float kOutputReference[] = {0.004669f, 0.005615f, 0.005585f};
#else
const float kSpeechProbabilityReference = 0.70897013f;
- const float kNoiseEstimateReference[] =
- {2171.490723f, 6553.567871f, 15626.562500f};
+ const float kNoiseEstimateReference[] = {2171.490723f, 6553.567871f,
+ 15626.562500f};
const float kOutputReference[] = {0.004513f, 0.005590f, 0.005614f};
#endif
@@ -238,18 +238,18 @@
TEST(NoiseSuppresionBitExactnessTest, Mono16kHzHigh) {
#if defined(WEBRTC_ARCH_ARM64)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2095.148193f, 7698.553711f, 19689.533203f};
+ const float kNoiseEstimateReference[] = {2095.148193f, 7698.553711f,
+ 19689.533203f};
const float kOutputReference[] = {0.004639f, 0.005402f, 0.005310f};
#elif defined(WEBRTC_ARCH_ARM)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2282.515625f, 6984.408203f, 16920.960938f};
+ const float kNoiseEstimateReference[] = {2282.515625f, 6984.408203f,
+ 16920.960938f};
const float kOutputReference[] = {0.004547f, 0.005432f, 0.005402f};
#else
const float kSpeechProbabilityReference = 0.70106733f;
- const float kNoiseEstimateReference[] =
- {2224.968506f, 6712.025879f, 15785.087891f};
+ const float kNoiseEstimateReference[] = {2224.968506f, 6712.025879f,
+ 15785.087891f};
const float kOutputReference[] = {0.004394f, 0.005406f, 0.005416f};
#endif
@@ -261,18 +261,18 @@
TEST(NoiseSuppresionBitExactnessTest, Mono16kHzVeryHigh) {
#if defined(WEBRTC_ARCH_ARM64)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2677.733398f, 6186.987305f, 14365.744141f};
+ const float kNoiseEstimateReference[] = {2677.733398f, 6186.987305f,
+ 14365.744141f};
const float kOutputReference[] = {0.004273f, 0.005127f, 0.005188f};
#elif defined(WEBRTC_ARCH_ARM)
const float kSpeechProbabilityReference = -4.0f;
- const float kNoiseEstimateReference[] =
- {2677.733398f, 6186.987305f, 14365.744141f};
+ const float kNoiseEstimateReference[] = {2677.733398f, 6186.987305f,
+ 14365.744141f};
const float kOutputReference[] = {0.004273f, 0.005127f, 0.005188f};
#else
const float kSpeechProbabilityReference = 0.70281971f;
- const float kNoiseEstimateReference[] =
- {2254.347900f, 6723.699707f, 15771.625977f};
+ const float kNoiseEstimateReference[] = {2254.347900f, 6723.699707f,
+ 15771.625977f};
const float kOutputReference[] = {0.004321f, 0.005247f, 0.005263f};
#endif
diff --git a/modules/audio_processing/ns/defines.h b/modules/audio_processing/ns/defines.h
index 66b45a9..d6abfea 100644
--- a/modules/audio_processing/ns/defines.h
+++ b/modules/audio_processing/ns/defines.h
@@ -11,39 +11,45 @@
#ifndef MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_DEFINES_H_
#define MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_DEFINES_H_
-#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 NUM_HIGH_BANDS_MAX 2 // max number of high bands: 2
+#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 NUM_HIGH_BANDS_MAX 2 // max number of high bands: 2
-#define QUANTILE (float)0.25
+#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 SIMULT 3
+#define END_STARTUP_LONG 200
+#define END_STARTUP_SHORT 50
+#define FACTOR (float)40.0
+#define WIDTH (float)0.01
// Length of fft work arrays.
-#define IP_LENGTH (ANAL_BLOCKL_MAX >> 1) // must be at least ceil(2 + sqrt(ANAL_BLOCKL_MAX/2))
+#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
+// 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 // MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_DEFINES_H_
+#define B_LIM (float)0.5 // threshold in final energy gain factor calculation
+#endif // MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_DEFINES_H_
diff --git a/modules/audio_processing/ns/noise_suppression.h b/modules/audio_processing/ns/noise_suppression.h
index fa5da70..fd6aa96 100644
--- a/modules/audio_processing/ns/noise_suppression.h
+++ b/modules/audio_processing/ns/noise_suppression.h
@@ -93,9 +93,9 @@
* - outframe : Pointer to output frame for each band
*/
void WebRtcNs_Process(NsHandle* NS_inst,
- const float* const* spframe,
- size_t num_bands,
- float* const* outframe);
+ const float* const* spframe,
+ size_t num_bands,
+ float* const* outframe);
/* 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
diff --git a/modules/audio_processing/ns/ns_core.h b/modules/audio_processing/ns/ns_core.h
index 990d363..e90b8ce 100644
--- a/modules/audio_processing/ns/ns_core.h
+++ b/modules/audio_processing/ns/ns_core.h
@@ -78,26 +78,26 @@
float wfft[W_LENGTH];
// Parameters for new method: some not needed, will reduce/cleanup later.
- int32_t blockInd; // Frame index counter.
+ 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 noise[HALF_ANAL_BLOCKL]; // Noise spectrum from current frame.
+ float priorModelPars[7]; // Parameters for prior model.
+ float noise[HALF_ANAL_BLOCKL]; // Noise spectrum from current frame.
float noisePrev[HALF_ANAL_BLOCKL]; // Noise spectrum from previous frame.
// Magnitude spectrum of previous analyze frame.
float magnPrevAnalyze[HALF_ANAL_BLOCKL];
// Magnitude spectrum of previous process frame.
float magnPrevProcess[HALF_ANAL_BLOCKL];
float logLrtTimeAvg[HALF_ANAL_BLOCKL]; // Log LRT factor with time-smoothing.
- float priorSpeechProb; // Prior speech/noise probability.
+ float priorSpeechProb; // Prior speech/noise probability.
float featureData[7];
// Conservative noise spectrum estimate.
float magnAvgPause[HALF_ANAL_BLOCKL];
float signalEnergy; // Energy of |magn|.
float sumMagn;
- float whiteNoiseLevel; // Initial noise estimate.
+ float whiteNoiseLevel; // Initial noise estimate.
float initMagnEst[HALF_ANAL_BLOCKL]; // Initial magnitude spectrum estimate.
- float pinkNoiseNumerator; // Pink noise parameter: numerator.
+ float pinkNoiseNumerator; // Pink noise parameter: numerator.
float pinkNoiseExp; // Pink noise parameter: power of frequencies.
float parametricNoise[HALF_ANAL_BLOCKL];
// Parameters for feature extraction.
diff --git a/modules/audio_processing/ns/nsx_core.h b/modules/audio_processing/ns/nsx_core.h
index c8097f7..479e90c 100644
--- a/modules/audio_processing/ns/nsx_core.h
+++ b/modules/audio_processing/ns/nsx_core.h
@@ -20,98 +20,97 @@
#include "typedefs.h" // NOLINT(build/include)
typedef struct NoiseSuppressionFixedC_ {
- uint32_t fs;
+ 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];
+ 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];
- size_t anaLen;
- size_t anaLen2;
- size_t magnLen;
- int aggrMode;
- int stages;
- int initFlag;
- int gainMap;
+ size_t anaLen;
+ size_t anaLen2;
+ size_t magnLen;
+ int aggrMode;
+ int stages;
+ int initFlag;
+ int gainMap;
- int32_t maxLrt;
- int32_t minLrt;
+ 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;
+ 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 featureSpecDiff;
+ uint32_t thresholdSpecDiff;
+ int16_t weightSpecDiff;
- uint32_t featureSpecFlat;
- uint32_t thresholdSpecFlat;
- int16_t weightSpecFlat;
+ 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;
+ 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.
+ uint32_t whiteNoiseLevel; // Initial noise estimate.
// Initial magnitude spectrum estimate.
- uint32_t initMagnEst[HALF_ANAL_BLOCKL];
+ 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.
+ 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];
+ uint32_t prevNoiseU32[HALF_ANAL_BLOCKL];
// Magnitude spectrum from previous frame.
- uint16_t prevMagnU16[HALF_ANAL_BLOCKL];
+ uint16_t prevMagnU16[HALF_ANAL_BLOCKL];
// Prior speech/noise probability in Q14.
- int16_t priorNonSpeechProb;
+ int16_t priorNonSpeechProb;
- int blockIndex; // Frame index counter.
+ int blockIndex; // Frame index counter.
// Parameter for updating or estimating thresholds/weights for prior model.
- int modelUpdate;
- int cntThresUpdate;
+ 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];
+ 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[NUM_HIGH_BANDS_MAX][ANAL_BLOCKL_MAX];
+ int16_t dataBufHBFX[NUM_HIGH_BANDS_MAX][ANAL_BLOCKL_MAX];
- int qNoise;
- int prevQNoise;
- int prevQMagn;
- size_t blockLen10ms;
+ int qNoise;
+ int prevQNoise;
+ int prevQMagn;
+ size_t blockLen10ms;
- int16_t real[ANAL_BLOCKL_MAX];
- int16_t imag[ANAL_BLOCKL_MAX];
- int32_t energyIn;
- int scaleEnergyIn;
- int normData;
+ int16_t real[ANAL_BLOCKL_MAX];
+ int16_t imag[ANAL_BLOCKL_MAX];
+ int32_t energyIn;
+ int scaleEnergyIn;
+ int normData;
struct RealFFT* real_fft;
} NoiseSuppressionFixedC;
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
/****************************************************************************
diff --git a/modules/audio_processing/ns/nsx_defines.h b/modules/audio_processing/ns/nsx_defines.h
index 12869b3..dc14dbc 100644
--- a/modules/audio_processing/ns/nsx_defines.h
+++ b/modules/audio_processing/ns/nsx_defines.h
@@ -11,54 +11,64 @@
#ifndef MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NSX_DEFINES_H_
#define 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 NUM_HIGH_BANDS_MAX 2 /* Max number of high bands */
-#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 ) */
+#define ANAL_BLOCKL_MAX 256 /* Max analysis block length */
+#define HALF_ANAL_BLOCKL 129 /* Half max analysis block length + 1 */
+#define NUM_HIGH_BANDS_MAX 2 /* Max number of high bands */
+#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 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 */
+#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 */
+#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. */
+#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
+#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 */
+#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. */
+#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 */
+#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 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 */
+#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 /* MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NSX_DEFINES_H_ */
diff --git a/modules/audio_processing/ns/windows_private.h b/modules/audio_processing/ns/windows_private.h
index 2ffd693..17792ec 100644
--- a/modules/audio_processing/ns/windows_private.h
+++ b/modules/audio_processing/ns/windows_private.h
@@ -13,562 +13,660 @@
// 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
-};
-
-
+ 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
-};
+ (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
-};
+ (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
-};
-
+ (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
-};
-
+ (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
-};
+ (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 // MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_WINDOWS_PRIVATE_H_
diff --git a/modules/audio_processing/residual_echo_detector.cc b/modules/audio_processing/residual_echo_detector.cc
index aec545a..e805013 100644
--- a/modules/audio_processing/residual_echo_detector.cc
+++ b/modules/audio_processing/residual_echo_detector.cc
@@ -141,19 +141,20 @@
read_index -= kLookbackFrames;
}
RTC_DCHECK_LT(read_index, render_power_.size());
- RTC_LOG_F(LS_ERROR)
- << "Echo detector internal state: {"
- "Echo likelihood: " << echo_likelihood_
- << ", Best Delay: " << best_delay
- << ", Covariance: " << covariances_[best_delay].covariance()
- << ", Last capture power: " << capture_power
- << ", Capture mean: " << capture_mean
- << ", Capture_standard deviation: " << capture_std_deviation
- << ", Last render power: " << render_power_[read_index]
- << ", Render mean: " << render_power_mean_[read_index]
- << ", Render standard deviation: "
- << render_power_std_dev_[read_index]
- << ", Reliability: " << reliability_ << "}";
+ RTC_LOG_F(LS_ERROR) << "Echo detector internal state: {"
+ "Echo likelihood: "
+ << echo_likelihood_ << ", Best Delay: " << best_delay
+ << ", Covariance: "
+ << covariances_[best_delay].covariance()
+ << ", Last capture power: " << capture_power
+ << ", Capture mean: " << capture_mean
+ << ", Capture_standard deviation: "
+ << capture_std_deviation << ", Last render power: "
+ << render_power_[read_index]
+ << ", Render mean: " << render_power_mean_[read_index]
+ << ", Render standard deviation: "
+ << render_power_std_dev_[read_index]
+ << ", Reliability: " << reliability_ << "}";
log_counter_++;
}
}
diff --git a/modules/audio_processing/rms_level.h b/modules/audio_processing/rms_level.h
index ae124b7..ae45a45 100644
--- a/modules/audio_processing/rms_level.h
+++ b/modules/audio_processing/rms_level.h
@@ -72,4 +72,3 @@
} // namespace webrtc
#endif // MODULES_AUDIO_PROCESSING_RMS_LEVEL_H_
-
diff --git a/modules/audio_processing/splitting_filter.cc b/modules/audio_processing/splitting_filter.cc
index e2b8f82..122bc9c 100644
--- a/modules/audio_processing/splitting_filter.cc
+++ b/modules/audio_processing/splitting_filter.cc
@@ -63,8 +63,7 @@
IFChannelBuffer* bands) {
RTC_DCHECK_EQ(two_bands_states_.size(), data->num_channels());
for (size_t i = 0; i < two_bands_states_.size(); ++i) {
- WebRtcSpl_AnalysisQMF(data->ibuf_const()->channels()[i],
- data->num_frames(),
+ WebRtcSpl_AnalysisQMF(data->ibuf_const()->channels()[i], data->num_frames(),
bands->ibuf()->channels(0)[i],
bands->ibuf()->channels(1)[i],
two_bands_states_[i].analysis_state1,
@@ -76,12 +75,11 @@
IFChannelBuffer* data) {
RTC_DCHECK_LE(data->num_channels(), two_bands_states_.size());
for (size_t i = 0; i < data->num_channels(); ++i) {
- WebRtcSpl_SynthesisQMF(bands->ibuf_const()->channels(0)[i],
- bands->ibuf_const()->channels(1)[i],
- bands->num_frames_per_band(),
- data->ibuf()->channels()[i],
- two_bands_states_[i].synthesis_state1,
- two_bands_states_[i].synthesis_state2);
+ WebRtcSpl_SynthesisQMF(
+ bands->ibuf_const()->channels(0)[i],
+ bands->ibuf_const()->channels(1)[i], bands->num_frames_per_band(),
+ data->ibuf()->channels()[i], two_bands_states_[i].synthesis_state1,
+ two_bands_states_[i].synthesis_state2);
}
}
diff --git a/modules/audio_processing/splitting_filter_unittest.cc b/modules/audio_processing/splitting_filter_unittest.cc
index 3e0dbb9..1caee64 100644
--- a/modules/audio_processing/splitting_filter_unittest.cc
+++ b/modules/audio_processing/splitting_filter_unittest.cc
@@ -39,8 +39,7 @@
static const int kFrequenciesHz[kNumBands] = {1000, 12000, 18000};
static const float kAmplitude = 8192.f;
static const size_t kChunks = 8;
- SplittingFilter splitting_filter(kChannels,
- kNumBands,
+ SplittingFilter splitting_filter(kChannels, kNumBands,
kSamplesPer48kHzChannel);
IFChannelBuffer in_data(kSamplesPer48kHzChannel, kChannels, kNumBands);
IFChannelBuffer bands(kSamplesPer48kHzChannel, kChannels, kNumBands);
@@ -48,8 +47,7 @@
for (size_t i = 0; i < kChunks; ++i) {
// Input signal generation.
bool is_present[kNumBands];
- memset(in_data.fbuf()->channels()[0],
- 0,
+ memset(in_data.fbuf()->channels()[0], 0,
kSamplesPer48kHzChannel * sizeof(in_data.fbuf()->channels()[0][0]));
for (size_t j = 0; j < kNumBands; ++j) {
is_present[j] = i & (static_cast<size_t>(1) << j);
@@ -57,7 +55,7 @@
for (size_t k = 0; k < kSamplesPer48kHzChannel; ++k) {
in_data.fbuf()->channels()[0][k] +=
amplitude * sin(2.f * M_PI * kFrequenciesHz[j] *
- (i * kSamplesPer48kHzChannel + k) / kSampleRateHz);
+ (i * kSamplesPer48kHzChannel + k) / kSampleRateHz);
}
}
// Three band splitting filter.
diff --git a/modules/audio_processing/test/audioproc_float_impl.cc b/modules/audio_processing/test/audioproc_float_impl.cc
index 6a3f316..ebf20e3 100644
--- a/modules/audio_processing/test/audioproc_float_impl.cc
+++ b/modules/audio_processing/test/audioproc_float_impl.cc
@@ -128,9 +128,7 @@
DEFINE_int(aecm_comfort_noise,
kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the AECM comfort noise");
-DEFINE_int(agc_mode,
- kParameterNotSpecifiedValue,
- "Specify the AGC mode (0-2)");
+DEFINE_int(agc_mode, kParameterNotSpecifiedValue, "Specify the AGC mode (0-2)");
DEFINE_int(agc_target_level,
kParameterNotSpecifiedValue,
"Specify the AGC target level (0-31)");
@@ -147,9 +145,7 @@
DEFINE_int(vad_likelihood,
kParameterNotSpecifiedValue,
"Specify the VAD likelihood (0-3)");
-DEFINE_int(ns_level,
- kParameterNotSpecifiedValue,
- "Specify the NS level (0-3)");
+DEFINE_int(ns_level, kParameterNotSpecifiedValue, "Specify the NS level (0-3)");
DEFINE_int(stream_delay,
kParameterNotSpecifiedValue,
"Specify the stream delay in ms to use");
@@ -454,8 +450,8 @@
int AudioprocFloatImpl(std::unique_ptr<AudioProcessingBuilder> ap_builder,
int argc,
char* argv[]) {
- if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) ||
- FLAG_help || argc != 1) {
+ if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) || FLAG_help ||
+ argc != 1) {
printf("%s", kUsageDescription);
if (FLAG_help) {
rtc::FlagList::Print(nullptr, false);
diff --git a/modules/audio_processing/test/conversational_speech/generator.cc b/modules/audio_processing/test/conversational_speech/generator.cc
index ee3f81a..f6a0b46 100644
--- a/modules/audio_processing/test/conversational_speech/generator.cc
+++ b/modules/audio_processing/test/conversational_speech/generator.cc
@@ -40,8 +40,8 @@
} // namespace
int main(int argc, char* argv[]) {
- if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) ||
- FLAG_help || argc != 1) {
+ if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) || FLAG_help ||
+ argc != 1) {
printf("%s", kUsageDescription);
if (FLAG_help) {
rtc::FlagList::Print(nullptr, false);
@@ -60,23 +60,23 @@
conversational_speech::LoadTiming(config.timing_filepath());
// Parse timing and audio tracks.
- auto wavreader_factory = rtc::MakeUnique<
- conversational_speech::WavReaderFactory>();
+ auto wavreader_factory =
+ rtc::MakeUnique<conversational_speech::WavReaderFactory>();
conversational_speech::MultiEndCall multiend_call(
timing, config.audiotracks_path(), std::move(wavreader_factory));
// Generate output audio tracks.
- auto generated_audiotrack_pairs = conversational_speech::Simulate(
- multiend_call, config.output_path());
+ auto generated_audiotrack_pairs =
+ conversational_speech::Simulate(multiend_call, config.output_path());
// Show paths to created audio tracks.
std::cout << "Output files:" << std::endl;
for (const auto& output_paths_entry : *generated_audiotrack_pairs) {
std::cout << " speaker: " << output_paths_entry.first << std::endl;
std::cout << " near end: " << output_paths_entry.second.near_end
- << std::endl;
+ << std::endl;
std::cout << " far end: " << output_paths_entry.second.far_end
- << std::endl;
+ << std::endl;
}
return 0;
diff --git a/modules/audio_processing/test/conversational_speech/mock_wavreader.cc b/modules/audio_processing/test/conversational_speech/mock_wavreader.cc
index 103483d..58d68e6 100644
--- a/modules/audio_processing/test/conversational_speech/mock_wavreader.cc
+++ b/modules/audio_processing/test/conversational_speech/mock_wavreader.cc
@@ -16,10 +16,12 @@
using testing::Return;
-MockWavReader::MockWavReader(
- int sample_rate, size_t num_channels, size_t num_samples)
- : sample_rate_(sample_rate), num_channels_(num_channels),
- num_samples_(num_samples) {
+MockWavReader::MockWavReader(int sample_rate,
+ size_t num_channels,
+ size_t num_samples)
+ : sample_rate_(sample_rate),
+ num_channels_(num_channels),
+ num_samples_(num_samples) {
ON_CALL(*this, SampleRate()).WillByDefault(Return(sample_rate_));
ON_CALL(*this, NumChannels()).WillByDefault(Return(num_channels_));
ON_CALL(*this, NumSamples()).WillByDefault(Return(num_samples_));
diff --git a/modules/audio_processing/test/conversational_speech/mock_wavreader_factory.cc b/modules/audio_processing/test/conversational_speech/mock_wavreader_factory.cc
index 76f5c80..eb8e3be 100644
--- a/modules/audio_processing/test/conversational_speech/mock_wavreader_factory.cc
+++ b/modules/audio_processing/test/conversational_speech/mock_wavreader_factory.cc
@@ -25,10 +25,9 @@
MockWavReaderFactory::MockWavReaderFactory(
const Params& default_params,
const std::map<std::string, const Params>& params)
- : default_params_(default_params),
- audiotrack_names_params_(params) {
- ON_CALL(*this, Create(_)).WillByDefault(Invoke(
- this, &MockWavReaderFactory::CreateMock));
+ : default_params_(default_params), audiotrack_names_params_(params) {
+ ON_CALL(*this, Create(_))
+ .WillByDefault(Invoke(this, &MockWavReaderFactory::CreateMock));
}
MockWavReaderFactory::MockWavReaderFactory(const Params& default_params)
@@ -41,16 +40,15 @@
const std::string& filepath) {
// Search the parameters corresponding to filepath.
const rtc::Pathname audiotrack_file_path(filepath);
- const auto it = audiotrack_names_params_.find(
- audiotrack_file_path.filename());
+ const auto it =
+ audiotrack_names_params_.find(audiotrack_file_path.filename());
// If not found, use default parameters.
if (it == audiotrack_names_params_.end()) {
RTC_LOG(LS_VERBOSE) << "using default parameters for " << filepath;
- return std::unique_ptr<WavReaderInterface>(
- new MockWavReader(default_params_.sample_rate,
- default_params_.num_channels,
- default_params_.num_samples));
+ return std::unique_ptr<WavReaderInterface>(new MockWavReader(
+ default_params_.sample_rate, default_params_.num_channels,
+ default_params_.num_samples));
}
// Found, use the audiotrack-specific parameters.
@@ -58,10 +56,8 @@
RTC_LOG(LS_VERBOSE) << "sample_rate " << it->second.sample_rate;
RTC_LOG(LS_VERBOSE) << "num_channels " << it->second.num_channels;
RTC_LOG(LS_VERBOSE) << "num_samples " << it->second.num_samples;
- return std::unique_ptr<WavReaderInterface>(
- new MockWavReader(it->second.sample_rate,
- it->second.num_channels,
- it->second.num_samples));
+ return std::unique_ptr<WavReaderInterface>(new MockWavReader(
+ it->second.sample_rate, it->second.num_channels, it->second.num_samples));
}
} // namespace conversational_speech
diff --git a/modules/audio_processing/test/conversational_speech/mock_wavreader_factory.h b/modules/audio_processing/test/conversational_speech/mock_wavreader_factory.h
index 4c055cf..e84f5f3 100644
--- a/modules/audio_processing/test/conversational_speech/mock_wavreader_factory.h
+++ b/modules/audio_processing/test/conversational_speech/mock_wavreader_factory.h
@@ -25,7 +25,7 @@
class MockWavReaderFactory : public WavReaderAbstractFactory {
public:
- struct Params{
+ struct Params {
int sample_rate;
size_t num_channels;
size_t num_samples;
@@ -36,8 +36,8 @@
explicit MockWavReaderFactory(const Params& default_params);
~MockWavReaderFactory();
- MOCK_CONST_METHOD1(Create, std::unique_ptr<WavReaderInterface>(
- const std::string&));
+ MOCK_CONST_METHOD1(Create,
+ std::unique_ptr<WavReaderInterface>(const std::string&));
private:
// Creates a MockWavReader instance using the parameters in
diff --git a/modules/audio_processing/test/conversational_speech/multiend_call.cc b/modules/audio_processing/test/conversational_speech/multiend_call.cc
index f5411bd..d633d90 100644
--- a/modules/audio_processing/test/conversational_speech/multiend_call.cc
+++ b/modules/audio_processing/test/conversational_speech/multiend_call.cc
@@ -21,11 +21,13 @@
namespace conversational_speech {
MultiEndCall::MultiEndCall(
- rtc::ArrayView<const Turn> timing, const std::string& audiotracks_path,
+ rtc::ArrayView<const Turn> timing,
+ const std::string& audiotracks_path,
std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory)
- : timing_(timing), audiotracks_path_(audiotracks_path),
- wavreader_abstract_factory_(std::move(wavreader_abstract_factory)),
- valid_(false) {
+ : timing_(timing),
+ audiotracks_path_(audiotracks_path),
+ wavreader_abstract_factory_(std::move(wavreader_abstract_factory)),
+ valid_(false) {
FindSpeakerNames();
if (CreateAudioTrackReaders())
valid_ = CheckTiming();
@@ -49,8 +51,8 @@
continue;
// Instance Pathname to retrieve the full path to the audiotrack file.
- const rtc::Pathname audiotrack_file_path(
- audiotracks_path_, turn.audiotrack_file_name);
+ const rtc::Pathname audiotrack_file_path(audiotracks_path_,
+ turn.audiotrack_file_name);
// Map the audiotrack file name to a new instance of WavReaderInterface.
std::unique_ptr<WavReaderInterface> wavreader =
@@ -69,8 +71,8 @@
return false;
}
- audiotrack_readers_.emplace(
- turn.audiotrack_file_name, std::move(wavreader));
+ audiotrack_readers_.emplace(turn.audiotrack_file_name,
+ std::move(wavreader));
}
return true;
@@ -101,10 +103,9 @@
// detect self cross-talk).
std::map<std::string, std::vector<size_t>> speaking_turn_indices;
for (const std::string& speaker_name : speaker_names_) {
- speaking_turn_indices.emplace(
- std::piecewise_construct,
- std::forward_as_tuple(speaker_name),
- std::forward_as_tuple());
+ speaking_turn_indices.emplace(std::piecewise_construct,
+ std::forward_as_tuple(speaker_name),
+ std::forward_as_tuple());
}
// Parse turns.
@@ -115,8 +116,8 @@
<< "Audio track reader not created";
// Begin and end timestamps for the current turn.
- int offset_samples = millisecond_to_samples(
- turn.offset, it->second->SampleRate());
+ int offset_samples =
+ millisecond_to_samples(turn.offset, it->second->SampleRate());
std::size_t begin_timestamp = last_turn.end + offset_samples;
std::size_t end_timestamp = begin_timestamp + it->second->NumSamples();
RTC_LOG(LS_INFO) << "turn #" << turn_index << " " << begin_timestamp << "-"
@@ -124,16 +125,16 @@
// The order is invalid if the offset is negative and its absolute value is
// larger then the duration of the previous turn.
- if (offset_samples < 0 && -offset_samples > static_cast<int>(
- last_turn.end - last_turn.begin)) {
+ if (offset_samples < 0 &&
+ -offset_samples > static_cast<int>(last_turn.end - last_turn.begin)) {
RTC_LOG(LS_ERROR) << "invalid order";
return false;
}
// Cross-talk with 3 or more speakers occurs when the beginning of the
// current interval falls in the last two turns.
- if (turn_index > 1 && in_interval(begin_timestamp, last_turn)
- && in_interval(begin_timestamp, second_last_turn)) {
+ if (turn_index > 1 && in_interval(begin_timestamp, last_turn) &&
+ in_interval(begin_timestamp, second_last_turn)) {
RTC_LOG(LS_ERROR) << "cross-talk with 3+ speakers";
return false;
}
@@ -164,8 +165,9 @@
std::vector<SpeakingTurn> speaking_turns_for_name;
std::copy_if(speaking_turns_.begin(), speaking_turns_.end(),
std::back_inserter(speaking_turns_for_name),
- [&speaker_name](const SpeakingTurn& st){
- return st.speaker_name == speaker_name; });
+ [&speaker_name](const SpeakingTurn& st) {
+ return st.speaker_name == speaker_name;
+ });
// Check for overlap between adjacent elements.
// This is a sufficient condition for self cross-talk since the intervals
@@ -173,7 +175,8 @@
auto overlap = std::adjacent_find(
speaking_turns_for_name.begin(), speaking_turns_for_name.end(),
[](const SpeakingTurn& a, const SpeakingTurn& b) {
- return a.end > b.begin; });
+ return a.end > b.begin;
+ });
if (overlap != speaking_turns_for_name.end()) {
RTC_LOG(LS_ERROR) << "Self cross-talk detected";
diff --git a/modules/audio_processing/test/conversational_speech/multiend_call.h b/modules/audio_processing/test/conversational_speech/multiend_call.h
index d91058f..a4eff38 100644
--- a/modules/audio_processing/test/conversational_speech/multiend_call.h
+++ b/modules/audio_processing/test/conversational_speech/multiend_call.h
@@ -51,18 +51,22 @@
};
MultiEndCall(
- rtc::ArrayView<const Turn> timing, const std::string& audiotracks_path,
+ rtc::ArrayView<const Turn> timing,
+ const std::string& audiotracks_path,
std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory);
~MultiEndCall();
const std::set<std::string>& speaker_names() const { return speaker_names_; }
const std::map<std::string, std::unique_ptr<WavReaderInterface>>&
- audiotrack_readers() const { return audiotrack_readers_; }
+ audiotrack_readers() const {
+ return audiotrack_readers_;
+ }
bool valid() const { return valid_; }
int sample_rate() const { return sample_rate_hz_; }
size_t total_duration_samples() const { return total_duration_samples_; }
const std::vector<SpeakingTurn>& speaking_turns() const {
- return speaking_turns_; }
+ return speaking_turns_;
+ }
private:
// Finds unique speaker names.
diff --git a/modules/audio_processing/test/conversational_speech/simulator.cc b/modules/audio_processing/test/conversational_speech/simulator.cc
index 437a973..946aee1 100644
--- a/modules/audio_processing/test/conversational_speech/simulator.cc
+++ b/modules/audio_processing/test/conversational_speech/simulator.cc
@@ -38,28 +38,27 @@
// Combines output path and speaker names to define the output file paths for
// the near-end and far=end audio tracks.
std::unique_ptr<std::map<std::string, SpeakerOutputFilePaths>>
- InitSpeakerOutputFilePaths(const std::set<std::string>& speaker_names,
- const std::string& output_path) {
+InitSpeakerOutputFilePaths(const std::set<std::string>& speaker_names,
+ const std::string& output_path) {
// Create map.
- auto speaker_output_file_paths_map = rtc::MakeUnique<
- std::map<std::string, SpeakerOutputFilePaths>>();
+ auto speaker_output_file_paths_map =
+ rtc::MakeUnique<std::map<std::string, SpeakerOutputFilePaths>>();
// Add near-end and far-end output paths into the map.
for (const auto& speaker_name : speaker_names) {
- const rtc::Pathname near_end_path(
- output_path, "s_" + speaker_name + "-near_end.wav");
+ const rtc::Pathname near_end_path(output_path,
+ "s_" + speaker_name + "-near_end.wav");
RTC_LOG(LS_VERBOSE) << "The near-end audio track will be created in "
<< near_end_path.pathname() << ".";
- const rtc::Pathname far_end_path(
- output_path, "s_" + speaker_name + "-far_end.wav");
+ const rtc::Pathname far_end_path(output_path,
+ "s_" + speaker_name + "-far_end.wav");
RTC_LOG(LS_VERBOSE) << "The far-end audio track will be created in "
<< far_end_path.pathname() << ".";
// Add to map.
speaker_output_file_paths_map->emplace(
- std::piecewise_construct,
- std::forward_as_tuple(speaker_name),
+ std::piecewise_construct, std::forward_as_tuple(speaker_name),
std::forward_as_tuple(near_end_path.pathname(),
far_end_path.pathname()));
}
@@ -71,16 +70,13 @@
// output track of a speaker.
class SpeakerWavWriters {
public:
- SpeakerWavWriters(
- const SpeakerOutputFilePaths& output_file_paths, int sample_rate)
- : near_end_wav_writer_(output_file_paths.near_end, sample_rate, 1u),
- far_end_wav_writer_(output_file_paths.far_end, sample_rate, 1u) {}
- WavWriter* near_end_wav_writer() {
- return &near_end_wav_writer_;
- }
- WavWriter* far_end_wav_writer() {
- return &far_end_wav_writer_;
- }
+ SpeakerWavWriters(const SpeakerOutputFilePaths& output_file_paths,
+ int sample_rate)
+ : near_end_wav_writer_(output_file_paths.near_end, sample_rate, 1u),
+ far_end_wav_writer_(output_file_paths.far_end, sample_rate, 1u) {}
+ WavWriter* near_end_wav_writer() { return &near_end_wav_writer_; }
+ WavWriter* far_end_wav_writer() { return &far_end_wav_writer_; }
+
private:
WavWriter near_end_wav_writer_;
WavWriter far_end_wav_writer_;
@@ -89,18 +85,18 @@
// Initializes one WavWriter instance for each speaker and both the near-end and
// far-end output tracks.
std::unique_ptr<std::map<std::string, SpeakerWavWriters>>
- InitSpeakersWavWriters(const std::map<std::string, SpeakerOutputFilePaths>&
- speaker_output_file_paths, int sample_rate) {
+InitSpeakersWavWriters(const std::map<std::string, SpeakerOutputFilePaths>&
+ speaker_output_file_paths,
+ int sample_rate) {
// Create map.
- auto speaker_wav_writers_map = rtc::MakeUnique<
- std::map<std::string, SpeakerWavWriters>>();
+ auto speaker_wav_writers_map =
+ rtc::MakeUnique<std::map<std::string, SpeakerWavWriters>>();
// Add SpeakerWavWriters instance into the map.
for (auto it = speaker_output_file_paths.begin();
- it != speaker_output_file_paths.end(); ++it) {
+ it != speaker_output_file_paths.end(); ++it) {
speaker_wav_writers_map->emplace(
- std::piecewise_construct,
- std::forward_as_tuple(it->first),
+ std::piecewise_construct, std::forward_as_tuple(it->first),
std::forward_as_tuple(it->second, sample_rate));
}
@@ -112,17 +108,16 @@
const std::map<std::string, std::unique_ptr<WavReaderInterface>>&
audiotrack_readers) {
// Create map.
- auto audiotracks_map = rtc::MakeUnique<
- std::map<std::string, std::vector<int16_t>>>();
+ auto audiotracks_map =
+ rtc::MakeUnique<std::map<std::string, std::vector<int16_t>>>();
// Add audio track vectors.
for (auto it = audiotrack_readers.begin(); it != audiotrack_readers.end();
- ++it) {
+ ++it) {
// Add map entry.
- audiotracks_map->emplace(
- std::piecewise_construct,
- std::forward_as_tuple(it->first),
- std::forward_as_tuple(it->second->NumSamples()));
+ audiotracks_map->emplace(std::piecewise_construct,
+ std::forward_as_tuple(it->first),
+ std::forward_as_tuple(it->second->NumSamples()));
// Read samples.
it->second->ReadInt16Samples(audiotracks_map->at(it->first));
@@ -136,7 +131,8 @@
// adds zeros as left padding. The padding corresponds to intervals during which
// a speaker is not active.
void PadLeftWriteChunk(rtc::ArrayView<const int16_t> source_samples,
- size_t interval_begin, WavWriter* wav_writer) {
+ size_t interval_begin,
+ WavWriter* wav_writer) {
// Add left padding.
RTC_CHECK(wav_writer);
RTC_CHECK_GE(interval_begin, wav_writer->num_samples());
@@ -179,11 +175,12 @@
namespace conversational_speech {
std::unique_ptr<std::map<std::string, SpeakerOutputFilePaths>> Simulate(
- const MultiEndCall& multiend_call, const std::string& output_path) {
+ const MultiEndCall& multiend_call,
+ const std::string& output_path) {
// Set output file paths and initialize wav writers.
const auto& speaker_names = multiend_call.speaker_names();
- auto speaker_output_file_paths = InitSpeakerOutputFilePaths(
- speaker_names, output_path);
+ auto speaker_output_file_paths =
+ InitSpeakerOutputFilePaths(speaker_names, output_path);
auto speakers_wav_writers = InitSpeakersWavWriters(
*speaker_output_file_paths, multiend_call.sample_rate());
diff --git a/modules/audio_processing/test/conversational_speech/simulator.h b/modules/audio_processing/test/conversational_speech/simulator.h
index 671c3b9..743db42 100644
--- a/modules/audio_processing/test/conversational_speech/simulator.h
+++ b/modules/audio_processing/test/conversational_speech/simulator.h
@@ -26,16 +26,16 @@
struct SpeakerOutputFilePaths {
SpeakerOutputFilePaths(const std::string& new_near_end,
const std::string& new_far_end)
- : near_end(new_near_end),
- far_end(new_far_end) {}
+ : near_end(new_near_end), far_end(new_far_end) {}
// Paths to the near-end and far-end audio track files.
const std::string near_end;
const std::string far_end;
};
// Generates the near-end and far-end audio track pairs for each speaker.
-std::unique_ptr<std::map<std::string, SpeakerOutputFilePaths>>
- Simulate(const MultiEndCall& multiend_call, const std::string& output_path);
+std::unique_ptr<std::map<std::string, SpeakerOutputFilePaths>> Simulate(
+ const MultiEndCall& multiend_call,
+ const std::string& output_path);
} // namespace conversational_speech
} // namespace test
diff --git a/modules/audio_processing/test/conversational_speech/timing.cc b/modules/audio_processing/test/conversational_speech/timing.cc
index 2e96d2b..6c19f32 100644
--- a/modules/audio_processing/test/conversational_speech/timing.cc
+++ b/modules/audio_processing/test/conversational_speech/timing.cc
@@ -19,7 +19,7 @@
namespace test {
namespace conversational_speech {
-bool Turn::operator==(const Turn &b) const {
+bool Turn::operator==(const Turn& b) const {
return b.speaker_name == speaker_name &&
b.audiotrack_file_name == audiotrack_file_name && b.offset == offset &&
b.gain == gain;
diff --git a/modules/audio_processing/test/conversational_speech/timing.h b/modules/audio_processing/test/conversational_speech/timing.h
index 07a26e1..812f3d5 100644
--- a/modules/audio_processing/test/conversational_speech/timing.h
+++ b/modules/audio_processing/test/conversational_speech/timing.h
@@ -20,7 +20,7 @@
namespace test {
namespace conversational_speech {
-struct Turn{
+struct Turn {
Turn(std::string new_speaker_name,
std::string new_audiotrack_file_name,
int new_offset,
@@ -29,7 +29,7 @@
audiotrack_file_name(new_audiotrack_file_name),
offset(new_offset),
gain(gain) {}
- bool operator==(const Turn &b) const;
+ bool operator==(const Turn& b) const;
std::string speaker_name;
std::string audiotrack_file_name;
int offset;
diff --git a/modules/audio_processing/test/conversational_speech/wavreader_factory.cc b/modules/audio_processing/test/conversational_speech/wavreader_factory.cc
index 8342d3f..1a5cf8f 100644
--- a/modules/audio_processing/test/conversational_speech/wavreader_factory.cc
+++ b/modules/audio_processing/test/conversational_speech/wavreader_factory.cc
@@ -37,17 +37,11 @@
return wav_reader_.ReadSamples(samples.size(), samples.begin());
}
- int SampleRate() const override {
- return wav_reader_.sample_rate();
- }
+ int SampleRate() const override { return wav_reader_.sample_rate(); }
- size_t NumChannels() const override {
- return wav_reader_.num_channels();
- }
+ size_t NumChannels() const override { return wav_reader_.num_channels(); }
- size_t NumSamples() const override {
- return wav_reader_.num_samples();
- }
+ size_t NumSamples() const override { return wav_reader_.num_samples(); }
private:
WavReader wav_reader_;
diff --git a/modules/audio_processing/test/conversational_speech/wavreader_factory.h b/modules/audio_processing/test/conversational_speech/wavreader_factory.h
index e168d0d..2f86bf5 100644
--- a/modules/audio_processing/test/conversational_speech/wavreader_factory.h
+++ b/modules/audio_processing/test/conversational_speech/wavreader_factory.h
@@ -25,8 +25,8 @@
public:
WavReaderFactory();
~WavReaderFactory() override;
- std::unique_ptr<WavReaderInterface> Create(const std::string& filepath) const
- override;
+ std::unique_ptr<WavReaderInterface> Create(
+ const std::string& filepath) const override;
};
} // namespace conversational_speech
diff --git a/modules/audio_processing/test/debug_dump_replayer.cc b/modules/audio_processing/test/debug_dump_replayer.cc
index bc95cfd..a06c76e 100644
--- a/modules/audio_processing/test/debug_dump_replayer.cc
+++ b/modules/audio_processing/test/debug_dump_replayer.cc
@@ -23,8 +23,8 @@
auto& buffer_ref = *buffer;
if (!buffer_ref.get() || buffer_ref->num_frames() != config.num_frames() ||
buffer_ref->num_channels() != config.num_channels()) {
- buffer_ref.reset(new ChannelBuffer<float>(config.num_frames(),
- config.num_channels()));
+ buffer_ref.reset(
+ new ChannelBuffer<float>(config.num_frames(), config.num_channels()));
}
}
diff --git a/modules/audio_processing/test/debug_dump_test.cc b/modules/audio_processing/test/debug_dump_test.cc
index d90d14f..4e29433 100644
--- a/modules/audio_processing/test/debug_dump_test.cc
+++ b/modules/audio_processing/test/debug_dump_test.cc
@@ -33,8 +33,8 @@
auto& buffer_ref = *buffer;
if (!buffer_ref.get() || buffer_ref->num_frames() != config.num_frames() ||
buffer_ref->num_channels() != config.num_channels()) {
- buffer_ref.reset(new ChannelBuffer<float>(config.num_frames(),
- config.num_channels()));
+ buffer_ref.reset(
+ new ChannelBuffer<float>(config.num_frames(), config.num_channels()));
}
}
@@ -87,7 +87,8 @@
AudioProcessing* apm() const { return apm_.get(); }
private:
- static void ReadAndDeinterleave(ResampleInputAudioFile* audio, int channels,
+ static void ReadAndDeinterleave(ResampleInputAudioFile* audio,
+ int channels,
const StreamConfig& config,
float* const* buffer);
@@ -227,11 +228,10 @@
apm_->ProcessStream(input_->channels(), input_config_,
output_config_, output_->channels()));
- RTC_CHECK_EQ(AudioProcessing::kNoError,
- apm_->ProcessReverseStream(reverse_->channels(),
- reverse_config_,
- reverse_config_,
- reverse_->channels()));
+ RTC_CHECK_EQ(
+ AudioProcessing::kNoError,
+ apm_->ProcessReverseStream(reverse_->channels(), reverse_config_,
+ reverse_config_, reverse_->channels()));
}
}
@@ -288,9 +288,9 @@
ASSERT_EQ(output_config.num_frames() * sizeof(float),
msg->output_channel(0).size());
for (int i = 0; i < msg->output_channel_size(); ++i) {
- ASSERT_EQ(0, memcmp(output->channels()[i],
- msg->output_channel(i).data(),
- msg->output_channel(i).size()));
+ ASSERT_EQ(0,
+ memcmp(output->channels()[i], msg->output_channel(i).data(),
+ msg->output_channel(i).size()));
}
}
}
diff --git a/modules/audio_processing/test/fake_recording_device.h b/modules/audio_processing/test/fake_recording_device.h
index 0d93b7a..13f94a7 100644
--- a/modules/audio_processing/test/fake_recording_device.h
+++ b/modules/audio_processing/test/fake_recording_device.h
@@ -15,8 +15,8 @@
#include <memory>
#include <vector>
-#include "api/audio/audio_frame.h"
#include "api/array_view.h"
+#include "api/audio/audio_frame.h"
#include "common_audio/channel_buffer.h"
#include "rtc_base/checks.h"
diff --git a/modules/audio_processing/test/protobuf_utils.cc b/modules/audio_processing/test/protobuf_utils.cc
index 3b623b9..6ecc97e 100644
--- a/modules/audio_processing/test/protobuf_utils.cc
+++ b/modules/audio_processing/test/protobuf_utils.cc
@@ -14,8 +14,8 @@
namespace webrtc {
size_t ReadMessageBytesFromFile(FILE* file, std::unique_ptr<uint8_t[]>* bytes) {
- // The "wire format" for the size is little-endian. Assume we're running on
- // a little-endian machine.
+// The "wire format" for the size is little-endian. Assume we're running on
+// a little-endian machine.
#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
#error "Need to convert messsage from little-endian."
#endif
diff --git a/modules/audio_processing/test/test_utils.cc b/modules/audio_processing/test/test_utils.cc
index 846ce2b..937775e 100644
--- a/modules/audio_processing/test/test_utils.cc
+++ b/modules/audio_processing/test/test_utils.cc
@@ -91,9 +91,9 @@
}
// TODO(aluebs): Use ScaleToInt16Range() from audio_util
for (size_t i = 0; i < length; ++i) {
- buffer[i] = buffer[i] > 0 ?
- buffer[i] * std::numeric_limits<int16_t>::max() :
- -buffer[i] * std::numeric_limits<int16_t>::min();
+ buffer[i] = buffer[i] > 0
+ ? buffer[i] * std::numeric_limits<int16_t>::max()
+ : -buffer[i] * std::numeric_limits<int16_t>::min();
}
if (wav_file) {
wav_file->WriteSamples(buffer.get(), length);
@@ -113,11 +113,10 @@
return static_cast<size_t>(AudioProcessing::kChunkSizeMs * rate / 1000);
}
-void SetFrameSampleRate(AudioFrame* frame,
- int sample_rate_hz) {
+void SetFrameSampleRate(AudioFrame* frame, int sample_rate_hz) {
frame->sample_rate_hz_ = sample_rate_hz;
- frame->samples_per_channel_ = AudioProcessing::kChunkSizeMs *
- sample_rate_hz / 1000;
+ frame->samples_per_channel_ =
+ AudioProcessing::kChunkSizeMs * sample_rate_hz / 1000;
}
AudioProcessing::ChannelLayout LayoutFromChannels(size_t num_channels) {
diff --git a/modules/audio_processing/test/test_utils.h b/modules/audio_processing/test/test_utils.h
index 43f907a..6e4154a 100644
--- a/modules/audio_processing/test/test_utils.h
+++ b/modules/audio_processing/test/test_utils.h
@@ -91,8 +91,7 @@
size_t SamplesFromRate(int rate);
-void SetFrameSampleRate(AudioFrame* frame,
- int sample_rate_hz);
+void SetFrameSampleRate(AudioFrame* frame, int sample_rate_hz);
template <typename T>
void SetContainerFormat(int sample_rate_hz,
@@ -130,14 +129,14 @@
// Returns a vector<T> parsed from whitespace delimited values in to_parse,
// or an empty vector if the string could not be parsed.
-template<typename T>
+template <typename T>
std::vector<T> ParseList(const std::string& to_parse) {
std::vector<T> values;
std::istringstream str(to_parse);
std::copy(
- std::istream_iterator<T>(str),
- std::istream_iterator<T>(),
+ std::istream_iterator<T>(str), // no-presubmit-check TODO(webrtc:8982)
+ std::istream_iterator<T>(), // no-presubmit-check TODO(webrtc:8982)
std::back_inserter(values));
return values;
diff --git a/modules/audio_processing/three_band_filter_bank.cc b/modules/audio_processing/three_band_filter_bank.cc
index f5a319b..dbbfc28 100644
--- a/modules/audio_processing/three_band_filter_bank.cc
+++ b/modules/audio_processing/three_band_filter_bank.cc
@@ -68,19 +68,19 @@
// A Kaiser window is used because of its flexibility and the alpha is set to
// 3.5, since that sets a stop band attenuation of 40dB ensuring a fast
// transition.
-const float kLowpassCoeffs[kNumBands * kSparsity][kNumCoeffs] =
- {{-0.00047749f, -0.00496888f, +0.16547118f, +0.00425496f},
- {-0.00173287f, -0.01585778f, +0.14989004f, +0.00994113f},
- {-0.00304815f, -0.02536082f, +0.12154542f, +0.01157993f},
- {-0.00383509f, -0.02982767f, +0.08543175f, +0.00983212f},
- {-0.00346946f, -0.02587886f, +0.04760441f, +0.00607594f},
- {-0.00154717f, -0.01136076f, +0.01387458f, +0.00186353f},
- {+0.00186353f, +0.01387458f, -0.01136076f, -0.00154717f},
- {+0.00607594f, +0.04760441f, -0.02587886f, -0.00346946f},
- {+0.00983212f, +0.08543175f, -0.02982767f, -0.00383509f},
- {+0.01157993f, +0.12154542f, -0.02536082f, -0.00304815f},
- {+0.00994113f, +0.14989004f, -0.01585778f, -0.00173287f},
- {+0.00425496f, +0.16547118f, -0.00496888f, -0.00047749f}};
+const float kLowpassCoeffs[kNumBands * kSparsity][kNumCoeffs] = {
+ {-0.00047749f, -0.00496888f, +0.16547118f, +0.00425496f},
+ {-0.00173287f, -0.01585778f, +0.14989004f, +0.00994113f},
+ {-0.00304815f, -0.02536082f, +0.12154542f, +0.01157993f},
+ {-0.00383509f, -0.02982767f, +0.08543175f, +0.00983212f},
+ {-0.00346946f, -0.02587886f, +0.04760441f, +0.00607594f},
+ {-0.00154717f, -0.01136076f, +0.01387458f, +0.00186353f},
+ {+0.00186353f, +0.01387458f, -0.01136076f, -0.00154717f},
+ {+0.00607594f, +0.04760441f, -0.02587886f, -0.00346946f},
+ {+0.00983212f, +0.08543175f, -0.02982767f, -0.00383509f},
+ {+0.01157993f, +0.12154542f, -0.02536082f, -0.00304815f},
+ {+0.00994113f, +0.14989004f, -0.01585778f, -0.00173287f},
+ {+0.00425496f, +0.16547118f, -0.00496888f, -0.00047749f}};
// Downsamples |in| into |out|, taking one every |kNumbands| starting from
// |offset|. |split_length| is the |out| length. |in| has to be at least
@@ -150,8 +150,7 @@
Downsample(in, in_buffer_.size(), kNumBands - i - 1, &in_buffer_[0]);
for (size_t j = 0; j < kSparsity; ++j) {
const size_t offset = i + j * kNumBands;
- analysis_filters_[offset]->Filter(&in_buffer_[0],
- in_buffer_.size(),
+ analysis_filters_[offset]->Filter(&in_buffer_[0], in_buffer_.size(),
&out_buffer_[0]);
DownModulate(&out_buffer_[0], out_buffer_.size(), offset, out);
}
@@ -173,15 +172,13 @@
for (size_t j = 0; j < kSparsity; ++j) {
const size_t offset = i + j * kNumBands;
UpModulate(in, in_buffer_.size(), offset, &in_buffer_[0]);
- synthesis_filters_[offset]->Filter(&in_buffer_[0],
- in_buffer_.size(),
+ synthesis_filters_[offset]->Filter(&in_buffer_[0], in_buffer_.size(),
&out_buffer_[0]);
Upsample(&out_buffer_[0], out_buffer_.size(), i, out);
}
}
}
-
// Modulates |in| by |dct_modulation_| and accumulates it in each of the
// |kNumBands| bands of |out|. |offset| is the index in the period of the
// cosines used for modulation. |split_length| is the length of |in| and each
diff --git a/modules/audio_processing/transient/click_annotate.cc b/modules/audio_processing/transient/click_annotate.cc
index 1f01d01..ce646b5 100644
--- a/modules/audio_processing/transient/click_annotate.cc
+++ b/modules/audio_processing/transient/click_annotate.cc
@@ -73,9 +73,7 @@
// Read first buffer from the PCM test file.
size_t file_samples_read = ReadInt16FromFileToFloatBuffer(
- pcm_file.get(),
- audio_buffer_length,
- audio_buffer.get());
+ pcm_file.get(), audio_buffer_length, audio_buffer.get());
for (int time = 0; file_samples_read > 0; time += chunk_size_ms) {
// Pad the rest of the buffer with zeros.
for (size_t i = file_samples_read; i < audio_buffer_length; ++i) {
@@ -92,14 +90,12 @@
send_times.push_back(value);
// Read next buffer from the PCM test file.
- file_samples_read = ReadInt16FromFileToFloatBuffer(pcm_file.get(),
- audio_buffer_length,
- audio_buffer.get());
+ file_samples_read = ReadInt16FromFileToFloatBuffer(
+ pcm_file.get(), audio_buffer_length, audio_buffer.get());
}
- size_t floats_written = WriteFloatBufferToFile(dat_file.get(),
- send_times.size(),
- &send_times[0]);
+ size_t floats_written =
+ WriteFloatBufferToFile(dat_file.get(), send_times.size(), &send_times[0]);
if (floats_written == 0) {
printf("\nThe send times could not be written to DAT file\n\n");
diff --git a/modules/audio_processing/transient/common.h b/modules/audio_processing/transient/common.h
index 69546fc..63c9a7b 100644
--- a/modules/audio_processing/transient/common.h
+++ b/modules/audio_processing/transient/common.h
@@ -22,6 +22,6 @@
kSampleRate48kHz = 48000
};
-} // namespace ts
-} // namespace webrtc
+} // namespace ts
+} // namespace webrtc
#endif // MODULES_AUDIO_PROCESSING_TRANSIENT_COMMON_H_
diff --git a/modules/audio_processing/transient/daubechies_8_wavelet_coeffs.h b/modules/audio_processing/transient/daubechies_8_wavelet_coeffs.h
index 4de24e0..92233bf 100644
--- a/modules/audio_processing/transient/daubechies_8_wavelet_coeffs.h
+++ b/modules/audio_processing/transient/daubechies_8_wavelet_coeffs.h
@@ -19,44 +19,25 @@
const int kDaubechies8CoefficientsLength = 16;
-const float kDaubechies8HighPassCoefficients[kDaubechies8CoefficientsLength]
- = {
- -5.44158422430816093862e-02f,
- 3.12871590914465924627e-01f,
- -6.75630736298012846142e-01f,
- 5.85354683654869090148e-01f,
- 1.58291052560238926228e-02f,
- -2.84015542962428091389e-01f,
- -4.72484573997972536787e-04f,
- 1.28747426620186011803e-01f,
- 1.73693010020221083600e-02f,
- -4.40882539310647192377e-02f,
- -1.39810279170155156436e-02f,
- 8.74609404701565465445e-03f,
- 4.87035299301066034600e-03f,
- -3.91740372995977108837e-04f,
- -6.75449405998556772109e-04f,
- -1.17476784002281916305e-04f
-};
+const float kDaubechies8HighPassCoefficients[kDaubechies8CoefficientsLength] = {
+ -5.44158422430816093862e-02f, 3.12871590914465924627e-01f,
+ -6.75630736298012846142e-01f, 5.85354683654869090148e-01f,
+ 1.58291052560238926228e-02f, -2.84015542962428091389e-01f,
+ -4.72484573997972536787e-04f, 1.28747426620186011803e-01f,
+ 1.73693010020221083600e-02f, -4.40882539310647192377e-02f,
+ -1.39810279170155156436e-02f, 8.74609404701565465445e-03f,
+ 4.87035299301066034600e-03f, -3.91740372995977108837e-04f,
+ -6.75449405998556772109e-04f, -1.17476784002281916305e-04f};
const float kDaubechies8LowPassCoefficients[kDaubechies8CoefficientsLength] = {
- -1.17476784002281916305e-04f,
- 6.75449405998556772109e-04f,
- -3.91740372995977108837e-04f,
- -4.87035299301066034600e-03f,
- 8.74609404701565465445e-03f,
- 1.39810279170155156436e-02f,
- -4.40882539310647192377e-02f,
- -1.73693010020221083600e-02f,
- 1.28747426620186011803e-01f,
- 4.72484573997972536787e-04f,
- -2.84015542962428091389e-01f,
- -1.58291052560238926228e-02f,
- 5.85354683654869090148e-01f,
- 6.75630736298012846142e-01f,
- 3.12871590914465924627e-01f,
- 5.44158422430816093862e-02f
-};
+ -1.17476784002281916305e-04f, 6.75449405998556772109e-04f,
+ -3.91740372995977108837e-04f, -4.87035299301066034600e-03f,
+ 8.74609404701565465445e-03f, 1.39810279170155156436e-02f,
+ -4.40882539310647192377e-02f, -1.73693010020221083600e-02f,
+ 1.28747426620186011803e-01f, 4.72484573997972536787e-04f,
+ -2.84015542962428091389e-01f, -1.58291052560238926228e-02f,
+ 5.85354683654869090148e-01f, 6.75630736298012846142e-01f,
+ 3.12871590914465924627e-01f, 5.44158422430816093862e-02f};
} // namespace webrtc
diff --git a/modules/audio_processing/transient/dyadic_decimator.h b/modules/audio_processing/transient/dyadic_decimator.h
index 104f95d..e5b1961 100644
--- a/modules/audio_processing/transient/dyadic_decimator.h
+++ b/modules/audio_processing/transient/dyadic_decimator.h
@@ -44,7 +44,7 @@
// GetOutLengthToDyadicDecimate().
// Must be previously allocated.
// Returns the number of output samples, -1 on error.
-template<typename T>
+template <typename T>
static size_t DyadicDecimate(const T* in,
size_t in_length,
bool odd_sequence,
diff --git a/modules/audio_processing/transient/dyadic_decimator_unittest.cc b/modules/audio_processing/transient/dyadic_decimator_unittest.cc
index c407f47..3e65a7b 100644
--- a/modules/audio_processing/transient/dyadic_decimator_unittest.cc
+++ b/modules/audio_processing/transient/dyadic_decimator_unittest.cc
@@ -19,7 +19,7 @@
static const size_t kOutBufferLength = 3;
int16_t const test_buffer_even_len[] = {0, 1, 2, 3, 4, 5};
-int16_t const test_buffer_odd_len[] = {0, 1, 2, 3, 4};
+int16_t const test_buffer_odd_len[] = {0, 1, 2, 3, 4};
int16_t test_buffer_out[kOutBufferLength];
TEST(DyadicDecimatorTest, GetOutLengthToDyadicDecimate) {
@@ -29,30 +29,23 @@
EXPECT_EQ(2u, GetOutLengthToDyadicDecimate(5, true));
}
-
TEST(DyadicDecimatorTest, DyadicDecimateErrorValues) {
size_t out_samples = 0;
- out_samples = DyadicDecimate(static_cast<int16_t*>(NULL),
- kEvenBufferLength,
+ out_samples = DyadicDecimate(static_cast<int16_t*>(NULL), kEvenBufferLength,
false, // Even sequence.
- test_buffer_out,
- kOutBufferLength);
+ test_buffer_out, kOutBufferLength);
EXPECT_EQ(0u, out_samples);
- out_samples = DyadicDecimate(test_buffer_even_len,
- kEvenBufferLength,
+ out_samples = DyadicDecimate(test_buffer_even_len, kEvenBufferLength,
false, // Even sequence.
- static_cast<int16_t*>(NULL),
- kOutBufferLength);
+ static_cast<int16_t*>(NULL), kOutBufferLength);
EXPECT_EQ(0u, out_samples);
// Less than required |out_length|.
- out_samples = DyadicDecimate(test_buffer_even_len,
- kEvenBufferLength,
+ out_samples = DyadicDecimate(test_buffer_even_len, kEvenBufferLength,
false, // Even sequence.
- test_buffer_out,
- 2);
+ test_buffer_out, 2);
EXPECT_EQ(0u, out_samples);
}
@@ -60,11 +53,9 @@
size_t expected_out_samples =
GetOutLengthToDyadicDecimate(kEvenBufferLength, false);
- size_t out_samples = DyadicDecimate(test_buffer_even_len,
- kEvenBufferLength,
+ size_t out_samples = DyadicDecimate(test_buffer_even_len, kEvenBufferLength,
false, // Even sequence.
- test_buffer_out,
- kOutBufferLength);
+ test_buffer_out, kOutBufferLength);
EXPECT_EQ(expected_out_samples, out_samples);
@@ -77,11 +68,9 @@
size_t expected_out_samples =
GetOutLengthToDyadicDecimate(kEvenBufferLength, true);
- size_t out_samples = DyadicDecimate(test_buffer_even_len,
- kEvenBufferLength,
+ size_t out_samples = DyadicDecimate(test_buffer_even_len, kEvenBufferLength,
true, // Odd sequence.
- test_buffer_out,
- kOutBufferLength);
+ test_buffer_out, kOutBufferLength);
EXPECT_EQ(expected_out_samples, out_samples);
@@ -94,11 +83,9 @@
size_t expected_out_samples =
GetOutLengthToDyadicDecimate(kOddBufferLength, false);
- size_t out_samples = DyadicDecimate(test_buffer_odd_len,
- kOddBufferLength,
+ size_t out_samples = DyadicDecimate(test_buffer_odd_len, kOddBufferLength,
false, // Even sequence.
- test_buffer_out,
- kOutBufferLength);
+ test_buffer_out, kOutBufferLength);
EXPECT_EQ(expected_out_samples, out_samples);
@@ -111,11 +98,9 @@
size_t expected_out_samples =
GetOutLengthToDyadicDecimate(kOddBufferLength, true);
- size_t out_samples = DyadicDecimate(test_buffer_odd_len,
- kOddBufferLength,
+ size_t out_samples = DyadicDecimate(test_buffer_odd_len, kOddBufferLength,
true, // Odd sequence.
- test_buffer_out,
- kOutBufferLength);
+ test_buffer_out, kOutBufferLength);
EXPECT_EQ(expected_out_samples, out_samples);
diff --git a/modules/audio_processing/transient/file_utils_unittest.cc b/modules/audio_processing/transient/file_utils_unittest.cc
index d9880f9..05f8341 100644
--- a/modules/audio_processing/transient/file_utils_unittest.cc
+++ b/modules/audio_processing/transient/file_utils_unittest.cc
@@ -11,8 +11,8 @@
#include "modules/audio_processing/transient/file_utils.h"
#include <string.h>
-#include <string>
#include <memory>
+#include <string>
#include <vector>
#include "rtc_base/system/file_wrapper.h"
@@ -26,18 +26,18 @@
static const uint8_t kEBytesf[4] = {0x54, 0xF8, 0x2D, 0x40};
static const uint8_t kAvogadroBytesf[4] = {0x2F, 0x0C, 0xFF, 0x66};
-static const uint8_t kPiBytes[8] =
- {0x18, 0x2D, 0x44, 0x54, 0xFB, 0x21, 0x09, 0x40};
-static const uint8_t kEBytes[8] =
- {0x69, 0x57, 0x14, 0x8B, 0x0A, 0xBF, 0x05, 0x40};
-static const uint8_t kAvogadroBytes[8] =
- {0xF4, 0xBC, 0xA8, 0xDF, 0x85, 0xE1, 0xDF, 0x44};
+static const uint8_t kPiBytes[8] = {0x18, 0x2D, 0x44, 0x54,
+ 0xFB, 0x21, 0x09, 0x40};
+static const uint8_t kEBytes[8] = {0x69, 0x57, 0x14, 0x8B,
+ 0x0A, 0xBF, 0x05, 0x40};
+static const uint8_t kAvogadroBytes[8] = {0xF4, 0xBC, 0xA8, 0xDF,
+ 0x85, 0xE1, 0xDF, 0x44};
static const double kPi = 3.14159265358979323846;
static const double kE = 2.71828182845904523536;
static const double kAvogadro = 602214100000000000000000.0;
-class TransientFileUtilsTest: public ::testing::Test {
+class TransientFileUtilsTest : public ::testing::Test {
protected:
TransientFileUtilsTest()
: kTestFileName(
@@ -47,12 +47,10 @@
test::ResourcePath("audio_processing/transient/float-utils",
"dat")) {}
- ~TransientFileUtilsTest() override {
- CleanupTempFiles();
- }
+ ~TransientFileUtilsTest() override { CleanupTempFiles(); }
std::string CreateTempFilename(const std::string& dir,
- const std::string& prefix) {
+ const std::string& prefix) {
std::string filename = test::TempFilename(dir, prefix);
temp_filenames_.push_back(filename);
return filename;
@@ -170,9 +168,8 @@
const size_t kBufferLength = 12;
std::unique_ptr<int16_t[]> buffer(new int16_t[kBufferLength]);
- EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(),
- kBufferLength,
- buffer.get()));
+ EXPECT_EQ(kBufferLength,
+ ReadInt16BufferFromFile(file.get(), kBufferLength, buffer.get()));
EXPECT_EQ(22377, buffer[4]);
EXPECT_EQ(16389, buffer[7]);
EXPECT_EQ(17631, buffer[kBufferLength - 1]);
@@ -184,9 +181,9 @@
// int16s read.
const size_t kBufferLenghtLargerThanFile = kBufferLength * 2;
buffer.reset(new int16_t[kBufferLenghtLargerThanFile]);
- EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(),
- kBufferLenghtLargerThanFile,
- buffer.get()));
+ EXPECT_EQ(kBufferLength,
+ ReadInt16BufferFromFile(file.get(), kBufferLenghtLargerThanFile,
+ buffer.get()));
EXPECT_EQ(11544, buffer[0]);
EXPECT_EQ(22377, buffer[4]);
EXPECT_EQ(16389, buffer[7]);
@@ -211,9 +208,8 @@
const size_t kBufferLength = 12;
std::unique_ptr<float[]> buffer(new float[kBufferLength]);
- EXPECT_EQ(kBufferLength, ReadInt16FromFileToFloatBuffer(file.get(),
- kBufferLength,
- buffer.get()));
+ EXPECT_EQ(kBufferLength, ReadInt16FromFileToFloatBuffer(
+ file.get(), kBufferLength, buffer.get()));
EXPECT_DOUBLE_EQ(11544, buffer[0]);
EXPECT_DOUBLE_EQ(22377, buffer[4]);
@@ -228,9 +224,8 @@
const size_t kBufferLenghtLargerThanFile = kBufferLength * 2;
buffer.reset(new float[kBufferLenghtLargerThanFile]);
EXPECT_EQ(kBufferLength,
- ReadInt16FromFileToFloatBuffer(file.get(),
- kBufferLenghtLargerThanFile,
- buffer.get()));
+ ReadInt16FromFileToFloatBuffer(
+ file.get(), kBufferLenghtLargerThanFile, buffer.get()));
EXPECT_DOUBLE_EQ(11544, buffer[0]);
EXPECT_DOUBLE_EQ(22377, buffer[4]);
EXPECT_DOUBLE_EQ(16389, buffer[7]);
@@ -255,9 +250,8 @@
const size_t kBufferLength = 12;
std::unique_ptr<double[]> buffer(new double[kBufferLength]);
- EXPECT_EQ(kBufferLength, ReadInt16FromFileToDoubleBuffer(file.get(),
- kBufferLength,
- buffer.get()));
+ EXPECT_EQ(kBufferLength, ReadInt16FromFileToDoubleBuffer(
+ file.get(), kBufferLength, buffer.get()));
EXPECT_DOUBLE_EQ(11544, buffer[0]);
EXPECT_DOUBLE_EQ(22377, buffer[4]);
EXPECT_DOUBLE_EQ(16389, buffer[7]);
@@ -271,9 +265,8 @@
const size_t kBufferLenghtLargerThanFile = kBufferLength * 2;
buffer.reset(new double[kBufferLenghtLargerThanFile]);
EXPECT_EQ(kBufferLength,
- ReadInt16FromFileToDoubleBuffer(file.get(),
- kBufferLenghtLargerThanFile,
- buffer.get()));
+ ReadInt16FromFileToDoubleBuffer(
+ file.get(), kBufferLenghtLargerThanFile, buffer.get()));
EXPECT_DOUBLE_EQ(11544, buffer[0]);
EXPECT_DOUBLE_EQ(22377, buffer[4]);
EXPECT_DOUBLE_EQ(16389, buffer[7]);
@@ -297,9 +290,8 @@
const size_t kBufferLength = 3;
std::unique_ptr<float[]> buffer(new float[kBufferLength]);
- EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(),
- kBufferLength,
- buffer.get()));
+ EXPECT_EQ(kBufferLength,
+ ReadFloatBufferFromFile(file.get(), kBufferLength, buffer.get()));
EXPECT_FLOAT_EQ(kPi, buffer[0]);
EXPECT_FLOAT_EQ(kE, buffer[1]);
EXPECT_FLOAT_EQ(kAvogadro, buffer[2]);
@@ -311,9 +303,9 @@
// doubles read.
const size_t kBufferLenghtLargerThanFile = kBufferLength * 2;
buffer.reset(new float[kBufferLenghtLargerThanFile]);
- EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(),
- kBufferLenghtLargerThanFile,
- buffer.get()));
+ EXPECT_EQ(kBufferLength,
+ ReadFloatBufferFromFile(file.get(), kBufferLenghtLargerThanFile,
+ buffer.get()));
EXPECT_FLOAT_EQ(kPi, buffer[0]);
EXPECT_FLOAT_EQ(kE, buffer[1]);
EXPECT_FLOAT_EQ(kAvogadro, buffer[2]);
@@ -336,9 +328,8 @@
const size_t kBufferLength = 3;
std::unique_ptr<double[]> buffer(new double[kBufferLength]);
- EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(),
- kBufferLength,
- buffer.get()));
+ EXPECT_EQ(kBufferLength,
+ ReadDoubleBufferFromFile(file.get(), kBufferLength, buffer.get()));
EXPECT_DOUBLE_EQ(kPi, buffer[0]);
EXPECT_DOUBLE_EQ(kE, buffer[1]);
EXPECT_DOUBLE_EQ(kAvogadro, buffer[2]);
@@ -350,9 +341,9 @@
// doubles read.
const size_t kBufferLenghtLargerThanFile = kBufferLength * 2;
buffer.reset(new double[kBufferLenghtLargerThanFile]);
- EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(),
- kBufferLenghtLargerThanFile,
- buffer.get()));
+ EXPECT_EQ(kBufferLength,
+ ReadDoubleBufferFromFile(file.get(), kBufferLenghtLargerThanFile,
+ buffer.get()));
EXPECT_DOUBLE_EQ(kPi, buffer[0]);
EXPECT_DOUBLE_EQ(kE, buffer[1]);
EXPECT_DOUBLE_EQ(kAvogadro, buffer[2]);
@@ -366,8 +357,8 @@
TEST_F(TransientFileUtilsTest, MAYBE_WriteInt16BufferToFile) {
std::unique_ptr<FileWrapper> file(FileWrapper::Create());
- std::string kOutFileName = CreateTempFilename(test::OutputPath(),
- "utils_test");
+ std::string kOutFileName =
+ CreateTempFilename(test::OutputPath(), "utils_test");
file->OpenFile(kOutFileName.c_str(), false); // Write mode.
ASSERT_TRUE(file->is_open()) << "File could not be opened:\n"
@@ -381,8 +372,7 @@
written_buffer[1] = 2;
written_buffer[2] = 3;
- EXPECT_EQ(kBufferLength, WriteInt16BufferToFile(file.get(),
- kBufferLength,
+ EXPECT_EQ(kBufferLength, WriteInt16BufferToFile(file.get(), kBufferLength,
written_buffer.get()));
file->CloseFile();
@@ -391,11 +381,9 @@
ASSERT_TRUE(file->is_open()) << "File could not be opened:\n"
<< kOutFileName.c_str();
- EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(),
- kBufferLength,
+ EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(), kBufferLength,
read_buffer.get()));
- EXPECT_EQ(0, memcmp(written_buffer.get(),
- read_buffer.get(),
+ EXPECT_EQ(0, memcmp(written_buffer.get(), read_buffer.get(),
kBufferLength * sizeof(written_buffer[0])));
}
@@ -407,8 +395,8 @@
TEST_F(TransientFileUtilsTest, MAYBE_WriteFloatBufferToFile) {
std::unique_ptr<FileWrapper> file(FileWrapper::Create());
- std::string kOutFileName = CreateTempFilename(test::OutputPath(),
- "utils_test");
+ std::string kOutFileName =
+ CreateTempFilename(test::OutputPath(), "utils_test");
file->OpenFile(kOutFileName.c_str(), false); // Write mode.
ASSERT_TRUE(file->is_open()) << "File could not be opened:\n"
@@ -422,8 +410,7 @@
written_buffer[1] = static_cast<float>(kE);
written_buffer[2] = static_cast<float>(kAvogadro);
- EXPECT_EQ(kBufferLength, WriteFloatBufferToFile(file.get(),
- kBufferLength,
+ EXPECT_EQ(kBufferLength, WriteFloatBufferToFile(file.get(), kBufferLength,
written_buffer.get()));
file->CloseFile();
@@ -432,11 +419,9 @@
ASSERT_TRUE(file->is_open()) << "File could not be opened:\n"
<< kOutFileName.c_str();
- EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(),
- kBufferLength,
+ EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(), kBufferLength,
read_buffer.get()));
- EXPECT_EQ(0, memcmp(written_buffer.get(),
- read_buffer.get(),
+ EXPECT_EQ(0, memcmp(written_buffer.get(), read_buffer.get(),
kBufferLength * sizeof(written_buffer[0])));
}
@@ -448,8 +433,8 @@
TEST_F(TransientFileUtilsTest, MAYBE_WriteDoubleBufferToFile) {
std::unique_ptr<FileWrapper> file(FileWrapper::Create());
- std::string kOutFileName = CreateTempFilename(test::OutputPath(),
- "utils_test");
+ std::string kOutFileName =
+ CreateTempFilename(test::OutputPath(), "utils_test");
file->OpenFile(kOutFileName.c_str(), false); // Write mode.
ASSERT_TRUE(file->is_open()) << "File could not be opened:\n"
@@ -463,8 +448,7 @@
written_buffer[1] = kE;
written_buffer[2] = kAvogadro;
- EXPECT_EQ(kBufferLength, WriteDoubleBufferToFile(file.get(),
- kBufferLength,
+ EXPECT_EQ(kBufferLength, WriteDoubleBufferToFile(file.get(), kBufferLength,
written_buffer.get()));
file->CloseFile();
@@ -473,11 +457,9 @@
ASSERT_TRUE(file->is_open()) << "File could not be opened:\n"
<< kOutFileName.c_str();
- EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(),
- kBufferLength,
+ EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(), kBufferLength,
read_buffer.get()));
- EXPECT_EQ(0, memcmp(written_buffer.get(),
- read_buffer.get(),
+ EXPECT_EQ(0, memcmp(written_buffer.get(), read_buffer.get(),
kBufferLength * sizeof(written_buffer[0])));
}
@@ -501,9 +483,8 @@
// Tests with file not opened.
EXPECT_EQ(0u, ReadInt16BufferFromFile(file.get(), 1, int16_buffer.get()));
- EXPECT_EQ(0u, ReadInt16FromFileToDoubleBuffer(file.get(),
- 1,
- double_buffer.get()));
+ EXPECT_EQ(
+ 0u, ReadInt16FromFileToDoubleBuffer(file.get(), 1, double_buffer.get()));
EXPECT_EQ(0u, ReadDoubleBufferFromFile(file.get(), 1, double_buffer.get()));
EXPECT_EQ(0u, WriteInt16BufferToFile(file.get(), 1, int16_buffer.get()));
EXPECT_EQ(0u, WriteDoubleBufferToFile(file.get(), 1, double_buffer.get()));
@@ -518,9 +499,8 @@
EXPECT_EQ(0u, ReadInt16FromFileToDoubleBuffer(NULL, 1, double_buffer.get()));
EXPECT_EQ(0u, ReadInt16FromFileToDoubleBuffer(file.get(), 1, NULL));
- EXPECT_EQ(0u, ReadInt16FromFileToDoubleBuffer(file.get(),
- 0,
- double_buffer.get()));
+ EXPECT_EQ(
+ 0u, ReadInt16FromFileToDoubleBuffer(file.get(), 0, double_buffer.get()));
EXPECT_EQ(0u, ReadDoubleBufferFromFile(NULL, 1, double_buffer.get()));
EXPECT_EQ(0u, ReadDoubleBufferFromFile(file.get(), 1, NULL));
@@ -536,4 +516,3 @@
}
} // namespace webrtc
-
diff --git a/modules/audio_processing/transient/moving_moments.cc b/modules/audio_processing/transient/moving_moments.cc
index 46b16b8..4be4d6a 100644
--- a/modules/audio_processing/transient/moving_moments.cc
+++ b/modules/audio_processing/transient/moving_moments.cc
@@ -18,10 +18,7 @@
namespace webrtc {
MovingMoments::MovingMoments(size_t length)
- : length_(length),
- queue_(),
- sum_(0.0),
- sum_of_squares_(0.0) {
+ : length_(length), queue_(), sum_(0.0), sum_of_squares_(0.0) {
RTC_DCHECK_GT(length, 0);
for (size_t i = 0; i < length; ++i) {
queue_.push(0.0);
@@ -30,8 +27,10 @@
MovingMoments::~MovingMoments() {}
-void MovingMoments::CalculateMoments(const float* in, size_t in_length,
- float* first, float* second) {
+void MovingMoments::CalculateMoments(const float* in,
+ size_t in_length,
+ float* first,
+ float* second) {
RTC_DCHECK(in);
RTC_DCHECK_GT(in_length, 0);
RTC_DCHECK(first);
diff --git a/modules/audio_processing/transient/moving_moments.h b/modules/audio_processing/transient/moving_moments.h
index f1b3e38..6dc0520 100644
--- a/modules/audio_processing/transient/moving_moments.h
+++ b/modules/audio_processing/transient/moving_moments.h
@@ -33,8 +33,10 @@
// Calculates the new values using |in|. Results will be in the out buffers.
// |first| and |second| must be allocated with at least |in_length|.
- void CalculateMoments(const float* in, size_t in_length,
- float* first, float* second);
+ void CalculateMoments(const float* in,
+ size_t in_length,
+ float* first,
+ float* second);
private:
size_t length_;
@@ -48,5 +50,4 @@
} // namespace webrtc
-
#endif // MODULES_AUDIO_PROCESSING_TRANSIENT_MOVING_MOMENTS_H_
diff --git a/modules/audio_processing/transient/moving_moments_unittest.cc b/modules/audio_processing/transient/moving_moments_unittest.cc
index 057bc45..b0e613e 100644
--- a/modules/audio_processing/transient/moving_moments_unittest.cc
+++ b/modules/audio_processing/transient/moving_moments_unittest.cc
@@ -26,7 +26,8 @@
virtual void SetUp();
// Calls CalculateMoments and verifies that it produces the expected
// outputs.
- void CalculateMomentsAndVerify(const float* input, size_t input_length,
+ void CalculateMomentsAndVerify(const float* input,
+ size_t input_length,
const float* expected_mean,
const float* expected_mean_squares);
@@ -42,14 +43,13 @@
}
void MovingMomentsTest::CalculateMomentsAndVerify(
- const float* input, size_t input_length,
+ const float* input,
+ size_t input_length,
const float* expected_mean,
const float* expected_mean_squares) {
ASSERT_LE(input_length, kMaxOutputLength);
- moving_moments_->CalculateMoments(input,
- input_length,
- output_mean_,
+ moving_moments_->CalculateMoments(input, input_length, output_mean_,
output_mean_squares_);
for (size_t i = 1; i < input_length; ++i) {
@@ -73,10 +73,10 @@
const float kInput[] = {5.f, 5.f, 5.f, 5.f, 5.f, 5.f, 5.f, 5.f, 5.f, 5.f};
const size_t kInputLength = sizeof(kInput) / sizeof(kInput[0]);
- const float expected_mean[kInputLength] =
- {1.f, 2.f, 3.f, 4.f, 5.f, 5.f, 5.f, 5.f, 5.f, 5.f};
- const float expected_mean_squares[kInputLength] =
- {5.f, 10.f, 15.f, 20.f, 25.f, 25.f, 25.f, 25.f, 25.f, 25.f};
+ const float expected_mean[kInputLength] = {1.f, 2.f, 3.f, 4.f, 5.f,
+ 5.f, 5.f, 5.f, 5.f, 5.f};
+ const float expected_mean_squares[kInputLength] = {
+ 5.f, 10.f, 15.f, 20.f, 25.f, 25.f, 25.f, 25.f, 25.f, 25.f};
CalculateMomentsAndVerify(kInput, kInputLength, expected_mean,
expected_mean_squares);
@@ -86,24 +86,23 @@
const float kInput[] = {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f};
const size_t kInputLength = sizeof(kInput) / sizeof(kInput[0]);
- const float expected_mean[kInputLength] =
- {0.2f, 0.6f, 1.2f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f};
- const float expected_mean_squares[kInputLength] =
- {0.2f, 1.f, 2.8f, 6.f, 11.f, 18.f, 27.f, 38.f, 51.f};
+ const float expected_mean[kInputLength] = {0.2f, 0.6f, 1.2f, 2.f, 3.f,
+ 4.f, 5.f, 6.f, 7.f};
+ const float expected_mean_squares[kInputLength] = {
+ 0.2f, 1.f, 2.8f, 6.f, 11.f, 18.f, 27.f, 38.f, 51.f};
CalculateMomentsAndVerify(kInput, kInputLength, expected_mean,
expected_mean_squares);
}
TEST_F(MovingMomentsTest, CorrectMomentsOfADecreasingBuffer) {
- const float kInput[] =
- {-1.f, -2.f, -3.f, -4.f, -5.f, -6.f, -7.f, -8.f, -9.f};
+ const float kInput[] = {-1.f, -2.f, -3.f, -4.f, -5.f, -6.f, -7.f, -8.f, -9.f};
const size_t kInputLength = sizeof(kInput) / sizeof(kInput[0]);
- const float expected_mean[kInputLength] =
- {-0.2f, -0.6f, -1.2f, -2.f, -3.f, -4.f, -5.f, -6.f, -7.f};
- const float expected_mean_squares[kInputLength] =
- {0.2f, 1.f, 2.8f, 6.f, 11.f, 18.f, 27.f, 38.f, 51.f};
+ const float expected_mean[kInputLength] = {-0.2f, -0.6f, -1.2f, -2.f, -3.f,
+ -4.f, -5.f, -6.f, -7.f};
+ const float expected_mean_squares[kInputLength] = {
+ 0.2f, 1.f, 2.8f, 6.f, 11.f, 18.f, 27.f, 38.f, 51.f};
CalculateMomentsAndVerify(kInput, kInputLength, expected_mean,
expected_mean_squares);
@@ -112,76 +111,78 @@
TEST_F(MovingMomentsTest, CorrectMomentsOfAZeroMeanSequence) {
const size_t kMovingMomentsBufferLength = 4;
moving_moments_.reset(new MovingMoments(kMovingMomentsBufferLength));
- const float kInput[] =
- {1.f, -1.f, 1.f, -1.f, 1.f, -1.f, 1.f, -1.f, 1.f, -1.f};
+ const float kInput[] = {1.f, -1.f, 1.f, -1.f, 1.f,
+ -1.f, 1.f, -1.f, 1.f, -1.f};
const size_t kInputLength = sizeof(kInput) / sizeof(kInput[0]);
- const float expected_mean[kInputLength] =
- {0.25f, 0.f, 0.25f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f};
- const float expected_mean_squares[kInputLength] =
- {0.25f, 0.5f, 0.75f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f};
+ const float expected_mean[kInputLength] = {0.25f, 0.f, 0.25f, 0.f, 0.f,
+ 0.f, 0.f, 0.f, 0.f, 0.f};
+ const float expected_mean_squares[kInputLength] = {
+ 0.25f, 0.5f, 0.75f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f};
CalculateMomentsAndVerify(kInput, kInputLength, expected_mean,
expected_mean_squares);
}
TEST_F(MovingMomentsTest, CorrectMomentsOfAnArbitraryBuffer) {
- const float kInput[] =
- {0.2f, 0.3f, 0.5f, 0.7f, 0.11f, 0.13f, 0.17f, 0.19f, 0.23f};
+ const float kInput[] = {0.2f, 0.3f, 0.5f, 0.7f, 0.11f,
+ 0.13f, 0.17f, 0.19f, 0.23f};
const size_t kInputLength = sizeof(kInput) / sizeof(kInput[0]);
- const float expected_mean[kInputLength] =
- {0.04f, 0.1f, 0.2f, 0.34f, 0.362f, 0.348f, 0.322f, 0.26f, 0.166f};
- const float expected_mean_squares[kInputLength] =
- {0.008f, 0.026f, 0.076f, 0.174f, 0.1764f, 0.1718f, 0.1596f, 0.1168f,
- 0.0294f};
+ const float expected_mean[kInputLength] = {
+ 0.04f, 0.1f, 0.2f, 0.34f, 0.362f, 0.348f, 0.322f, 0.26f, 0.166f};
+ const float expected_mean_squares[kInputLength] = {0.008f, 0.026f, 0.076f,
+ 0.174f, 0.1764f, 0.1718f,
+ 0.1596f, 0.1168f, 0.0294f};
CalculateMomentsAndVerify(kInput, kInputLength, expected_mean,
expected_mean_squares);
}
TEST_F(MovingMomentsTest, MutipleCalculateMomentsCalls) {
- const float kInputFirstCall[] =
- {0.2f, 0.3f, 0.5f, 0.7f, 0.11f, 0.13f, 0.17f, 0.19f, 0.23f};
- const size_t kInputFirstCallLength = sizeof(kInputFirstCall) /
- sizeof(kInputFirstCall[0]);
+ const float kInputFirstCall[] = {0.2f, 0.3f, 0.5f, 0.7f, 0.11f,
+ 0.13f, 0.17f, 0.19f, 0.23f};
+ const size_t kInputFirstCallLength =
+ sizeof(kInputFirstCall) / sizeof(kInputFirstCall[0]);
const float kInputSecondCall[] = {0.29f, 0.31f};
- const size_t kInputSecondCallLength = sizeof(kInputSecondCall) /
- sizeof(kInputSecondCall[0]);
+ const size_t kInputSecondCallLength =
+ sizeof(kInputSecondCall) / sizeof(kInputSecondCall[0]);
const float kInputThirdCall[] = {0.37f, 0.41f, 0.43f, 0.47f};
- const size_t kInputThirdCallLength = sizeof(kInputThirdCall) /
- sizeof(kInputThirdCall[0]);
+ const size_t kInputThirdCallLength =
+ sizeof(kInputThirdCall) / sizeof(kInputThirdCall[0]);
- const float expected_mean_first_call[kInputFirstCallLength] =
- {0.04f, 0.1f, 0.2f, 0.34f, 0.362f, 0.348f, 0.322f, 0.26f, 0.166f};
- const float expected_mean_squares_first_call[kInputFirstCallLength] =
- {0.008f, 0.026f, 0.076f, 0.174f, 0.1764f, 0.1718f, 0.1596f, 0.1168f,
- 0.0294f};
+ const float expected_mean_first_call[kInputFirstCallLength] = {
+ 0.04f, 0.1f, 0.2f, 0.34f, 0.362f, 0.348f, 0.322f, 0.26f, 0.166f};
+ const float expected_mean_squares_first_call[kInputFirstCallLength] = {
+ 0.008f, 0.026f, 0.076f, 0.174f, 0.1764f,
+ 0.1718f, 0.1596f, 0.1168f, 0.0294f};
- const float expected_mean_second_call[kInputSecondCallLength] =
- {0.202f, 0.238f};
- const float expected_mean_squares_second_call[kInputSecondCallLength] =
- {0.0438f, 0.0596f};
+ const float expected_mean_second_call[kInputSecondCallLength] = {0.202f,
+ 0.238f};
+ const float expected_mean_squares_second_call[kInputSecondCallLength] = {
+ 0.0438f, 0.0596f};
- const float expected_mean_third_call[kInputThirdCallLength] =
- {0.278f, 0.322f, 0.362f, 0.398f};
- const float expected_mean_squares_third_call[kInputThirdCallLength] =
- {0.0812f, 0.1076f, 0.134f, 0.1614f};
+ const float expected_mean_third_call[kInputThirdCallLength] = {
+ 0.278f, 0.322f, 0.362f, 0.398f};
+ const float expected_mean_squares_third_call[kInputThirdCallLength] = {
+ 0.0812f, 0.1076f, 0.134f, 0.1614f};
CalculateMomentsAndVerify(kInputFirstCall, kInputFirstCallLength,
- expected_mean_first_call, expected_mean_squares_first_call);
+ expected_mean_first_call,
+ expected_mean_squares_first_call);
CalculateMomentsAndVerify(kInputSecondCall, kInputSecondCallLength,
- expected_mean_second_call, expected_mean_squares_second_call);
+ expected_mean_second_call,
+ expected_mean_squares_second_call);
CalculateMomentsAndVerify(kInputThirdCall, kInputThirdCallLength,
- expected_mean_third_call, expected_mean_squares_third_call);
+ expected_mean_third_call,
+ expected_mean_squares_third_call);
}
-TEST_F(MovingMomentsTest,
- VerifySampleBasedVsBlockBasedCalculation) {
- const float kInput[] =
- {0.2f, 0.3f, 0.5f, 0.7f, 0.11f, 0.13f, 0.17f, 0.19f, 0.23f};
+TEST_F(MovingMomentsTest, VerifySampleBasedVsBlockBasedCalculation) {
+ const float kInput[] = {0.2f, 0.3f, 0.5f, 0.7f, 0.11f,
+ 0.13f, 0.17f, 0.19f, 0.23f};
const size_t kInputLength = sizeof(kInput) / sizeof(kInput[0]);
float output_mean_block_based[kInputLength];
@@ -190,17 +191,16 @@
float output_mean_sample_based;
float output_mean_squares_sample_based;
- moving_moments_->CalculateMoments(
- kInput, kInputLength, output_mean_block_based,
- output_mean_squares_block_based);
+ moving_moments_->CalculateMoments(kInput, kInputLength,
+ output_mean_block_based,
+ output_mean_squares_block_based);
moving_moments_.reset(new MovingMoments(kMovingMomentsBufferLength));
for (size_t i = 0; i < kInputLength; ++i) {
- moving_moments_->CalculateMoments(
- &kInput[i], 1, &output_mean_sample_based,
- &output_mean_squares_sample_based);
+ moving_moments_->CalculateMoments(&kInput[i], 1, &output_mean_sample_based,
+ &output_mean_squares_sample_based);
EXPECT_FLOAT_EQ(output_mean_block_based[i], output_mean_sample_based);
EXPECT_FLOAT_EQ(output_mean_squares_block_based[i],
- output_mean_squares_sample_based);
+ output_mean_squares_sample_based);
}
}
diff --git a/modules/audio_processing/transient/transient_detector.cc b/modules/audio_processing/transient/transient_detector.cc
index 1bb6f9f..c3bf282 100644
--- a/modules/audio_processing/transient/transient_detector.cc
+++ b/modules/audio_processing/transient/transient_detector.cc
@@ -51,8 +51,7 @@
wpd_tree_.reset(new WPDTree(samples_per_chunk_,
kDaubechies8HighPassCoefficients,
kDaubechies8LowPassCoefficients,
- kDaubechies8CoefficientsLength,
- kLevels));
+ kDaubechies8CoefficientsLength, kLevels));
for (size_t i = 0; i < kLeaves; ++i) {
moving_moments_[i].reset(
new MovingMoments(samples_per_transient / kLeaves));
@@ -86,8 +85,7 @@
for (size_t i = 0; i < kLeaves; ++i) {
WPDNode* leaf = wpd_tree_->NodeAt(kLevels, i);
- moving_moments_[i]->CalculateMoments(leaf->data(),
- tree_leaves_data_length_,
+ moving_moments_[i]->CalculateMoments(leaf->data(), tree_leaves_data_length_,
first_moments_.get(),
second_moments_.get());
@@ -127,8 +125,9 @@
const float kVerticalScaling = 0.5f;
const float kVerticalShift = 1.f;
- result = (cos(result * horizontal_scaling + kHorizontalShift)
- + kVerticalShift) * kVerticalScaling;
+ result =
+ (cos(result * horizontal_scaling + kHorizontalShift) + kVerticalShift) *
+ kVerticalScaling;
result *= result;
}
diff --git a/modules/audio_processing/transient/transient_detector_unittest.cc b/modules/audio_processing/transient/transient_detector_unittest.cc
index 8f60954..69a669f 100644
--- a/modules/audio_processing/transient/transient_detector_unittest.cc
+++ b/modules/audio_processing/transient/transient_detector_unittest.cc
@@ -23,8 +23,7 @@
namespace webrtc {
-static const int kSampleRatesHz[] = {ts::kSampleRate8kHz,
- ts::kSampleRate16kHz,
+static const int kSampleRatesHz[] = {ts::kSampleRate8kHz, ts::kSampleRate16kHz,
ts::kSampleRate32kHz,
ts::kSampleRate48kHz};
static const size_t kNumberOfSampleRates =
@@ -57,7 +56,7 @@
bool file_opened = detect_file->is_open();
ASSERT_TRUE(file_opened) << "File could not be opened.\n"
- << detect_file_name.str().c_str();
+ << detect_file_name.str().c_str();
// Prepare audio file.
std::stringstream audio_file_name;
@@ -80,8 +79,7 @@
size_t frames_read = 0;
- while (ReadInt16FromFileToFloatBuffer(audio_file.get(),
- buffer_length,
+ while (ReadInt16FromFileToFloatBuffer(audio_file.get(), buffer_length,
buffer.get()) == buffer_length) {
++frames_read;
@@ -92,8 +90,8 @@
<< "Detect test file is malformed.\n";
// Compare results with data from the matlab test file.
- EXPECT_NEAR(file_value, detector_value, kTolerance) << "Frame: "
- << frames_read;
+ EXPECT_NEAR(file_value, detector_value, kTolerance)
+ << "Frame: " << frames_read;
}
detect_file->CloseFile();
diff --git a/modules/audio_processing/transient/transient_suppression_test.cc b/modules/audio_processing/transient/transient_suppression_test.cc
index 8512e01..00e1989 100644
--- a/modules/audio_processing/transient/transient_suppression_test.cc
+++ b/modules/audio_processing/transient/transient_suppression_test.cc
@@ -10,8 +10,8 @@
#include "modules/audio_processing/transient/transient_suppressor.h"
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <memory>
@@ -36,9 +36,7 @@
10,
"Time between each chunk of samples in milliseconds.");
-DEFINE_int(sample_rate_hz,
- 16000,
- "Sampling frequency of the signal in Hertz.");
+DEFINE_int(sample_rate_hz, 16000, "Sampling frequency of the signal in Hertz.");
DEFINE_int(detection_rate_hz,
0,
"Sampling frequency of the detection signal in Hertz.");
@@ -79,9 +77,7 @@
tmpbuf.reset(new int16_t[num_channels * audio_buffer_size]);
read_ptr = tmpbuf.get();
}
- if (fread(read_ptr,
- sizeof(*read_ptr),
- num_channels * audio_buffer_size,
+ if (fread(read_ptr, sizeof(*read_ptr), num_channels * audio_buffer_size,
in_file) != num_channels * audio_buffer_size) {
return false;
}
@@ -104,8 +100,8 @@
}
if (reference_file) {
std::unique_ptr<int16_t[]> ibuf(new int16_t[audio_buffer_size]);
- if (fread(ibuf.get(), sizeof(ibuf[0]), audio_buffer_size, reference_file)
- != audio_buffer_size)
+ if (fread(ibuf.get(), sizeof(ibuf[0]), audio_buffer_size, reference_file) !=
+ audio_buffer_size)
return false;
S16ToFloat(ibuf.get(), audio_buffer_size, reference_buffer);
}
@@ -163,8 +159,8 @@
Agc agc;
TransientSuppressor suppressor;
- suppressor.Initialize(
- FLAG_sample_rate_hz, detection_rate_hz, FLAG_num_channels);
+ suppressor.Initialize(FLAG_sample_rate_hz, detection_rate_hz,
+ FLAG_num_channels);
const size_t audio_buffer_size =
FLAG_chunk_size_ms * FLAG_sample_rate_hz / 1000;
@@ -184,38 +180,27 @@
if (reference_file)
reference_buffer.reset(new float[audio_buffer_size]);
- while (ReadBuffers(in_file,
- audio_buffer_size,
- FLAG_num_channels,
- audio_buffer_i.get(),
- detection_file,
- detection_buffer_size,
- detection_buffer.get(),
- reference_file,
- reference_buffer.get())) {
- agc.Process(audio_buffer_i.get(),
- static_cast<int>(audio_buffer_size),
+ while (ReadBuffers(in_file, audio_buffer_size, FLAG_num_channels,
+ audio_buffer_i.get(), detection_file,
+ detection_buffer_size, detection_buffer.get(),
+ reference_file, reference_buffer.get())) {
+ agc.Process(audio_buffer_i.get(), static_cast<int>(audio_buffer_size),
FLAG_sample_rate_hz);
for (size_t i = 0; i < FLAG_num_channels * audio_buffer_size; ++i) {
audio_buffer_f[i] = audio_buffer_i[i];
}
- ASSERT_EQ(0,
- suppressor.Suppress(audio_buffer_f.get(),
- audio_buffer_size,
- FLAG_num_channels,
- detection_buffer.get(),
- detection_buffer_size,
- reference_buffer.get(),
- audio_buffer_size,
- agc.voice_probability(),
- true))
+ ASSERT_EQ(0, suppressor.Suppress(audio_buffer_f.get(), audio_buffer_size,
+ FLAG_num_channels, detection_buffer.get(),
+ detection_buffer_size,
+ reference_buffer.get(), audio_buffer_size,
+ agc.voice_probability(), true))
<< "The transient suppressor could not suppress the frame";
// Write result to out file.
- WritePCM(
- out_file, audio_buffer_size, FLAG_num_channels, audio_buffer_f.get());
+ WritePCM(out_file, audio_buffer_size, FLAG_num_channels,
+ audio_buffer_f.get());
}
fclose(in_file);
@@ -231,8 +216,8 @@
} // namespace webrtc
int main(int argc, char* argv[]) {
- if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) ||
- FLAG_help || argc != 1) {
+ if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) || FLAG_help ||
+ argc != 1) {
printf("%s", webrtc::kUsage);
if (FLAG_help) {
rtc::FlagList::Print(nullptr, false);
diff --git a/modules/audio_processing/transient/transient_suppressor.cc b/modules/audio_processing/transient/transient_suppressor.cc
index 9bbd7d9..28eb666 100644
--- a/modules/audio_processing/transient/transient_suppressor.cc
+++ b/modules/audio_processing/transient/transient_suppressor.cc
@@ -60,8 +60,7 @@
use_hard_restoration_(false),
chunks_since_voice_change_(0),
seed_(182),
- using_reference_(false) {
-}
+ using_reference_(false) {}
TransientSuppressor::~TransientSuppressor() {}
@@ -110,17 +109,14 @@
RTC_DCHECK_GE(complex_analysis_length_, kMaxVoiceBin);
num_channels_ = num_channels;
in_buffer_.reset(new float[analysis_length_ * num_channels_]);
- memset(in_buffer_.get(),
- 0,
+ memset(in_buffer_.get(), 0,
analysis_length_ * num_channels_ * sizeof(in_buffer_[0]));
detection_length_ = detection_rate_hz * ts::kChunkSizeMs / 1000;
detection_buffer_.reset(new float[detection_length_]);
- memset(detection_buffer_.get(),
- 0,
+ memset(detection_buffer_.get(), 0,
detection_length_ * sizeof(detection_buffer_[0]));
out_buffer_.reset(new float[analysis_length_ * num_channels_]);
- memset(out_buffer_.get(),
- 0,
+ memset(out_buffer_.get(), 0,
analysis_length_ * num_channels_ * sizeof(out_buffer_[0]));
// ip[0] must be zero to trigger initialization using rdft().
size_t ip_length = 2 + sqrtf(analysis_length_);
@@ -129,14 +125,12 @@
wfft_.reset(new float[complex_analysis_length_ - 1]);
memset(wfft_.get(), 0, (complex_analysis_length_ - 1) * sizeof(wfft_[0]));
spectral_mean_.reset(new float[complex_analysis_length_ * num_channels_]);
- memset(spectral_mean_.get(),
- 0,
+ memset(spectral_mean_.get(), 0,
complex_analysis_length_ * num_channels_ * sizeof(spectral_mean_[0]));
fft_buffer_.reset(new float[analysis_length_ + 2]);
memset(fft_buffer_.get(), 0, (analysis_length_ + 2) * sizeof(fft_buffer_[0]));
magnitudes_.reset(new float[complex_analysis_length_]);
- memset(magnitudes_.get(),
- 0,
+ memset(magnitudes_.get(), 0,
complex_analysis_length_ * sizeof(magnitudes_[0]));
mean_factor_.reset(new float[complex_analysis_length_]);
@@ -190,8 +184,8 @@
detection_data = &in_buffer_[buffer_delay_];
}
- float detector_result = detector_->Detect(
- detection_data, detection_length, reference_data, reference_length);
+ float detector_result = detector_->Detect(detection_data, detection_length,
+ reference_data, reference_length);
if (detector_result < 0) {
return -1;
}
@@ -247,8 +241,8 @@
fft_buffer_[1] = 0.f;
for (size_t i = 0; i < complex_analysis_length_; ++i) {
- magnitudes_[i] = ComplexMagnitude(fft_buffer_[i * 2],
- fft_buffer_[i * 2 + 1]);
+ magnitudes_[i] =
+ ComplexMagnitude(fft_buffer_[i * 2], fft_buffer_[i * 2 + 1]);
}
// Restore audio if necessary.
if (suppression_enabled_) {
@@ -269,11 +263,7 @@
// Put R[n/2] back in fft_buffer_[1].
fft_buffer_[1] = fft_buffer_[analysis_length_];
- WebRtc_rdft(analysis_length_,
- -1,
- fft_buffer_.get(),
- ip_.get(),
- wfft_.get());
+ WebRtc_rdft(analysis_length_, -1, fft_buffer_.get(), ip_.get(), wfft_.get());
const float fft_scaling = 2.f / analysis_length_;
for (size_t i = 0; i < analysis_length_; ++i) {
@@ -301,8 +291,7 @@
keypress_counter_ = 0;
}
- if (detection_enabled_ &&
- ++chunks_since_keypress_ > kChunksUntilNotTyping) {
+ if (detection_enabled_ && ++chunks_since_keypress_ > kChunksUntilNotTyping) {
if (suppression_enabled_) {
RTC_LOG(LS_INFO) << "[ts] Transient suppression is now disabled.";
}
@@ -337,26 +326,22 @@
// |detection_enabled_| is updated by UpdateKeypress().
void TransientSuppressor::UpdateBuffers(float* data) {
// TODO(aluebs): Change to ring buffer.
- memmove(in_buffer_.get(),
- &in_buffer_[data_length_],
+ memmove(in_buffer_.get(), &in_buffer_[data_length_],
(buffer_delay_ + (num_channels_ - 1) * analysis_length_) *
sizeof(in_buffer_[0]));
// Copy new chunk to buffer.
for (int i = 0; i < num_channels_; ++i) {
memcpy(&in_buffer_[buffer_delay_ + i * analysis_length_],
- &data[i * data_length_],
- data_length_ * sizeof(*data));
+ &data[i * data_length_], data_length_ * sizeof(*data));
}
if (detection_enabled_) {
// Shift previous chunk in out buffer.
- memmove(out_buffer_.get(),
- &out_buffer_[data_length_],
+ memmove(out_buffer_.get(), &out_buffer_[data_length_],
(buffer_delay_ + (num_channels_ - 1) * analysis_length_) *
sizeof(out_buffer_[0]));
// Initialize new chunk in out buffer.
for (int i = 0; i < num_channels_; ++i) {
- memset(&out_buffer_[buffer_delay_ + i * analysis_length_],
- 0,
+ memset(&out_buffer_[buffer_delay_ + i * analysis_length_], 0,
data_length_ * sizeof(out_buffer_[0]));
}
}
@@ -375,7 +360,7 @@
if (magnitudes_[i] > spectral_mean[i] && magnitudes_[i] > 0) {
// RandU() generates values on [0, int16::max()]
const float phase = 2 * ts::kPi * WebRtcSpl_RandU(&seed_) /
- std::numeric_limits<int16_t>::max();
+ std::numeric_limits<int16_t>::max();
const float scaled_mean = detector_result * spectral_mean[i];
fft_buffer_[i * 2] = (1 - detector_result) * fft_buffer_[i * 2] +
diff --git a/modules/audio_processing/transient/wpd_node.cc b/modules/audio_processing/transient/wpd_node.cc
index 20d6a90..2e0ee7e 100644
--- a/modules/audio_processing/transient/wpd_node.cc
+++ b/modules/audio_processing/transient/wpd_node.cc
@@ -23,13 +23,12 @@
WPDNode::WPDNode(size_t length,
const float* coefficients,
size_t coefficients_length)
- : // The data buffer has parent data length to be able to contain and filter
- // it.
+ : // The data buffer has parent data length to be able to contain and
+ // filter it.
data_(new float[2 * length + 1]),
length_(length),
- filter_(CreateFirFilter(coefficients,
- coefficients_length,
- 2 * length + 1)) {
+ filter_(
+ CreateFirFilter(coefficients, coefficients_length, 2 * length + 1)) {
RTC_DCHECK_GT(length, 0);
RTC_DCHECK(coefficients);
RTC_DCHECK_GT(coefficients_length, 0);
@@ -48,8 +47,8 @@
// Decimate data.
const bool kOddSequence = true;
- size_t output_samples = DyadicDecimate(
- data_.get(), parent_data_length, kOddSequence, data_.get(), length_);
+ size_t output_samples = DyadicDecimate(data_.get(), parent_data_length,
+ kOddSequence, data_.get(), length_);
if (output_samples != length_) {
return -1;
}
diff --git a/modules/audio_processing/transient/wpd_node_unittest.cc b/modules/audio_processing/transient/wpd_node_unittest.cc
index 1929361..5f92382 100644
--- a/modules/audio_processing/transient/wpd_node_unittest.cc
+++ b/modules/audio_processing/transient/wpd_node_unittest.cc
@@ -20,18 +20,17 @@
static const float kTolerance = 0.0001f;
static const size_t kParentDataLength = kDataLength * 2;
-static const float kParentData[kParentDataLength] =
- {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f};
+static const float kParentData[kParentDataLength] = {1.f, 2.f, 3.f, 4.f, 5.f,
+ 6.f, 7.f, 8.f, 9.f, 10.f};
static const float kCoefficients[] = {0.2f, -0.3f, 0.5f, -0.7f, 0.11f};
-static const size_t kCoefficientsLength = sizeof(kCoefficients) /
- sizeof(kCoefficients[0]);
+static const size_t kCoefficientsLength =
+ sizeof(kCoefficients) / sizeof(kCoefficients[0]);
TEST(WPDNodeTest, Accessors) {
WPDNode node(kDataLength, kCoefficients, kCoefficientsLength);
EXPECT_EQ(0, node.set_data(kParentData, kDataLength));
- EXPECT_EQ(0, memcmp(node.data(),
- kParentData,
+ EXPECT_EQ(0, memcmp(node.data(), kParentData,
kDataLength * sizeof(node.data()[0])));
}
diff --git a/modules/audio_processing/transient/wpd_tree.cc b/modules/audio_processing/transient/wpd_tree.cc
index a01b816..72f4d76 100644
--- a/modules/audio_processing/transient/wpd_tree.cc
+++ b/modules/audio_processing/transient/wpd_tree.cc
@@ -19,8 +19,10 @@
namespace webrtc {
-WPDTree::WPDTree(size_t data_length, const float* high_pass_coefficients,
- const float* low_pass_coefficients, size_t coefficients_length,
+WPDTree::WPDTree(size_t data_length,
+ const float* high_pass_coefficients,
+ const float* low_pass_coefficients,
+ size_t coefficients_length,
int levels)
: data_length_(data_length),
levels_(levels),
@@ -98,8 +100,8 @@
index_left_child = index * 2;
index_right_child = index_left_child + 1;
- update_result = nodes_[index_left_child]->Update(
- nodes_[index]->data(), nodes_[index]->length());
+ update_result = nodes_[index_left_child]->Update(nodes_[index]->data(),
+ nodes_[index]->length());
if (update_result != 0) {
return -1;
}
diff --git a/modules/audio_processing/transient/wpd_tree.h b/modules/audio_processing/transient/wpd_tree.h
index 53fc06b..707a89d 100644
--- a/modules/audio_processing/transient/wpd_tree.h
+++ b/modules/audio_processing/transient/wpd_tree.h
@@ -47,9 +47,7 @@
~WPDTree();
// Returns the number of nodes at any given level.
- static int NumberOfNodesAtLevel(int level) {
- return 1 << level;
- }
+ static int NumberOfNodesAtLevel(int level) { return 1 << level; }
// Returns a pointer to the node at the given level and index(of that level).
// Level goes from 0 to levels().
diff --git a/modules/audio_processing/transient/wpd_tree_unittest.cc b/modules/audio_processing/transient/wpd_tree_unittest.cc
index 02c7f51..88f0739 100644
--- a/modules/audio_processing/transient/wpd_tree_unittest.cc
+++ b/modules/audio_processing/transient/wpd_tree_unittest.cc
@@ -30,13 +30,10 @@
float test_buffer[kTestBufferSize];
memset(test_buffer, 0.f, kTestBufferSize * sizeof(*test_buffer));
float test_coefficients[] = {1.f, 2.f, 3.f, 4.f, 5.f};
- const size_t kTestCoefficientsLength = sizeof(test_coefficients) /
- sizeof(test_coefficients[0]);
- WPDTree tree(kTestBufferSize,
- test_coefficients,
- test_coefficients,
- kTestCoefficientsLength,
- kLevels);
+ const size_t kTestCoefficientsLength =
+ sizeof(test_coefficients) / sizeof(test_coefficients[0]);
+ WPDTree tree(kTestBufferSize, test_coefficients, test_coefficients,
+ kTestCoefficientsLength, kLevels);
ASSERT_EQ(kExpectedNumberOfNodes, tree.num_nodes());
// Checks for NodeAt(level, index).
int nodes_at_level = 0;
@@ -79,10 +76,8 @@
const int kLeaves = 1 << kLevels;
const size_t kLeavesSamples = kTestBufferSize >> kLevels;
// Create tree with Discrete Meyer Wavelet Coefficients.
- WPDTree tree(kTestBufferSize,
- kDaubechies8HighPassCoefficients,
- kDaubechies8LowPassCoefficients,
- kDaubechies8CoefficientsLength,
+ WPDTree tree(kTestBufferSize, kDaubechies8HighPassCoefficients,
+ kDaubechies8LowPassCoefficients, kDaubechies8CoefficientsLength,
kLevels);
// Allocate and open all matlab and out files.
std::unique_ptr<FileWrapper> matlab_files_data[kLeaves];
@@ -134,9 +129,8 @@
size_t frames_read = 0;
// Read first buffer from the PCM test file.
- size_t file_samples_read = ReadInt16FromFileToFloatBuffer(test_file.get(),
- kTestBufferSize,
- test_buffer);
+ size_t file_samples_read = ReadInt16FromFileToFloatBuffer(
+ test_file.get(), kTestBufferSize, test_buffer);
while (file_samples_read > 0 && frames_read < kMaxFramesToTest) {
++frames_read;
@@ -152,10 +146,8 @@
// Compare results with data from the matlab test files.
for (int i = 0; i < kLeaves; ++i) {
// Compare data values
- size_t matlab_samples_read =
- ReadDoubleBufferFromFile(matlab_files_data[i].get(),
- kLeavesSamples,
- matlab_buffer);
+ size_t matlab_samples_read = ReadDoubleBufferFromFile(
+ matlab_files_data[i].get(), kLeavesSamples, matlab_buffer);
ASSERT_EQ(kLeavesSamples, matlab_samples_read)
<< "Matlab test files are malformed.\n"
@@ -170,15 +162,13 @@
}
// Write results to out files.
- WriteFloatBufferToFile(out_files_data[i].get(),
- kLeavesSamples,
+ WriteFloatBufferToFile(out_files_data[i].get(), kLeavesSamples,
node_data);
}
// Read next buffer from the PCM test file.
- file_samples_read = ReadInt16FromFileToFloatBuffer(test_file.get(),
- kTestBufferSize,
- test_buffer);
+ file_samples_read = ReadInt16FromFileToFloatBuffer(
+ test_file.get(), kTestBufferSize, test_buffer);
}
// Close all matlab and out files.
diff --git a/modules/audio_processing/typing_detection.cc b/modules/audio_processing/typing_detection.cc
index 6e18124..e725b26 100644
--- a/modules/audio_processing/typing_detection.cc
+++ b/modules/audio_processing/typing_detection.cc
@@ -24,8 +24,7 @@
reporting_threshold_(300),
penalty_decay_(1),
type_event_delay_(2),
- report_detection_update_period_(1) {
-}
+ report_detection_update_period_(1) {}
TypingDetection::~TypingDetection() {}
@@ -41,8 +40,7 @@
else
++time_since_last_typing_;
- if (time_since_last_typing_ < type_event_delay_ &&
- vad_activity &&
+ if (time_since_last_typing_ < type_event_delay_ && vad_activity &&
time_active_ < time_window_) {
penalty_counter_ += cost_per_typing_;
if (penalty_counter_ > reporting_threshold_)
@@ -73,15 +71,20 @@
int penalty_decay,
int type_event_delay,
int report_detection_update_period) {
- if (time_window) time_window_ = time_window;
+ if (time_window)
+ time_window_ = time_window;
- if (cost_per_typing) cost_per_typing_ = cost_per_typing;
+ if (cost_per_typing)
+ cost_per_typing_ = cost_per_typing;
- if (reporting_threshold) reporting_threshold_ = reporting_threshold;
+ if (reporting_threshold)
+ reporting_threshold_ = reporting_threshold;
- if (penalty_decay) penalty_decay_ = penalty_decay;
+ if (penalty_decay)
+ penalty_decay_ = penalty_decay;
- if (type_event_delay) type_event_delay_ = type_event_delay;
+ if (type_event_delay)
+ type_event_delay_ = type_event_delay;
if (report_detection_update_period)
report_detection_update_period_ = report_detection_update_period;
diff --git a/modules/audio_processing/utility/block_mean_calculator.cc b/modules/audio_processing/utility/block_mean_calculator.cc
index 3d76692..82c1c0f 100644
--- a/modules/audio_processing/utility/block_mean_calculator.cc
+++ b/modules/audio_processing/utility/block_mean_calculator.cc
@@ -15,10 +15,7 @@
namespace webrtc {
BlockMeanCalculator::BlockMeanCalculator(size_t block_length)
- : block_length_(block_length),
- count_(0),
- sum_(0.0),
- mean_(0.0) {
+ : block_length_(block_length), count_(0), sum_(0.0), mean_(0.0) {
RTC_DCHECK(block_length_ != 0);
}
diff --git a/modules/audio_processing/utility/delay_estimator.cc b/modules/audio_processing/utility/delay_estimator.cc
index 871b541..a15b914 100644
--- a/modules/audio_processing/utility/delay_estimator.cc
+++ b/modules/audio_processing/utility/delay_estimator.cc
@@ -21,9 +21,9 @@
static const int kShiftsAtZero = 13; // Right shifts at zero binary spectrum.
static const int kShiftsLinearSlope = 3;
-static const int32_t kProbabilityOffset = 1024; // 2 in Q9.
+static const int32_t kProbabilityOffset = 1024; // 2 in Q9.
static const int32_t kProbabilityLowerLimit = 8704; // 17 in Q9.
-static const int32_t kProbabilityMinSpread = 2816; // 5.5 in Q9.
+static const int32_t kProbabilityMinSpread = 2816; // 5.5 in Q9.
// Robust validation settings
static const float kHistogramMax = 3000.f;
@@ -39,13 +39,13 @@
// Counts and returns number of bits of a 32-bit word.
static int BitCount(uint32_t u32) {
- uint32_t tmp = u32 - ((u32 >> 1) & 033333333333) -
- ((u32 >> 2) & 011111111111);
+ uint32_t tmp =
+ u32 - ((u32 >> 1) & 033333333333) - ((u32 >> 2) & 011111111111);
tmp = ((tmp + (tmp >> 3)) & 030707070707);
tmp = (tmp + (tmp >> 6));
tmp = (tmp + (tmp >> 12) + (tmp >> 24)) & 077;
- return ((int) tmp);
+ return ((int)tmp);
}
// Compares the |binary_vector| with all rows of the |binary_matrix| and counts
@@ -69,7 +69,7 @@
// Compare |binary_vector| with all rows of the |binary_matrix|
for (; n < matrix_size; n++) {
- bit_counts[n] = (int32_t) BitCount(binary_vector ^ binary_matrix[n]);
+ bit_counts[n] = (int32_t)BitCount(binary_vector ^ binary_matrix[n]);
}
}
@@ -96,8 +96,9 @@
int32_t valley_level_q14) {
const float valley_depth = valley_depth_q14 * kQ14Scaling;
float decrease_in_last_set = valley_depth;
- const int max_hits_for_slow_change = (candidate_delay < self->last_delay) ?
- kMaxHitsWhenPossiblyNonCausal : kMaxHitsWhenPossiblyCausal;
+ const int max_hits_for_slow_change = (candidate_delay < self->last_delay)
+ ? kMaxHitsWhenPossiblyNonCausal
+ : kMaxHitsWhenPossiblyCausal;
int i = 0;
RTC_DCHECK_EQ(self->history_size, self->farend->history_size);
@@ -127,18 +128,20 @@
// |candidate_delay| is a "potential" candidate and we start decreasing
// these histogram bins more rapidly with |valley_depth|.
if (self->candidate_hits < max_hits_for_slow_change) {
- decrease_in_last_set = (self->mean_bit_counts[self->compare_delay] -
- valley_level_q14) * kQ14Scaling;
+ decrease_in_last_set =
+ (self->mean_bit_counts[self->compare_delay] - valley_level_q14) *
+ kQ14Scaling;
}
// 4. All other bins are decreased with |valley_depth|.
// TODO(bjornv): Investigate how to make this loop more efficient. Split up
// the loop? Remove parts that doesn't add too much.
for (i = 0; i < self->history_size; ++i) {
int is_in_last_set = (i >= self->last_delay - 2) &&
- (i <= self->last_delay + 1) && (i != candidate_delay);
- int is_in_candidate_set = (i >= candidate_delay - 2) &&
- (i <= candidate_delay + 1);
- self->histogram[i] -= decrease_in_last_set * is_in_last_set +
+ (i <= self->last_delay + 1) && (i != candidate_delay);
+ int is_in_candidate_set =
+ (i >= candidate_delay - 2) && (i <= candidate_delay + 1);
+ self->histogram[i] -=
+ decrease_in_last_set * is_in_last_set +
valley_depth * (!is_in_last_set && !is_in_candidate_set);
// 5. No histogram bin can go below 0.
if (self->histogram[i] < 0) {
@@ -196,16 +199,18 @@
// into tables?
if (delay_difference > self->allowed_offset) {
fraction = 1.f - kFractionSlope * (delay_difference - self->allowed_offset);
- fraction = (fraction > kMinFractionWhenPossiblyCausal ? fraction :
- kMinFractionWhenPossiblyCausal);
+ fraction = (fraction > kMinFractionWhenPossiblyCausal
+ ? fraction
+ : kMinFractionWhenPossiblyCausal);
} else if (delay_difference < 0) {
- fraction = kMinFractionWhenPossiblyNonCausal -
- kFractionSlope * delay_difference;
+ fraction =
+ kMinFractionWhenPossiblyNonCausal - kFractionSlope * delay_difference;
fraction = (fraction > 1.f ? 1.f : fraction);
}
histogram_threshold *= fraction;
- histogram_threshold = (histogram_threshold > kMinHistogramThreshold ?
- histogram_threshold : kMinHistogramThreshold);
+ histogram_threshold =
+ (histogram_threshold > kMinHistogramThreshold ? histogram_threshold
+ : kMinHistogramThreshold);
is_histogram_valid =
(self->histogram[candidate_delay] >= histogram_threshold) &&
@@ -243,8 +248,8 @@
// i) Before we actually have a valid estimate (|last_delay| == -2), we say
// a candidate is valid if either algorithm states so
// (|is_instantaneous_valid| OR |is_histogram_valid|).
- is_robust = (self->last_delay < 0) &&
- (is_instantaneous_valid || is_histogram_valid);
+ is_robust =
+ (self->last_delay < 0) && (is_instantaneous_valid || is_histogram_valid);
// ii) Otherwise, we need both algorithms to be certain
// (|is_instantaneous_valid| AND |is_histogram_valid|)
is_robust |= is_instantaneous_valid && is_histogram_valid;
@@ -252,13 +257,12 @@
// the instantaneous one if |is_histogram_valid| = 1 and the histogram
// is significantly strong.
is_robust |= is_histogram_valid &&
- (self->histogram[candidate_delay] > self->last_delay_histogram);
+ (self->histogram[candidate_delay] > self->last_delay_histogram);
return is_robust;
}
void WebRtc_FreeBinaryDelayEstimatorFarend(BinaryDelayEstimatorFarend* self) {
-
if (self == NULL) {
return;
}
@@ -302,20 +306,17 @@
self->binary_far_history = static_cast<uint32_t*>(
realloc(self->binary_far_history,
history_size * sizeof(*self->binary_far_history)));
- self->far_bit_counts = static_cast<int*>(
- realloc(self->far_bit_counts,
- history_size * sizeof(*self->far_bit_counts)));
+ self->far_bit_counts = static_cast<int*>(realloc(
+ self->far_bit_counts, history_size * sizeof(*self->far_bit_counts)));
if ((self->binary_far_history == NULL) || (self->far_bit_counts == NULL)) {
history_size = 0;
}
// Fill with zeros if we have expanded the buffers.
if (history_size > self->history_size) {
int size_diff = history_size - self->history_size;
- memset(&self->binary_far_history[self->history_size],
- 0,
+ memset(&self->binary_far_history[self->history_size], 0,
sizeof(*self->binary_far_history) * size_diff);
- memset(&self->far_bit_counts[self->history_size],
- 0,
+ memset(&self->far_bit_counts[self->history_size], 0,
sizeof(*self->far_bit_counts) * size_diff);
}
self->history_size = history_size;
@@ -330,7 +331,8 @@
}
void WebRtc_SoftResetBinaryDelayEstimatorFarend(
- BinaryDelayEstimatorFarend* self, int delay_shift) {
+ BinaryDelayEstimatorFarend* self,
+ int delay_shift) {
int abs_shift = abs(delay_shift);
int shift_size = 0;
int dest_index = 0;
@@ -355,8 +357,7 @@
sizeof(*self->binary_far_history) * shift_size);
memset(&self->binary_far_history[padding_index], 0,
sizeof(*self->binary_far_history) * abs_shift);
- memmove(&self->far_bit_counts[dest_index],
- &self->far_bit_counts[src_index],
+ memmove(&self->far_bit_counts[dest_index], &self->far_bit_counts[src_index],
sizeof(*self->far_bit_counts) * shift_size);
memset(&self->far_bit_counts[padding_index], 0,
sizeof(*self->far_bit_counts) * abs_shift);
@@ -378,7 +379,6 @@
}
void WebRtc_FreeBinaryDelayEstimator(BinaryDelayEstimator* self) {
-
if (self == NULL) {
return;
}
@@ -403,7 +403,8 @@
}
BinaryDelayEstimator* WebRtc_CreateBinaryDelayEstimator(
- BinaryDelayEstimatorFarend* farend, int max_lookahead) {
+ BinaryDelayEstimatorFarend* farend,
+ int max_lookahead) {
BinaryDelayEstimator* self = NULL;
if ((farend != NULL) && (max_lookahead >= 0)) {
@@ -457,22 +458,18 @@
self->histogram = static_cast<float*>(
realloc(self->histogram, (history_size + 1) * sizeof(*self->histogram)));
- if ((self->mean_bit_counts == NULL) ||
- (self->bit_counts == NULL) ||
+ if ((self->mean_bit_counts == NULL) || (self->bit_counts == NULL) ||
(self->histogram == NULL)) {
history_size = 0;
}
// Fill with zeros if we have expanded the buffers.
if (history_size > self->history_size) {
int size_diff = history_size - self->history_size;
- memset(&self->mean_bit_counts[self->history_size],
- 0,
+ memset(&self->mean_bit_counts[self->history_size], 0,
sizeof(*self->mean_bit_counts) * size_diff);
- memset(&self->bit_counts[self->history_size],
- 0,
+ memset(&self->bit_counts[self->history_size], 0,
sizeof(*self->bit_counts) * size_diff);
- memset(&self->histogram[self->history_size],
- 0,
+ memset(&self->histogram[self->history_size], 0,
sizeof(*self->histogram) * size_diff);
}
self->history_size = history_size;
@@ -485,15 +482,14 @@
RTC_DCHECK(self);
memset(self->bit_counts, 0, sizeof(int32_t) * self->history_size);
- memset(self->binary_near_history,
- 0,
+ memset(self->binary_near_history, 0,
sizeof(uint32_t) * self->near_history_size);
for (i = 0; i <= self->history_size; ++i) {
self->mean_bit_counts[i] = (20 << 9); // 20 in Q9.
self->histogram[i] = 0.f;
}
- self->minimum_probability = kMaxBitCountsQ9; // 32 in Q9.
- self->last_delay_probability = (int) kMaxBitCountsQ9; // 32 in Q9.
+ self->minimum_probability = kMaxBitCountsQ9; // 32 in Q9.
+ self->last_delay_probability = (int)kMaxBitCountsQ9; // 32 in Q9.
// Default return value if we're unable to estimate. -1 is used for errors.
self->last_delay = -2;
@@ -617,8 +613,8 @@
// and deeper than the best estimate so far
// (|value_best_candidate| < |last_delay_probability|)
valid_candidate = ((valley_depth > kProbabilityOffset) &&
- ((value_best_candidate < self->minimum_probability) ||
- (value_best_candidate < self->last_delay_probability)));
+ ((value_best_candidate < self->minimum_probability) ||
+ (value_best_candidate < self->last_delay_probability)));
// Check for nonstationary farend signal.
const bool non_stationary_farend =
@@ -637,7 +633,6 @@
int is_histogram_valid = HistogramBasedValidation(self, candidate_delay);
valid_candidate = RobustValidation(self, candidate_delay, valid_candidate,
is_histogram_valid);
-
}
// Only update the delay estimate when the farend is nonstationary and when
@@ -645,8 +640,9 @@
if (non_stationary_farend && valid_candidate) {
if (candidate_delay != self->last_delay) {
self->last_delay_histogram =
- (self->histogram[candidate_delay] > kLastHistogramMax ?
- kLastHistogramMax : self->histogram[candidate_delay]);
+ (self->histogram[candidate_delay] > kLastHistogramMax
+ ? kLastHistogramMax
+ : self->histogram[candidate_delay]);
// Adjust the histogram if we made a change to |last_delay|, though it was
// not the most likely one according to the histogram.
if (self->histogram[candidate_delay] <
@@ -679,8 +675,8 @@
} else {
// Note that |last_delay_probability| states how deep the minimum of the
// cost function is, so it is rather an error probability.
- quality = (float) (kMaxBitCountsQ9 - self->last_delay_probability) /
- kMaxBitCountsQ9;
+ quality = (float)(kMaxBitCountsQ9 - self->last_delay_probability) /
+ kMaxBitCountsQ9;
if (quality < 0) {
quality = 0;
}
diff --git a/modules/audio_processing/utility/delay_estimator.h b/modules/audio_processing/utility/delay_estimator.h
index cce6113..11483ec 100644
--- a/modules/audio_processing/utility/delay_estimator.h
+++ b/modules/audio_processing/utility/delay_estimator.h
@@ -117,7 +117,8 @@
// - delay_shift : The amount of blocks to shift history buffers.
//
void WebRtc_SoftResetBinaryDelayEstimatorFarend(
- BinaryDelayEstimatorFarend* self, int delay_shift);
+ BinaryDelayEstimatorFarend* self,
+ int delay_shift);
// Adds the binary far-end spectrum to the internal far-end history buffer. This
// spectrum is used as reference when calculating the delay using
@@ -153,7 +154,8 @@
// See WebRtc_CreateDelayEstimator(..) in delay_estimator_wrapper.c for detailed
// description.
BinaryDelayEstimator* WebRtc_CreateBinaryDelayEstimator(
- BinaryDelayEstimatorFarend* farend, int max_lookahead);
+ BinaryDelayEstimatorFarend* farend,
+ int max_lookahead);
// Re-allocates |history_size| dependent buffers. The far-end buffers will be
// updated at the same time if needed.
diff --git a/modules/audio_processing/utility/delay_estimator_unittest.cc b/modules/audio_processing/utility/delay_estimator_unittest.cc
index 36700e5..3e4e050 100644
--- a/modules/audio_processing/utility/delay_estimator_unittest.cc
+++ b/modules/audio_processing/utility/delay_estimator_unittest.cc
@@ -27,7 +27,7 @@
const int kDifferentHistorySize = 3;
const int kDifferentLookahead = 1;
-const int kEnable[] = { 0, 1 };
+const int kEnable[] = {0, 1};
const size_t kSizeEnable = sizeof(kEnable) / sizeof(*kEnable);
class DelayEstimatorTest : public ::testing::Test {
@@ -41,9 +41,13 @@
void VerifyDelay(BinaryDelayEstimator* binary_handle, int offset, int delay);
void RunBinarySpectra(BinaryDelayEstimator* binary1,
BinaryDelayEstimator* binary2,
- int near_offset, int lookahead_offset, int far_offset);
- void RunBinarySpectraTest(int near_offset, int lookahead_offset,
- int ref_robust_validation, int robust_validation);
+ int near_offset,
+ int lookahead_offset,
+ int far_offset);
+ void RunBinarySpectraTest(int near_offset,
+ int lookahead_offset,
+ int ref_robust_validation,
+ int robust_validation);
void* handle_;
DelayEstimator* self_;
@@ -83,8 +87,8 @@
}
void DelayEstimatorTest::SetUp() {
- farend_handle_ = WebRtc_CreateDelayEstimatorFarend(kSpectrumSize,
- kHistorySize);
+ farend_handle_ =
+ WebRtc_CreateDelayEstimatorFarend(kSpectrumSize, kHistorySize);
ASSERT_TRUE(farend_handle_ != NULL);
farend_self_ = reinterpret_cast<DelayEstimatorFarend*>(farend_handle_);
handle_ = WebRtc_CreateDelayEstimator(farend_handle_, kLookahead);
@@ -131,7 +135,8 @@
}
void DelayEstimatorTest::VerifyDelay(BinaryDelayEstimator* binary_handle,
- int offset, int delay) {
+ int offset,
+ int delay) {
// Verify that we WebRtc_binary_last_delay() returns correct delay.
EXPECT_EQ(delay, WebRtc_binary_last_delay(binary_handle));
@@ -147,8 +152,8 @@
int near_offset,
int lookahead_offset,
int far_offset) {
- int different_validations = binary1->robust_validation_enabled ^
- binary2->robust_validation_enabled;
+ int different_validations =
+ binary1->robust_validation_enabled ^ binary2->robust_validation_enabled;
WebRtc_InitBinaryDelayEstimatorFarend(binary_farend_);
WebRtc_InitBinaryDelayEstimator(binary1);
WebRtc_InitBinaryDelayEstimator(binary2);
@@ -160,9 +165,8 @@
WebRtc_AddBinaryFarSpectrum(binary_farend_,
binary_spectrum_[i + far_offset]);
int delay_1 = WebRtc_ProcessBinarySpectrum(binary1, binary_spectrum_[i]);
- int delay_2 =
- WebRtc_ProcessBinarySpectrum(binary2,
- binary_spectrum_[i - near_offset]);
+ int delay_2 = WebRtc_ProcessBinarySpectrum(
+ binary2, binary_spectrum_[i - near_offset]);
VerifyDelay(binary1, far_offset + kLookahead, delay_1);
VerifyDelay(binary2,
@@ -177,7 +181,7 @@
// all the time, unless one of them has robust validation turned on. In
// that case the robust validation leaves the initial state faster.
if ((near_offset == 0) && (lookahead_offset == 0)) {
- if (!different_validations) {
+ if (!different_validations) {
EXPECT_EQ(delay_1, delay_2);
} else {
if (binary1->robust_validation_enabled) {
@@ -199,9 +203,8 @@
int lookahead_offset,
int ref_robust_validation,
int robust_validation) {
- BinaryDelayEstimator* binary2 =
- WebRtc_CreateBinaryDelayEstimator(binary_farend_,
- kLookahead + lookahead_offset);
+ BinaryDelayEstimator* binary2 = WebRtc_CreateBinaryDelayEstimator(
+ binary_farend_, kLookahead + lookahead_offset);
// Verify the delay for both causal and non-causal systems. For causal systems
// the delay is equivalent with a positive |offset| of the far-end sequence.
// For non-causal systems the delay is equivalent with a negative |offset| of
@@ -209,8 +212,7 @@
binary_->robust_validation_enabled = ref_robust_validation;
binary2->robust_validation_enabled = robust_validation;
for (int offset = -kLookahead;
- offset < kMaxDelay - lookahead_offset - near_offset;
- offset++) {
+ offset < kMaxDelay - lookahead_offset - near_offset; offset++) {
RunBinarySpectra(binary_, binary2, near_offset, lookahead_offset, offset);
}
WebRtc_FreeBinaryDelayEstimator(binary2);
@@ -248,8 +250,8 @@
// 3) Incorrect spectrum size.
EXPECT_EQ(-1, WebRtc_AddFarSpectrumFloat(NULL, far_f_, spectrum_size_));
// Use |farend_handle_| which is properly created at SetUp().
- EXPECT_EQ(-1, WebRtc_AddFarSpectrumFloat(farend_handle_, NULL,
- spectrum_size_));
+ EXPECT_EQ(-1,
+ WebRtc_AddFarSpectrumFloat(farend_handle_, NULL, spectrum_size_));
EXPECT_EQ(-1, WebRtc_AddFarSpectrumFloat(farend_handle_, far_f_,
spectrum_size_ + 1));
@@ -259,8 +261,8 @@
// 3) Incorrect spectrum size.
// 4) Too high precision in far-end spectrum (Q-domain > 15).
EXPECT_EQ(-1, WebRtc_AddFarSpectrumFix(NULL, far_u16_, spectrum_size_, 0));
- EXPECT_EQ(-1, WebRtc_AddFarSpectrumFix(farend_handle_, NULL, spectrum_size_,
- 0));
+ EXPECT_EQ(-1,
+ WebRtc_AddFarSpectrumFix(farend_handle_, NULL, spectrum_size_, 0));
EXPECT_EQ(-1, WebRtc_AddFarSpectrumFix(farend_handle_, far_u16_,
spectrum_size_ + 1, 0));
EXPECT_EQ(-1, WebRtc_AddFarSpectrumFix(farend_handle_, far_u16_,
@@ -313,16 +315,15 @@
// 3) Incorrect spectrum size.
// 4) Non matching history sizes if multiple delay estimators using the same
// far-end reference.
- EXPECT_EQ(-1, WebRtc_DelayEstimatorProcessFloat(NULL, near_f_,
- spectrum_size_));
+ EXPECT_EQ(-1,
+ WebRtc_DelayEstimatorProcessFloat(NULL, near_f_, spectrum_size_));
// Use |handle_| which is properly created at SetUp().
- EXPECT_EQ(-1, WebRtc_DelayEstimatorProcessFloat(handle_, NULL,
- spectrum_size_));
+ EXPECT_EQ(-1,
+ WebRtc_DelayEstimatorProcessFloat(handle_, NULL, spectrum_size_));
EXPECT_EQ(-1, WebRtc_DelayEstimatorProcessFloat(handle_, near_f_,
spectrum_size_ + 1));
// |tmp_handle| is already in a non-matching state.
- EXPECT_EQ(-1, WebRtc_DelayEstimatorProcessFloat(tmp_handle,
- near_f_,
+ EXPECT_EQ(-1, WebRtc_DelayEstimatorProcessFloat(tmp_handle, near_f_,
spectrum_size_));
// WebRtc_DelayEstimatorProcessFix() should return -1 if we have:
@@ -332,19 +333,17 @@
// 4) Too high precision in near-end spectrum (Q-domain > 15).
// 5) Non matching history sizes if multiple delay estimators using the same
// far-end reference.
- EXPECT_EQ(-1, WebRtc_DelayEstimatorProcessFix(NULL, near_u16_, spectrum_size_,
- 0));
- EXPECT_EQ(-1, WebRtc_DelayEstimatorProcessFix(handle_, NULL, spectrum_size_,
- 0));
+ EXPECT_EQ(
+ -1, WebRtc_DelayEstimatorProcessFix(NULL, near_u16_, spectrum_size_, 0));
+ EXPECT_EQ(-1,
+ WebRtc_DelayEstimatorProcessFix(handle_, NULL, spectrum_size_, 0));
EXPECT_EQ(-1, WebRtc_DelayEstimatorProcessFix(handle_, near_u16_,
spectrum_size_ + 1, 0));
EXPECT_EQ(-1, WebRtc_DelayEstimatorProcessFix(handle_, near_u16_,
spectrum_size_, 16));
// |tmp_handle| is already in a non-matching state.
- EXPECT_EQ(-1, WebRtc_DelayEstimatorProcessFix(tmp_handle,
- near_u16_,
- spectrum_size_,
- 0));
+ EXPECT_EQ(-1, WebRtc_DelayEstimatorProcessFix(tmp_handle, near_u16_,
+ spectrum_size_, 0));
WebRtc_FreeDelayEstimator(tmp_handle);
// WebRtc_last_delay() should return -1 if we have a NULL pointer as |handle|.
@@ -382,8 +381,8 @@
// In this test we verify that the mean spectra are initialized after first
// time we call WebRtc_AddFarSpectrum() and Process() respectively. The test
// also verifies the state is not left for zero spectra.
- const float kZerosFloat[kSpectrumSize] = { 0.0 };
- const uint16_t kZerosU16[kSpectrumSize] = { 0 };
+ const float kZerosFloat[kSpectrumSize] = {0.0};
+ const uint16_t kZerosU16[kSpectrumSize] = {0};
// For floating point operations, process one frame and verify initialization
// flag.
@@ -391,14 +390,14 @@
EXPECT_EQ(0, WebRtc_AddFarSpectrumFloat(farend_handle_, kZerosFloat,
spectrum_size_));
EXPECT_EQ(0, farend_self_->far_spectrum_initialized);
- EXPECT_EQ(0, WebRtc_AddFarSpectrumFloat(farend_handle_, far_f_,
- spectrum_size_));
+ EXPECT_EQ(0,
+ WebRtc_AddFarSpectrumFloat(farend_handle_, far_f_, spectrum_size_));
EXPECT_EQ(1, farend_self_->far_spectrum_initialized);
EXPECT_EQ(-2, WebRtc_DelayEstimatorProcessFloat(handle_, kZerosFloat,
spectrum_size_));
EXPECT_EQ(0, self_->near_spectrum_initialized);
- EXPECT_EQ(-2, WebRtc_DelayEstimatorProcessFloat(handle_, near_f_,
- spectrum_size_));
+ EXPECT_EQ(
+ -2, WebRtc_DelayEstimatorProcessFloat(handle_, near_f_, spectrum_size_));
EXPECT_EQ(1, self_->near_spectrum_initialized);
// For fixed point operations, process one frame and verify initialization
@@ -407,8 +406,8 @@
EXPECT_EQ(0, WebRtc_AddFarSpectrumFix(farend_handle_, kZerosU16,
spectrum_size_, 0));
EXPECT_EQ(0, farend_self_->far_spectrum_initialized);
- EXPECT_EQ(0, WebRtc_AddFarSpectrumFix(farend_handle_, far_u16_,
- spectrum_size_, 0));
+ EXPECT_EQ(
+ 0, WebRtc_AddFarSpectrumFix(farend_handle_, far_u16_, spectrum_size_, 0));
EXPECT_EQ(1, farend_self_->far_spectrum_initialized);
EXPECT_EQ(-2, WebRtc_DelayEstimatorProcessFix(handle_, kZerosU16,
spectrum_size_, 0));
@@ -429,10 +428,10 @@
// Floating point operations.
Init();
for (int i = 0; i < 200; i++) {
- EXPECT_EQ(0, WebRtc_AddFarSpectrumFloat(farend_handle_, far_f_,
- spectrum_size_));
- last_delay = WebRtc_DelayEstimatorProcessFloat(handle_, near_f_,
- spectrum_size_);
+ EXPECT_EQ(
+ 0, WebRtc_AddFarSpectrumFloat(farend_handle_, far_f_, spectrum_size_));
+ last_delay =
+ WebRtc_DelayEstimatorProcessFloat(handle_, near_f_, spectrum_size_);
if (last_delay != -2) {
EXPECT_EQ(last_delay, WebRtc_last_delay(handle_));
if (!WebRtc_is_robust_validation_enabled(handle_)) {
@@ -451,8 +450,8 @@
for (int i = 0; i < 200; i++) {
EXPECT_EQ(0, WebRtc_AddFarSpectrumFix(farend_handle_, far_u16_,
spectrum_size_, 0));
- last_delay = WebRtc_DelayEstimatorProcessFix(handle_, near_u16_,
- spectrum_size_, 0);
+ last_delay =
+ WebRtc_DelayEstimatorProcessFix(handle_, near_u16_, spectrum_size_, 0);
if (last_delay != -2) {
EXPECT_EQ(last_delay, WebRtc_last_delay(handle_));
if (!WebRtc_is_robust_validation_enabled(handle_)) {
@@ -577,8 +576,8 @@
}
TEST_F(DelayEstimatorTest, VerifyLookaheadAtCreate) {
- void* farend_handle = WebRtc_CreateDelayEstimatorFarend(kSpectrumSize,
- kMaxDelay);
+ void* farend_handle =
+ WebRtc_CreateDelayEstimatorFarend(kSpectrumSize, kMaxDelay);
ASSERT_TRUE(farend_handle != NULL);
void* handle = WebRtc_CreateDelayEstimator(farend_handle, kLookahead);
ASSERT_TRUE(handle != NULL);
diff --git a/modules/audio_processing/utility/delay_estimator_wrapper.cc b/modules/audio_processing/utility/delay_estimator_wrapper.cc
index f907c80..27c2a3a 100644
--- a/modules/audio_processing/utility/delay_estimator_wrapper.cc
+++ b/modules/audio_processing/utility/delay_estimator_wrapper.cc
@@ -72,7 +72,7 @@
for (i = kBandFirst; i <= kBandLast; i++) {
if (spectrum[i] > 0) {
// Convert input spectrum from Q(|q_domain|) to Q15.
- int32_t spectrum_q15 = ((int32_t) spectrum[i]) << (15 - q_domain);
+ int32_t spectrum_q15 = ((int32_t)spectrum[i]) << (15 - q_domain);
threshold_spectrum[i].int32_ = (spectrum_q15 >> 1);
*threshold_initialized = 1;
}
@@ -80,7 +80,7 @@
}
for (i = kBandFirst; i <= kBandLast; i++) {
// Convert input spectrum from Q(|q_domain|) to Q15.
- int32_t spectrum_q15 = ((int32_t) spectrum[i]) << (15 - q_domain);
+ int32_t spectrum_q15 = ((int32_t)spectrum[i]) << (15 - q_domain);
// Update the |threshold_spectrum|.
WebRtc_MeanEstimatorFix(spectrum_q15, 6, &(threshold_spectrum[i].int32_));
// Convert |spectrum| at current frequency bin to a binary value.
@@ -123,7 +123,7 @@
}
void WebRtc_FreeDelayEstimatorFarend(void* handle) {
- DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle;
+ DelayEstimatorFarend* self = (DelayEstimatorFarend*)handle;
if (handle == NULL) {
return;
@@ -158,8 +158,8 @@
memory_fail |= (self->binary_farend == NULL);
// Allocate memory for spectrum buffers.
- self->mean_far_spectrum =
- static_cast<SpectrumType*>(malloc(spectrum_size * sizeof(SpectrumType)));
+ self->mean_far_spectrum = static_cast<SpectrumType*>(
+ malloc(spectrum_size * sizeof(SpectrumType)));
memory_fail |= (self->mean_far_spectrum == NULL);
self->spectrum_size = spectrum_size;
@@ -174,7 +174,7 @@
}
int WebRtc_InitDelayEstimatorFarend(void* handle) {
- DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle;
+ DelayEstimatorFarend* self = (DelayEstimatorFarend*)handle;
if (self == NULL) {
return -1;
@@ -193,7 +193,7 @@
}
void WebRtc_SoftResetDelayEstimatorFarend(void* handle, int delay_shift) {
- DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle;
+ DelayEstimatorFarend* self = (DelayEstimatorFarend*)handle;
RTC_DCHECK(self);
WebRtc_SoftResetBinaryDelayEstimatorFarend(self->binary_farend, delay_shift);
}
@@ -202,7 +202,7 @@
const uint16_t* far_spectrum,
int spectrum_size,
int far_q) {
- DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle;
+ DelayEstimatorFarend* self = (DelayEstimatorFarend*)handle;
uint32_t binary_spectrum = 0;
if (self == NULL) {
@@ -232,7 +232,7 @@
int WebRtc_AddFarSpectrumFloat(void* handle,
const float* far_spectrum,
int spectrum_size) {
- DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle;
+ DelayEstimatorFarend* self = (DelayEstimatorFarend*)handle;
uint32_t binary_spectrum = 0;
if (self == NULL) {
@@ -256,7 +256,7 @@
}
void WebRtc_FreeDelayEstimator(void* handle) {
- DelayEstimator* self = (DelayEstimator*) handle;
+ DelayEstimator* self = (DelayEstimator*)handle;
if (handle == NULL) {
return;
@@ -273,7 +273,7 @@
void* WebRtc_CreateDelayEstimator(void* farend_handle, int max_lookahead) {
DelayEstimator* self = NULL;
- DelayEstimatorFarend* farend = (DelayEstimatorFarend*) farend_handle;
+ DelayEstimatorFarend* farend = (DelayEstimatorFarend*)farend_handle;
if (farend_handle != NULL) {
self = static_cast<DelayEstimator*>(malloc(sizeof(DelayEstimator)));
@@ -304,7 +304,7 @@
}
int WebRtc_InitDelayEstimator(void* handle) {
- DelayEstimator* self = (DelayEstimator*) handle;
+ DelayEstimator* self = (DelayEstimator*)handle;
if (self == NULL) {
return -1;
@@ -323,7 +323,7 @@
}
int WebRtc_SoftResetDelayEstimator(void* handle, int delay_shift) {
- DelayEstimator* self = (DelayEstimator*) handle;
+ DelayEstimator* self = (DelayEstimator*)handle;
RTC_DCHECK(self);
return WebRtc_SoftResetBinaryDelayEstimator(self->binary_handle, delay_shift);
}
@@ -352,7 +352,7 @@
}
int WebRtc_set_lookahead(void* handle, int lookahead) {
- DelayEstimator* self = (DelayEstimator*) handle;
+ DelayEstimator* self = (DelayEstimator*)handle;
RTC_DCHECK(self);
RTC_DCHECK(self->binary_handle);
if ((lookahead > self->binary_handle->near_history_size - 1) ||
@@ -364,14 +364,14 @@
}
int WebRtc_lookahead(void* handle) {
- DelayEstimator* self = (DelayEstimator*) handle;
+ DelayEstimator* self = (DelayEstimator*)handle;
RTC_DCHECK(self);
RTC_DCHECK(self->binary_handle);
return self->binary_handle->lookahead;
}
int WebRtc_set_allowed_offset(void* handle, int allowed_offset) {
- DelayEstimator* self = (DelayEstimator*) handle;
+ DelayEstimator* self = (DelayEstimator*)handle;
if ((self == NULL) || (allowed_offset < 0)) {
return -1;
@@ -381,7 +381,7 @@
}
int WebRtc_get_allowed_offset(const void* handle) {
- const DelayEstimator* self = (const DelayEstimator*) handle;
+ const DelayEstimator* self = (const DelayEstimator*)handle;
if (self == NULL) {
return -1;
@@ -390,7 +390,7 @@
}
int WebRtc_enable_robust_validation(void* handle, int enable) {
- DelayEstimator* self = (DelayEstimator*) handle;
+ DelayEstimator* self = (DelayEstimator*)handle;
if (self == NULL) {
return -1;
@@ -404,7 +404,7 @@
}
int WebRtc_is_robust_validation_enabled(const void* handle) {
- const DelayEstimator* self = (const DelayEstimator*) handle;
+ const DelayEstimator* self = (const DelayEstimator*)handle;
if (self == NULL) {
return -1;
@@ -416,7 +416,7 @@
const uint16_t* near_spectrum,
int spectrum_size,
int near_q) {
- DelayEstimator* self = (DelayEstimator*) handle;
+ DelayEstimator* self = (DelayEstimator*)handle;
uint32_t binary_spectrum = 0;
if (self == NULL) {
@@ -436,10 +436,9 @@
}
// Get binary spectra.
- binary_spectrum = BinarySpectrumFix(near_spectrum,
- self->mean_near_spectrum,
- near_q,
- &(self->near_spectrum_initialized));
+ binary_spectrum =
+ BinarySpectrumFix(near_spectrum, self->mean_near_spectrum, near_q,
+ &(self->near_spectrum_initialized));
return WebRtc_ProcessBinarySpectrum(self->binary_handle, binary_spectrum);
}
@@ -447,7 +446,7 @@
int WebRtc_DelayEstimatorProcessFloat(void* handle,
const float* near_spectrum,
int spectrum_size) {
- DelayEstimator* self = (DelayEstimator*) handle;
+ DelayEstimator* self = (DelayEstimator*)handle;
uint32_t binary_spectrum = 0;
if (self == NULL) {
@@ -470,7 +469,7 @@
}
int WebRtc_last_delay(void* handle) {
- DelayEstimator* self = (DelayEstimator*) handle;
+ DelayEstimator* self = (DelayEstimator*)handle;
if (self == NULL) {
return -1;
@@ -480,7 +479,7 @@
}
float WebRtc_last_delay_quality(void* handle) {
- DelayEstimator* self = (DelayEstimator*) handle;
+ DelayEstimator* self = (DelayEstimator*)handle;
RTC_DCHECK(self);
return WebRtc_binary_last_delay_quality(self->binary_handle);
}
diff --git a/modules/audio_processing/utility/ooura_fft.cc b/modules/audio_processing/utility/ooura_fft.cc
index d753a81..2add4eb 100644
--- a/modules/audio_processing/utility/ooura_fft.cc
+++ b/modules/audio_processing/utility/ooura_fft.cc
@@ -313,7 +313,6 @@
}
#endif
-
} // namespace
OouraFft::OouraFft() {
diff --git a/modules/audio_processing/utility/ooura_fft_mips.cc b/modules/audio_processing/utility/ooura_fft_mips.cc
index 569e1d7..c782ee7 100644
--- a/modules/audio_processing/utility/ooura_fft_mips.cc
+++ b/modules/audio_processing/utility/ooura_fft_mips.cc
@@ -279,533 +279,600 @@
const float* first = rdft_wk3ri_first;
const float* second = rdft_wk3ri_second;
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- // first 8
- "lwc1 %[f0], 0(%[a]) \n\t"
- "lwc1 %[f1], 4(%[a]) \n\t"
- "lwc1 %[f2], 8(%[a]) \n\t"
- "lwc1 %[f3], 12(%[a]) \n\t"
- "lwc1 %[f4], 16(%[a]) \n\t"
- "lwc1 %[f5], 20(%[a]) \n\t"
- "lwc1 %[f6], 24(%[a]) \n\t"
- "lwc1 %[f7], 28(%[a]) \n\t"
- "add.s %[f8], %[f0], %[f2] \n\t"
- "sub.s %[f0], %[f0], %[f2] \n\t"
- "add.s %[f2], %[f4], %[f6] \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "add.s %[f6], %[f1], %[f3] \n\t"
- "sub.s %[f1], %[f1], %[f3] \n\t"
- "add.s %[f3], %[f5], %[f7] \n\t"
- "sub.s %[f5], %[f5], %[f7] \n\t"
- "add.s %[f7], %[f8], %[f2] \n\t"
- "sub.s %[f8], %[f8], %[f2] \n\t"
- "sub.s %[f2], %[f1], %[f4] \n\t"
- "add.s %[f1], %[f1], %[f4] \n\t"
- "add.s %[f4], %[f6], %[f3] \n\t"
- "sub.s %[f6], %[f6], %[f3] \n\t"
- "sub.s %[f3], %[f0], %[f5] \n\t"
- "add.s %[f0], %[f0], %[f5] \n\t"
- "swc1 %[f7], 0(%[a]) \n\t"
- "swc1 %[f8], 16(%[a]) \n\t"
- "swc1 %[f2], 28(%[a]) \n\t"
- "swc1 %[f1], 12(%[a]) \n\t"
- "swc1 %[f4], 4(%[a]) \n\t"
- "swc1 %[f6], 20(%[a]) \n\t"
- "swc1 %[f3], 8(%[a]) \n\t"
- "swc1 %[f0], 24(%[a]) \n\t"
- // second 8
- "lwc1 %[f0], 32(%[a]) \n\t"
- "lwc1 %[f1], 36(%[a]) \n\t"
- "lwc1 %[f2], 40(%[a]) \n\t"
- "lwc1 %[f3], 44(%[a]) \n\t"
- "lwc1 %[f4], 48(%[a]) \n\t"
- "lwc1 %[f5], 52(%[a]) \n\t"
- "lwc1 %[f6], 56(%[a]) \n\t"
- "lwc1 %[f7], 60(%[a]) \n\t"
- "add.s %[f8], %[f4], %[f6] \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "add.s %[f6], %[f1], %[f3] \n\t"
- "sub.s %[f1], %[f1], %[f3] \n\t"
- "add.s %[f3], %[f0], %[f2] \n\t"
- "sub.s %[f0], %[f0], %[f2] \n\t"
- "add.s %[f2], %[f5], %[f7] \n\t"
- "sub.s %[f5], %[f5], %[f7] \n\t"
- "add.s %[f7], %[f4], %[f1] \n\t"
- "sub.s %[f4], %[f4], %[f1] \n\t"
- "add.s %[f1], %[f3], %[f8] \n\t"
- "sub.s %[f3], %[f3], %[f8] \n\t"
- "sub.s %[f8], %[f0], %[f5] \n\t"
- "add.s %[f0], %[f0], %[f5] \n\t"
- "add.s %[f5], %[f6], %[f2] \n\t"
- "sub.s %[f6], %[f2], %[f6] \n\t"
- "lwc1 %[f9], 8(%[rdft_w]) \n\t"
- "sub.s %[f2], %[f8], %[f7] \n\t"
- "add.s %[f8], %[f8], %[f7] \n\t"
- "sub.s %[f7], %[f4], %[f0] \n\t"
- "add.s %[f4], %[f4], %[f0] \n\t"
- // prepare for loop
- "addiu %[a_ptr], %[a], 64 \n\t"
- "addiu %[p1_rdft], %[rdft_w], 8 \n\t"
- "addiu %[p2_rdft], %[rdft_w], 16 \n\t"
- "addiu %[count], $zero, 7 \n\t"
- // finish second 8
- "mul.s %[f2], %[f9], %[f2] \n\t"
- "mul.s %[f8], %[f9], %[f8] \n\t"
- "mul.s %[f7], %[f9], %[f7] \n\t"
- "mul.s %[f4], %[f9], %[f4] \n\t"
- "swc1 %[f1], 32(%[a]) \n\t"
- "swc1 %[f3], 52(%[a]) \n\t"
- "swc1 %[f5], 36(%[a]) \n\t"
- "swc1 %[f6], 48(%[a]) \n\t"
- "swc1 %[f2], 40(%[a]) \n\t"
- "swc1 %[f8], 44(%[a]) \n\t"
- "swc1 %[f7], 56(%[a]) \n\t"
- "swc1 %[f4], 60(%[a]) \n\t"
- // loop
- "1: \n\t"
- "lwc1 %[f0], 0(%[a_ptr]) \n\t"
- "lwc1 %[f1], 4(%[a_ptr]) \n\t"
- "lwc1 %[f2], 8(%[a_ptr]) \n\t"
- "lwc1 %[f3], 12(%[a_ptr]) \n\t"
- "lwc1 %[f4], 16(%[a_ptr]) \n\t"
- "lwc1 %[f5], 20(%[a_ptr]) \n\t"
- "lwc1 %[f6], 24(%[a_ptr]) \n\t"
- "lwc1 %[f7], 28(%[a_ptr]) \n\t"
- "add.s %[f8], %[f0], %[f2] \n\t"
- "sub.s %[f0], %[f0], %[f2] \n\t"
- "add.s %[f2], %[f4], %[f6] \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "add.s %[f6], %[f1], %[f3] \n\t"
- "sub.s %[f1], %[f1], %[f3] \n\t"
- "add.s %[f3], %[f5], %[f7] \n\t"
- "sub.s %[f5], %[f5], %[f7] \n\t"
- "lwc1 %[f10], 4(%[p1_rdft]) \n\t"
- "lwc1 %[f11], 0(%[p2_rdft]) \n\t"
- "lwc1 %[f12], 4(%[p2_rdft]) \n\t"
- "lwc1 %[f13], 8(%[first]) \n\t"
- "lwc1 %[f14], 12(%[first]) \n\t"
- "add.s %[f7], %[f8], %[f2] \n\t"
- "sub.s %[f8], %[f8], %[f2] \n\t"
- "add.s %[f2], %[f6], %[f3] \n\t"
- "sub.s %[f6], %[f6], %[f3] \n\t"
- "add.s %[f3], %[f0], %[f5] \n\t"
- "sub.s %[f0], %[f0], %[f5] \n\t"
- "add.s %[f5], %[f1], %[f4] \n\t"
- "sub.s %[f1], %[f1], %[f4] \n\t"
- "swc1 %[f7], 0(%[a_ptr]) \n\t"
- "swc1 %[f2], 4(%[a_ptr]) \n\t"
- "mul.s %[f4], %[f9], %[f8] \n\t"
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ // first 8
+ "lwc1 %[f0], 0(%[a]) \n\t"
+ "lwc1 %[f1], 4(%[a]) \n\t"
+ "lwc1 %[f2], 8(%[a]) \n\t"
+ "lwc1 %[f3], 12(%[a]) \n\t"
+ "lwc1 %[f4], 16(%[a]) \n\t"
+ "lwc1 %[f5], 20(%[a]) \n\t"
+ "lwc1 %[f6], 24(%[a]) \n\t"
+ "lwc1 %[f7], 28(%[a]) \n\t"
+ "add.s %[f8], %[f0], %[f2] \n\t"
+ "sub.s %[f0], %[f0], %[f2] \n\t"
+ "add.s %[f2], %[f4], %[f6] \n\t"
+ "sub.s %[f4], %[f4], %[f6] \n\t"
+ "add.s %[f6], %[f1], %[f3] \n\t"
+ "sub.s %[f1], %[f1], %[f3] \n\t"
+ "add.s %[f3], %[f5], %[f7] \n\t"
+ "sub.s %[f5], %[f5], %[f7] \n\t"
+ "add.s %[f7], %[f8], %[f2] \n\t"
+ "sub.s %[f8], %[f8], %[f2] \n\t"
+ "sub.s %[f2], %[f1], %[f4] \n\t"
+ "add.s %[f1], %[f1], %[f4] \n\t"
+ "add.s %[f4], %[f6], %[f3] \n\t"
+ "sub.s %[f6], %[f6], %[f3] \n\t"
+ "sub.s %[f3], %[f0], %[f5] \n\t"
+ "add.s %[f0], %[f0], %[f5] \n\t"
+ "swc1 %[f7], 0(%[a]) \n\t"
+ "swc1 %[f8], 16(%[a]) \n\t"
+ "swc1 %[f2], 28(%[a]) \n\t"
+ "swc1 %[f1], 12(%[a]) \n\t"
+ "swc1 %[f4], 4(%[a]) \n\t"
+ "swc1 %[f6], 20(%[a]) \n\t"
+ "swc1 %[f3], 8(%[a]) \n\t"
+ "swc1 %[f0], 24(%[a]) \n\t"
+ // second 8
+ "lwc1 %[f0], 32(%[a]) \n\t"
+ "lwc1 %[f1], 36(%[a]) \n\t"
+ "lwc1 %[f2], 40(%[a]) \n\t"
+ "lwc1 %[f3], 44(%[a]) \n\t"
+ "lwc1 %[f4], 48(%[a]) \n\t"
+ "lwc1 %[f5], 52(%[a]) \n\t"
+ "lwc1 %[f6], 56(%[a]) \n\t"
+ "lwc1 %[f7], 60(%[a]) \n\t"
+ "add.s %[f8], %[f4], %[f6] \n\t"
+ "sub.s %[f4], %[f4], %[f6] \n\t"
+ "add.s %[f6], %[f1], %[f3] \n\t"
+ "sub.s %[f1], %[f1], %[f3] \n\t"
+ "add.s %[f3], %[f0], %[f2] \n\t"
+ "sub.s %[f0], %[f0], %[f2] \n\t"
+ "add.s %[f2], %[f5], %[f7] \n\t"
+ "sub.s %[f5], %[f5], %[f7] \n\t"
+ "add.s %[f7], %[f4], %[f1] \n\t"
+ "sub.s %[f4], %[f4], %[f1] \n\t"
+ "add.s %[f1], %[f3], %[f8] \n\t"
+ "sub.s %[f3], %[f3], %[f8] \n\t"
+ "sub.s %[f8], %[f0], %[f5] \n\t"
+ "add.s %[f0], %[f0], %[f5] \n\t"
+ "add.s %[f5], %[f6], %[f2] \n\t"
+ "sub.s %[f6], %[f2], %[f6] \n\t"
+ "lwc1 %[f9], 8(%[rdft_w]) \n\t"
+ "sub.s %[f2], %[f8], %[f7] \n\t"
+ "add.s %[f8], %[f8], %[f7] \n\t"
+ "sub.s %[f7], %[f4], %[f0] \n\t"
+ "add.s %[f4], %[f4], %[f0] \n\t"
+ // prepare for loop
+ "addiu %[a_ptr], %[a], 64 \n\t"
+ "addiu %[p1_rdft], %[rdft_w], 8 \n\t"
+ "addiu %[p2_rdft], %[rdft_w], 16 \n\t"
+ "addiu %[count], $zero, 7 \n\t"
+ // finish second 8
+ "mul.s %[f2], %[f9], %[f2] \n\t"
+ "mul.s %[f8], %[f9], %[f8] \n\t"
+ "mul.s %[f7], %[f9], %[f7] \n\t"
+ "mul.s %[f4], %[f9], %[f4] \n\t"
+ "swc1 %[f1], 32(%[a]) \n\t"
+ "swc1 %[f3], 52(%[a]) \n\t"
+ "swc1 %[f5], 36(%[a]) \n\t"
+ "swc1 %[f6], 48(%[a]) \n\t"
+ "swc1 %[f2], 40(%[a]) \n\t"
+ "swc1 %[f8], 44(%[a]) \n\t"
+ "swc1 %[f7], 56(%[a]) \n\t"
+ "swc1 %[f4], 60(%[a]) \n\t"
+ // loop
+ "1: \n\t"
+ "lwc1 %[f0], 0(%[a_ptr]) \n\t"
+ "lwc1 %[f1], 4(%[a_ptr]) \n\t"
+ "lwc1 %[f2], 8(%[a_ptr]) \n\t"
+ "lwc1 %[f3], 12(%[a_ptr]) \n\t"
+ "lwc1 %[f4], 16(%[a_ptr]) \n\t"
+ "lwc1 %[f5], 20(%[a_ptr]) \n\t"
+ "lwc1 %[f6], 24(%[a_ptr]) \n\t"
+ "lwc1 %[f7], 28(%[a_ptr]) \n\t"
+ "add.s %[f8], %[f0], %[f2] \n\t"
+ "sub.s %[f0], %[f0], %[f2] \n\t"
+ "add.s %[f2], %[f4], %[f6] \n\t"
+ "sub.s %[f4], %[f4], %[f6] \n\t"
+ "add.s %[f6], %[f1], %[f3] \n\t"
+ "sub.s %[f1], %[f1], %[f3] \n\t"
+ "add.s %[f3], %[f5], %[f7] \n\t"
+ "sub.s %[f5], %[f5], %[f7] \n\t"
+ "lwc1 %[f10], 4(%[p1_rdft]) \n\t"
+ "lwc1 %[f11], 0(%[p2_rdft]) \n\t"
+ "lwc1 %[f12], 4(%[p2_rdft]) \n\t"
+ "lwc1 %[f13], 8(%[first]) \n\t"
+ "lwc1 %[f14], 12(%[first]) \n\t"
+ "add.s %[f7], %[f8], %[f2] \n\t"
+ "sub.s %[f8], %[f8], %[f2] \n\t"
+ "add.s %[f2], %[f6], %[f3] \n\t"
+ "sub.s %[f6], %[f6], %[f3] \n\t"
+ "add.s %[f3], %[f0], %[f5] \n\t"
+ "sub.s %[f0], %[f0], %[f5] \n\t"
+ "add.s %[f5], %[f1], %[f4] \n\t"
+ "sub.s %[f1], %[f1], %[f4] \n\t"
+ "swc1 %[f7], 0(%[a_ptr]) \n\t"
+ "swc1 %[f2], 4(%[a_ptr]) \n\t"
+ "mul.s %[f4], %[f9], %[f8] \n\t"
#if defined(MIPS32_R2_LE)
- "mul.s %[f8], %[f10], %[f8] \n\t"
- "mul.s %[f7], %[f11], %[f0] \n\t"
- "mul.s %[f0], %[f12], %[f0] \n\t"
- "mul.s %[f2], %[f13], %[f3] \n\t"
- "mul.s %[f3], %[f14], %[f3] \n\t"
- "nmsub.s %[f4], %[f4], %[f10], %[f6] \n\t"
- "madd.s %[f8], %[f8], %[f9], %[f6] \n\t"
- "nmsub.s %[f7], %[f7], %[f12], %[f5] \n\t"
- "madd.s %[f0], %[f0], %[f11], %[f5] \n\t"
- "nmsub.s %[f2], %[f2], %[f14], %[f1] \n\t"
- "madd.s %[f3], %[f3], %[f13], %[f1] \n\t"
+ "mul.s %[f8], %[f10], %[f8] \n\t"
+ "mul.s %[f7], %[f11], %[f0] \n\t"
+ "mul.s %[f0], %[f12], %[f0] \n\t"
+ "mul.s %[f2], %[f13], %[f3] \n\t"
+ "mul.s %[f3], %[f14], %[f3] \n\t"
+ "nmsub.s %[f4], %[f4], %[f10], %[f6] \n\t"
+ "madd.s %[f8], %[f8], %[f9], %[f6] \n\t"
+ "nmsub.s %[f7], %[f7], %[f12], %[f5] \n\t"
+ "madd.s %[f0], %[f0], %[f11], %[f5] \n\t"
+ "nmsub.s %[f2], %[f2], %[f14], %[f1] \n\t"
+ "madd.s %[f3], %[f3], %[f13], %[f1] \n\t"
#else
- "mul.s %[f7], %[f10], %[f6] \n\t"
- "mul.s %[f6], %[f9], %[f6] \n\t"
- "mul.s %[f8], %[f10], %[f8] \n\t"
- "mul.s %[f2], %[f11], %[f0] \n\t"
- "mul.s %[f11], %[f11], %[f5] \n\t"
- "mul.s %[f5], %[f12], %[f5] \n\t"
- "mul.s %[f0], %[f12], %[f0] \n\t"
- "mul.s %[f12], %[f13], %[f3] \n\t"
- "mul.s %[f13], %[f13], %[f1] \n\t"
- "mul.s %[f1], %[f14], %[f1] \n\t"
- "mul.s %[f3], %[f14], %[f3] \n\t"
- "sub.s %[f4], %[f4], %[f7] \n\t"
- "add.s %[f8], %[f6], %[f8] \n\t"
- "sub.s %[f7], %[f2], %[f5] \n\t"
- "add.s %[f0], %[f11], %[f0] \n\t"
- "sub.s %[f2], %[f12], %[f1] \n\t"
- "add.s %[f3], %[f13], %[f3] \n\t"
+ "mul.s %[f7], %[f10], %[f6] \n\t"
+ "mul.s %[f6], %[f9], %[f6] \n\t"
+ "mul.s %[f8], %[f10], %[f8] \n\t"
+ "mul.s %[f2], %[f11], %[f0] \n\t"
+ "mul.s %[f11], %[f11], %[f5] \n\t"
+ "mul.s %[f5], %[f12], %[f5] \n\t"
+ "mul.s %[f0], %[f12], %[f0] \n\t"
+ "mul.s %[f12], %[f13], %[f3] \n\t"
+ "mul.s %[f13], %[f13], %[f1] \n\t"
+ "mul.s %[f1], %[f14], %[f1] \n\t"
+ "mul.s %[f3], %[f14], %[f3] \n\t"
+ "sub.s %[f4], %[f4], %[f7] \n\t"
+ "add.s %[f8], %[f6], %[f8] \n\t"
+ "sub.s %[f7], %[f2], %[f5] \n\t"
+ "add.s %[f0], %[f11], %[f0] \n\t"
+ "sub.s %[f2], %[f12], %[f1] \n\t"
+ "add.s %[f3], %[f13], %[f3] \n\t"
#endif
- "swc1 %[f4], 16(%[a_ptr]) \n\t"
- "swc1 %[f8], 20(%[a_ptr]) \n\t"
- "swc1 %[f7], 8(%[a_ptr]) \n\t"
- "swc1 %[f0], 12(%[a_ptr]) \n\t"
- "swc1 %[f2], 24(%[a_ptr]) \n\t"
- "swc1 %[f3], 28(%[a_ptr]) \n\t"
- "lwc1 %[f0], 32(%[a_ptr]) \n\t"
- "lwc1 %[f1], 36(%[a_ptr]) \n\t"
- "lwc1 %[f2], 40(%[a_ptr]) \n\t"
- "lwc1 %[f3], 44(%[a_ptr]) \n\t"
- "lwc1 %[f4], 48(%[a_ptr]) \n\t"
- "lwc1 %[f5], 52(%[a_ptr]) \n\t"
- "lwc1 %[f6], 56(%[a_ptr]) \n\t"
- "lwc1 %[f7], 60(%[a_ptr]) \n\t"
- "add.s %[f8], %[f0], %[f2] \n\t"
- "sub.s %[f0], %[f0], %[f2] \n\t"
- "add.s %[f2], %[f4], %[f6] \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "add.s %[f6], %[f1], %[f3] \n\t"
- "sub.s %[f1], %[f1], %[f3] \n\t"
- "add.s %[f3], %[f5], %[f7] \n\t"
- "sub.s %[f5], %[f5], %[f7] \n\t"
- "lwc1 %[f11], 8(%[p2_rdft]) \n\t"
- "lwc1 %[f12], 12(%[p2_rdft]) \n\t"
- "lwc1 %[f13], 8(%[second]) \n\t"
- "lwc1 %[f14], 12(%[second]) \n\t"
- "add.s %[f7], %[f8], %[f2] \n\t"
- "sub.s %[f8], %[f2], %[f8] \n\t"
- "add.s %[f2], %[f6], %[f3] \n\t"
- "sub.s %[f6], %[f3], %[f6] \n\t"
- "add.s %[f3], %[f0], %[f5] \n\t"
- "sub.s %[f0], %[f0], %[f5] \n\t"
- "add.s %[f5], %[f1], %[f4] \n\t"
- "sub.s %[f1], %[f1], %[f4] \n\t"
- "swc1 %[f7], 32(%[a_ptr]) \n\t"
- "swc1 %[f2], 36(%[a_ptr]) \n\t"
- "mul.s %[f4], %[f10], %[f8] \n\t"
+ "swc1 %[f4], 16(%[a_ptr]) \n\t"
+ "swc1 %[f8], 20(%[a_ptr]) \n\t"
+ "swc1 %[f7], 8(%[a_ptr]) \n\t"
+ "swc1 %[f0], 12(%[a_ptr]) \n\t"
+ "swc1 %[f2], 24(%[a_ptr]) \n\t"
+ "swc1 %[f3], 28(%[a_ptr]) \n\t"
+ "lwc1 %[f0], 32(%[a_ptr]) \n\t"
+ "lwc1 %[f1], 36(%[a_ptr]) \n\t"
+ "lwc1 %[f2], 40(%[a_ptr]) \n\t"
+ "lwc1 %[f3], 44(%[a_ptr]) \n\t"
+ "lwc1 %[f4], 48(%[a_ptr]) \n\t"
+ "lwc1 %[f5], 52(%[a_ptr]) \n\t"
+ "lwc1 %[f6], 56(%[a_ptr]) \n\t"
+ "lwc1 %[f7], 60(%[a_ptr]) \n\t"
+ "add.s %[f8], %[f0], %[f2] \n\t"
+ "sub.s %[f0], %[f0], %[f2] \n\t"
+ "add.s %[f2], %[f4], %[f6] \n\t"
+ "sub.s %[f4], %[f4], %[f6] \n\t"
+ "add.s %[f6], %[f1], %[f3] \n\t"
+ "sub.s %[f1], %[f1], %[f3] \n\t"
+ "add.s %[f3], %[f5], %[f7] \n\t"
+ "sub.s %[f5], %[f5], %[f7] \n\t"
+ "lwc1 %[f11], 8(%[p2_rdft]) \n\t"
+ "lwc1 %[f12], 12(%[p2_rdft]) \n\t"
+ "lwc1 %[f13], 8(%[second]) \n\t"
+ "lwc1 %[f14], 12(%[second]) \n\t"
+ "add.s %[f7], %[f8], %[f2] \n\t"
+ "sub.s %[f8], %[f2], %[f8] \n\t"
+ "add.s %[f2], %[f6], %[f3] \n\t"
+ "sub.s %[f6], %[f3], %[f6] \n\t"
+ "add.s %[f3], %[f0], %[f5] \n\t"
+ "sub.s %[f0], %[f0], %[f5] \n\t"
+ "add.s %[f5], %[f1], %[f4] \n\t"
+ "sub.s %[f1], %[f1], %[f4] \n\t"
+ "swc1 %[f7], 32(%[a_ptr]) \n\t"
+ "swc1 %[f2], 36(%[a_ptr]) \n\t"
+ "mul.s %[f4], %[f10], %[f8] \n\t"
#if defined(MIPS32_R2_LE)
- "mul.s %[f10], %[f10], %[f6] \n\t"
- "mul.s %[f7], %[f11], %[f0] \n\t"
- "mul.s %[f11], %[f11], %[f5] \n\t"
- "mul.s %[f2], %[f13], %[f3] \n\t"
- "mul.s %[f13], %[f13], %[f1] \n\t"
- "madd.s %[f4], %[f4], %[f9], %[f6] \n\t"
- "nmsub.s %[f10], %[f10], %[f9], %[f8] \n\t"
- "nmsub.s %[f7], %[f7], %[f12], %[f5] \n\t"
- "madd.s %[f11], %[f11], %[f12], %[f0] \n\t"
- "nmsub.s %[f2], %[f2], %[f14], %[f1] \n\t"
- "madd.s %[f13], %[f13], %[f14], %[f3] \n\t"
+ "mul.s %[f10], %[f10], %[f6] \n\t"
+ "mul.s %[f7], %[f11], %[f0] \n\t"
+ "mul.s %[f11], %[f11], %[f5] \n\t"
+ "mul.s %[f2], %[f13], %[f3] \n\t"
+ "mul.s %[f13], %[f13], %[f1] \n\t"
+ "madd.s %[f4], %[f4], %[f9], %[f6] \n\t"
+ "nmsub.s %[f10], %[f10], %[f9], %[f8] \n\t"
+ "nmsub.s %[f7], %[f7], %[f12], %[f5] \n\t"
+ "madd.s %[f11], %[f11], %[f12], %[f0] \n\t"
+ "nmsub.s %[f2], %[f2], %[f14], %[f1] \n\t"
+ "madd.s %[f13], %[f13], %[f14], %[f3] \n\t"
#else
- "mul.s %[f2], %[f9], %[f6] \n\t"
- "mul.s %[f10], %[f10], %[f6] \n\t"
- "mul.s %[f9], %[f9], %[f8] \n\t"
- "mul.s %[f7], %[f11], %[f0] \n\t"
- "mul.s %[f8], %[f12], %[f5] \n\t"
- "mul.s %[f11], %[f11], %[f5] \n\t"
- "mul.s %[f12], %[f12], %[f0] \n\t"
- "mul.s %[f5], %[f13], %[f3] \n\t"
- "mul.s %[f0], %[f14], %[f1] \n\t"
- "mul.s %[f13], %[f13], %[f1] \n\t"
- "mul.s %[f14], %[f14], %[f3] \n\t"
- "add.s %[f4], %[f4], %[f2] \n\t"
- "sub.s %[f10], %[f10], %[f9] \n\t"
- "sub.s %[f7], %[f7], %[f8] \n\t"
- "add.s %[f11], %[f11], %[f12] \n\t"
- "sub.s %[f2], %[f5], %[f0] \n\t"
- "add.s %[f13], %[f13], %[f14] \n\t"
+ "mul.s %[f2], %[f9], %[f6] \n\t"
+ "mul.s %[f10], %[f10], %[f6] \n\t"
+ "mul.s %[f9], %[f9], %[f8] \n\t"
+ "mul.s %[f7], %[f11], %[f0] \n\t"
+ "mul.s %[f8], %[f12], %[f5] \n\t"
+ "mul.s %[f11], %[f11], %[f5] \n\t"
+ "mul.s %[f12], %[f12], %[f0] \n\t"
+ "mul.s %[f5], %[f13], %[f3] \n\t"
+ "mul.s %[f0], %[f14], %[f1] \n\t"
+ "mul.s %[f13], %[f13], %[f1] \n\t"
+ "mul.s %[f14], %[f14], %[f3] \n\t"
+ "add.s %[f4], %[f4], %[f2] \n\t"
+ "sub.s %[f10], %[f10], %[f9] \n\t"
+ "sub.s %[f7], %[f7], %[f8] \n\t"
+ "add.s %[f11], %[f11], %[f12] \n\t"
+ "sub.s %[f2], %[f5], %[f0] \n\t"
+ "add.s %[f13], %[f13], %[f14] \n\t"
#endif
- "swc1 %[f4], 48(%[a_ptr]) \n\t"
- "swc1 %[f10], 52(%[a_ptr]) \n\t"
- "swc1 %[f7], 40(%[a_ptr]) \n\t"
- "swc1 %[f11], 44(%[a_ptr]) \n\t"
- "swc1 %[f2], 56(%[a_ptr]) \n\t"
- "swc1 %[f13], 60(%[a_ptr]) \n\t"
- "addiu %[count], %[count], -1 \n\t"
- "lwc1 %[f9], 8(%[p1_rdft]) \n\t"
- "addiu %[a_ptr], %[a_ptr], 64 \n\t"
- "addiu %[p1_rdft], %[p1_rdft], 8 \n\t"
- "addiu %[p2_rdft], %[p2_rdft], 16 \n\t"
- "addiu %[first], %[first], 8 \n\t"
- "bgtz %[count], 1b \n\t"
- " addiu %[second], %[second], 8 \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3),
- [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7),
- [f8] "=&f" (f8), [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11),
- [f12] "=&f" (f12), [f13] "=&f" (f13), [f14] "=&f" (f14),
- [a_ptr] "=&r" (a_ptr), [p1_rdft] "=&r" (p1_rdft), [first] "+r" (first),
- [p2_rdft] "=&r" (p2_rdft), [count] "=&r" (count), [second] "+r" (second)
- : [a] "r" (a), [rdft_w] "r" (rdft_w)
- : "memory"
- );
+ "swc1 %[f4], 48(%[a_ptr]) \n\t"
+ "swc1 %[f10], 52(%[a_ptr]) \n\t"
+ "swc1 %[f7], 40(%[a_ptr]) \n\t"
+ "swc1 %[f11], 44(%[a_ptr]) \n\t"
+ "swc1 %[f2], 56(%[a_ptr]) \n\t"
+ "swc1 %[f13], 60(%[a_ptr]) \n\t"
+ "addiu %[count], %[count], -1 \n\t"
+ "lwc1 %[f9], 8(%[p1_rdft]) \n\t"
+ "addiu %[a_ptr], %[a_ptr], 64 \n\t"
+ "addiu %[p1_rdft], %[p1_rdft], 8 \n\t"
+ "addiu %[p2_rdft], %[p2_rdft], 16 \n\t"
+ "addiu %[first], %[first], 8 \n\t"
+ "bgtz %[count], 1b \n\t"
+ " addiu %[second], %[second], 8 \n\t"
+ ".set pop \n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3),
+ [f4] "=&f"(f4), [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7),
+ [f8] "=&f"(f8), [f9] "=&f"(f9), [f10] "=&f"(f10), [f11] "=&f"(f11),
+ [f12] "=&f"(f12), [f13] "=&f"(f13), [f14] "=&f"(f14),
+ [a_ptr] "=&r"(a_ptr), [p1_rdft] "=&r"(p1_rdft), [first] "+r"(first),
+ [p2_rdft] "=&r"(p2_rdft), [count] "=&r"(count), [second] "+r"(second)
+ : [a] "r"(a), [rdft_w] "r"(rdft_w)
+ : "memory");
}
void cftmdl_128_mips(float* a) {
float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14;
int tmp_a, count;
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[tmp_a], %[a], 0 \n\t"
- "addiu %[count], $zero, 4 \n\t"
- "1: \n\t"
- "addiu %[count], %[count], -1 \n\t"
- "lwc1 %[f0], 0(%[tmp_a]) \n\t"
- "lwc1 %[f2], 32(%[tmp_a]) \n\t"
- "lwc1 %[f4], 64(%[tmp_a]) \n\t"
- "lwc1 %[f6], 96(%[tmp_a]) \n\t"
- "lwc1 %[f1], 4(%[tmp_a]) \n\t"
- "lwc1 %[f3], 36(%[tmp_a]) \n\t"
- "lwc1 %[f5], 68(%[tmp_a]) \n\t"
- "lwc1 %[f7], 100(%[tmp_a]) \n\t"
- "add.s %[f8], %[f0], %[f2] \n\t"
- "sub.s %[f0], %[f0], %[f2] \n\t"
- "add.s %[f2], %[f4], %[f6] \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "add.s %[f6], %[f1], %[f3] \n\t"
- "sub.s %[f1], %[f1], %[f3] \n\t"
- "add.s %[f3], %[f5], %[f7] \n\t"
- "sub.s %[f5], %[f5], %[f7] \n\t"
- "add.s %[f7], %[f8], %[f2] \n\t"
- "sub.s %[f8], %[f8], %[f2] \n\t"
- "add.s %[f2], %[f1], %[f4] \n\t"
- "sub.s %[f1], %[f1], %[f4] \n\t"
- "add.s %[f4], %[f6], %[f3] \n\t"
- "sub.s %[f6], %[f6], %[f3] \n\t"
- "sub.s %[f3], %[f0], %[f5] \n\t"
- "add.s %[f0], %[f0], %[f5] \n\t"
- "swc1 %[f7], 0(%[tmp_a]) \n\t"
- "swc1 %[f8], 64(%[tmp_a]) \n\t"
- "swc1 %[f2], 36(%[tmp_a]) \n\t"
- "swc1 %[f1], 100(%[tmp_a]) \n\t"
- "swc1 %[f4], 4(%[tmp_a]) \n\t"
- "swc1 %[f6], 68(%[tmp_a]) \n\t"
- "swc1 %[f3], 32(%[tmp_a]) \n\t"
- "swc1 %[f0], 96(%[tmp_a]) \n\t"
- "bgtz %[count], 1b \n\t"
- " addiu %[tmp_a], %[tmp_a], 8 \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3),
- [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7),
- [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a), [count] "=&r" (count)
- : [a] "r" (a)
- : "memory"
- );
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "addiu %[tmp_a], %[a], 0 \n\t"
+ "addiu %[count], $zero, 4 \n\t"
+ "1: \n\t"
+ "addiu %[count], %[count], -1 \n\t"
+ "lwc1 %[f0], 0(%[tmp_a]) \n\t"
+ "lwc1 %[f2], 32(%[tmp_a]) \n\t"
+ "lwc1 %[f4], 64(%[tmp_a]) \n\t"
+ "lwc1 %[f6], 96(%[tmp_a]) \n\t"
+ "lwc1 %[f1], 4(%[tmp_a]) \n\t"
+ "lwc1 %[f3], 36(%[tmp_a]) \n\t"
+ "lwc1 %[f5], 68(%[tmp_a]) \n\t"
+ "lwc1 %[f7], 100(%[tmp_a]) \n\t"
+ "add.s %[f8], %[f0], %[f2] \n\t"
+ "sub.s %[f0], %[f0], %[f2] \n\t"
+ "add.s %[f2], %[f4], %[f6] \n\t"
+ "sub.s %[f4], %[f4], %[f6] \n\t"
+ "add.s %[f6], %[f1], %[f3] \n\t"
+ "sub.s %[f1], %[f1], %[f3] \n\t"
+ "add.s %[f3], %[f5], %[f7] \n\t"
+ "sub.s %[f5], %[f5], %[f7] \n\t"
+ "add.s %[f7], %[f8], %[f2] \n\t"
+ "sub.s %[f8], %[f8], %[f2] \n\t"
+ "add.s %[f2], %[f1], %[f4] \n\t"
+ "sub.s %[f1], %[f1], %[f4] \n\t"
+ "add.s %[f4], %[f6], %[f3] \n\t"
+ "sub.s %[f6], %[f6], %[f3] \n\t"
+ "sub.s %[f3], %[f0], %[f5] \n\t"
+ "add.s %[f0], %[f0], %[f5] \n\t"
+ "swc1 %[f7], 0(%[tmp_a]) \n\t"
+ "swc1 %[f8], 64(%[tmp_a]) \n\t"
+ "swc1 %[f2], 36(%[tmp_a]) \n\t"
+ "swc1 %[f1], 100(%[tmp_a]) \n\t"
+ "swc1 %[f4], 4(%[tmp_a]) \n\t"
+ "swc1 %[f6], 68(%[tmp_a]) \n\t"
+ "swc1 %[f3], 32(%[tmp_a]) \n\t"
+ "swc1 %[f0], 96(%[tmp_a]) \n\t"
+ "bgtz %[count], 1b \n\t"
+ " addiu %[tmp_a], %[tmp_a], 8 \n\t"
+ ".set pop \n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3),
+ [f4] "=&f"(f4), [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7),
+ [f8] "=&f"(f8), [tmp_a] "=&r"(tmp_a), [count] "=&r"(count)
+ : [a] "r"(a)
+ : "memory");
f9 = rdft_w[2];
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[tmp_a], %[a], 128 \n\t"
- "addiu %[count], $zero, 4 \n\t"
- "1: \n\t"
- "addiu %[count], %[count], -1 \n\t"
- "lwc1 %[f0], 0(%[tmp_a]) \n\t"
- "lwc1 %[f2], 32(%[tmp_a]) \n\t"
- "lwc1 %[f5], 68(%[tmp_a]) \n\t"
- "lwc1 %[f7], 100(%[tmp_a]) \n\t"
- "lwc1 %[f1], 4(%[tmp_a]) \n\t"
- "lwc1 %[f3], 36(%[tmp_a]) \n\t"
- "lwc1 %[f4], 64(%[tmp_a]) \n\t"
- "lwc1 %[f6], 96(%[tmp_a]) \n\t"
- "sub.s %[f8], %[f0], %[f2] \n\t"
- "add.s %[f0], %[f0], %[f2] \n\t"
- "sub.s %[f2], %[f5], %[f7] \n\t"
- "add.s %[f5], %[f5], %[f7] \n\t"
- "sub.s %[f7], %[f1], %[f3] \n\t"
- "add.s %[f1], %[f1], %[f3] \n\t"
- "sub.s %[f3], %[f4], %[f6] \n\t"
- "add.s %[f4], %[f4], %[f6] \n\t"
- "sub.s %[f6], %[f8], %[f2] \n\t"
- "add.s %[f8], %[f8], %[f2] \n\t"
- "add.s %[f2], %[f5], %[f1] \n\t"
- "sub.s %[f5], %[f5], %[f1] \n\t"
- "add.s %[f1], %[f3], %[f7] \n\t"
- "sub.s %[f3], %[f3], %[f7] \n\t"
- "add.s %[f7], %[f0], %[f4] \n\t"
- "sub.s %[f0], %[f0], %[f4] \n\t"
- "sub.s %[f4], %[f6], %[f1] \n\t"
- "add.s %[f6], %[f6], %[f1] \n\t"
- "sub.s %[f1], %[f3], %[f8] \n\t"
- "add.s %[f3], %[f3], %[f8] \n\t"
- "mul.s %[f4], %[f4], %[f9] \n\t"
- "mul.s %[f6], %[f6], %[f9] \n\t"
- "mul.s %[f1], %[f1], %[f9] \n\t"
- "mul.s %[f3], %[f3], %[f9] \n\t"
- "swc1 %[f7], 0(%[tmp_a]) \n\t"
- "swc1 %[f2], 4(%[tmp_a]) \n\t"
- "swc1 %[f5], 64(%[tmp_a]) \n\t"
- "swc1 %[f0], 68(%[tmp_a]) \n\t"
- "swc1 %[f4], 32(%[tmp_a]) \n\t"
- "swc1 %[f6], 36(%[tmp_a]) \n\t"
- "swc1 %[f1], 96(%[tmp_a]) \n\t"
- "swc1 %[f3], 100(%[tmp_a]) \n\t"
- "bgtz %[count], 1b \n\t"
- " addiu %[tmp_a], %[tmp_a], 8 \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3),
- [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7),
- [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a), [count] "=&r" (count)
- : [a] "r" (a), [f9] "f" (f9)
- : "memory"
- );
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "addiu %[tmp_a], %[a], 128 \n\t"
+ "addiu %[count], $zero, 4 \n\t"
+ "1: \n\t"
+ "addiu %[count], %[count], -1 \n\t"
+ "lwc1 %[f0], 0(%[tmp_a]) \n\t"
+ "lwc1 %[f2], 32(%[tmp_a]) \n\t"
+ "lwc1 %[f5], 68(%[tmp_a]) \n\t"
+ "lwc1 %[f7], 100(%[tmp_a]) \n\t"
+ "lwc1 %[f1], 4(%[tmp_a]) \n\t"
+ "lwc1 %[f3], 36(%[tmp_a]) \n\t"
+ "lwc1 %[f4], 64(%[tmp_a]) \n\t"
+ "lwc1 %[f6], 96(%[tmp_a]) \n\t"
+ "sub.s %[f8], %[f0], %[f2] \n\t"
+ "add.s %[f0], %[f0], %[f2] \n\t"
+ "sub.s %[f2], %[f5], %[f7] \n\t"
+ "add.s %[f5], %[f5], %[f7] \n\t"
+ "sub.s %[f7], %[f1], %[f3] \n\t"
+ "add.s %[f1], %[f1], %[f3] \n\t"
+ "sub.s %[f3], %[f4], %[f6] \n\t"
+ "add.s %[f4], %[f4], %[f6] \n\t"
+ "sub.s %[f6], %[f8], %[f2] \n\t"
+ "add.s %[f8], %[f8], %[f2] \n\t"
+ "add.s %[f2], %[f5], %[f1] \n\t"
+ "sub.s %[f5], %[f5], %[f1] \n\t"
+ "add.s %[f1], %[f3], %[f7] \n\t"
+ "sub.s %[f3], %[f3], %[f7] \n\t"
+ "add.s %[f7], %[f0], %[f4] \n\t"
+ "sub.s %[f0], %[f0], %[f4] \n\t"
+ "sub.s %[f4], %[f6], %[f1] \n\t"
+ "add.s %[f6], %[f6], %[f1] \n\t"
+ "sub.s %[f1], %[f3], %[f8] \n\t"
+ "add.s %[f3], %[f3], %[f8] \n\t"
+ "mul.s %[f4], %[f4], %[f9] \n\t"
+ "mul.s %[f6], %[f6], %[f9] \n\t"
+ "mul.s %[f1], %[f1], %[f9] \n\t"
+ "mul.s %[f3], %[f3], %[f9] \n\t"
+ "swc1 %[f7], 0(%[tmp_a]) \n\t"
+ "swc1 %[f2], 4(%[tmp_a]) \n\t"
+ "swc1 %[f5], 64(%[tmp_a]) \n\t"
+ "swc1 %[f0], 68(%[tmp_a]) \n\t"
+ "swc1 %[f4], 32(%[tmp_a]) \n\t"
+ "swc1 %[f6], 36(%[tmp_a]) \n\t"
+ "swc1 %[f1], 96(%[tmp_a]) \n\t"
+ "swc1 %[f3], 100(%[tmp_a]) \n\t"
+ "bgtz %[count], 1b \n\t"
+ " addiu %[tmp_a], %[tmp_a], 8 \n\t"
+ ".set pop \n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3),
+ [f4] "=&f"(f4), [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7),
+ [f8] "=&f"(f8), [tmp_a] "=&r"(tmp_a), [count] "=&r"(count)
+ : [a] "r"(a), [f9] "f"(f9)
+ : "memory");
f10 = rdft_w[3];
f11 = rdft_w[4];
f12 = rdft_w[5];
f13 = rdft_wk3ri_first[2];
f14 = rdft_wk3ri_first[3];
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[tmp_a], %[a], 256 \n\t"
- "addiu %[count], $zero, 4 \n\t"
- "1: \n\t"
- "addiu %[count], %[count], -1 \n\t"
- "lwc1 %[f0], 0(%[tmp_a]) \n\t"
- "lwc1 %[f2], 32(%[tmp_a]) \n\t"
- "lwc1 %[f4], 64(%[tmp_a]) \n\t"
- "lwc1 %[f6], 96(%[tmp_a]) \n\t"
- "lwc1 %[f1], 4(%[tmp_a]) \n\t"
- "lwc1 %[f3], 36(%[tmp_a]) \n\t"
- "lwc1 %[f5], 68(%[tmp_a]) \n\t"
- "lwc1 %[f7], 100(%[tmp_a]) \n\t"
- "add.s %[f8], %[f0], %[f2] \n\t"
- "sub.s %[f0], %[f0], %[f2] \n\t"
- "add.s %[f2], %[f4], %[f6] \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "add.s %[f6], %[f1], %[f3] \n\t"
- "sub.s %[f1], %[f1], %[f3] \n\t"
- "add.s %[f3], %[f5], %[f7] \n\t"
- "sub.s %[f5], %[f5], %[f7] \n\t"
- "sub.s %[f7], %[f8], %[f2] \n\t"
- "add.s %[f8], %[f8], %[f2] \n\t"
- "add.s %[f2], %[f1], %[f4] \n\t"
- "sub.s %[f1], %[f1], %[f4] \n\t"
- "sub.s %[f4], %[f6], %[f3] \n\t"
- "add.s %[f6], %[f6], %[f3] \n\t"
- "sub.s %[f3], %[f0], %[f5] \n\t"
- "add.s %[f0], %[f0], %[f5] \n\t"
- "swc1 %[f8], 0(%[tmp_a]) \n\t"
- "swc1 %[f6], 4(%[tmp_a]) \n\t"
- "mul.s %[f5], %[f9], %[f7] \n\t"
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "addiu %[tmp_a], %[a], 256 \n\t"
+ "addiu %[count], $zero, 4 \n\t"
+ "1: \n\t"
+ "addiu %[count], %[count], -1 \n\t"
+ "lwc1 %[f0], 0(%[tmp_a]) \n\t"
+ "lwc1 %[f2], 32(%[tmp_a]) \n\t"
+ "lwc1 %[f4], 64(%[tmp_a]) \n\t"
+ "lwc1 %[f6], 96(%[tmp_a]) \n\t"
+ "lwc1 %[f1], 4(%[tmp_a]) \n\t"
+ "lwc1 %[f3], 36(%[tmp_a]) \n\t"
+ "lwc1 %[f5], 68(%[tmp_a]) \n\t"
+ "lwc1 %[f7], 100(%[tmp_a]) \n\t"
+ "add.s %[f8], %[f0], %[f2] \n\t"
+ "sub.s %[f0], %[f0], %[f2] \n\t"
+ "add.s %[f2], %[f4], %[f6] \n\t"
+ "sub.s %[f4], %[f4], %[f6] \n\t"
+ "add.s %[f6], %[f1], %[f3] \n\t"
+ "sub.s %[f1], %[f1], %[f3] \n\t"
+ "add.s %[f3], %[f5], %[f7] \n\t"
+ "sub.s %[f5], %[f5], %[f7] \n\t"
+ "sub.s %[f7], %[f8], %[f2] \n\t"
+ "add.s %[f8], %[f8], %[f2] \n\t"
+ "add.s %[f2], %[f1], %[f4] \n\t"
+ "sub.s %[f1], %[f1], %[f4] \n\t"
+ "sub.s %[f4], %[f6], %[f3] \n\t"
+ "add.s %[f6], %[f6], %[f3] \n\t"
+ "sub.s %[f3], %[f0], %[f5] \n\t"
+ "add.s %[f0], %[f0], %[f5] \n\t"
+ "swc1 %[f8], 0(%[tmp_a]) \n\t"
+ "swc1 %[f6], 4(%[tmp_a]) \n\t"
+ "mul.s %[f5], %[f9], %[f7] \n\t"
#if defined(MIPS32_R2_LE)
- "mul.s %[f7], %[f10], %[f7] \n\t"
- "mul.s %[f8], %[f11], %[f3] \n\t"
- "mul.s %[f3], %[f12], %[f3] \n\t"
- "mul.s %[f6], %[f13], %[f0] \n\t"
- "mul.s %[f0], %[f14], %[f0] \n\t"
- "nmsub.s %[f5], %[f5], %[f10], %[f4] \n\t"
- "madd.s %[f7], %[f7], %[f9], %[f4] \n\t"
- "nmsub.s %[f8], %[f8], %[f12], %[f2] \n\t"
- "madd.s %[f3], %[f3], %[f11], %[f2] \n\t"
- "nmsub.s %[f6], %[f6], %[f14], %[f1] \n\t"
- "madd.s %[f0], %[f0], %[f13], %[f1] \n\t"
- "swc1 %[f5], 64(%[tmp_a]) \n\t"
- "swc1 %[f7], 68(%[tmp_a]) \n\t"
+ "mul.s %[f7], %[f10], %[f7] \n\t"
+ "mul.s %[f8], %[f11], %[f3] \n\t"
+ "mul.s %[f3], %[f12], %[f3] \n\t"
+ "mul.s %[f6], %[f13], %[f0] \n\t"
+ "mul.s %[f0], %[f14], %[f0] \n\t"
+ "nmsub.s %[f5], %[f5], %[f10], %[f4] \n\t"
+ "madd.s %[f7], %[f7], %[f9], %[f4] \n\t"
+ "nmsub.s %[f8], %[f8], %[f12], %[f2] \n\t"
+ "madd.s %[f3], %[f3], %[f11], %[f2] \n\t"
+ "nmsub.s %[f6], %[f6], %[f14], %[f1] \n\t"
+ "madd.s %[f0], %[f0], %[f13], %[f1] \n\t"
+ "swc1 %[f5], 64(%[tmp_a]) \n\t"
+ "swc1 %[f7], 68(%[tmp_a]) \n\t"
#else
- "mul.s %[f8], %[f10], %[f4] \n\t"
- "mul.s %[f4], %[f9], %[f4] \n\t"
- "mul.s %[f7], %[f10], %[f7] \n\t"
- "mul.s %[f6], %[f11], %[f3] \n\t"
- "mul.s %[f3], %[f12], %[f3] \n\t"
- "sub.s %[f5], %[f5], %[f8] \n\t"
- "mul.s %[f8], %[f12], %[f2] \n\t"
- "mul.s %[f2], %[f11], %[f2] \n\t"
- "add.s %[f7], %[f4], %[f7] \n\t"
- "mul.s %[f4], %[f13], %[f0] \n\t"
- "mul.s %[f0], %[f14], %[f0] \n\t"
- "sub.s %[f8], %[f6], %[f8] \n\t"
- "mul.s %[f6], %[f14], %[f1] \n\t"
- "mul.s %[f1], %[f13], %[f1] \n\t"
- "add.s %[f3], %[f2], %[f3] \n\t"
- "swc1 %[f5], 64(%[tmp_a]) \n\t"
- "swc1 %[f7], 68(%[tmp_a]) \n\t"
- "sub.s %[f6], %[f4], %[f6] \n\t"
- "add.s %[f0], %[f1], %[f0] \n\t"
+ "mul.s %[f8], %[f10], %[f4] \n\t"
+ "mul.s %[f4], %[f9], %[f4] \n\t"
+ "mul.s %[f7], %[f10], %[f7] \n\t"
+ "mul.s %[f6], %[f11], %[f3] \n\t"
+ "mul.s %[f3], %[f12], %[f3] \n\t"
+ "sub.s %[f5], %[f5], %[f8] \n\t"
+ "mul.s %[f8], %[f12], %[f2] \n\t"
+ "mul.s %[f2], %[f11], %[f2] \n\t"
+ "add.s %[f7], %[f4], %[f7] \n\t"
+ "mul.s %[f4], %[f13], %[f0] \n\t"
+ "mul.s %[f0], %[f14], %[f0] \n\t"
+ "sub.s %[f8], %[f6], %[f8] \n\t"
+ "mul.s %[f6], %[f14], %[f1] \n\t"
+ "mul.s %[f1], %[f13], %[f1] \n\t"
+ "add.s %[f3], %[f2], %[f3] \n\t"
+ "swc1 %[f5], 64(%[tmp_a]) \n\t"
+ "swc1 %[f7], 68(%[tmp_a]) \n\t"
+ "sub.s %[f6], %[f4], %[f6] \n\t"
+ "add.s %[f0], %[f1], %[f0] \n\t"
#endif
- "swc1 %[f8], 32(%[tmp_a]) \n\t"
- "swc1 %[f3], 36(%[tmp_a]) \n\t"
- "swc1 %[f6], 96(%[tmp_a]) \n\t"
- "swc1 %[f0], 100(%[tmp_a]) \n\t"
- "bgtz %[count], 1b \n\t"
- " addiu %[tmp_a], %[tmp_a], 8 \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3),
- [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7),
- [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a), [count] "=&r" (count)
- : [a] "r" (a), [f9] "f" (f9), [f10] "f" (f10), [f11] "f" (f11),
- [f12] "f" (f12), [f13] "f" (f13), [f14] "f" (f14)
- : "memory"
- );
+ "swc1 %[f8], 32(%[tmp_a]) \n\t"
+ "swc1 %[f3], 36(%[tmp_a]) \n\t"
+ "swc1 %[f6], 96(%[tmp_a]) \n\t"
+ "swc1 %[f0], 100(%[tmp_a]) \n\t"
+ "bgtz %[count], 1b \n\t"
+ " addiu %[tmp_a], %[tmp_a], 8 \n\t"
+ ".set pop \n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3),
+ [f4] "=&f"(f4), [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7),
+ [f8] "=&f"(f8), [tmp_a] "=&r"(tmp_a), [count] "=&r"(count)
+ : [a] "r"(a), [f9] "f"(f9), [f10] "f"(f10), [f11] "f"(f11),
+ [f12] "f"(f12), [f13] "f"(f13), [f14] "f"(f14)
+ : "memory");
f11 = rdft_w[6];
f12 = rdft_w[7];
f13 = rdft_wk3ri_second[2];
f14 = rdft_wk3ri_second[3];
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[tmp_a], %[a], 384 \n\t"
- "addiu %[count], $zero, 4 \n\t"
- "1: \n\t"
- "addiu %[count], %[count], -1 \n\t"
- "lwc1 %[f0], 0(%[tmp_a]) \n\t"
- "lwc1 %[f1], 4(%[tmp_a]) \n\t"
- "lwc1 %[f2], 32(%[tmp_a]) \n\t"
- "lwc1 %[f3], 36(%[tmp_a]) \n\t"
- "lwc1 %[f4], 64(%[tmp_a]) \n\t"
- "lwc1 %[f5], 68(%[tmp_a]) \n\t"
- "lwc1 %[f6], 96(%[tmp_a]) \n\t"
- "lwc1 %[f7], 100(%[tmp_a]) \n\t"
- "add.s %[f8], %[f0], %[f2] \n\t"
- "sub.s %[f0], %[f0], %[f2] \n\t"
- "add.s %[f2], %[f4], %[f6] \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "add.s %[f6], %[f1], %[f3] \n\t"
- "sub.s %[f1], %[f1], %[f3] \n\t"
- "add.s %[f3], %[f5], %[f7] \n\t"
- "sub.s %[f5], %[f5], %[f7] \n\t"
- "sub.s %[f7], %[f2], %[f8] \n\t"
- "add.s %[f2], %[f2], %[f8] \n\t"
- "add.s %[f8], %[f1], %[f4] \n\t"
- "sub.s %[f1], %[f1], %[f4] \n\t"
- "sub.s %[f4], %[f3], %[f6] \n\t"
- "add.s %[f3], %[f3], %[f6] \n\t"
- "sub.s %[f6], %[f0], %[f5] \n\t"
- "add.s %[f0], %[f0], %[f5] \n\t"
- "swc1 %[f2], 0(%[tmp_a]) \n\t"
- "swc1 %[f3], 4(%[tmp_a]) \n\t"
- "mul.s %[f5], %[f10], %[f7] \n\t"
+ __asm __volatile(
+ ".set push "
+ "\n\t"
+ ".set noreorder "
+ "\n\t"
+ "addiu %[tmp_a], %[a], 384 "
+ "\n\t"
+ "addiu %[count], $zero, 4 "
+ "\n\t"
+ "1: "
+ "\n\t"
+ "addiu %[count], %[count], -1 "
+ "\n\t"
+ "lwc1 %[f0], 0(%[tmp_a]) "
+ "\n\t"
+ "lwc1 %[f1], 4(%[tmp_a]) "
+ "\n\t"
+ "lwc1 %[f2], 32(%[tmp_a]) "
+ "\n\t"
+ "lwc1 %[f3], 36(%[tmp_a]) "
+ "\n\t"
+ "lwc1 %[f4], 64(%[tmp_a]) "
+ "\n\t"
+ "lwc1 %[f5], 68(%[tmp_a]) "
+ "\n\t"
+ "lwc1 %[f6], 96(%[tmp_a]) "
+ "\n\t"
+ "lwc1 %[f7], 100(%[tmp_a]) "
+ "\n\t"
+ "add.s %[f8], %[f0], %[f2] "
+ "\n\t"
+ "sub.s %[f0], %[f0], %[f2] "
+ "\n\t"
+ "add.s %[f2], %[f4], %[f6] "
+ "\n\t"
+ "sub.s %[f4], %[f4], %[f6] "
+ "\n\t"
+ "add.s %[f6], %[f1], %[f3] "
+ "\n\t"
+ "sub.s %[f1], %[f1], %[f3] "
+ "\n\t"
+ "add.s %[f3], %[f5], %[f7] "
+ "\n\t"
+ "sub.s %[f5], %[f5], %[f7] "
+ "\n\t"
+ "sub.s %[f7], %[f2], %[f8] "
+ "\n\t"
+ "add.s %[f2], %[f2], %[f8] "
+ "\n\t"
+ "add.s %[f8], %[f1], %[f4] "
+ "\n\t"
+ "sub.s %[f1], %[f1], %[f4] "
+ "\n\t"
+ "sub.s %[f4], %[f3], %[f6] "
+ "\n\t"
+ "add.s %[f3], %[f3], %[f6] "
+ "\n\t"
+ "sub.s %[f6], %[f0], %[f5] "
+ "\n\t"
+ "add.s %[f0], %[f0], %[f5] "
+ "\n\t"
+ "swc1 %[f2], 0(%[tmp_a]) "
+ "\n\t"
+ "swc1 %[f3], 4(%[tmp_a]) "
+ "\n\t"
+ "mul.s %[f5], %[f10], %[f7] "
+ "\n\t"
#if defined(MIPS32_R2_LE)
- "mul.s %[f7], %[f9], %[f7] \n\t"
- "mul.s %[f2], %[f12], %[f8] \n\t"
- "mul.s %[f8], %[f11], %[f8] \n\t"
- "mul.s %[f3], %[f14], %[f1] \n\t"
- "mul.s %[f1], %[f13], %[f1] \n\t"
- "madd.s %[f5], %[f5], %[f9], %[f4] \n\t"
- "msub.s %[f7], %[f7], %[f10], %[f4] \n\t"
- "msub.s %[f2], %[f2], %[f11], %[f6] \n\t"
- "madd.s %[f8], %[f8], %[f12], %[f6] \n\t"
- "msub.s %[f3], %[f3], %[f13], %[f0] \n\t"
- "madd.s %[f1], %[f1], %[f14], %[f0] \n\t"
- "swc1 %[f5], 64(%[tmp_a]) \n\t"
- "swc1 %[f7], 68(%[tmp_a]) \n\t"
+ "mul.s %[f7], %[f9], %[f7] "
+ "\n\t"
+ "mul.s %[f2], %[f12], %[f8] "
+ "\n\t"
+ "mul.s %[f8], %[f11], %[f8] "
+ "\n\t"
+ "mul.s %[f3], %[f14], %[f1] "
+ "\n\t"
+ "mul.s %[f1], %[f13], %[f1] "
+ "\n\t"
+ "madd.s %[f5], %[f5], %[f9], %[f4] "
+ "\n\t"
+ "msub.s %[f7], %[f7], %[f10], %[f4] "
+ "\n\t"
+ "msub.s %[f2], %[f2], %[f11], %[f6] "
+ "\n\t"
+ "madd.s %[f8], %[f8], %[f12], %[f6] "
+ "\n\t"
+ "msub.s %[f3], %[f3], %[f13], %[f0] "
+ "\n\t"
+ "madd.s %[f1], %[f1], %[f14], %[f0] "
+ "\n\t"
+ "swc1 %[f5], 64(%[tmp_a]) "
+ "\n\t"
+ "swc1 %[f7], 68(%[tmp_a]) "
+ "\n\t"
#else
- "mul.s %[f2], %[f9], %[f4] \n\t"
- "mul.s %[f4], %[f10], %[f4] \n\t"
- "mul.s %[f7], %[f9], %[f7] \n\t"
- "mul.s %[f3], %[f11], %[f6] \n\t"
- "mul.s %[f6], %[f12], %[f6] \n\t"
- "add.s %[f5], %[f5], %[f2] \n\t"
- "sub.s %[f7], %[f4], %[f7] \n\t"
- "mul.s %[f2], %[f12], %[f8] \n\t"
- "mul.s %[f8], %[f11], %[f8] \n\t"
- "mul.s %[f4], %[f14], %[f1] \n\t"
- "mul.s %[f1], %[f13], %[f1] \n\t"
- "sub.s %[f2], %[f3], %[f2] \n\t"
- "mul.s %[f3], %[f13], %[f0] \n\t"
- "mul.s %[f0], %[f14], %[f0] \n\t"
- "add.s %[f8], %[f8], %[f6] \n\t"
- "swc1 %[f5], 64(%[tmp_a]) \n\t"
- "swc1 %[f7], 68(%[tmp_a]) \n\t"
- "sub.s %[f3], %[f3], %[f4] \n\t"
- "add.s %[f1], %[f1], %[f0] \n\t"
+ "mul.s %[f2], %[f9], %[f4] "
+ "\n\t"
+ "mul.s %[f4], %[f10], %[f4] "
+ "\n\t"
+ "mul.s %[f7], %[f9], %[f7] "
+ "\n\t"
+ "mul.s %[f3], %[f11], %[f6] "
+ "\n\t"
+ "mul.s %[f6], %[f12], %[f6] "
+ "\n\t"
+ "add.s %[f5], %[f5], %[f2] "
+ "\n\t"
+ "sub.s %[f7], %[f4], %[f7] "
+ "\n\t"
+ "mul.s %[f2], %[f12], %[f8] "
+ "\n\t"
+ "mul.s %[f8], %[f11], %[f8] "
+ "\n\t"
+ "mul.s %[f4], %[f14], %[f1] "
+ "\n\t"
+ "mul.s %[f1], %[f13], %[f1] "
+ "\n\t"
+ "sub.s %[f2], %[f3], %[f2] "
+ "\n\t"
+ "mul.s %[f3], %[f13], %[f0] "
+ "\n\t"
+ "mul.s %[f0], %[f14], %[f0] "
+ "\n\t"
+ "add.s %[f8], %[f8], %[f6] "
+ "\n\t"
+ "swc1 %[f5], 64(%[tmp_a]) "
+ "\n\t"
+ "swc1 %[f7], 68(%[tmp_a]) "
+ "\n\t"
+ "sub.s %[f3], %[f3], %[f4] "
+ "\n\t"
+ "add.s %[f1], %[f1], %[f0] "
+ "\n\t"
#endif
- "swc1 %[f2], 32(%[tmp_a]) \n\t"
- "swc1 %[f8], 36(%[tmp_a]) \n\t"
- "swc1 %[f3], 96(%[tmp_a]) \n\t"
- "swc1 %[f1], 100(%[tmp_a]) \n\t"
- "bgtz %[count], 1b \n\t"
- " addiu %[tmp_a], %[tmp_a], 8 \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3),
- [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7),
- [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a), [count] "=&r" (count)
- : [a] "r" (a), [f9] "f" (f9), [f10] "f" (f10), [f11] "f" (f11),
- [f12] "f" (f12), [f13] "f" (f13), [f14] "f" (f14)
- : "memory"
- );
+ "swc1 %[f2], 32(%[tmp_a]) "
+ "\n\t"
+ "swc1 %[f8], 36(%[tmp_a]) "
+ "\n\t"
+ "swc1 %[f3], 96(%[tmp_a]) "
+ "\n\t"
+ "swc1 %[f1], 100(%[tmp_a]) "
+ "\n\t"
+ "bgtz %[count], 1b "
+ "\n\t"
+ " addiu %[tmp_a], %[tmp_a], 8 "
+ "\n\t"
+ ".set pop "
+ "\n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3),
+ [f4] "=&f"(f4), [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7),
+ [f8] "=&f"(f8), [tmp_a] "=&r"(tmp_a), [count] "=&r"(count)
+ : [a] "r"(a), [f9] "f"(f9), [f10] "f"(f10), [f11] "f"(f11),
+ [f12] "f"(f12), [f13] "f"(f13), [f14] "f"(f14)
+ : "memory");
}
void cftfsub_128_mips(float* a) {
@@ -815,55 +882,53 @@
cft1st_128_mips(a);
cftmdl_128_mips(a);
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[tmp_a], %[a], 0 \n\t"
- "addiu %[count], $zero, 16 \n\t"
- "1: \n\t"
- "addiu %[count], %[count], -1 \n\t"
- "lwc1 %[f0], 0(%[tmp_a]) \n\t"
- "lwc1 %[f2], 128(%[tmp_a]) \n\t"
- "lwc1 %[f4], 256(%[tmp_a]) \n\t"
- "lwc1 %[f6], 384(%[tmp_a]) \n\t"
- "lwc1 %[f1], 4(%[tmp_a]) \n\t"
- "lwc1 %[f3], 132(%[tmp_a]) \n\t"
- "lwc1 %[f5], 260(%[tmp_a]) \n\t"
- "lwc1 %[f7], 388(%[tmp_a]) \n\t"
- "add.s %[f8], %[f0], %[f2] \n\t"
- "sub.s %[f0], %[f0], %[f2] \n\t"
- "add.s %[f2], %[f4], %[f6] \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "add.s %[f6], %[f1], %[f3] \n\t"
- "sub.s %[f1], %[f1], %[f3] \n\t"
- "add.s %[f3], %[f5], %[f7] \n\t"
- "sub.s %[f5], %[f5], %[f7] \n\t"
- "add.s %[f7], %[f8], %[f2] \n\t"
- "sub.s %[f8], %[f8], %[f2] \n\t"
- "add.s %[f2], %[f1], %[f4] \n\t"
- "sub.s %[f1], %[f1], %[f4] \n\t"
- "add.s %[f4], %[f6], %[f3] \n\t"
- "sub.s %[f6], %[f6], %[f3] \n\t"
- "sub.s %[f3], %[f0], %[f5] \n\t"
- "add.s %[f0], %[f0], %[f5] \n\t"
- "swc1 %[f7], 0(%[tmp_a]) \n\t"
- "swc1 %[f8], 256(%[tmp_a]) \n\t"
- "swc1 %[f2], 132(%[tmp_a]) \n\t"
- "swc1 %[f1], 388(%[tmp_a]) \n\t"
- "swc1 %[f4], 4(%[tmp_a]) \n\t"
- "swc1 %[f6], 260(%[tmp_a]) \n\t"
- "swc1 %[f3], 128(%[tmp_a]) \n\t"
- "swc1 %[f0], 384(%[tmp_a]) \n\t"
- "bgtz %[count], 1b \n\t"
- " addiu %[tmp_a], %[tmp_a], 8 \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3),
- [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7),
- [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a),
- [count] "=&r" (count)
- : [a] "r" (a)
- : "memory"
- );
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "addiu %[tmp_a], %[a], 0 \n\t"
+ "addiu %[count], $zero, 16 \n\t"
+ "1: \n\t"
+ "addiu %[count], %[count], -1 \n\t"
+ "lwc1 %[f0], 0(%[tmp_a]) \n\t"
+ "lwc1 %[f2], 128(%[tmp_a]) \n\t"
+ "lwc1 %[f4], 256(%[tmp_a]) \n\t"
+ "lwc1 %[f6], 384(%[tmp_a]) \n\t"
+ "lwc1 %[f1], 4(%[tmp_a]) \n\t"
+ "lwc1 %[f3], 132(%[tmp_a]) \n\t"
+ "lwc1 %[f5], 260(%[tmp_a]) \n\t"
+ "lwc1 %[f7], 388(%[tmp_a]) \n\t"
+ "add.s %[f8], %[f0], %[f2] \n\t"
+ "sub.s %[f0], %[f0], %[f2] \n\t"
+ "add.s %[f2], %[f4], %[f6] \n\t"
+ "sub.s %[f4], %[f4], %[f6] \n\t"
+ "add.s %[f6], %[f1], %[f3] \n\t"
+ "sub.s %[f1], %[f1], %[f3] \n\t"
+ "add.s %[f3], %[f5], %[f7] \n\t"
+ "sub.s %[f5], %[f5], %[f7] \n\t"
+ "add.s %[f7], %[f8], %[f2] \n\t"
+ "sub.s %[f8], %[f8], %[f2] \n\t"
+ "add.s %[f2], %[f1], %[f4] \n\t"
+ "sub.s %[f1], %[f1], %[f4] \n\t"
+ "add.s %[f4], %[f6], %[f3] \n\t"
+ "sub.s %[f6], %[f6], %[f3] \n\t"
+ "sub.s %[f3], %[f0], %[f5] \n\t"
+ "add.s %[f0], %[f0], %[f5] \n\t"
+ "swc1 %[f7], 0(%[tmp_a]) \n\t"
+ "swc1 %[f8], 256(%[tmp_a]) \n\t"
+ "swc1 %[f2], 132(%[tmp_a]) \n\t"
+ "swc1 %[f1], 388(%[tmp_a]) \n\t"
+ "swc1 %[f4], 4(%[tmp_a]) \n\t"
+ "swc1 %[f6], 260(%[tmp_a]) \n\t"
+ "swc1 %[f3], 128(%[tmp_a]) \n\t"
+ "swc1 %[f0], 384(%[tmp_a]) \n\t"
+ "bgtz %[count], 1b \n\t"
+ " addiu %[tmp_a], %[tmp_a], 8 \n\t"
+ ".set pop \n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3),
+ [f4] "=&f"(f4), [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7),
+ [f8] "=&f"(f8), [tmp_a] "=&r"(tmp_a), [count] "=&r"(count)
+ : [a] "r"(a)
+ : "memory");
}
void cftbsub_128_mips(float* a) {
@@ -873,55 +938,54 @@
cft1st_128_mips(a);
cftmdl_128_mips(a);
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "addiu %[tmp_a], %[a], 0 \n\t"
- "addiu %[count], $zero, 16 \n\t"
- "1: \n\t"
- "addiu %[count], %[count], -1 \n\t"
- "lwc1 %[f0], 0(%[tmp_a]) \n\t"
- "lwc1 %[f2], 128(%[tmp_a]) \n\t"
- "lwc1 %[f4], 256(%[tmp_a]) \n\t"
- "lwc1 %[f6], 384(%[tmp_a]) \n\t"
- "lwc1 %[f1], 4(%[tmp_a]) \n\t"
- "lwc1 %[f3], 132(%[tmp_a]) \n\t"
- "lwc1 %[f5], 260(%[tmp_a]) \n\t"
- "lwc1 %[f7], 388(%[tmp_a]) \n\t"
- "add.s %[f8], %[f0], %[f2] \n\t"
- "sub.s %[f0], %[f0], %[f2] \n\t"
- "add.s %[f2], %[f4], %[f6] \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "add.s %[f6], %[f1], %[f3] \n\t"
- "sub.s %[f1], %[f3], %[f1] \n\t"
- "add.s %[f3], %[f5], %[f7] \n\t"
- "sub.s %[f5], %[f5], %[f7] \n\t"
- "add.s %[f7], %[f8], %[f2] \n\t"
- "sub.s %[f8], %[f8], %[f2] \n\t"
- "sub.s %[f2], %[f1], %[f4] \n\t"
- "add.s %[f1], %[f1], %[f4] \n\t"
- "add.s %[f4], %[f3], %[f6] \n\t"
- "sub.s %[f6], %[f3], %[f6] \n\t"
- "sub.s %[f3], %[f0], %[f5] \n\t"
- "add.s %[f0], %[f0], %[f5] \n\t"
- "neg.s %[f4], %[f4] \n\t"
- "swc1 %[f7], 0(%[tmp_a]) \n\t"
- "swc1 %[f8], 256(%[tmp_a]) \n\t"
- "swc1 %[f2], 132(%[tmp_a]) \n\t"
- "swc1 %[f1], 388(%[tmp_a]) \n\t"
- "swc1 %[f6], 260(%[tmp_a]) \n\t"
- "swc1 %[f3], 128(%[tmp_a]) \n\t"
- "swc1 %[f0], 384(%[tmp_a]) \n\t"
- "swc1 %[f4], 4(%[tmp_a]) \n\t"
- "bgtz %[count], 1b \n\t"
- " addiu %[tmp_a], %[tmp_a], 8 \n\t"
- ".set pop \n\t"
- : [f0] "=&f" (f0), [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3),
- [f4] "=&f" (f4), [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7),
- [f8] "=&f" (f8), [tmp_a] "=&r" (tmp_a), [count] "=&r" (count)
- : [a] "r" (a)
- : "memory"
- );
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "addiu %[tmp_a], %[a], 0 \n\t"
+ "addiu %[count], $zero, 16 \n\t"
+ "1: \n\t"
+ "addiu %[count], %[count], -1 \n\t"
+ "lwc1 %[f0], 0(%[tmp_a]) \n\t"
+ "lwc1 %[f2], 128(%[tmp_a]) \n\t"
+ "lwc1 %[f4], 256(%[tmp_a]) \n\t"
+ "lwc1 %[f6], 384(%[tmp_a]) \n\t"
+ "lwc1 %[f1], 4(%[tmp_a]) \n\t"
+ "lwc1 %[f3], 132(%[tmp_a]) \n\t"
+ "lwc1 %[f5], 260(%[tmp_a]) \n\t"
+ "lwc1 %[f7], 388(%[tmp_a]) \n\t"
+ "add.s %[f8], %[f0], %[f2] \n\t"
+ "sub.s %[f0], %[f0], %[f2] \n\t"
+ "add.s %[f2], %[f4], %[f6] \n\t"
+ "sub.s %[f4], %[f4], %[f6] \n\t"
+ "add.s %[f6], %[f1], %[f3] \n\t"
+ "sub.s %[f1], %[f3], %[f1] \n\t"
+ "add.s %[f3], %[f5], %[f7] \n\t"
+ "sub.s %[f5], %[f5], %[f7] \n\t"
+ "add.s %[f7], %[f8], %[f2] \n\t"
+ "sub.s %[f8], %[f8], %[f2] \n\t"
+ "sub.s %[f2], %[f1], %[f4] \n\t"
+ "add.s %[f1], %[f1], %[f4] \n\t"
+ "add.s %[f4], %[f3], %[f6] \n\t"
+ "sub.s %[f6], %[f3], %[f6] \n\t"
+ "sub.s %[f3], %[f0], %[f5] \n\t"
+ "add.s %[f0], %[f0], %[f5] \n\t"
+ "neg.s %[f4], %[f4] \n\t"
+ "swc1 %[f7], 0(%[tmp_a]) \n\t"
+ "swc1 %[f8], 256(%[tmp_a]) \n\t"
+ "swc1 %[f2], 132(%[tmp_a]) \n\t"
+ "swc1 %[f1], 388(%[tmp_a]) \n\t"
+ "swc1 %[f6], 260(%[tmp_a]) \n\t"
+ "swc1 %[f3], 128(%[tmp_a]) \n\t"
+ "swc1 %[f0], 384(%[tmp_a]) \n\t"
+ "swc1 %[f4], 4(%[tmp_a]) \n\t"
+ "bgtz %[count], 1b \n\t"
+ " addiu %[tmp_a], %[tmp_a], 8 \n\t"
+ ".set pop \n\t"
+ : [f0] "=&f"(f0), [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3),
+ [f4] "=&f"(f4), [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7),
+ [f8] "=&f"(f8), [tmp_a] "=&r"(tmp_a), [count] "=&r"(count)
+ : [a] "r"(a)
+ : "memory");
}
void rftfsub_128_mips(float* a) {
@@ -931,254 +995,252 @@
float* a2 = &a[126];
const float* c1 = &c[1];
const float* c2 = &c[31];
- float f1, f2, f3 ,f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15;
+ float f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15;
int count;
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "lwc1 %[f6], 0(%[c2]) \n\t"
- "lwc1 %[f1], 0(%[a1]) \n\t"
- "lwc1 %[f2], 0(%[a2]) \n\t"
- "lwc1 %[f3], 4(%[a1]) \n\t"
- "lwc1 %[f4], 4(%[a2]) \n\t"
- "lwc1 %[f5], 0(%[c1]) \n\t"
- "sub.s %[f6], %[f0], %[f6] \n\t"
- "sub.s %[f7], %[f1], %[f2] \n\t"
- "add.s %[f8], %[f3], %[f4] \n\t"
- "addiu %[count], $zero, 15 \n\t"
- "mul.s %[f9], %[f6], %[f7] \n\t"
- "mul.s %[f6], %[f6], %[f8] \n\t"
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "lwc1 %[f6], 0(%[c2]) \n\t"
+ "lwc1 %[f1], 0(%[a1]) \n\t"
+ "lwc1 %[f2], 0(%[a2]) \n\t"
+ "lwc1 %[f3], 4(%[a1]) \n\t"
+ "lwc1 %[f4], 4(%[a2]) \n\t"
+ "lwc1 %[f5], 0(%[c1]) \n\t"
+ "sub.s %[f6], %[f0], %[f6] \n\t"
+ "sub.s %[f7], %[f1], %[f2] \n\t"
+ "add.s %[f8], %[f3], %[f4] \n\t"
+ "addiu %[count], $zero, 15 \n\t"
+ "mul.s %[f9], %[f6], %[f7] \n\t"
+ "mul.s %[f6], %[f6], %[f8] \n\t"
#if !defined(MIPS32_R2_LE)
- "mul.s %[f8], %[f5], %[f8] \n\t"
- "mul.s %[f5], %[f5], %[f7] \n\t"
- "sub.s %[f9], %[f9], %[f8] \n\t"
- "add.s %[f6], %[f6], %[f5] \n\t"
+ "mul.s %[f8], %[f5], %[f8] \n\t"
+ "mul.s %[f5], %[f5], %[f7] \n\t"
+ "sub.s %[f9], %[f9], %[f8] \n\t"
+ "add.s %[f6], %[f6], %[f5] \n\t"
#else
- "nmsub.s %[f9], %[f9], %[f5], %[f8] \n\t"
- "madd.s %[f6], %[f6], %[f5], %[f7] \n\t"
+ "nmsub.s %[f9], %[f9], %[f5], %[f8] \n\t"
+ "madd.s %[f6], %[f6], %[f5], %[f7] \n\t"
#endif
- "sub.s %[f1], %[f1], %[f9] \n\t"
- "add.s %[f2], %[f2], %[f9] \n\t"
- "sub.s %[f3], %[f3], %[f6] \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "swc1 %[f1], 0(%[a1]) \n\t"
- "swc1 %[f2], 0(%[a2]) \n\t"
- "swc1 %[f3], 4(%[a1]) \n\t"
- "swc1 %[f4], 4(%[a2]) \n\t"
- "addiu %[a1], %[a1], 8 \n\t"
- "addiu %[a2], %[a2], -8 \n\t"
- "addiu %[c1], %[c1], 4 \n\t"
- "addiu %[c2], %[c2], -4 \n\t"
- "1: \n\t"
- "lwc1 %[f6], 0(%[c2]) \n\t"
- "lwc1 %[f1], 0(%[a1]) \n\t"
- "lwc1 %[f2], 0(%[a2]) \n\t"
- "lwc1 %[f3], 4(%[a1]) \n\t"
- "lwc1 %[f4], 4(%[a2]) \n\t"
- "lwc1 %[f5], 0(%[c1]) \n\t"
- "sub.s %[f6], %[f0], %[f6] \n\t"
- "sub.s %[f7], %[f1], %[f2] \n\t"
- "add.s %[f8], %[f3], %[f4] \n\t"
- "lwc1 %[f10], -4(%[c2]) \n\t"
- "lwc1 %[f11], 8(%[a1]) \n\t"
- "lwc1 %[f12], -8(%[a2]) \n\t"
- "mul.s %[f9], %[f6], %[f7] \n\t"
- "mul.s %[f6], %[f6], %[f8] \n\t"
+ "sub.s %[f1], %[f1], %[f9] \n\t"
+ "add.s %[f2], %[f2], %[f9] \n\t"
+ "sub.s %[f3], %[f3], %[f6] \n\t"
+ "sub.s %[f4], %[f4], %[f6] \n\t"
+ "swc1 %[f1], 0(%[a1]) \n\t"
+ "swc1 %[f2], 0(%[a2]) \n\t"
+ "swc1 %[f3], 4(%[a1]) \n\t"
+ "swc1 %[f4], 4(%[a2]) \n\t"
+ "addiu %[a1], %[a1], 8 \n\t"
+ "addiu %[a2], %[a2], -8 \n\t"
+ "addiu %[c1], %[c1], 4 \n\t"
+ "addiu %[c2], %[c2], -4 \n\t"
+ "1: \n\t"
+ "lwc1 %[f6], 0(%[c2]) \n\t"
+ "lwc1 %[f1], 0(%[a1]) \n\t"
+ "lwc1 %[f2], 0(%[a2]) \n\t"
+ "lwc1 %[f3], 4(%[a1]) \n\t"
+ "lwc1 %[f4], 4(%[a2]) \n\t"
+ "lwc1 %[f5], 0(%[c1]) \n\t"
+ "sub.s %[f6], %[f0], %[f6] \n\t"
+ "sub.s %[f7], %[f1], %[f2] \n\t"
+ "add.s %[f8], %[f3], %[f4] \n\t"
+ "lwc1 %[f10], -4(%[c2]) \n\t"
+ "lwc1 %[f11], 8(%[a1]) \n\t"
+ "lwc1 %[f12], -8(%[a2]) \n\t"
+ "mul.s %[f9], %[f6], %[f7] \n\t"
+ "mul.s %[f6], %[f6], %[f8] \n\t"
#if !defined(MIPS32_R2_LE)
- "mul.s %[f8], %[f5], %[f8] \n\t"
- "mul.s %[f5], %[f5], %[f7] \n\t"
- "lwc1 %[f13], 12(%[a1]) \n\t"
- "lwc1 %[f14], -4(%[a2]) \n\t"
- "lwc1 %[f15], 4(%[c1]) \n\t"
- "sub.s %[f9], %[f9], %[f8] \n\t"
- "add.s %[f6], %[f6], %[f5] \n\t"
+ "mul.s %[f8], %[f5], %[f8] \n\t"
+ "mul.s %[f5], %[f5], %[f7] \n\t"
+ "lwc1 %[f13], 12(%[a1]) \n\t"
+ "lwc1 %[f14], -4(%[a2]) \n\t"
+ "lwc1 %[f15], 4(%[c1]) \n\t"
+ "sub.s %[f9], %[f9], %[f8] \n\t"
+ "add.s %[f6], %[f6], %[f5] \n\t"
#else
- "lwc1 %[f13], 12(%[a1]) \n\t"
- "lwc1 %[f14], -4(%[a2]) \n\t"
- "lwc1 %[f15], 4(%[c1]) \n\t"
- "nmsub.s %[f9], %[f9], %[f5], %[f8] \n\t"
- "madd.s %[f6], %[f6], %[f5], %[f7] \n\t"
+ "lwc1 %[f13], 12(%[a1]) \n\t"
+ "lwc1 %[f14], -4(%[a2]) \n\t"
+ "lwc1 %[f15], 4(%[c1]) \n\t"
+ "nmsub.s %[f9], %[f9], %[f5], %[f8] \n\t"
+ "madd.s %[f6], %[f6], %[f5], %[f7] \n\t"
#endif
- "sub.s %[f10], %[f0], %[f10] \n\t"
- "sub.s %[f5], %[f11], %[f12] \n\t"
- "add.s %[f7], %[f13], %[f14] \n\t"
- "sub.s %[f1], %[f1], %[f9] \n\t"
- "add.s %[f2], %[f2], %[f9] \n\t"
- "sub.s %[f3], %[f3], %[f6] \n\t"
- "mul.s %[f8], %[f10], %[f5] \n\t"
- "mul.s %[f10], %[f10], %[f7] \n\t"
+ "sub.s %[f10], %[f0], %[f10] \n\t"
+ "sub.s %[f5], %[f11], %[f12] \n\t"
+ "add.s %[f7], %[f13], %[f14] \n\t"
+ "sub.s %[f1], %[f1], %[f9] \n\t"
+ "add.s %[f2], %[f2], %[f9] \n\t"
+ "sub.s %[f3], %[f3], %[f6] \n\t"
+ "mul.s %[f8], %[f10], %[f5] \n\t"
+ "mul.s %[f10], %[f10], %[f7] \n\t"
#if !defined(MIPS32_R2_LE)
- "mul.s %[f9], %[f15], %[f7] \n\t"
- "mul.s %[f15], %[f15], %[f5] \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "swc1 %[f1], 0(%[a1]) \n\t"
- "swc1 %[f2], 0(%[a2]) \n\t"
- "sub.s %[f8], %[f8], %[f9] \n\t"
- "add.s %[f10], %[f10], %[f15] \n\t"
+ "mul.s %[f9], %[f15], %[f7] \n\t"
+ "mul.s %[f15], %[f15], %[f5] \n\t"
+ "sub.s %[f4], %[f4], %[f6] \n\t"
+ "swc1 %[f1], 0(%[a1]) \n\t"
+ "swc1 %[f2], 0(%[a2]) \n\t"
+ "sub.s %[f8], %[f8], %[f9] \n\t"
+ "add.s %[f10], %[f10], %[f15] \n\t"
#else
- "swc1 %[f1], 0(%[a1]) \n\t"
- "swc1 %[f2], 0(%[a2]) \n\t"
- "sub.s %[f4], %[f4], %[f6] \n\t"
- "nmsub.s %[f8], %[f8], %[f15], %[f7] \n\t"
- "madd.s %[f10], %[f10], %[f15], %[f5] \n\t"
+ "swc1 %[f1], 0(%[a1]) \n\t"
+ "swc1 %[f2], 0(%[a2]) \n\t"
+ "sub.s %[f4], %[f4], %[f6] \n\t"
+ "nmsub.s %[f8], %[f8], %[f15], %[f7] \n\t"
+ "madd.s %[f10], %[f10], %[f15], %[f5] \n\t"
#endif
- "swc1 %[f3], 4(%[a1]) \n\t"
- "swc1 %[f4], 4(%[a2]) \n\t"
- "sub.s %[f11], %[f11], %[f8] \n\t"
- "add.s %[f12], %[f12], %[f8] \n\t"
- "sub.s %[f13], %[f13], %[f10] \n\t"
- "sub.s %[f14], %[f14], %[f10] \n\t"
- "addiu %[c2], %[c2], -8 \n\t"
- "addiu %[c1], %[c1], 8 \n\t"
- "swc1 %[f11], 8(%[a1]) \n\t"
- "swc1 %[f12], -8(%[a2]) \n\t"
- "swc1 %[f13], 12(%[a1]) \n\t"
- "swc1 %[f14], -4(%[a2]) \n\t"
- "addiu %[a1], %[a1], 16 \n\t"
- "addiu %[count], %[count], -1 \n\t"
- "bgtz %[count], 1b \n\t"
- " addiu %[a2], %[a2], -16 \n\t"
- ".set pop \n\t"
- : [a1] "+r" (a1), [a2] "+r" (a2), [c1] "+r" (c1), [c2] "+r" (c2),
- [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), [f4] "=&f" (f4),
- [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8),
- [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), [f12] "=&f" (f12),
- [f13] "=&f" (f13), [f14] "=&f" (f14), [f15] "=&f" (f15),
- [count] "=&r" (count)
- : [f0] "f" (f0)
- : "memory"
- );
+ "swc1 %[f3], 4(%[a1]) \n\t"
+ "swc1 %[f4], 4(%[a2]) \n\t"
+ "sub.s %[f11], %[f11], %[f8] \n\t"
+ "add.s %[f12], %[f12], %[f8] \n\t"
+ "sub.s %[f13], %[f13], %[f10] \n\t"
+ "sub.s %[f14], %[f14], %[f10] \n\t"
+ "addiu %[c2], %[c2], -8 \n\t"
+ "addiu %[c1], %[c1], 8 \n\t"
+ "swc1 %[f11], 8(%[a1]) \n\t"
+ "swc1 %[f12], -8(%[a2]) \n\t"
+ "swc1 %[f13], 12(%[a1]) \n\t"
+ "swc1 %[f14], -4(%[a2]) \n\t"
+ "addiu %[a1], %[a1], 16 \n\t"
+ "addiu %[count], %[count], -1 \n\t"
+ "bgtz %[count], 1b \n\t"
+ " addiu %[a2], %[a2], -16 \n\t"
+ ".set pop \n\t"
+ : [a1] "+r"(a1), [a2] "+r"(a2), [c1] "+r"(c1), [c2] "+r"(c2),
+ [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3), [f4] "=&f"(f4),
+ [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7), [f8] "=&f"(f8),
+ [f9] "=&f"(f9), [f10] "=&f"(f10), [f11] "=&f"(f11), [f12] "=&f"(f12),
+ [f13] "=&f"(f13), [f14] "=&f"(f14), [f15] "=&f"(f15),
+ [count] "=&r"(count)
+ : [f0] "f"(f0)
+ : "memory");
}
void rftbsub_128_mips(float* a) {
- const float *c = rdft_w + 32;
+ const float* c = rdft_w + 32;
const float f0 = 0.5f;
float* a1 = &a[2];
float* a2 = &a[126];
const float* c1 = &c[1];
const float* c2 = &c[31];
- float f1, f2, f3 ,f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15;
+ float f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15;
int count;
a[1] = -a[1];
a[65] = -a[65];
- __asm __volatile (
- ".set push \n\t"
- ".set noreorder \n\t"
- "lwc1 %[f6], 0(%[c2]) \n\t"
- "lwc1 %[f1], 0(%[a1]) \n\t"
- "lwc1 %[f2], 0(%[a2]) \n\t"
- "lwc1 %[f3], 4(%[a1]) \n\t"
- "lwc1 %[f4], 4(%[a2]) \n\t"
- "lwc1 %[f5], 0(%[c1]) \n\t"
- "sub.s %[f6], %[f0], %[f6] \n\t"
- "sub.s %[f7], %[f1], %[f2] \n\t"
- "add.s %[f8], %[f3], %[f4] \n\t"
- "addiu %[count], $zero, 15 \n\t"
- "mul.s %[f9], %[f6], %[f7] \n\t"
- "mul.s %[f6], %[f6], %[f8] \n\t"
+ __asm __volatile(
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "lwc1 %[f6], 0(%[c2]) \n\t"
+ "lwc1 %[f1], 0(%[a1]) \n\t"
+ "lwc1 %[f2], 0(%[a2]) \n\t"
+ "lwc1 %[f3], 4(%[a1]) \n\t"
+ "lwc1 %[f4], 4(%[a2]) \n\t"
+ "lwc1 %[f5], 0(%[c1]) \n\t"
+ "sub.s %[f6], %[f0], %[f6] \n\t"
+ "sub.s %[f7], %[f1], %[f2] \n\t"
+ "add.s %[f8], %[f3], %[f4] \n\t"
+ "addiu %[count], $zero, 15 \n\t"
+ "mul.s %[f9], %[f6], %[f7] \n\t"
+ "mul.s %[f6], %[f6], %[f8] \n\t"
#if !defined(MIPS32_R2_LE)
- "mul.s %[f8], %[f5], %[f8] \n\t"
- "mul.s %[f5], %[f5], %[f7] \n\t"
- "add.s %[f9], %[f9], %[f8] \n\t"
- "sub.s %[f6], %[f6], %[f5] \n\t"
+ "mul.s %[f8], %[f5], %[f8] \n\t"
+ "mul.s %[f5], %[f5], %[f7] \n\t"
+ "add.s %[f9], %[f9], %[f8] \n\t"
+ "sub.s %[f6], %[f6], %[f5] \n\t"
#else
- "madd.s %[f9], %[f9], %[f5], %[f8] \n\t"
- "nmsub.s %[f6], %[f6], %[f5], %[f7] \n\t"
+ "madd.s %[f9], %[f9], %[f5], %[f8] \n\t"
+ "nmsub.s %[f6], %[f6], %[f5], %[f7] \n\t"
#endif
- "sub.s %[f1], %[f1], %[f9] \n\t"
- "add.s %[f2], %[f2], %[f9] \n\t"
- "sub.s %[f3], %[f6], %[f3] \n\t"
- "sub.s %[f4], %[f6], %[f4] \n\t"
- "swc1 %[f1], 0(%[a1]) \n\t"
- "swc1 %[f2], 0(%[a2]) \n\t"
- "swc1 %[f3], 4(%[a1]) \n\t"
- "swc1 %[f4], 4(%[a2]) \n\t"
- "addiu %[a1], %[a1], 8 \n\t"
- "addiu %[a2], %[a2], -8 \n\t"
- "addiu %[c1], %[c1], 4 \n\t"
- "addiu %[c2], %[c2], -4 \n\t"
- "1: \n\t"
- "lwc1 %[f6], 0(%[c2]) \n\t"
- "lwc1 %[f1], 0(%[a1]) \n\t"
- "lwc1 %[f2], 0(%[a2]) \n\t"
- "lwc1 %[f3], 4(%[a1]) \n\t"
- "lwc1 %[f4], 4(%[a2]) \n\t"
- "lwc1 %[f5], 0(%[c1]) \n\t"
- "sub.s %[f6], %[f0], %[f6] \n\t"
- "sub.s %[f7], %[f1], %[f2] \n\t"
- "add.s %[f8], %[f3], %[f4] \n\t"
- "lwc1 %[f10], -4(%[c2]) \n\t"
- "lwc1 %[f11], 8(%[a1]) \n\t"
- "lwc1 %[f12], -8(%[a2]) \n\t"
- "mul.s %[f9], %[f6], %[f7] \n\t"
- "mul.s %[f6], %[f6], %[f8] \n\t"
+ "sub.s %[f1], %[f1], %[f9] \n\t"
+ "add.s %[f2], %[f2], %[f9] \n\t"
+ "sub.s %[f3], %[f6], %[f3] \n\t"
+ "sub.s %[f4], %[f6], %[f4] \n\t"
+ "swc1 %[f1], 0(%[a1]) \n\t"
+ "swc1 %[f2], 0(%[a2]) \n\t"
+ "swc1 %[f3], 4(%[a1]) \n\t"
+ "swc1 %[f4], 4(%[a2]) \n\t"
+ "addiu %[a1], %[a1], 8 \n\t"
+ "addiu %[a2], %[a2], -8 \n\t"
+ "addiu %[c1], %[c1], 4 \n\t"
+ "addiu %[c2], %[c2], -4 \n\t"
+ "1: \n\t"
+ "lwc1 %[f6], 0(%[c2]) \n\t"
+ "lwc1 %[f1], 0(%[a1]) \n\t"
+ "lwc1 %[f2], 0(%[a2]) \n\t"
+ "lwc1 %[f3], 4(%[a1]) \n\t"
+ "lwc1 %[f4], 4(%[a2]) \n\t"
+ "lwc1 %[f5], 0(%[c1]) \n\t"
+ "sub.s %[f6], %[f0], %[f6] \n\t"
+ "sub.s %[f7], %[f1], %[f2] \n\t"
+ "add.s %[f8], %[f3], %[f4] \n\t"
+ "lwc1 %[f10], -4(%[c2]) \n\t"
+ "lwc1 %[f11], 8(%[a1]) \n\t"
+ "lwc1 %[f12], -8(%[a2]) \n\t"
+ "mul.s %[f9], %[f6], %[f7] \n\t"
+ "mul.s %[f6], %[f6], %[f8] \n\t"
#if !defined(MIPS32_R2_LE)
- "mul.s %[f8], %[f5], %[f8] \n\t"
- "mul.s %[f5], %[f5], %[f7] \n\t"
- "lwc1 %[f13], 12(%[a1]) \n\t"
- "lwc1 %[f14], -4(%[a2]) \n\t"
- "lwc1 %[f15], 4(%[c1]) \n\t"
- "add.s %[f9], %[f9], %[f8] \n\t"
- "sub.s %[f6], %[f6], %[f5] \n\t"
+ "mul.s %[f8], %[f5], %[f8] \n\t"
+ "mul.s %[f5], %[f5], %[f7] \n\t"
+ "lwc1 %[f13], 12(%[a1]) \n\t"
+ "lwc1 %[f14], -4(%[a2]) \n\t"
+ "lwc1 %[f15], 4(%[c1]) \n\t"
+ "add.s %[f9], %[f9], %[f8] \n\t"
+ "sub.s %[f6], %[f6], %[f5] \n\t"
#else
- "lwc1 %[f13], 12(%[a1]) \n\t"
- "lwc1 %[f14], -4(%[a2]) \n\t"
- "lwc1 %[f15], 4(%[c1]) \n\t"
- "madd.s %[f9], %[f9], %[f5], %[f8] \n\t"
- "nmsub.s %[f6], %[f6], %[f5], %[f7] \n\t"
+ "lwc1 %[f13], 12(%[a1]) \n\t"
+ "lwc1 %[f14], -4(%[a2]) \n\t"
+ "lwc1 %[f15], 4(%[c1]) \n\t"
+ "madd.s %[f9], %[f9], %[f5], %[f8] \n\t"
+ "nmsub.s %[f6], %[f6], %[f5], %[f7] \n\t"
#endif
- "sub.s %[f10], %[f0], %[f10] \n\t"
- "sub.s %[f5], %[f11], %[f12] \n\t"
- "add.s %[f7], %[f13], %[f14] \n\t"
- "sub.s %[f1], %[f1], %[f9] \n\t"
- "add.s %[f2], %[f2], %[f9] \n\t"
- "sub.s %[f3], %[f6], %[f3] \n\t"
- "mul.s %[f8], %[f10], %[f5] \n\t"
- "mul.s %[f10], %[f10], %[f7] \n\t"
+ "sub.s %[f10], %[f0], %[f10] \n\t"
+ "sub.s %[f5], %[f11], %[f12] \n\t"
+ "add.s %[f7], %[f13], %[f14] \n\t"
+ "sub.s %[f1], %[f1], %[f9] \n\t"
+ "add.s %[f2], %[f2], %[f9] \n\t"
+ "sub.s %[f3], %[f6], %[f3] \n\t"
+ "mul.s %[f8], %[f10], %[f5] \n\t"
+ "mul.s %[f10], %[f10], %[f7] \n\t"
#if !defined(MIPS32_R2_LE)
- "mul.s %[f9], %[f15], %[f7] \n\t"
- "mul.s %[f15], %[f15], %[f5] \n\t"
- "sub.s %[f4], %[f6], %[f4] \n\t"
- "swc1 %[f1], 0(%[a1]) \n\t"
- "swc1 %[f2], 0(%[a2]) \n\t"
- "add.s %[f8], %[f8], %[f9] \n\t"
- "sub.s %[f10], %[f10], %[f15] \n\t"
+ "mul.s %[f9], %[f15], %[f7] \n\t"
+ "mul.s %[f15], %[f15], %[f5] \n\t"
+ "sub.s %[f4], %[f6], %[f4] \n\t"
+ "swc1 %[f1], 0(%[a1]) \n\t"
+ "swc1 %[f2], 0(%[a2]) \n\t"
+ "add.s %[f8], %[f8], %[f9] \n\t"
+ "sub.s %[f10], %[f10], %[f15] \n\t"
#else
- "swc1 %[f1], 0(%[a1]) \n\t"
- "swc1 %[f2], 0(%[a2]) \n\t"
- "sub.s %[f4], %[f6], %[f4] \n\t"
- "madd.s %[f8], %[f8], %[f15], %[f7] \n\t"
- "nmsub.s %[f10], %[f10], %[f15], %[f5] \n\t"
+ "swc1 %[f1], 0(%[a1]) \n\t"
+ "swc1 %[f2], 0(%[a2]) \n\t"
+ "sub.s %[f4], %[f6], %[f4] \n\t"
+ "madd.s %[f8], %[f8], %[f15], %[f7] \n\t"
+ "nmsub.s %[f10], %[f10], %[f15], %[f5] \n\t"
#endif
- "swc1 %[f3], 4(%[a1]) \n\t"
- "swc1 %[f4], 4(%[a2]) \n\t"
- "sub.s %[f11], %[f11], %[f8] \n\t"
- "add.s %[f12], %[f12], %[f8] \n\t"
- "sub.s %[f13], %[f10], %[f13] \n\t"
- "sub.s %[f14], %[f10], %[f14] \n\t"
- "addiu %[c2], %[c2], -8 \n\t"
- "addiu %[c1], %[c1], 8 \n\t"
- "swc1 %[f11], 8(%[a1]) \n\t"
- "swc1 %[f12], -8(%[a2]) \n\t"
- "swc1 %[f13], 12(%[a1]) \n\t"
- "swc1 %[f14], -4(%[a2]) \n\t"
- "addiu %[a1], %[a1], 16 \n\t"
- "addiu %[count], %[count], -1 \n\t"
- "bgtz %[count], 1b \n\t"
- " addiu %[a2], %[a2], -16 \n\t"
- ".set pop \n\t"
- : [a1] "+r" (a1), [a2] "+r" (a2), [c1] "+r" (c1), [c2] "+r" (c2),
- [f1] "=&f" (f1), [f2] "=&f" (f2), [f3] "=&f" (f3), [f4] "=&f" (f4),
- [f5] "=&f" (f5), [f6] "=&f" (f6), [f7] "=&f" (f7), [f8] "=&f" (f8),
- [f9] "=&f" (f9), [f10] "=&f" (f10), [f11] "=&f" (f11), [f12] "=&f" (f12),
- [f13] "=&f" (f13), [f14] "=&f" (f14), [f15] "=&f" (f15),
- [count] "=&r" (count)
- : [f0] "f" (f0)
- : "memory"
- );
+ "swc1 %[f3], 4(%[a1]) \n\t"
+ "swc1 %[f4], 4(%[a2]) \n\t"
+ "sub.s %[f11], %[f11], %[f8] \n\t"
+ "add.s %[f12], %[f12], %[f8] \n\t"
+ "sub.s %[f13], %[f10], %[f13] \n\t"
+ "sub.s %[f14], %[f10], %[f14] \n\t"
+ "addiu %[c2], %[c2], -8 \n\t"
+ "addiu %[c1], %[c1], 8 \n\t"
+ "swc1 %[f11], 8(%[a1]) \n\t"
+ "swc1 %[f12], -8(%[a2]) \n\t"
+ "swc1 %[f13], 12(%[a1]) \n\t"
+ "swc1 %[f14], -4(%[a2]) \n\t"
+ "addiu %[a1], %[a1], 16 \n\t"
+ "addiu %[count], %[count], -1 \n\t"
+ "bgtz %[count], 1b \n\t"
+ " addiu %[a2], %[a2], -16 \n\t"
+ ".set pop \n\t"
+ : [a1] "+r"(a1), [a2] "+r"(a2), [c1] "+r"(c1), [c2] "+r"(c2),
+ [f1] "=&f"(f1), [f2] "=&f"(f2), [f3] "=&f"(f3), [f4] "=&f"(f4),
+ [f5] "=&f"(f5), [f6] "=&f"(f6), [f7] "=&f"(f7), [f8] "=&f"(f8),
+ [f9] "=&f"(f9), [f10] "=&f"(f10), [f11] "=&f"(f11), [f12] "=&f"(f12),
+ [f13] "=&f"(f13), [f14] "=&f"(f14), [f15] "=&f"(f15),
+ [count] "=&r"(count)
+ : [f0] "f"(f0)
+ : "memory");
}
#endif
diff --git a/modules/audio_processing/vad/gmm_unittest.cc b/modules/audio_processing/vad/gmm_unittest.cc
index dfc8855..d895afa 100644
--- a/modules/audio_processing/vad/gmm_unittest.cc
+++ b/modules/audio_processing/vad/gmm_unittest.cc
@@ -37,10 +37,10 @@
voice_gmm.covar_inverse = &kVoiceGmmCovarInverse[0][0][0];
// Test vectors. These are the mean of the GMM means.
- const double kXVoice[kVoiceGmmDim] = {
- -1.35893162459863, 602.862491970368, 178.022069191324};
- const double kXNoise[kNoiseGmmDim] = {
- -2.33443722724409, 2827.97828765184, 141.114178166812};
+ const double kXVoice[kVoiceGmmDim] = {-1.35893162459863, 602.862491970368,
+ 178.022069191324};
+ const double kXNoise[kNoiseGmmDim] = {-2.33443722724409, 2827.97828765184,
+ 141.114178166812};
// Expected pdf values. These values are computed in MATLAB using EvalGmm.m
const double kPdfNoise = 1.88904409403101e-07;
diff --git a/modules/audio_processing/vad/noise_gmm_tables.h b/modules/audio_processing/vad/noise_gmm_tables.h
index c07dade..1556277 100644
--- a/modules/audio_processing/vad/noise_gmm_tables.h
+++ b/modules/audio_processing/vad/noise_gmm_tables.h
@@ -70,16 +70,8 @@
{-2.30193040814533e+00, 1.43953696546439e+03, 7.04085275122649e+01}};
static const double kNoiseGmmWeights[kNoiseGmmNumMixtures] = {
- -1.09422832086193e+01,
- -1.10847897513425e+01,
- -1.36767587732187e+01,
- -1.79789356118641e+01,
- -1.42830169160894e+01,
- -1.56500228061379e+01,
- -1.83124990950113e+01,
- -1.69979436177477e+01,
- -1.12329424387828e+01,
- -1.41311785780639e+01,
- -1.47171861448585e+01,
- -1.35963362781839e+01};
+ -1.09422832086193e+01, -1.10847897513425e+01, -1.36767587732187e+01,
+ -1.79789356118641e+01, -1.42830169160894e+01, -1.56500228061379e+01,
+ -1.83124990950113e+01, -1.69979436177477e+01, -1.12329424387828e+01,
+ -1.41311785780639e+01, -1.47171861448585e+01, -1.35963362781839e+01};
#endif // MODULES_AUDIO_PROCESSING_VAD_NOISE_GMM_TABLES_H_
diff --git a/modules/audio_processing/vad/pitch_based_vad.cc b/modules/audio_processing/vad/pitch_based_vad.cc
index 240ec63..025ef20 100644
--- a/modules/audio_processing/vad/pitch_based_vad.cc
+++ b/modules/audio_processing/vad/pitch_based_vad.cc
@@ -13,9 +13,9 @@
#include <math.h>
#include <string.h>
-#include "modules/audio_processing/vad/vad_circular_buffer.h"
#include "modules/audio_processing/vad/common.h"
#include "modules/audio_processing/vad/noise_gmm_tables.h"
+#include "modules/audio_processing/vad/vad_circular_buffer.h"
#include "modules/audio_processing/vad/voice_gmm_tables.h"
namespace webrtc {
@@ -58,8 +58,7 @@
voice_gmm_.covar_inverse = &kVoiceGmmCovarInverse[0][0][0];
}
-PitchBasedVad::~PitchBasedVad() {
-}
+PitchBasedVad::~PitchBasedVad() {}
int PitchBasedVad::VoicingProbability(const AudioFeatures& features,
double* p_combined) {
diff --git a/modules/audio_processing/vad/pitch_internal_unittest.cc b/modules/audio_processing/vad/pitch_internal_unittest.cc
index c1fde10..19c2e1a 100644
--- a/modules/audio_processing/vad/pitch_internal_unittest.cc
+++ b/modules/audio_processing/vad/pitch_internal_unittest.cc
@@ -26,12 +26,12 @@
double lags[] = {90, 111, 122, 50};
// Expected outputs
- double expected_log_pitch_gain[] = {
- -0.541212549898316, -1.45672279045507, -0.80471895621705};
+ double expected_log_pitch_gain[] = {-0.541212549898316, -1.45672279045507,
+ -0.80471895621705};
double expected_log_old_gain = log(gains[kNumInputParameters - 1]);
- double expected_pitch_lag_hz[] = {
- 92.3076923076923, 70.9010339734121, 93.0232558139535};
+ double expected_pitch_lag_hz[] = {92.3076923076923, 70.9010339734121,
+ 93.0232558139535};
double expected_old_lag = lags[kNumInputParameters - 1];
double log_pitch_gain[kNumOutputParameters];
diff --git a/modules/audio_processing/vad/pole_zero_filter.cc b/modules/audio_processing/vad/pole_zero_filter.cc
index fa56a3c..b9967d7 100644
--- a/modules/audio_processing/vad/pole_zero_filter.cc
+++ b/modules/audio_processing/vad/pole_zero_filter.cc
@@ -53,7 +53,8 @@
}
template <typename T>
-static float FilterArPast(const T* past, size_t order,
+static float FilterArPast(const T* past,
+ size_t order,
const float* coefficients) {
float sum = 0.0f;
size_t past_index = order - 1;
diff --git a/modules/audio_processing/vad/standalone_vad.cc b/modules/audio_processing/vad/standalone_vad.cc
index 2640892..813d375 100644
--- a/modules/audio_processing/vad/standalone_vad.cc
+++ b/modules/audio_processing/vad/standalone_vad.cc
@@ -21,8 +21,7 @@
static const int kDefaultStandaloneVadMode = 3;
StandaloneVad::StandaloneVad(VadInst* vad)
- : vad_(vad), buffer_(), index_(0), mode_(kDefaultStandaloneVadMode) {
-}
+ : vad_(vad), buffer_(), index_(0), mode_(kDefaultStandaloneVadMode) {}
StandaloneVad::~StandaloneVad() {
WebRtcVad_Free(vad_);
diff --git a/modules/audio_processing/vad/standalone_vad.h b/modules/audio_processing/vad/standalone_vad.h
index b85de0a..3f6eb7f 100644
--- a/modules/audio_processing/vad/standalone_vad.h
+++ b/modules/audio_processing/vad/standalone_vad.h
@@ -11,8 +11,8 @@
#ifndef MODULES_AUDIO_PROCESSING_AGC_STANDALONE_VAD_H_
#define MODULES_AUDIO_PROCESSING_AGC_STANDALONE_VAD_H_
-#include "modules/audio_processing/vad/common.h"
#include "common_audio/vad/include/webrtc_vad.h"
+#include "modules/audio_processing/vad/common.h"
#include "typedefs.h" // NOLINT(build/include)
namespace webrtc {
diff --git a/modules/audio_processing/vad/vad_audio_proc.cc b/modules/audio_processing/vad/vad_audio_proc.cc
index 459cda6..e9007c6 100644
--- a/modules/audio_processing/vad/vad_audio_proc.cc
+++ b/modules/audio_processing/vad/vad_audio_proc.cc
@@ -67,8 +67,7 @@
WebRtcIsac_InitPitchAnalysis(pitch_analysis_handle_.get());
}
-VadAudioProc::~VadAudioProc() {
-}
+VadAudioProc::~VadAudioProc() {}
void VadAudioProc::ResetBuffer() {
memcpy(audio_buffer_, &audio_buffer_[kNumSamplesToProcess],
diff --git a/modules/audio_processing/vad/vad_audio_proc_internal.h b/modules/audio_processing/vad/vad_audio_proc_internal.h
index ab1e636..915524f 100644
--- a/modules/audio_processing/vad/vad_audio_proc_internal.h
+++ b/modules/audio_processing/vad/vad_audio_proc_internal.h
@@ -14,23 +14,10 @@
namespace webrtc {
// These values should match MATLAB counterparts for unit-tests to pass.
-static const double kCorrWeight[] = {1.000000,
- 0.985000,
- 0.970225,
- 0.955672,
- 0.941337,
- 0.927217,
- 0.913308,
- 0.899609,
- 0.886115,
- 0.872823,
- 0.859730,
- 0.846834,
- 0.834132,
- 0.821620,
- 0.809296,
- 0.797156,
- 0.785199};
+static const double kCorrWeight[] = {
+ 1.000000, 0.985000, 0.970225, 0.955672, 0.941337, 0.927217,
+ 0.913308, 0.899609, 0.886115, 0.872823, 0.859730, 0.846834,
+ 0.834132, 0.821620, 0.809296, 0.797156, 0.785199};
static const double kLpcAnalWin[] = {
0.00000000, 0.01314436, 0.02628645, 0.03942400, 0.05255473, 0.06567639,
@@ -75,11 +62,9 @@
0.06567639, 0.05255473, 0.03942400, 0.02628645, 0.01314436, 0.00000000};
static const size_t kFilterOrder = 2;
-static const float kCoeffNumerator[kFilterOrder + 1] = {0.974827f,
- -1.949650f,
+static const float kCoeffNumerator[kFilterOrder + 1] = {0.974827f, -1.949650f,
0.974827f};
-static const float kCoeffDenominator[kFilterOrder + 1] = {1.0f,
- -1.971999f,
+static const float kCoeffDenominator[kFilterOrder + 1] = {1.0f, -1.971999f,
0.972457f};
static_assert(kFilterOrder + 1 ==
diff --git a/modules/audio_processing/vad/vad_circular_buffer.cc b/modules/audio_processing/vad/vad_circular_buffer.cc
index 3c4d5ad..31f14d7 100644
--- a/modules/audio_processing/vad/vad_circular_buffer.cc
+++ b/modules/audio_processing/vad/vad_circular_buffer.cc
@@ -19,11 +19,9 @@
is_full_(false),
index_(0),
buffer_size_(buffer_size),
- sum_(0) {
-}
+ sum_(0) {}
-VadCircularBuffer::~VadCircularBuffer() {
-}
+VadCircularBuffer::~VadCircularBuffer() {}
void VadCircularBuffer::Reset() {
is_full_ = false;
diff --git a/modules/audio_processing/vad/voice_activity_detector.cc b/modules/audio_processing/vad/voice_activity_detector.cc
index 66a704f..f0d34c6 100644
--- a/modules/audio_processing/vad/voice_activity_detector.cc
+++ b/modules/audio_processing/vad/voice_activity_detector.cc
@@ -27,8 +27,7 @@
VoiceActivityDetector::VoiceActivityDetector()
: last_voice_probability_(kDefaultVoiceValue),
- standalone_vad_(StandaloneVad::Create()) {
-}
+ standalone_vad_(StandaloneVad::Create()) {}
VoiceActivityDetector::~VoiceActivityDetector() = default;
diff --git a/modules/audio_processing/vad/voice_activity_detector.h b/modules/audio_processing/vad/voice_activity_detector.h
index 0079cb2..e424ac1 100644
--- a/modules/audio_processing/vad/voice_activity_detector.h
+++ b/modules/audio_processing/vad/voice_activity_detector.h
@@ -15,10 +15,10 @@
#include <vector>
#include "common_audio/resampler/include/resampler.h"
-#include "modules/audio_processing/vad/vad_audio_proc.h"
#include "modules/audio_processing/vad/common.h"
#include "modules/audio_processing/vad/pitch_based_vad.h"
#include "modules/audio_processing/vad/standalone_vad.h"
+#include "modules/audio_processing/vad/vad_audio_proc.h"
namespace webrtc {
diff --git a/modules/audio_processing/vad/voice_gmm_tables.h b/modules/audio_processing/vad/voice_gmm_tables.h
index 29cc7d6..ef4ad7e 100644
--- a/modules/audio_processing/vad/voice_gmm_tables.h
+++ b/modules/audio_processing/vad/voice_gmm_tables.h
@@ -70,16 +70,8 @@
{-7.29187507662854e-01, 5.22717685022855e+02, 1.16377942283991e+02}};
static const double kVoiceGmmWeights[kVoiceGmmNumMixtures] = {
- -1.39789694361035e+01,
- -1.19527720202104e+01,
- -1.32396317929055e+01,
- -1.09436815209238e+01,
- -1.13440027478149e+01,
- -1.12200721834504e+01,
- -1.02537324043693e+01,
- -1.60789861938302e+01,
- -1.03394494048344e+01,
- -1.83207938586818e+01,
- -1.31186044948288e+01,
- -9.52479998673554e+00};
+ -1.39789694361035e+01, -1.19527720202104e+01, -1.32396317929055e+01,
+ -1.09436815209238e+01, -1.13440027478149e+01, -1.12200721834504e+01,
+ -1.02537324043693e+01, -1.60789861938302e+01, -1.03394494048344e+01,
+ -1.83207938586818e+01, -1.31186044948288e+01, -9.52479998673554e+00};
#endif // MODULES_AUDIO_PROCESSING_VAD_VOICE_GMM_TABLES_H_
diff --git a/modules/audio_processing/voice_detection_impl.cc b/modules/audio_processing/voice_detection_impl.cc
index 5ee0c7b..9280be1 100644
--- a/modules/audio_processing/voice_detection_impl.cc
+++ b/modules/audio_processing/voice_detection_impl.cc
@@ -23,10 +23,9 @@
int error = WebRtcVad_Init(state_);
RTC_DCHECK_EQ(0, error);
}
- ~Vad() {
- WebRtcVad_Free(state_);
- }
+ ~Vad() { WebRtcVad_Free(state_); }
VadInst* state() { return state_; }
+
private:
VadInst* state_ = nullptr;
RTC_DISALLOW_COPY_AND_ASSIGN(Vad);
@@ -65,9 +64,9 @@
RTC_DCHECK_GE(160, audio->num_frames_per_band());
// TODO(ajm): concatenate data in frame buffer here.
- int vad_ret = WebRtcVad_Process(vad_->state(), sample_rate_hz_,
- audio->mixed_low_pass_data(),
- frame_size_samples_);
+ int vad_ret =
+ WebRtcVad_Process(vad_->state(), sample_rate_hz_,
+ audio->mixed_low_pass_data(), frame_size_samples_);
if (vad_ret == 0) {
stream_has_voice_ = false;
audio->set_activity(AudioFrame::kVadPassive);
@@ -103,7 +102,7 @@
bool VoiceDetectionImpl::stream_has_voice() const {
rtc::CritScope cs(crit_);
// TODO(ajm): enable this assertion?
- //RTC_DCHECK(using_external_vad_ || is_component_enabled());
+ // RTC_DCHECK(using_external_vad_ || is_component_enabled());
return stream_has_voice_;
}
@@ -142,7 +141,7 @@
int VoiceDetectionImpl::set_frame_size_ms(int size) {
rtc::CritScope cs(crit_);
- RTC_DCHECK_EQ(10, size); // TODO(ajm): remove when supported.
+ RTC_DCHECK_EQ(10, size); // TODO(ajm): remove when supported.
frame_size_ms_ = size;
Initialize(sample_rate_hz_);
return AudioProcessing::kNoError;