Clean-up iLBC nits

Bug: webrtc:372395680
Change-Id: Ic33295bdc6e14abe35404dd969d5d51008e698f6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/366602
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43322}
This commit is contained in:
Alessio Bazzica 2024-10-24 14:56:16 +02:00 committed by WebRTC LUCI CQ
parent ddac9f2739
commit e8c8218f1b
14 changed files with 94 additions and 198 deletions

View file

@ -117,7 +117,6 @@ rtc_library("common_audio_c") {
"signal_processing/filter_ma_fast_q12.c",
"signal_processing/get_hanning_window.c",
"signal_processing/get_scaling_square.c",
"signal_processing/ilbc_specific_functions.c",
"signal_processing/include/real_fft.h",
"signal_processing/include/signal_processing_library.h",
"signal_processing/include/spl_inl.h",
@ -139,6 +138,7 @@ rtc_library("common_audio_c") {
"signal_processing/spl_sqrt.c",
"signal_processing/splitting_filter.c",
"signal_processing/sqrt_of_one_minus_x_squared.c",
"signal_processing/vector_operations.c",
"signal_processing/vector_scaling_operations.c",
"vad/include/webrtc_vad.h",
"vad/vad_core.c",

View file

@ -389,36 +389,121 @@ int WebRtcSpl_ScaleAndAddVectorsWithRound_mips(const int16_t* in_vector1,
#endif
// End: Vector scaling operations.
// iLBC specific functions. Implementations in ilbc_specific_functions.c.
// Description at bottom of file.
//
// WebRtcSpl_ReverseOrderMultArrayElements(...)
//
// Performs the vector operation:
// out_vector[n] = (in_vector[n]*window[-n])>>right_shifts
//
// Input:
// - in_vector : Input vector
// - window : Window vector (should be reversed). The pointer
// should be set to the last value in the vector
// - right_shifts : Number of right bit shift to be applied after the
// multiplication
// - vector_length : Number of elements in `in_vector`
//
// Output:
// - out_vector : Output vector (can be same as `in_vector`)
//
void WebRtcSpl_ReverseOrderMultArrayElements(int16_t* out_vector,
const int16_t* in_vector,
const int16_t* window,
size_t vector_length,
int16_t right_shifts);
//
// WebRtcSpl_ElementwiseVectorMult(...)
//
// Performs the vector operation:
// out_vector[n] = (in_vector[n]*window[n])>>right_shifts
//
// Input:
// - in_vector : Input vector
// - window : Window vector.
// - right_shifts : Number of right bit shift to be applied after the
// multiplication
// - vector_length : Number of elements in `in_vector`
//
// Output:
// - out_vector : Output vector (can be same as `in_vector`)
//
void WebRtcSpl_ElementwiseVectorMult(int16_t* out_vector,
const int16_t* in_vector,
const int16_t* window,
size_t vector_length,
int16_t right_shifts);
//
// WebRtcSpl_AddVectorsAndShift(...)
//
// Performs the vector operation:
// out_vector[k] = (in_vector1[k] + in_vector2[k])>>right_shifts
//
// Input:
// - in_vector1 : Input vector 1
// - in_vector2 : Input vector 2
// - right_shifts : Number of right bit shift to be applied after the
// multiplication
// - vector_length : Number of elements in `in_vector1` and `in_vector2`
//
// Output:
// - out_vector : Output vector (can be same as `in_vector1`)
//
void WebRtcSpl_AddVectorsAndShift(int16_t* out_vector,
const int16_t* in_vector1,
const int16_t* in_vector2,
size_t vector_length,
int16_t right_shifts);
//
// WebRtcSpl_AddAffineVectorToVector(...)
//
// Adds an affine transformed vector to another vector `out_vector`, i.e,
// performs
// out_vector[k] += (in_vector[k]*gain+add_constant)>>right_shifts
//
// Input:
// - in_vector : Input vector
// - gain : Gain value, used to multiply the in vector with
// - add_constant : Constant value to add (usually 1<<(right_shifts-1),
// but others can be used as well
// - right_shifts : Number of right bit shifts (0-16)
// - vector_length : Number of samples in `in_vector` and `out_vector`
//
// Output:
// - out_vector : Vector with the output
//
void WebRtcSpl_AddAffineVectorToVector(int16_t* out_vector,
const int16_t* in_vector,
int16_t gain,
int32_t add_constant,
int16_t right_shifts,
size_t vector_length);
//
// WebRtcSpl_AffineTransformVector(...)
//
// Affine transforms a vector, i.e, performs
// out_vector[k] = (in_vector[k]*gain+add_constant)>>right_shifts
//
// Input:
// - in_vector : Input vector
// - gain : Gain value, used to multiply the in vector with
// - add_constant : Constant value to add (usually 1<<(right_shifts-1),
// but others can be used as well
// - right_shifts : Number of right bit shifts (0-16)
// - vector_length : Number of samples in `in_vector` and `out_vector`
//
// Output:
// - out_vector : Vector with the output
//
void WebRtcSpl_AffineTransformVector(int16_t* out_vector,
const int16_t* in_vector,
int16_t gain,
int32_t add_constant,
int16_t right_shifts,
size_t vector_length);
// End: iLBC specific functions.
// Signal processing operations.
@ -1186,95 +1271,6 @@ void WebRtcSpl_SynthesisQMF(const int16_t* low_band,
// - out_vector : Output vector
//
//
// WebRtcSpl_ReverseOrderMultArrayElements(...)
//
// Performs the vector operation:
// out_vector[n] = (in_vector[n]*window[-n])>>right_shifts
//
// Input:
// - in_vector : Input vector
// - window : Window vector (should be reversed). The pointer
// should be set to the last value in the vector
// - right_shifts : Number of right bit shift to be applied after the
// multiplication
// - vector_length : Number of elements in `in_vector`
//
// Output:
// - out_vector : Output vector (can be same as `in_vector`)
//
//
// WebRtcSpl_ElementwiseVectorMult(...)
//
// Performs the vector operation:
// out_vector[n] = (in_vector[n]*window[n])>>right_shifts
//
// Input:
// - in_vector : Input vector
// - window : Window vector.
// - right_shifts : Number of right bit shift to be applied after the
// multiplication
// - vector_length : Number of elements in `in_vector`
//
// Output:
// - out_vector : Output vector (can be same as `in_vector`)
//
//
// WebRtcSpl_AddVectorsAndShift(...)
//
// Performs the vector operation:
// out_vector[k] = (in_vector1[k] + in_vector2[k])>>right_shifts
//
// Input:
// - in_vector1 : Input vector 1
// - in_vector2 : Input vector 2
// - right_shifts : Number of right bit shift to be applied after the
// multiplication
// - vector_length : Number of elements in `in_vector1` and `in_vector2`
//
// Output:
// - out_vector : Output vector (can be same as `in_vector1`)
//
//
// WebRtcSpl_AddAffineVectorToVector(...)
//
// Adds an affine transformed vector to another vector `out_vector`, i.e,
// performs
// out_vector[k] += (in_vector[k]*gain+add_constant)>>right_shifts
//
// Input:
// - in_vector : Input vector
// - gain : Gain value, used to multiply the in vector with
// - add_constant : Constant value to add (usually 1<<(right_shifts-1),
// but others can be used as well
// - right_shifts : Number of right bit shifts (0-16)
// - vector_length : Number of samples in `in_vector` and `out_vector`
//
// Output:
// - out_vector : Vector with the output
//
//
// WebRtcSpl_AffineTransformVector(...)
//
// Affine transforms a vector, i.e, performs
// out_vector[k] = (in_vector[k]*gain+add_constant)>>right_shifts
//
// Input:
// - in_vector : Input vector
// - gain : Gain value, used to multiply the in vector with
// - add_constant : Constant value to add (usually 1<<(right_shifts-1),
// but others can be used as well
// - right_shifts : Number of right bit shifts (0-16)
// - vector_length : Number of samples in `in_vector` and `out_vector`
//
// Output:
// - out_vector : Vector with the output
//
//
// WebRtcSpl_IncreaseSeed(...)
//

View file

@ -8,17 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file contains implementations of the iLBC specific functions
* WebRtcSpl_ReverseOrderMultArrayElements()
* WebRtcSpl_ElementwiseVectorMult()
* WebRtcSpl_AddVectorsAndShift()
* WebRtcSpl_AddAffineVectorToVector()
* WebRtcSpl_AffineTransformVector()
*
*/
#include "common_audio/signal_processing/include/signal_processing_library.h"
void WebRtcSpl_ReverseOrderMultArrayElements(int16_t *out, const int16_t *in,

View file

@ -56,15 +56,6 @@ millions of VoIP endpoints. This codec is included as part of the WebRTC
project.
### What is the iLBC audio codec?
iLBC is a free narrowband voice codec that was developed by Global IP
Solutions, and is used in many Voice over IP (VoIP) and streaming audio
applications. In 2004, the final IETF RFC versions of the iLBC codec
specification and the iLBC RTP Profile draft became available. This codec is
included as part of the WebRTC project.
### What is the VP8 video codec?
VP8 is a highly-efficient video compression technology developed by the WebM Project. It is the video codec included with WebRTC.

View file

@ -898,23 +898,6 @@ TEST_F(AcmSenderBitExactnessOldApi, Pcma_stereo_20ms) {
/*expected_channels=*/test::AcmReceiveTestOldApi::kStereoOutput);
}
#if defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_LINUX) && \
defined(WEBRTC_ARCH_X86_64)
// TODO(bugs.webrtc.org/345525069): Either fix/enable or remove iLBC.
#if defined(__has_feature) && __has_feature(undefined_behavior_sanitizer)
TEST_F(AcmSenderBitExactnessOldApi, DISABLED_Ilbc_30ms) {
#else
TEST_F(AcmSenderBitExactnessOldApi, Ilbc_30ms) {
#endif
ASSERT_NO_FATAL_FAILURE(SetUpTest("ILBC", 8000, 1, 102, 240, 240));
Run(/*audio_checksum_ref=*/"a739434bec8a754e9356ce2115603ce5",
/*payload_checksum_ref=*/"cfae2e9f6aba96e145f2bcdd5050ce78",
/*expected_packets=*/33,
/*expected_channels=*/test::AcmReceiveTestOldApi::kMonoOutput);
}
#endif
#if defined(WEBRTC_LINUX) && defined(WEBRTC_ARCH_X86_64)
// TODO(bugs.webrtc.org/345525069): Either fix/enable or remove G722.

View file

@ -54,21 +54,6 @@ TEST(AudioDecoderFactoryTest, CreatePcma) {
adf->Create(env, SdpAudioFormat("pcma", 16000, 1), std::nullopt));
}
TEST(AudioDecoderFactoryTest, CreateIlbc) {
const Environment env = CreateEnvironment();
rtc::scoped_refptr<AudioDecoderFactory> adf =
CreateBuiltinAudioDecoderFactory();
ASSERT_TRUE(adf);
// iLBC supports 8 kHz, 1 channel.
EXPECT_FALSE(adf->Create(env, SdpAudioFormat("ilbc", 8000, 0), std::nullopt));
#ifdef WEBRTC_CODEC_ILBC
EXPECT_TRUE(adf->Create(env, SdpAudioFormat("ilbc", 8000, 1), std::nullopt));
#endif
EXPECT_FALSE(adf->Create(env, SdpAudioFormat("ilbc", 8000, 2), std::nullopt));
EXPECT_FALSE(
adf->Create(env, SdpAudioFormat("ilbc", 16000, 1), std::nullopt));
}
TEST(AudioDecoderFactoryTest, CreateL16) {
const Environment env = CreateEnvironment();
rtc::scoped_refptr<AudioDecoderFactory> adf =
@ -95,9 +80,6 @@ TEST(AudioDecoderFactoryTest, MaxNrOfChannels) {
std::vector<std::string> codecs = {
#ifdef WEBRTC_CODEC_OPUS
"opus",
#endif
#ifdef WEBRTC_CODEC_ILBC
"ilbc",
#endif
"pcmu", "pcma", "l16", "G722", "G711",
};

View file

@ -145,9 +145,6 @@ TEST(BuiltinAudioEncoderFactoryTest, SupportsTheExpectedFormats) {
{"isac", 32000, 1},
#endif
{"G722", 8000, 1},
#ifdef WEBRTC_CODEC_ILBC
{"ilbc", 8000, 1},
#endif
{"pcmu", 8000, 1},
{"pcma", 8000, 1}
};
@ -166,9 +163,6 @@ TEST(BuiltinAudioEncoderFactoryTest, MaxNrOfChannels) {
#endif
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
"isac",
#endif
#ifdef WEBRTC_CODEC_ILBC
"ilbc",
#endif
"pcmu",
"pcma",

View file

@ -43,15 +43,8 @@ ABSL_FLAG(bool, gen_ref, false, "Generate reference files.");
namespace webrtc {
#if defined(WEBRTC_LINUX) && defined(WEBRTC_ARCH_X86_64) && \
defined(WEBRTC_NETEQ_UNITTEST_BITEXACT) && \
(defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \
defined(WEBRTC_CODEC_ILBC)
#define MAYBE_TestBitExactness TestBitExactness
#else
#define MAYBE_TestBitExactness DISABLED_TestBitExactness
#endif
TEST_F(NetEqDecodingTest, MAYBE_TestBitExactness) {
// TODO(bugs.webrtc.org/345525069): Either fix/enable or remove.
TEST_F(NetEqDecodingTest, DISABLED_TestBitExactness) {
const std::string input_rtp_file =
webrtc::test::ResourcePath("audio_coding/neteq_universal_new", "rtp");

View file

@ -36,7 +36,6 @@ ABSL_FLAG(std::string,
" will assign the group Enable to field trial WebRTC-FooFeature.");
ABSL_FLAG(int, pcmu, TestConfig::default_pcmu(), "RTP payload type for PCM-u");
ABSL_FLAG(int, pcma, TestConfig::default_pcma(), "RTP payload type for PCM-a");
ABSL_FLAG(int, ilbc, TestConfig::default_ilbc(), "RTP payload type for iLBC");
ABSL_FLAG(int, isac, TestConfig::default_isac(), "RTP payload type for iSAC");
ABSL_FLAG(int,
isac_swb,
@ -212,7 +211,6 @@ void PrintCodecMappingEntry(absl::string_view codec, int flag) {
void PrintCodecMapping() {
PrintCodecMappingEntry("PCM-u", absl::GetFlag(FLAGS_pcmu));
PrintCodecMappingEntry("PCM-a", absl::GetFlag(FLAGS_pcma));
PrintCodecMappingEntry("iLBC", absl::GetFlag(FLAGS_ilbc));
PrintCodecMappingEntry("iSAC", absl::GetFlag(FLAGS_isac));
PrintCodecMappingEntry("iSAC-swb (32 kHz)", absl::GetFlag(FLAGS_isac_swb));
PrintCodecMappingEntry("Opus", absl::GetFlag(FLAGS_opus));
@ -314,7 +312,6 @@ int main(int argc, char* argv[]) {
output_files_base_name, output_audio_filename));
RTC_CHECK(ValidatePayloadType(absl::GetFlag(FLAGS_pcmu)));
RTC_CHECK(ValidatePayloadType(absl::GetFlag(FLAGS_pcma)));
RTC_CHECK(ValidatePayloadType(absl::GetFlag(FLAGS_ilbc)));
RTC_CHECK(ValidatePayloadType(absl::GetFlag(FLAGS_isac)));
RTC_CHECK(ValidatePayloadType(absl::GetFlag(FLAGS_isac_swb)));
RTC_CHECK(ValidatePayloadType(absl::GetFlag(FLAGS_opus)));
@ -348,7 +345,6 @@ int main(int argc, char* argv[]) {
webrtc::test::NetEqTestFactory::Config config;
config.pcmu = absl::GetFlag(FLAGS_pcmu);
config.pcma = absl::GetFlag(FLAGS_pcma);
config.ilbc = absl::GetFlag(FLAGS_ilbc);
config.isac = absl::GetFlag(FLAGS_isac);
config.isac_swb = absl::GetFlag(FLAGS_isac_swb);
config.opus = absl::GetFlag(FLAGS_opus);

View file

@ -312,9 +312,6 @@ NetEqLifetimeStatistics NetEqTest::LifetimeStats() const {
NetEqTest::DecoderMap NetEqTest::StandardDecoderMap() {
DecoderMap codecs = {{0, SdpAudioFormat("pcmu", 8000, 1)},
{8, SdpAudioFormat("pcma", 8000, 1)},
#ifdef WEBRTC_CODEC_ILBC
{102, SdpAudioFormat("ilbc", 8000, 1)},
#endif
#ifdef WEBRTC_CODEC_OPUS
{111, SdpAudioFormat("opus", 48000, 2)},
{63, SdpAudioFormat("red", 48000, 2)},

View file

@ -51,8 +51,8 @@ std::optional<int> CodecSampleRate(
uint8_t payload_type,
webrtc::test::NetEqTestFactory::Config config) {
if (payload_type == config.pcmu || payload_type == config.pcma ||
payload_type == config.ilbc || payload_type == config.pcm16b ||
payload_type == config.cn_nb || payload_type == config.avt)
payload_type == config.pcm16b || payload_type == config.cn_nb ||
payload_type == config.avt)
return 8000;
if (payload_type == config.isac || payload_type == config.pcm16b_wb ||
payload_type == config.g722 || payload_type == config.cn_wb ||

View file

@ -41,9 +41,6 @@ class NetEqTestFactory {
// RTP payload type for PCM-a.
static constexpr int default_pcma() { return 8; }
int pcma = default_pcma();
// RTP payload type for iLBC.
static constexpr int default_ilbc() { return 102; }
int ilbc = default_ilbc();
// RTP payload type for iSAC.
static constexpr int default_isac() { return 103; }
int isac = default_isac();

View file

@ -117,7 +117,6 @@ void Receiver::Setup(NetEq* neteq,
{109, {"L16", 32000, 1}},
{0, {"PCMU", 8000, 1}},
{8, {"PCMA", 8000, 1}},
{102, {"ILBC", 8000, 1}},
{9, {"G722", 8000, 1}},
{120, {"OPUS", 48000, 2}},
{13, {"CN", 8000, 1}},
@ -239,11 +238,8 @@ void EncodeDecodeTest::Perform() {
{107, {"L16", 8000, 1}}, {108, {"L16", 16000, 1}},
{109, {"L16", 32000, 1}}, {0, {"PCMU", 8000, 1}},
{8, {"PCMA", 8000, 1}},
// TODO(bugs.webrtc.org/345525069): Either fix/enable or remove G722 and iLBC.
// TODO(bugs.webrtc.org/345525069): Either fix/enable or remove G722.
#if defined(__has_feature) && !__has_feature(undefined_behavior_sanitizer)
#ifdef WEBRTC_CODEC_ILBC
{102, {"ILBC", 8000, 1}},
#endif
{9, {"G722", 8000, 1}},
#endif
};

View file

@ -142,7 +142,6 @@ void TestAllCodecs::Perform() {
{110, {"PCMU", 8000, 2}},
{8, {"PCMA", 8000, 1}},
{118, {"PCMA", 8000, 2}},
{102, {"ILBC", 8000, 1}},
{9, {"G722", 8000, 1}},
{119, {"G722", 8000, 2}},
{120, {"OPUS", 48000, 2, {{"stereo", "1"}}}},
@ -176,23 +175,6 @@ void TestAllCodecs::Perform() {
RegisterSendCodec(codec_g722, 16000, 64000, 960, 0);
Run(channel_a_to_b_);
outfile_b_.Close();
#endif
// TODO(bugs.webrtc.org/345525069): Either fix/enable or remove iLBC.
#if defined(__has_feature) && !__has_feature(undefined_behavior_sanitizer)
#ifdef WEBRTC_CODEC_ILBC
test_count_++;
OpenOutFile(test_count_);
char codec_ilbc[] = "ILBC";
RegisterSendCodec(codec_ilbc, 8000, 13300, 240, 0);
Run(channel_a_to_b_);
RegisterSendCodec(codec_ilbc, 8000, 13300, 480, 0);
Run(channel_a_to_b_);
RegisterSendCodec(codec_ilbc, 8000, 15200, 160, 0);
Run(channel_a_to_b_);
RegisterSendCodec(codec_ilbc, 8000, 15200, 320, 0);
Run(channel_a_to_b_);
outfile_b_.Close();
#endif
#endif
test_count_++;
OpenOutFile(test_count_);