Initialize signal processing function pointers statically
The last run-time logic for selecting function pointers was removed in
May 2016, here: https://codereview.webrtc.org/1955413003
It would be even better if we could eliminate the function pointers
entirely and just have different implementations that we select at
compile time; I've left a TODO asking for this.
Bug: webrtc:9553
Change-Id: Ica71d71e19759da00967168f6479b7eb8b46c590
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144053
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28414}
diff --git a/common_audio/signal_processing/signal_processing_unittest.cc b/common_audio/signal_processing/signal_processing_unittest.cc
index 0e316b9..3106c47 100644
--- a/common_audio/signal_processing/signal_processing_unittest.cc
+++ b/common_audio/signal_processing/signal_processing_unittest.cc
@@ -25,13 +25,7 @@
-3333,
345};
-class SplTest : public ::testing::Test {
- protected:
- SplTest() { WebRtcSpl_Init(); }
- ~SplTest() override {}
-};
-
-TEST_F(SplTest, MacroTest) {
+TEST(SplTest, MacroTest) {
// Macros with inputs.
int A = 10;
int B = 21;
@@ -93,7 +87,7 @@
#endif
}
-TEST_F(SplTest, InlineTest) {
+TEST(SplTest, InlineTest) {
int16_t a16 = 121;
int16_t b16 = -17;
int32_t a32 = 111121;
@@ -124,7 +118,7 @@
EXPECT_EQ(138, WebRtcSpl_SubSatW16(a16, b16));
}
-TEST_F(SplTest, AddSubSatW32) {
+TEST(SplTest, AddSubSatW32) {
static constexpr int32_t kAddSubArgs[] = {
INT32_MIN, INT32_MIN + 1, -3, -2, -1, 0, 1, -1, 2,
3, INT32_MAX - 1, INT32_MAX};
@@ -143,7 +137,7 @@
}
}
-TEST_F(SplTest, CountLeadingZeros32) {
+TEST(SplTest, CountLeadingZeros32) {
EXPECT_EQ(32, WebRtcSpl_CountLeadingZeros32(0));
EXPECT_EQ(32, WebRtcSpl_CountLeadingZeros32_NotBuiltin(0));
for (int i = 0; i < 32; ++i) {
@@ -156,7 +150,7 @@
}
}
-TEST_F(SplTest, CountLeadingZeros64) {
+TEST(SplTest, CountLeadingZeros64) {
EXPECT_EQ(64, WebRtcSpl_CountLeadingZeros64(0));
EXPECT_EQ(64, WebRtcSpl_CountLeadingZeros64_NotBuiltin(0));
for (int i = 0; i < 64; ++i) {
@@ -169,7 +163,7 @@
}
}
-TEST_F(SplTest, MathOperationsTest) {
+TEST(SplTest, MathOperationsTest) {
int A = 1134567892;
int32_t num = 117;
int32_t den = -5;
@@ -184,7 +178,7 @@
EXPECT_EQ(0, WebRtcSpl_DivW32HiLow(128, 0, 256));
}
-TEST_F(SplTest, BasicArrayOperationsTest) {
+TEST(SplTest, BasicArrayOperationsTest) {
const size_t kVectorSize = 4;
int B[] = {4, 12, 133, 1100};
int16_t b16[kVectorSize];
@@ -249,7 +243,7 @@
}
}
-TEST_F(SplTest, MinMaxOperationsTest) {
+TEST(SplTest, MinMaxOperationsTest) {
const size_t kVectorSize = 17;
// Vectors to test the cases where minimum values have to be caught
@@ -340,7 +334,7 @@
EXPECT_EQ(6u, WebRtcSpl_MinIndexW32(vector32, kVectorSize));
}
-TEST_F(SplTest, VectorOperationsTest) {
+TEST(SplTest, VectorOperationsTest) {
const size_t kVectorSize = 4;
int B[] = {4, 12, 133, 1100};
int16_t a16[kVectorSize];
@@ -402,7 +396,7 @@
EXPECT_EQ(0, WebRtcSpl_GetScalingSquare(b16, kVectorSize, 1));
}
-TEST_F(SplTest, EstimatorsTest) {
+TEST(SplTest, EstimatorsTest) {
const size_t kOrder = 2;
const int32_t unstable_filter[] = {4, 12, 133, 1100};
const int32_t stable_filter[] = {1100, 133, 12, 4};
@@ -419,7 +413,7 @@
}
}
-TEST_F(SplTest, FilterTest) {
+TEST(SplTest, FilterTest) {
const size_t kVectorSize = 4;
const size_t kFilterOrder = 3;
int16_t A[] = {1, 2, 33, 100};
@@ -457,7 +451,7 @@
data_out, bTmp16Low, kVectorSize));
}
-TEST_F(SplTest, RandTest) {
+TEST(SplTest, RandTest) {
const int kVectorSize = 4;
int16_t BU[] = {3653, 12446, 8525, 30691};
int16_t b16[kVectorSize];
@@ -472,12 +466,12 @@
}
}
-TEST_F(SplTest, DotProductWithScaleTest) {
+TEST(SplTest, DotProductWithScaleTest) {
EXPECT_EQ(605362796, WebRtcSpl_DotProductWithScale(vector16, vector16,
kVector16Size, 2));
}
-TEST_F(SplTest, CrossCorrelationTest) {
+TEST(SplTest, CrossCorrelationTest) {
// Note the function arguments relation specificed by API.
const size_t kCrossCorrelationDimension = 3;
const int kShift = 2;
@@ -509,7 +503,7 @@
}
}
-TEST_F(SplTest, AutoCorrelationTest) {
+TEST(SplTest, AutoCorrelationTest) {
int scale = 0;
int32_t vector32[kVector16Size];
const int32_t expected[kVector16Size] = {302681398, 14223410, -121705063,
@@ -525,7 +519,7 @@
}
}
-TEST_F(SplTest, SignalProcessingTest) {
+TEST(SplTest, SignalProcessingTest) {
const size_t kVectorSize = 4;
int A[] = {1, 2, 33, 100};
const int16_t kHanning[4] = {2399, 8192, 13985, 16384};
@@ -565,7 +559,7 @@
EXPECT_EQ(0, bScale);
}
-TEST_F(SplTest, FFTTest) {
+TEST(SplTest, FFTTest) {
int16_t B[] = {1, 2, 33, 100, 2, 3, 34, 101, 3, 4, 35, 102, 4, 5, 36, 103};
EXPECT_EQ(0, WebRtcSpl_ComplexFFT(B, 3, 1));
@@ -582,7 +576,7 @@
}
}
-TEST_F(SplTest, Resample48WithSaturationTest) {
+TEST(SplTest, Resample48WithSaturationTest) {
// The test resamples 3*kBlockSize number of samples to 2*kBlockSize number
// of samples.
const size_t kBlockSize = 16;