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}
This commit is contained in:
Karl Wiberg
2019-06-28 14:51:49 +02:00
committed by Commit Bot
parent a47ba4119f
commit 225842ced8
17 changed files with 76 additions and 179 deletions

View File

@ -51,7 +51,6 @@ const int16_t WebRtcCng_kCorrWindow[WEBRTC_CNG_MAX_LPC_ORDER] = {
ComfortNoiseDecoder::ComfortNoiseDecoder() {
/* Needed to get the right function pointers in SPLIB. */
WebRtcSpl_Init();
Reset();
}
@ -217,8 +216,6 @@ ComfortNoiseEncoder::ComfortNoiseEncoder(int fs, int interval, int quality)
enc_seed_(7777) /* For debugging only. */ {
RTC_CHECK_GT(quality, 0);
RTC_CHECK_LE(quality, WEBRTC_CNG_MAX_LPC_ORDER);
/* Needed to get the right function pointers in SPLIB. */
WebRtcSpl_Init();
}
void ComfortNoiseEncoder::Reset(int fs, int interval, int quality) {

View File

@ -53,7 +53,6 @@ int16_t WebRtcIlbcfix_DecoderAssign(IlbcDecoderInstance** iLBC_decinst,
int16_t WebRtcIlbcfix_EncoderCreate(IlbcEncoderInstance **iLBC_encinst) {
*iLBC_encinst=(IlbcEncoderInstance*)malloc(sizeof(IlbcEncoder));
if (*iLBC_encinst!=NULL) {
WebRtcSpl_Init();
return(0);
} else {
return(-1);
@ -63,7 +62,6 @@ int16_t WebRtcIlbcfix_EncoderCreate(IlbcEncoderInstance **iLBC_encinst) {
int16_t WebRtcIlbcfix_DecoderCreate(IlbcDecoderInstance **iLBC_decinst) {
*iLBC_decinst=(IlbcDecoderInstance*)malloc(sizeof(IlbcDecoder));
if (*iLBC_decinst!=NULL) {
WebRtcSpl_Init();
return(0);
} else {
return(-1);

View File

@ -109,7 +109,6 @@ int16_t WebRtcIsacfix_Create(ISACFIX_MainStruct **ISAC_main_inst)
(*(ISACFIX_SubStruct**)ISAC_main_inst)->errorcode = 0;
(*(ISACFIX_SubStruct**)ISAC_main_inst)->initflag = 0;
(*(ISACFIX_SubStruct**)ISAC_main_inst)->ISACenc_obj.SaveEnc_ptr = NULL;
WebRtcSpl_Init();
WebRtcIsacfix_InitBandwidthEstimator(&tempo->bwestimator_obj);
return(0);
} else {

View File

@ -138,8 +138,6 @@ static const int16_t time2spec_out_expected_2[kSamples] = {
class TransformTest : public ::testing::Test {
protected:
TransformTest() { WebRtcSpl_Init(); }
// Pass a function pointer to the Tester function.
void Time2SpecTester(Time2Spec Time2SpecFunction) {
// WebRtcIsacfix_Time2Spec functions hard coded the buffer lengths. It's a

View File

@ -83,7 +83,6 @@ class ExpandTest : public ::testing::Test {
&statistics_,
test_sample_rate_hz_,
num_channels_) {
WebRtcSpl_Init();
input_file_.set_output_rate_hz(test_sample_rate_hz_);
}

View File

@ -133,7 +133,6 @@ NetEqImpl::NetEqImpl(const NetEq::Config& config,
last_output_sample_rate_hz_ = fs;
output_size_samples_ = static_cast<size_t>(kOutputSizeMs * 8 * fs_mult_);
decoder_frame_length_ = 3 * output_size_samples_;
WebRtcSpl_Init();
if (create_components) {
SetSampleRateAndChannels(fs, 1); // Default is 1 channel.
}

View File

@ -55,7 +55,6 @@ TEST(Normal, CreateAndDestroy) {
}
TEST(Normal, AvoidDivideByZero) {
WebRtcSpl_Init();
MockDecoderDatabase db;
int fs = 8000;
size_t channels = 1;
@ -91,7 +90,6 @@ TEST(Normal, AvoidDivideByZero) {
}
TEST(Normal, InputLengthAndChannelsDoNotMatch) {
WebRtcSpl_Init();
MockDecoderDatabase db;
int fs = 8000;
size_t channels = 2;
@ -116,7 +114,6 @@ TEST(Normal, InputLengthAndChannelsDoNotMatch) {
}
TEST(Normal, LastModeExpand120msPacket) {
WebRtcSpl_Init();
MockDecoderDatabase db;
const int kFs = 48000;
const size_t kPacketsizeBytes = 11520u;

View File

@ -65,7 +65,6 @@ class TimeStretchTest : public ::testing::Test {
block_size_(30 * sample_rate_hz_ / 1000), // 30 ms
audio_(new int16_t[block_size_]),
background_noise_(kNumChannels) {
WebRtcSpl_Init();
}
const int16_t* Next30Ms() {