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_coding/codecs/cng/audio_encoder_cng.cc b/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
index 91c07a9..4cda340 100644
--- a/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
+++ b/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
@@ -11,8 +11,8 @@
#include "modules/audio_coding/codecs/cng/audio_encoder_cng.h"
#include <algorithm>
-#include <memory>
#include <limits>
+#include <memory>
#include <utility>
namespace webrtc {
@@ -158,9 +158,8 @@
rtp_timestamps_.clear();
last_frame_active_ = true;
vad_->Reset();
- cng_encoder_.reset(
- new ComfortNoiseEncoder(SampleRateHz(), sid_frame_interval_ms_,
- num_cng_coefficients_));
+ cng_encoder_.reset(new ComfortNoiseEncoder(
+ SampleRateHz(), sid_frame_interval_ms_, num_cng_coefficients_));
}
bool AudioEncoderCng::SetFec(bool enable) {
@@ -217,11 +216,10 @@
// that value, in which case we don't want to overwrite any value from
// an earlier iteration.
size_t encoded_bytes_tmp =
- cng_encoder_->Encode(
- rtc::ArrayView<const int16_t>(
- &speech_buffer_[i * samples_per_10ms_frame],
- samples_per_10ms_frame),
- force_sid, encoded);
+ cng_encoder_->Encode(rtc::ArrayView<const int16_t>(
+ &speech_buffer_[i * samples_per_10ms_frame],
+ samples_per_10ms_frame),
+ force_sid, encoded);
if (encoded_bytes_tmp > 0) {
RTC_CHECK(!output_produced);
@@ -238,9 +236,8 @@
return info;
}
-AudioEncoder::EncodedInfo AudioEncoderCng::EncodeActive(
- size_t frames_to_encode,
- rtc::Buffer* encoded) {
+AudioEncoder::EncodedInfo AudioEncoderCng::EncodeActive(size_t frames_to_encode,
+ rtc::Buffer* encoded) {
const size_t samples_per_10ms_frame = SamplesPer10msFrame();
AudioEncoder::EncodedInfo info;
for (size_t i = 0; i < frames_to_encode; ++i) {
diff --git a/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc b/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc
index c582b44..a76dcbd 100644
--- a/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc
+++ b/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc
@@ -30,7 +30,7 @@
static const size_t kMaxNumSamples = 48 * 10 * 2; // 10 ms @ 48 kHz stereo.
static const size_t kMockReturnEncodedBytes = 17;
static const int kCngPayloadType = 18;
-}
+} // namespace
class AudioEncoderCngTest : public ::testing::Test {
protected:
@@ -94,8 +94,7 @@
InSequence s;
AudioEncoder::EncodedInfo info;
for (size_t j = 0; j < num_calls - 1; ++j) {
- EXPECT_CALL(*mock_encoder_, EncodeImpl(_, _, _))
- .WillOnce(Return(info));
+ EXPECT_CALL(*mock_encoder_, EncodeImpl(_, _, _)).WillOnce(Return(info));
}
info.encoded_bytes = kMockReturnEncodedBytes;
EXPECT_CALL(*mock_encoder_, EncodeImpl(_, _, _))
@@ -155,12 +154,14 @@
EXPECT_CALL(
*mock_vad_,
VoiceActivity(_, expected_first_block_size_ms * sample_rate_hz_ / 1000,
- sample_rate_hz_)).WillOnce(Return(Vad::kPassive));
+ sample_rate_hz_))
+ .WillOnce(Return(Vad::kPassive));
if (expected_second_block_size_ms > 0) {
EXPECT_CALL(*mock_vad_,
VoiceActivity(
_, expected_second_block_size_ms * sample_rate_hz_ / 1000,
- sample_rate_hz_)).WillOnce(Return(Vad::kPassive));
+ sample_rate_hz_))
+ .WillOnce(Return(Vad::kPassive));
}
// With this call to Encode(), |mock_vad_| should be called according to the
@@ -429,9 +430,7 @@
// Override AudioEncoderCngTest::TearDown, since that one expects a call to
// the destructor of |mock_vad_|. In this case, that object is already
// deleted.
- void TearDown() override {
- cng_.reset();
- }
+ void TearDown() override { cng_.reset(); }
AudioEncoderCng::Config MakeCngConfig() {
// Don't provide a Vad mock object, since it would leak when the test dies.
diff --git a/modules/audio_coding/codecs/cng/cng_unittest.cc b/modules/audio_coding/codecs/cng/cng_unittest.cc
index 54e5189..81688b1 100644
--- a/modules/audio_coding/codecs/cng/cng_unittest.cc
+++ b/modules/audio_coding/codecs/cng/cng_unittest.cc
@@ -29,10 +29,7 @@
kCNGNumParamsTooHigh = WEBRTC_CNG_MAX_LPC_ORDER + 1
};
-enum {
- kNoSid,
- kForceSid
-};
+enum { kNoSid, kForceSid };
class CngTest : public ::testing::Test {
protected:
@@ -46,11 +43,11 @@
void CngTest::SetUp() {
FILE* input_file;
const std::string file_name =
- webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
+ webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
input_file = fopen(file_name.c_str(), "rb");
ASSERT_TRUE(input_file != NULL);
- ASSERT_EQ(640, static_cast<int32_t>(fread(speech_data_, sizeof(int16_t),
- 640, input_file)));
+ ASSERT_EQ(640, static_cast<int32_t>(
+ fread(speech_data_, sizeof(int16_t), 640, input_file)));
fclose(input_file);
input_file = NULL;
}
@@ -74,11 +71,18 @@
// Create CNG encoder, init with faulty values, free CNG encoder.
TEST_F(CngTest, CngInitFail) {
// Call with too few parameters.
- EXPECT_DEATH({ ComfortNoiseEncoder(8000, kSidNormalIntervalUpdate,
- kCNGNumParamsLow); }, "");
+ EXPECT_DEATH(
+ {
+ ComfortNoiseEncoder(8000, kSidNormalIntervalUpdate, kCNGNumParamsLow);
+ },
+ "");
// Call with too many parameters.
- EXPECT_DEATH({ ComfortNoiseEncoder(8000, kSidNormalIntervalUpdate,
- kCNGNumParamsTooHigh); }, "");
+ EXPECT_DEATH(
+ {
+ ComfortNoiseEncoder(8000, kSidNormalIntervalUpdate,
+ kCNGNumParamsTooHigh);
+ },
+ "");
}
// Encode Cng with too long input vector.
@@ -209,13 +213,15 @@
// Normal Encode, 100 msec, where no SID data should be generated.
for (int i = 0; i < 10; i++) {
- EXPECT_EQ(0U, cng_encoder.Encode(
- rtc::ArrayView<const int16_t>(speech_data_, 160), kNoSid, &sid_data));
+ EXPECT_EQ(
+ 0U, cng_encoder.Encode(rtc::ArrayView<const int16_t>(speech_data_, 160),
+ kNoSid, &sid_data));
}
// We have reached 100 msec, and SID data should be generated.
- EXPECT_EQ(kCNGNumParamsNormal + 1, cng_encoder.Encode(
- rtc::ArrayView<const int16_t>(speech_data_, 160), kNoSid, &sid_data));
+ EXPECT_EQ(kCNGNumParamsNormal + 1,
+ cng_encoder.Encode(rtc::ArrayView<const int16_t>(speech_data_, 160),
+ kNoSid, &sid_data));
}
// Test automatic SID, with very short interval.
@@ -228,13 +234,16 @@
ComfortNoiseDecoder cng_decoder;
// First call will never generate SID, unless forced to.
- EXPECT_EQ(0U, cng_encoder.Encode(
- rtc::ArrayView<const int16_t>(speech_data_, 160), kNoSid, &sid_data));
+ EXPECT_EQ(0U,
+ cng_encoder.Encode(rtc::ArrayView<const int16_t>(speech_data_, 160),
+ kNoSid, &sid_data));
// Normal Encode, 100 msec, SID data should be generated all the time.
for (int i = 0; i < 10; i++) {
- EXPECT_EQ(kCNGNumParamsNormal + 1, cng_encoder.Encode(
- rtc::ArrayView<const int16_t>(speech_data_, 160), kNoSid, &sid_data));
+ EXPECT_EQ(
+ kCNGNumParamsNormal + 1,
+ cng_encoder.Encode(rtc::ArrayView<const int16_t>(speech_data_, 160),
+ kNoSid, &sid_data));
}
}
diff --git a/modules/audio_coding/codecs/cng/webrtc_cng.cc b/modules/audio_coding/codecs/cng/webrtc_cng.cc
index bd17a61..a07b093 100644
--- a/modules/audio_coding/codecs/cng/webrtc_cng.cc
+++ b/modules/audio_coding/codecs/cng/webrtc_cng.cc
@@ -25,28 +25,26 @@
void WebRtcCng_K2a16(int16_t* k, int useOrder, int16_t* a);
const int32_t WebRtcCng_kDbov[94] = {
- 1081109975, 858756178, 682134279, 541838517, 430397633, 341876992,
- 271562548, 215709799, 171344384, 136103682, 108110997, 85875618,
- 68213428, 54183852, 43039763, 34187699, 27156255, 21570980,
- 17134438, 13610368, 10811100, 8587562, 6821343, 5418385,
- 4303976, 3418770, 2715625, 2157098, 1713444, 1361037,
- 1081110, 858756, 682134, 541839, 430398, 341877,
- 271563, 215710, 171344, 136104, 108111, 85876,
- 68213, 54184, 43040, 34188, 27156, 21571,
- 17134, 13610, 10811, 8588, 6821, 5418,
- 4304, 3419, 2716, 2157, 1713, 1361,
- 1081, 859, 682, 542, 430, 342,
- 272, 216, 171, 136, 108, 86,
- 68, 54, 43, 34, 27, 22,
- 17, 14, 11, 9, 7, 5,
- 4, 3, 3, 2, 2, 1,
- 1, 1, 1, 1
-};
+ 1081109975, 858756178, 682134279, 541838517, 430397633, 341876992,
+ 271562548, 215709799, 171344384, 136103682, 108110997, 85875618,
+ 68213428, 54183852, 43039763, 34187699, 27156255, 21570980,
+ 17134438, 13610368, 10811100, 8587562, 6821343, 5418385,
+ 4303976, 3418770, 2715625, 2157098, 1713444, 1361037,
+ 1081110, 858756, 682134, 541839, 430398, 341877,
+ 271563, 215710, 171344, 136104, 108111, 85876,
+ 68213, 54184, 43040, 34188, 27156, 21571,
+ 17134, 13610, 10811, 8588, 6821, 5418,
+ 4304, 3419, 2716, 2157, 1713, 1361,
+ 1081, 859, 682, 542, 430, 342,
+ 272, 216, 171, 136, 108, 86,
+ 68, 54, 43, 34, 27, 22,
+ 17, 14, 11, 9, 7, 5,
+ 4, 3, 3, 2, 2, 1,
+ 1, 1, 1, 1};
const int16_t WebRtcCng_kCorrWindow[WEBRTC_CNG_MAX_LPC_ORDER] = {
- 32702, 32636, 32570, 32505, 32439, 32374,
- 32309, 32244, 32179, 32114, 32049, 31985
-};
+ 32702, 32636, 32570, 32505, 32439, 32374,
+ 32309, 32244, 32179, 32114, 32049, 31985};
} // namespace
@@ -57,7 +55,7 @@
}
void ComfortNoiseDecoder::Reset() {
- dec_seed_ = 7777; /* For debugging only. */
+ dec_seed_ = 7777; /* For debugging only. */
dec_target_energy_ = 0;
dec_used_energy_ = 0;
for (auto& c : dec_target_reflCoefs_)
@@ -115,11 +113,11 @@
int16_t excitation[kCngMaxOutsizeOrder];
int16_t low[kCngMaxOutsizeOrder];
int16_t lpPoly[WEBRTC_CNG_MAX_LPC_ORDER + 1];
- int16_t ReflBetaStd = 26214; /* 0.8 in q15. */
- int16_t ReflBetaCompStd = 6553; /* 0.2 in q15. */
- int16_t ReflBetaNewP = 19661; /* 0.6 in q15. */
- int16_t ReflBetaCompNewP = 13107; /* 0.4 in q15. */
- int16_t Beta, BetaC; /* These are in Q15. */
+ int16_t ReflBetaStd = 26214; /* 0.8 in q15. */
+ int16_t ReflBetaCompStd = 6553; /* 0.2 in q15. */
+ int16_t ReflBetaNewP = 19661; /* 0.6 in q15. */
+ int16_t ReflBetaCompNewP = 13107; /* 0.4 in q15. */
+ int16_t Beta, BetaC; /* These are in Q15. */
int32_t targetEnergy;
int16_t En;
int16_t temp16;
@@ -139,30 +137,28 @@
}
/* Calculate new scale factor in Q13 */
- dec_used_scale_factor_ =
- rtc::checked_cast<int16_t>(
- WEBRTC_SPL_MUL_16_16_RSFT(dec_used_scale_factor_, Beta >> 2, 13) +
- WEBRTC_SPL_MUL_16_16_RSFT(dec_target_scale_factor_, BetaC >> 2, 13));
+ dec_used_scale_factor_ = rtc::checked_cast<int16_t>(
+ WEBRTC_SPL_MUL_16_16_RSFT(dec_used_scale_factor_, Beta >> 2, 13) +
+ WEBRTC_SPL_MUL_16_16_RSFT(dec_target_scale_factor_, BetaC >> 2, 13));
- dec_used_energy_ = dec_used_energy_ >> 1;
+ dec_used_energy_ = dec_used_energy_ >> 1;
dec_used_energy_ += dec_target_energy_ >> 1;
/* Do the same for the reflection coeffs, albeit in Q15. */
for (size_t i = 0; i < WEBRTC_CNG_MAX_LPC_ORDER; i++) {
- dec_used_reflCoefs_[i] = (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(
- dec_used_reflCoefs_[i], Beta, 15);
- dec_used_reflCoefs_[i] += (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(
- dec_target_reflCoefs_[i], BetaC, 15);
+ dec_used_reflCoefs_[i] =
+ (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(dec_used_reflCoefs_[i], Beta, 15);
+ dec_used_reflCoefs_[i] +=
+ (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(dec_target_reflCoefs_[i], BetaC, 15);
}
/* Compute the polynomial coefficients. */
WebRtcCng_K2a16(dec_used_reflCoefs_, WEBRTC_CNG_MAX_LPC_ORDER, lpPoly);
-
targetEnergy = dec_used_energy_;
/* Calculate scaling factor based on filter energy. */
- En = 8192; /* 1.0 in Q13. */
+ En = 8192; /* 1.0 in Q13. */
for (size_t i = 0; i < (WEBRTC_CNG_MAX_LPC_ORDER); i++) {
/* Floating point value for reference.
E *= 1.0 - (dec_used_reflCoefs_[i] / 32768.0) *
@@ -171,11 +167,11 @@
/* Same in fixed point. */
/* K(i).^2 in Q15. */
- temp16 = (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(
- dec_used_reflCoefs_[i], dec_used_reflCoefs_[i], 15);
+ temp16 = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(dec_used_reflCoefs_[i],
+ dec_used_reflCoefs_[i], 15);
/* 1 - K(i).^2 in Q15. */
temp16 = 0x7fff - temp16;
- En = (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(En, temp16, 15);
+ En = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(En, temp16, 15);
}
/* float scaling= sqrt(E * dec_target_energy_ / (1 << 24)); */
@@ -183,8 +179,8 @@
/* Calculate sqrt(En * target_energy / excitation energy) */
targetEnergy = WebRtcSpl_Sqrt(dec_used_energy_);
- En = (int16_t) WebRtcSpl_Sqrt(En) << 6;
- En = (En * 3) >> 1; /* 1.5 estimates sqrt(2). */
+ En = (int16_t)WebRtcSpl_Sqrt(En) << 6;
+ En = (En * 3) >> 1; /* 1.5 estimates sqrt(2). */
dec_used_scale_factor_ = (int16_t)((En * targetEnergy) >> 12);
/* Generate excitation. */
@@ -217,7 +213,7 @@
enc_Energy_(0),
enc_reflCoefs_{0},
enc_corrVector_{0},
- enc_seed_(7777) /* For debugging only. */ {
+ 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. */
@@ -236,7 +232,7 @@
c = 0;
for (auto& c : enc_corrVector_)
c = 0;
- enc_seed_ = 7777; /* For debugging only. */
+ enc_seed_ = 7777; /* For debugging only. */
}
size_t ComfortNoiseEncoder::Encode(rtc::ArrayView<const int16_t> speech,
@@ -312,20 +308,19 @@
if (negate)
*bptr = -*bptr;
- blo = (int32_t) * aptr * (*bptr & 0xffff);
- bhi = ((blo >> 16) & 0xffff)
- + ((int32_t)(*aptr++) * ((*bptr >> 16) & 0xffff));
+ blo = (int32_t)*aptr * (*bptr & 0xffff);
+ bhi = ((blo >> 16) & 0xffff) +
+ ((int32_t)(*aptr++) * ((*bptr >> 16) & 0xffff));
blo = (blo & 0xffff) | ((bhi & 0xffff) << 16);
- *bptr = (((bhi >> 16) & 0x7fff) << 17) | ((uint32_t) blo >> 15);
+ *bptr = (((bhi >> 16) & 0x7fff) << 17) | ((uint32_t)blo >> 15);
if (negate)
*bptr = -*bptr;
bptr++;
}
/* End of bandwidth expansion. */
- stab = WebRtcSpl_LevinsonDurbin(corrVector, arCoefs, refCs,
- enc_nrOfCoefs_);
+ stab = WebRtcSpl_LevinsonDurbin(corrVector, arCoefs, refCs, enc_nrOfCoefs_);
if (!stab) {
/* Disregard from this frame */
@@ -345,13 +340,12 @@
} else {
/* Average history with new values. */
for (i = 0; i < enc_nrOfCoefs_; i++) {
- enc_reflCoefs_[i] = (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(
- enc_reflCoefs_[i], ReflBeta, 15);
+ enc_reflCoefs_[i] =
+ (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(enc_reflCoefs_[i], ReflBeta, 15);
enc_reflCoefs_[i] +=
- (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(refCs[i], ReflBetaComp, 15);
+ (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(refCs[i], ReflBetaComp, 15);
}
- enc_Energy_ =
- (outEnergy >> 2) + (enc_Energy_ >> 1) + (enc_Energy_ >> 2);
+ enc_Energy_ = (outEnergy >> 2) + (enc_Energy_ >> 1) + (enc_Energy_ >> 2);
}
if (enc_Energy_ < 1) {
@@ -372,25 +366,25 @@
index = 94;
const size_t output_coefs = enc_nrOfCoefs_ + 1;
- output->AppendData(output_coefs, [&] (rtc::ArrayView<uint8_t> output) {
- output[0] = (uint8_t)index;
+ output->AppendData(output_coefs, [&](rtc::ArrayView<uint8_t> output) {
+ output[0] = (uint8_t)index;
- /* Quantize coefficients with tweak for WebRtc implementation of
- * RFC3389. */
- if (enc_nrOfCoefs_ == WEBRTC_CNG_MAX_LPC_ORDER) {
- for (i = 0; i < enc_nrOfCoefs_; i++) {
- /* Q15 to Q7 with rounding. */
- output[i + 1] = ((enc_reflCoefs_[i] + 128) >> 8);
- }
- } else {
- for (i = 0; i < enc_nrOfCoefs_; i++) {
- /* Q15 to Q7 with rounding. */
- output[i + 1] = (127 + ((enc_reflCoefs_[i] + 128) >> 8));
- }
+ /* Quantize coefficients with tweak for WebRtc implementation of
+ * RFC3389. */
+ if (enc_nrOfCoefs_ == WEBRTC_CNG_MAX_LPC_ORDER) {
+ for (i = 0; i < enc_nrOfCoefs_; i++) {
+ /* Q15 to Q7 with rounding. */
+ output[i + 1] = ((enc_reflCoefs_[i] + 128) >> 8);
}
+ } else {
+ for (i = 0; i < enc_nrOfCoefs_; i++) {
+ /* Q15 to Q7 with rounding. */
+ output[i + 1] = (127 + ((enc_reflCoefs_[i] + 128) >> 8));
+ }
+ }
- return output_coefs;
- });
+ return output_coefs;
+ });
enc_msSinceSid_ =
static_cast<int16_t>((1000 * num_samples) / enc_sampfreq_);
diff --git a/modules/audio_coding/codecs/cng/webrtc_cng.h b/modules/audio_coding/codecs/cng/webrtc_cng.h
index 5e21b8f..684480a 100644
--- a/modules/audio_coding/codecs/cng/webrtc_cng.h
+++ b/modules/audio_coding/codecs/cng/webrtc_cng.h
@@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
#ifndef MODULES_AUDIO_CODING_CODECS_CNG_WEBRTC_CNG_H_
#define MODULES_AUDIO_CODING_CODECS_CNG_WEBRTC_CNG_H_
@@ -54,8 +53,8 @@
int16_t dec_filtstate_[WEBRTC_CNG_MAX_LPC_ORDER + 1];
int16_t dec_filtstateLow_[WEBRTC_CNG_MAX_LPC_ORDER + 1];
uint16_t dec_order_;
- int16_t dec_target_scale_factor_; /* Q29 */
- int16_t dec_used_scale_factor_; /* Q29 */
+ int16_t dec_target_scale_factor_; /* Q29 */
+ int16_t dec_used_scale_factor_; /* Q29 */
};
class ComfortNoiseEncoder {
diff --git a/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc b/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc
index a620a3e..25f495f 100644
--- a/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc
+++ b/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc
@@ -10,8 +10,8 @@
#include "modules/audio_coding/codecs/g711/audio_decoder_pcm.h"
-#include "modules/audio_coding/codecs/legacy_encoded_audio_frame.h"
#include "modules/audio_coding/codecs/g711/g711_interface.h"
+#include "modules/audio_coding/codecs/legacy_encoded_audio_frame.h"
namespace webrtc {
diff --git a/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc b/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc
index 9fb94fd..c14287e 100644
--- a/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc
+++ b/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc
@@ -42,8 +42,8 @@
payload_type_(config.payload_type),
num_10ms_frames_per_packet_(
static_cast<size_t>(config.frame_size_ms / 10)),
- full_frame_samples_(
- config.num_channels * config.frame_size_ms * sample_rate_hz / 1000),
+ full_frame_samples_(config.num_channels * config.frame_size_ms *
+ sample_rate_hz / 1000),
first_timestamp_in_buffer_(0) {
RTC_CHECK_GT(sample_rate_hz, 0) << "Sample rate must be larger than 0 Hz";
RTC_CHECK_EQ(config.frame_size_ms % 10, 0)
@@ -70,8 +70,8 @@
}
int AudioEncoderPcm::GetTargetBitrate() const {
- return static_cast<int>(
- 8 * BytesPerSample() * SampleRateHz() * NumChannels());
+ return static_cast<int>(8 * BytesPerSample() * SampleRateHz() *
+ NumChannels());
}
AudioEncoder::EncodedInfo AudioEncoderPcm::EncodeImpl(
@@ -89,13 +89,12 @@
EncodedInfo info;
info.encoded_timestamp = first_timestamp_in_buffer_;
info.payload_type = payload_type_;
- info.encoded_bytes =
- encoded->AppendData(full_frame_samples_ * BytesPerSample(),
- [&] (rtc::ArrayView<uint8_t> encoded) {
- return EncodeCall(&speech_buffer_[0],
- full_frame_samples_,
- encoded.data());
- });
+ info.encoded_bytes = encoded->AppendData(
+ full_frame_samples_ * BytesPerSample(),
+ [&](rtc::ArrayView<uint8_t> encoded) {
+ return EncodeCall(&speech_buffer_[0], full_frame_samples_,
+ encoded.data());
+ });
speech_buffer_.clear();
info.encoder_type = GetCodecType();
return info;
diff --git a/modules/audio_coding/codecs/g711/g711.h b/modules/audio_coding/codecs/g711/g711.h
index 8b1fc81..365f31b 100644
--- a/modules/audio_coding/codecs/g711/g711.h
+++ b/modules/audio_coding/codecs/g711/g711.h
@@ -17,7 +17,8 @@
* Modifications for WebRtc, 2011/04/28, by tlegrand:
* -Changed to use WebRtc types
* -Changed __inline__ to __inline
- * -Two changes to make implementation bitexact with ITU-T reference implementation
+ * -Two changes to make implementation bitexact with ITU-T reference
+ * implementation
*/
/*! \page g711_page A-law and mu-law handling
@@ -58,10 +59,11 @@
static __inline__ int top_bit(unsigned int bits) {
int res;
- __asm__ __volatile__(" movl $-1,%%edx;\n"
- " bsrl %%eax,%%edx;\n"
- : "=d" (res)
- : "a" (bits));
+ __asm__ __volatile__(
+ " movl $-1,%%edx;\n"
+ " bsrl %%eax,%%edx;\n"
+ : "=d"(res)
+ : "a"(bits));
return res;
}
@@ -71,30 +73,33 @@
static __inline__ int bottom_bit(unsigned int bits) {
int res;
- __asm__ __volatile__(" movl $-1,%%edx;\n"
- " bsfl %%eax,%%edx;\n"
- : "=d" (res)
- : "a" (bits));
+ __asm__ __volatile__(
+ " movl $-1,%%edx;\n"
+ " bsfl %%eax,%%edx;\n"
+ : "=d"(res)
+ : "a"(bits));
return res;
}
#elif defined(__x86_64__)
static __inline__ int top_bit(unsigned int bits) {
int res;
- __asm__ __volatile__(" movq $-1,%%rdx;\n"
- " bsrq %%rax,%%rdx;\n"
- : "=d" (res)
- : "a" (bits));
+ __asm__ __volatile__(
+ " movq $-1,%%rdx;\n"
+ " bsrq %%rax,%%rdx;\n"
+ : "=d"(res)
+ : "a"(bits));
return res;
}
static __inline__ int bottom_bit(unsigned int bits) {
int res;
- __asm__ __volatile__(" movq $-1,%%rdx;\n"
- " bsfq %%rax,%%rdx;\n"
- : "=d" (res)
- : "a" (bits));
+ __asm__ __volatile__(
+ " movq $-1,%%rdx;\n"
+ " bsfq %%rax,%%rdx;\n"
+ : "=d"(res)
+ : "a"(bits));
return res;
}
#else
@@ -166,8 +171,8 @@
* linear sound like peanuts these days, and shouldn't an array lookup be
* real fast? No! When the cache sloshes as badly as this one will, a tight
* calculation may be better. The messiest part is normally finding the
- * segment, but a little inline assembly can fix that on an i386, x86_64 and
- * many other modern processors.
+ * segment, but a little inline assembly can fix that on an i386, x86_64
+ * and many other modern processors.
*/
/*
@@ -196,8 +201,9 @@
* John Wiley & Sons, pps 98-111 and 472-476.
*/
-//#define ULAW_ZEROTRAP /* turn on the trap as per the MIL-STD */
-#define ULAW_BIAS 0x84 /* Bias for linear code. */
+//#define ULAW_ZEROTRAP /* turn on the trap as per the MIL-STD
+//*/
+#define ULAW_BIAS 0x84 /* Bias for linear code. */
/*! \brief Encode a linear sample to u-law
\param linear The sample to encode.
@@ -249,7 +255,7 @@
* Extract and bias the quantization bits. Then
* shift up by the segment number and subtract out the bias.
*/
- t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4);
+ t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int)ulaw & 0x70) >> 4);
return (int16_t)((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS));
}
@@ -317,7 +323,7 @@
alaw ^= ALAW_AMI_MASK;
i = ((alaw & 0x0F) << 4);
- seg = (((int) alaw & 0x70) >> 4);
+ seg = (((int)alaw & 0x70) >> 4);
if (seg)
i = (i + 0x108) << (seg - 1);
else
diff --git a/modules/audio_coding/codecs/g711/g711_interface.h b/modules/audio_coding/codecs/g711/g711_interface.h
index 1f23da6..f206f30 100644
--- a/modules/audio_coding/codecs/g711/g711_interface.h
+++ b/modules/audio_coding/codecs/g711/g711_interface.h
@@ -112,19 +112,19 @@
int16_t* speechType);
/**********************************************************************
-* WebRtcG711_Version(...)
-*
-* This function gives the version string of the G.711 codec.
-*
-* Input:
-* - lenBytes: the size of Allocated space (in Bytes) where
-* the version number is written to (in string format).
-*
-* Output:
-* - version: Pointer to a buffer where the version number is
-* written to.
-*
-*/
+ * WebRtcG711_Version(...)
+ *
+ * This function gives the version string of the G.711 codec.
+ *
+ * Input:
+ * - lenBytes: the size of Allocated space (in Bytes) where
+ * the version number is written to (in string format).
+ *
+ * Output:
+ * - version: Pointer to a buffer where the version number is
+ * written to.
+ *
+ */
int16_t WebRtcG711_Version(char* version, int16_t lenBytes);
diff --git a/modules/audio_coding/codecs/g711/test/testG711.cc b/modules/audio_coding/codecs/g711/test/testG711.cc
index 98f3925..f3a42f5 100644
--- a/modules/audio_coding/codecs/g711/test/testG711.cc
+++ b/modules/audio_coding/codecs/g711/test/testG711.cc
@@ -69,7 +69,6 @@
printf("outfile : Speech output file\n\n");
printf("outbits : Output bitstream file [optional]\n\n");
exit(0);
-
}
/* Get version and print */
@@ -80,8 +79,8 @@
/* Get frame length */
int framelength_int = atoi(argv[1]);
if (framelength_int < 0) {
- printf(" G.722: Invalid framelength %d.\n", framelength_int);
- exit(1);
+ printf(" G.722: Invalid framelength %d.\n", framelength_int);
+ exit(1);
}
framelength = static_cast<size_t>(framelength_int);
@@ -112,7 +111,7 @@
printf("\nBitfile: %s\n", bitname);
}
- starttime = clock() / (double) CLOCKS_PER_SEC_G711; /* Runtime statistics */
+ starttime = clock() / (double)CLOCKS_PER_SEC_G711; /* Runtime statistics */
/* Initialize encoder and decoder */
framecnt = 0;
@@ -155,11 +154,10 @@
}
}
- runtime = (double)(clock() / (double) CLOCKS_PER_SEC_G711 - starttime);
- length_file = ((double) framecnt * (double) framelength / 8000);
+ runtime = (double)(clock() / (double)CLOCKS_PER_SEC_G711 - starttime);
+ length_file = ((double)framecnt * (double)framelength / 8000);
printf("\n\nLength of speech file: %.1f s\n", length_file);
- printf("Time to run G.711: %.2f s (%.2f %% of realtime)\n\n",
- runtime,
+ printf("Time to run G.711: %.2f s (%.2f %% of realtime)\n\n", runtime,
(100 * runtime / length_file));
printf("---------------------END----------------------\n");
diff --git a/modules/audio_coding/codecs/g722/audio_encoder_g722.cc b/modules/audio_coding/codecs/g722/audio_encoder_g722.cc
index ec97ee3..cb96c3c 100644
--- a/modules/audio_coding/codecs/g722/audio_encoder_g722.cc
+++ b/modules/audio_coding/codecs/g722/audio_encoder_g722.cc
@@ -123,7 +123,7 @@
const size_t bytes_to_encode = samples_per_channel / 2 * num_channels_;
EncodedInfo info;
info.encoded_bytes = encoded->AppendData(
- bytes_to_encode, [&] (rtc::ArrayView<uint8_t> encoded) {
+ bytes_to_encode, [&](rtc::ArrayView<uint8_t> encoded) {
// Interleave the encoded bytes of the different channels. Each separate
// channel and the interleaved stream encodes two samples per byte, most
// significant half first.
diff --git a/modules/audio_coding/codecs/g722/audio_encoder_g722.h b/modules/audio_coding/codecs/g722/audio_encoder_g722.h
index 1f4b943..3cf1439 100644
--- a/modules/audio_coding/codecs/g722/audio_encoder_g722.h
+++ b/modules/audio_coding/codecs/g722/audio_encoder_g722.h
@@ -46,8 +46,8 @@
// The encoder state for one channel.
struct EncoderState {
G722EncInst* encoder;
- std::unique_ptr<int16_t[]> speech_buffer; // Queued up for encoding.
- rtc::Buffer encoded_buffer; // Already encoded.
+ std::unique_ptr<int16_t[]> speech_buffer; // Queued up for encoding.
+ rtc::Buffer encoded_buffer; // Already encoded.
EncoderState();
~EncoderState();
};
diff --git a/modules/audio_coding/codecs/g722/g722_enc_dec.h b/modules/audio_coding/codecs/g722/g722_enc_dec.h
index ccda09b..24f238d 100644
--- a/modules/audio_coding/codecs/g722/g722_enc_dec.h
+++ b/modules/audio_coding/codecs/g722/g722_enc_dec.h
@@ -7,7 +7,7 @@
*
* Copyright (C) 2005 Steve Underwood
*
- * Despite my general liking of the GPL, I place my own contributions
+ * Despite my general liking of the GPL, I place my own contributions
* to this code in the public domain for the benefit of all mankind -
* even the slimy ones who might try to proprietize my work and use it
* to my detriment.
@@ -25,7 +25,6 @@
* -Added new defines for minimum and maximum values of short int
*/
-
/*! \file */
#if !defined(_G722_ENC_DEC_H_)
@@ -35,12 +34,14 @@
/*! \page g722_page G.722 encoding and decoding
\section g722_page_sec_1 What does it do?
-The G.722 module is a bit exact implementation of the ITU G.722 specification for all three
-specified bit rates - 64000bps, 56000bps and 48000bps. It passes the ITU tests.
+The G.722 module is a bit exact implementation of the ITU G.722 specification
+for all three specified bit rates - 64000bps, 56000bps and 48000bps. It passes
+the ITU tests.
-To allow fast and flexible interworking with narrow band telephony, the encoder and decoder
-support an option for the linear audio to be an 8k samples/second stream. In this mode the
-codec is considerably faster, and still fully compatible with wideband terminals using G.722.
+To allow fast and flexible interworking with narrow band telephony, the encoder
+and decoder support an option for the linear audio to be an 8k samples/second
+stream. In this mode the codec is considerably faster, and still fully
+compatible with wideband terminals using G.722.
\section g722_page_sec_2 How does it work?
???.
@@ -49,86 +50,78 @@
#define WEBRTC_INT16_MAX 32767
#define WEBRTC_INT16_MIN -32768
-enum
-{
- G722_SAMPLE_RATE_8000 = 0x0001,
- G722_PACKED = 0x0002
-};
+enum { G722_SAMPLE_RATE_8000 = 0x0001, G722_PACKED = 0x0002 };
-typedef struct
-{
- /*! TRUE if the operating in the special ITU test mode, with the band split filters
- disabled. */
- int itu_test_mode;
- /*! TRUE if the G.722 data is packed */
- int packed;
- /*! TRUE if encode from 8k samples/second */
- int eight_k;
- /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
- int bits_per_sample;
+typedef struct {
+ /*! TRUE if the operating in the special ITU test mode, with the band split
+ filters disabled. */
+ int itu_test_mode;
+ /*! TRUE if the G.722 data is packed */
+ int packed;
+ /*! TRUE if encode from 8k samples/second */
+ int eight_k;
+ /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
+ int bits_per_sample;
- /*! Signal history for the QMF */
- int x[24];
+ /*! Signal history for the QMF */
+ int x[24];
- struct
- {
- int s;
- int sp;
- int sz;
- int r[3];
- int a[3];
- int ap[3];
- int p[3];
- int d[7];
- int b[7];
- int bp[7];
- int sg[7];
- int nb;
- int det;
- } band[2];
+ struct {
+ int s;
+ int sp;
+ int sz;
+ int r[3];
+ int a[3];
+ int ap[3];
+ int p[3];
+ int d[7];
+ int b[7];
+ int bp[7];
+ int sg[7];
+ int nb;
+ int det;
+ } band[2];
- unsigned int in_buffer;
- int in_bits;
- unsigned int out_buffer;
- int out_bits;
+ unsigned int in_buffer;
+ int in_bits;
+ unsigned int out_buffer;
+ int out_bits;
} G722EncoderState;
-typedef struct
-{
- /*! TRUE if the operating in the special ITU test mode, with the band split filters
- disabled. */
- int itu_test_mode;
- /*! TRUE if the G.722 data is packed */
- int packed;
- /*! TRUE if decode to 8k samples/second */
- int eight_k;
- /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
- int bits_per_sample;
+typedef struct {
+ /*! TRUE if the operating in the special ITU test mode, with the band split
+ filters disabled. */
+ int itu_test_mode;
+ /*! TRUE if the G.722 data is packed */
+ int packed;
+ /*! TRUE if decode to 8k samples/second */
+ int eight_k;
+ /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
+ int bits_per_sample;
- /*! Signal history for the QMF */
- int x[24];
+ /*! Signal history for the QMF */
+ int x[24];
- struct
- {
- int s;
- int sp;
- int sz;
- int r[3];
- int a[3];
- int ap[3];
- int p[3];
- int d[7];
- int b[7];
- int bp[7];
- int sg[7];
- int nb;
- int det;
- } band[2];
-
- unsigned int in_buffer;
- int in_bits;
- unsigned int out_buffer;
- int out_bits;
+ struct {
+ int s;
+ int sp;
+ int sz;
+ int r[3];
+ int a[3];
+ int ap[3];
+ int p[3];
+ int d[7];
+ int b[7];
+ int bp[7];
+ int sg[7];
+ int nb;
+ int det;
+ } band[2];
+
+ unsigned int in_buffer;
+ int in_bits;
+ unsigned int out_buffer;
+ int out_bits;
} G722DecoderState;
#ifdef __cplusplus
@@ -138,8 +131,8 @@
G722EncoderState* WebRtc_g722_encode_init(G722EncoderState* s,
int rate,
int options);
-int WebRtc_g722_encode_release(G722EncoderState *s);
-size_t WebRtc_g722_encode(G722EncoderState *s,
+int WebRtc_g722_encode_release(G722EncoderState* s);
+size_t WebRtc_g722_encode(G722EncoderState* s,
uint8_t g722_data[],
const int16_t amp[],
size_t len);
@@ -147,8 +140,8 @@
G722DecoderState* WebRtc_g722_decode_init(G722DecoderState* s,
int rate,
int options);
-int WebRtc_g722_decode_release(G722DecoderState *s);
-size_t WebRtc_g722_decode(G722DecoderState *s,
+int WebRtc_g722_decode_release(G722DecoderState* s);
+size_t WebRtc_g722_decode(G722DecoderState* s,
int16_t amp[],
const uint8_t g722_data[],
size_t len);
diff --git a/modules/audio_coding/codecs/g722/g722_interface.h b/modules/audio_coding/codecs/g722/g722_interface.h
index d957223..3b73f85 100644
--- a/modules/audio_coding/codecs/g722/g722_interface.h
+++ b/modules/audio_coding/codecs/g722/g722_interface.h
@@ -17,21 +17,20 @@
* Solution to support multiple instances
*/
-typedef struct WebRtcG722EncInst G722EncInst;
-typedef struct WebRtcG722DecInst G722DecInst;
+typedef struct WebRtcG722EncInst G722EncInst;
+typedef struct WebRtcG722DecInst G722DecInst;
/*
* Comfort noise constants
*/
-#define G722_WEBRTC_SPEECH 1
-#define G722_WEBRTC_CNG 2
+#define G722_WEBRTC_SPEECH 1
+#define G722_WEBRTC_CNG 2
#ifdef __cplusplus
extern "C" {
#endif
-
/****************************************************************************
* WebRtcG722_CreateEncoder(...)
*
@@ -43,8 +42,7 @@
* Return value : 0 - Ok
* -1 - Error
*/
-int16_t WebRtcG722_CreateEncoder(G722EncInst **G722enc_inst);
-
+int16_t WebRtcG722_CreateEncoder(G722EncInst** G722enc_inst);
/****************************************************************************
* WebRtcG722_EncoderInit(...)
@@ -59,8 +57,7 @@
* -1 - Error
*/
-int16_t WebRtcG722_EncoderInit(G722EncInst *G722enc_inst);
-
+int16_t WebRtcG722_EncoderInit(G722EncInst* G722enc_inst);
/****************************************************************************
* WebRtcG722_FreeEncoder(...)
@@ -73,9 +70,7 @@
* Return value : 0 - Ok
* -1 - Error
*/
-int WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst);
-
-
+int WebRtcG722_FreeEncoder(G722EncInst* G722enc_inst);
/****************************************************************************
* WebRtcG722_Encode(...)
@@ -99,7 +94,6 @@
size_t len,
uint8_t* encoded);
-
/****************************************************************************
* WebRtcG722_CreateDecoder(...)
*
@@ -111,7 +105,7 @@
* Return value : 0 - Ok
* -1 - Error
*/
-int16_t WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst);
+int16_t WebRtcG722_CreateDecoder(G722DecInst** G722dec_inst);
/****************************************************************************
* WebRtcG722_DecoderInit(...)
@@ -136,8 +130,7 @@
* -1 - Error
*/
-int WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst);
-
+int WebRtcG722_FreeDecoder(G722DecInst* G722dec_inst);
/****************************************************************************
* WebRtcG722_Decode(...)
@@ -159,11 +152,11 @@
* Return value : Samples in decoded vector
*/
-size_t WebRtcG722_Decode(G722DecInst *G722dec_inst,
+size_t WebRtcG722_Decode(G722DecInst* G722dec_inst,
const uint8_t* encoded,
size_t len,
- int16_t *decoded,
- int16_t *speechType);
+ int16_t* decoded,
+ int16_t* speechType);
/****************************************************************************
* WebRtcG722_Version(...)
@@ -171,12 +164,10 @@
* Get a string with the current version of the codec
*/
-int16_t WebRtcG722_Version(char *versionStr, short len);
-
+int16_t WebRtcG722_Version(char* versionStr, short len);
#ifdef __cplusplus
}
#endif
-
#endif /* MODULES_AUDIO_CODING_CODECS_G722_G722_INTERFACE_H_ */
diff --git a/modules/audio_coding/codecs/g722/test/testG722.cc b/modules/audio_coding/codecs/g722/test/testG722.cc
index e0281f2..ada56ab 100644
--- a/modules/audio_coding/codecs/g722/test/testG722.cc
+++ b/modules/audio_coding/codecs/g722/test/testG722.cc
@@ -22,137 +22,135 @@
/* Runtime statistics */
#include <time.h>
-#define CLOCKS_PER_SEC_G722 100000
+#define CLOCKS_PER_SEC_G722 100000
// Forward declaration
-typedef struct WebRtcG722EncInst G722EncInst;
-typedef struct WebRtcG722DecInst G722DecInst;
+typedef struct WebRtcG722EncInst G722EncInst;
+typedef struct WebRtcG722DecInst G722DecInst;
/* function for reading audio data from PCM file */
-bool readframe(int16_t *data, FILE *inp, size_t length)
-{
- size_t rlen = fread(data, sizeof(int16_t), length, inp);
- if (rlen >= length)
- return false;
- memset(data + rlen, 0, (length - rlen) * sizeof(int16_t));
- return true;
+bool readframe(int16_t* data, FILE* inp, size_t length) {
+ size_t rlen = fread(data, sizeof(int16_t), length, inp);
+ if (rlen >= length)
+ return false;
+ memset(data + rlen, 0, (length - rlen) * sizeof(int16_t));
+ return true;
}
-int main(int argc, char* argv[])
-{
- char inname[60], outbit[40], outname[40];
- FILE *inp, *outbitp, *outp;
+int main(int argc, char* argv[]) {
+ char inname[60], outbit[40], outname[40];
+ FILE *inp, *outbitp, *outp;
- int framecnt;
- bool endfile;
- size_t framelength = 160;
- G722EncInst *G722enc_inst;
- G722DecInst *G722dec_inst;
+ int framecnt;
+ bool endfile;
+ size_t framelength = 160;
+ G722EncInst* G722enc_inst;
+ G722DecInst* G722dec_inst;
- /* Runtime statistics */
- double starttime;
- double runtime = 0;
- double length_file;
+ /* Runtime statistics */
+ double starttime;
+ double runtime = 0;
+ double length_file;
- size_t stream_len = 0;
- int16_t shortdata[960];
- int16_t decoded[960];
- uint8_t streamdata[80 * 6];
- int16_t speechType[1];
+ size_t stream_len = 0;
+ int16_t shortdata[960];
+ int16_t decoded[960];
+ uint8_t streamdata[80 * 6];
+ int16_t speechType[1];
- /* handling wrong input arguments in the command line */
- if (argc!=5) {
- printf("\n\nWrong number of arguments or flag values.\n\n");
+ /* handling wrong input arguments in the command line */
+ if (argc != 5) {
+ printf("\n\nWrong number of arguments or flag values.\n\n");
- printf("\n");
- printf("Usage:\n\n");
- printf("./testG722.exe framelength infile outbitfile outspeechfile \n\n");
- printf("with:\n");
- printf("framelength : Framelength in samples.\n\n");
- printf("infile : Normal speech input file\n\n");
- printf("outbitfile : Bitstream output file\n\n");
- printf("outspeechfile: Speech output file\n\n");
- exit(0);
+ printf("\n");
+ printf("Usage:\n\n");
+ printf("./testG722.exe framelength infile outbitfile outspeechfile \n\n");
+ printf("with:\n");
+ printf("framelength : Framelength in samples.\n\n");
+ printf("infile : Normal speech input file\n\n");
+ printf("outbitfile : Bitstream output file\n\n");
+ printf("outspeechfile: Speech output file\n\n");
+ exit(0);
+ }
+ /* Get frame length */
+ int framelength_int = atoi(argv[1]);
+ if (framelength_int < 0) {
+ printf(" G.722: Invalid framelength %d.\n", framelength_int);
+ exit(1);
+ }
+ framelength = static_cast<size_t>(framelength_int);
+
+ /* Get Input and Output files */
+ sscanf(argv[2], "%s", inname);
+ sscanf(argv[3], "%s", outbit);
+ sscanf(argv[4], "%s", outname);
+
+ if ((inp = fopen(inname, "rb")) == NULL) {
+ printf(" G.722: Cannot read file %s.\n", inname);
+ exit(1);
+ }
+ if ((outbitp = fopen(outbit, "wb")) == NULL) {
+ printf(" G.722: Cannot write file %s.\n", outbit);
+ exit(1);
+ }
+ if ((outp = fopen(outname, "wb")) == NULL) {
+ printf(" G.722: Cannot write file %s.\n", outname);
+ exit(1);
+ }
+ printf("\nInput:%s\nOutput bitstream:%s\nOutput:%s\n", inname, outbit,
+ outname);
+
+ /* Create and init */
+ WebRtcG722_CreateEncoder((G722EncInst**)&G722enc_inst);
+ WebRtcG722_CreateDecoder((G722DecInst**)&G722dec_inst);
+ WebRtcG722_EncoderInit((G722EncInst*)G722enc_inst);
+ WebRtcG722_DecoderInit((G722DecInst*)G722dec_inst);
+
+ /* Initialize encoder and decoder */
+ framecnt = 0;
+ endfile = false;
+ while (!endfile) {
+ framecnt++;
+
+ /* Read speech block */
+ endfile = readframe(shortdata, inp, framelength);
+
+ /* Start clock before call to encoder and decoder */
+ starttime = clock() / (double)CLOCKS_PER_SEC_G722;
+
+ /* G.722 encoding + decoding */
+ stream_len = WebRtcG722_Encode((G722EncInst*)G722enc_inst, shortdata,
+ framelength, streamdata);
+ WebRtcG722_Decode(G722dec_inst, streamdata, stream_len, decoded,
+ speechType);
+
+ /* Stop clock after call to encoder and decoder */
+ runtime += (double)((clock() / (double)CLOCKS_PER_SEC_G722) - starttime);
+
+ /* Write coded bits to file */
+ if (fwrite(streamdata, sizeof(short), stream_len / 2, outbitp) !=
+ stream_len / 2) {
+ return -1;
}
-
- /* Get frame length */
- int framelength_int = atoi(argv[1]);
- if (framelength_int < 0) {
- printf(" G.722: Invalid framelength %d.\n", framelength_int);
- exit(1);
+ /* Write coded speech to file */
+ if (fwrite(decoded, sizeof(short), framelength, outp) != framelength) {
+ return -1;
}
- framelength = static_cast<size_t>(framelength_int);
+ }
- /* Get Input and Output files */
- sscanf(argv[2], "%s", inname);
- sscanf(argv[3], "%s", outbit);
- sscanf(argv[4], "%s", outname);
+ WebRtcG722_FreeEncoder((G722EncInst*)G722enc_inst);
+ WebRtcG722_FreeDecoder((G722DecInst*)G722dec_inst);
- if ((inp = fopen(inname,"rb")) == NULL) {
- printf(" G.722: Cannot read file %s.\n", inname);
- exit(1);
- }
- if ((outbitp = fopen(outbit,"wb")) == NULL) {
- printf(" G.722: Cannot write file %s.\n", outbit);
- exit(1);
- }
- if ((outp = fopen(outname,"wb")) == NULL) {
- printf(" G.722: Cannot write file %s.\n", outname);
- exit(1);
- }
- printf("\nInput:%s\nOutput bitstream:%s\nOutput:%s\n", inname, outbit, outname);
+ length_file = ((double)framecnt * (double)framelength / 16000);
+ printf("\n\nLength of speech file: %.1f s\n", length_file);
+ printf("Time to run G.722: %.2f s (%.2f %% of realtime)\n\n", runtime,
+ (100 * runtime / length_file));
+ printf("---------------------END----------------------\n");
- /* Create and init */
- WebRtcG722_CreateEncoder((G722EncInst **)&G722enc_inst);
- WebRtcG722_CreateDecoder((G722DecInst **)&G722dec_inst);
- WebRtcG722_EncoderInit((G722EncInst *)G722enc_inst);
- WebRtcG722_DecoderInit((G722DecInst *)G722dec_inst);
+ fclose(inp);
+ fclose(outbitp);
+ fclose(outp);
-
- /* Initialize encoder and decoder */
- framecnt = 0;
- endfile = false;
- while (!endfile) {
- framecnt++;
-
- /* Read speech block */
- endfile = readframe(shortdata, inp, framelength);
-
- /* Start clock before call to encoder and decoder */
- starttime = clock()/(double)CLOCKS_PER_SEC_G722;
-
- /* G.722 encoding + decoding */
- stream_len = WebRtcG722_Encode((G722EncInst *)G722enc_inst, shortdata, framelength, streamdata);
- WebRtcG722_Decode(G722dec_inst, streamdata, stream_len, decoded,
- speechType);
-
- /* Stop clock after call to encoder and decoder */
- runtime += (double)((clock()/(double)CLOCKS_PER_SEC_G722)-starttime);
-
- /* Write coded bits to file */
- if (fwrite(streamdata, sizeof(short), stream_len / 2, outbitp) !=
- stream_len / 2) {
- return -1;
- }
- /* Write coded speech to file */
- if (fwrite(decoded, sizeof(short), framelength, outp) !=
- framelength) {
- return -1;
- }
- }
-
- WebRtcG722_FreeEncoder((G722EncInst *)G722enc_inst);
- WebRtcG722_FreeDecoder((G722DecInst *)G722dec_inst);
-
- length_file = ((double)framecnt*(double)framelength/16000);
- printf("\n\nLength of speech file: %.1f s\n", length_file);
- printf("Time to run G.722: %.2f s (%.2f %% of realtime)\n\n", runtime, (100*runtime/length_file));
- printf("---------------------END----------------------\n");
-
- fclose(inp);
- fclose(outbitp);
- fclose(outp);
-
- return 0;
+ return 0;
}
diff --git a/modules/audio_coding/codecs/ilbc/abs_quant.h b/modules/audio_coding/codecs/ilbc/abs_quant.h
index 3a98a6e..331921c 100644
--- a/modules/audio_coding/codecs/ilbc/abs_quant.h
+++ b/modules/audio_coding/codecs/ilbc/abs_quant.h
@@ -27,13 +27,13 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_AbsQuant(
- IlbcEncoder *iLBCenc_inst,
+ IlbcEncoder* iLBCenc_inst,
/* (i) Encoder instance */
- iLBC_bits *iLBC_encbits, /* (i/o) Encoded bits (outputs idxForMax
+ iLBC_bits* iLBC_encbits, /* (i/o) Encoded bits (outputs idxForMax
and idxVec, uses state_first as
input) */
- int16_t *in, /* (i) vector to encode */
- int16_t *weightDenum /* (i) denominator of synthesis filter */
- );
+ int16_t* in, /* (i) vector to encode */
+ int16_t* weightDenum /* (i) denominator of synthesis filter */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/abs_quant_loop.h b/modules/audio_coding/codecs/ilbc/abs_quant_loop.h
index 5116bfd..a193a07 100644
--- a/modules/audio_coding/codecs/ilbc/abs_quant_loop.h
+++ b/modules/audio_coding/codecs/ilbc/abs_quant_loop.h
@@ -26,8 +26,10 @@
* (subrutine for WebRtcIlbcfix_StateSearch)
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_AbsQuantLoop(int16_t *syntOutIN, int16_t *in_weightedIN,
- int16_t *weightDenumIN, size_t *quantLenIN,
- int16_t *idxVecIN);
+void WebRtcIlbcfix_AbsQuantLoop(int16_t* syntOutIN,
+ int16_t* in_weightedIN,
+ int16_t* weightDenumIN,
+ size_t* quantLenIN,
+ int16_t* idxVecIN);
#endif
diff --git a/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.cc b/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.cc
index 08d21f4..9e58ce0 100644
--- a/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.cc
+++ b/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.cc
@@ -33,10 +33,10 @@
}
int AudioDecoderIlbcImpl::DecodeInternal(const uint8_t* encoded,
- size_t encoded_len,
- int sample_rate_hz,
- int16_t* decoded,
- SpeechType* speech_type) {
+ size_t encoded_len,
+ int sample_rate_hz,
+ int16_t* decoded,
+ SpeechType* speech_type) {
RTC_DCHECK_EQ(sample_rate_hz, 8000);
int16_t temp_type = 1; // Default is speech.
int ret = WebRtcIlbcfix_Decode(dec_state_, encoded, encoded_len, decoded,
@@ -86,10 +86,9 @@
} else {
size_t byte_offset;
uint32_t timestamp_offset;
- for (byte_offset = 0, timestamp_offset = 0;
- byte_offset < payload.size();
+ for (byte_offset = 0, timestamp_offset = 0; byte_offset < payload.size();
byte_offset += bytes_per_frame,
- timestamp_offset += timestamps_per_frame) {
+ timestamp_offset += timestamps_per_frame) {
std::unique_ptr<EncodedAudioFrame> frame(new LegacyEncodedAudioFrame(
this, rtc::Buffer(payload.data() + byte_offset, bytes_per_frame)));
results.emplace_back(timestamp + timestamp_offset, 0, std::move(frame));
diff --git a/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc b/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc
index 6ddc078..84695e3 100644
--- a/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc
+++ b/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc
@@ -89,7 +89,6 @@
uint32_t rtp_timestamp,
rtc::ArrayView<const int16_t> audio,
rtc::Buffer* encoded) {
-
// Save timestamp if starting a new packet.
if (num_10ms_frames_buffered_ == 0)
first_timestamp_in_buffer_ = rtp_timestamp;
@@ -107,19 +106,15 @@
// Encode buffered input.
RTC_DCHECK_EQ(num_10ms_frames_buffered_, num_10ms_frames_per_packet_);
num_10ms_frames_buffered_ = 0;
- size_t encoded_bytes =
- encoded->AppendData(
- RequiredOutputSizeBytes(),
- [&] (rtc::ArrayView<uint8_t> encoded) {
- const int r = WebRtcIlbcfix_Encode(
- encoder_,
- input_buffer_,
- kSampleRateHz / 100 * num_10ms_frames_per_packet_,
- encoded.data());
- RTC_CHECK_GE(r, 0);
+ size_t encoded_bytes = encoded->AppendData(
+ RequiredOutputSizeBytes(), [&](rtc::ArrayView<uint8_t> encoded) {
+ const int r = WebRtcIlbcfix_Encode(
+ encoder_, input_buffer_,
+ kSampleRateHz / 100 * num_10ms_frames_per_packet_, encoded.data());
+ RTC_CHECK_GE(r, 0);
- return static_cast<size_t>(r);
- });
+ return static_cast<size_t>(r);
+ });
RTC_DCHECK_EQ(encoded_bytes, RequiredOutputSizeBytes());
@@ -135,20 +130,24 @@
if (encoder_)
RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderFree(encoder_));
RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderCreate(&encoder_));
- const int encoder_frame_size_ms = frame_size_ms_ > 30
- ? frame_size_ms_ / 2
- : frame_size_ms_;
+ const int encoder_frame_size_ms =
+ frame_size_ms_ > 30 ? frame_size_ms_ / 2 : frame_size_ms_;
RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderInit(encoder_, encoder_frame_size_ms));
num_10ms_frames_buffered_ = 0;
}
size_t AudioEncoderIlbcImpl::RequiredOutputSizeBytes() const {
switch (num_10ms_frames_per_packet_) {
- case 2: return 38;
- case 3: return 50;
- case 4: return 2 * 38;
- case 6: return 2 * 50;
- default: FATAL();
+ case 2:
+ return 38;
+ case 3:
+ return 50;
+ case 4:
+ return 2 * 38;
+ case 6:
+ return 2 * 50;
+ default:
+ FATAL();
}
}
diff --git a/modules/audio_coding/codecs/ilbc/augmented_cb_corr.h b/modules/audio_coding/codecs/ilbc/augmented_cb_corr.h
index 581f0d6..646e564 100644
--- a/modules/audio_coding/codecs/ilbc/augmented_cb_corr.h
+++ b/modules/audio_coding/codecs/ilbc/augmented_cb_corr.h
@@ -26,16 +26,16 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_AugmentedCbCorr(
- int16_t *target, /* (i) Target vector */
- int16_t *buffer, /* (i) Memory buffer */
- int16_t *interpSamples, /* (i) buffer with
+ int16_t* target, /* (i) Target vector */
+ int16_t* buffer, /* (i) Memory buffer */
+ int16_t* interpSamples, /* (i) buffer with
interpolated samples */
- int32_t *crossDot, /* (o) The cross correlation between
- the target and the Augmented
- vector */
- size_t low, /* (i) Lag to start from (typically
- 20) */
- size_t high, /* (i) Lag to end at (typically 39 */
- int scale); /* (i) Scale factor to use for the crossDot */
+ int32_t* crossDot, /* (o) The cross correlation between
+ the target and the Augmented
+ vector */
+ size_t low, /* (i) Lag to start from (typically
+ 20) */
+ size_t high, /* (i) Lag to end at (typically 39 */
+ int scale); /* (i) Scale factor to use for the crossDot */
#endif
diff --git a/modules/audio_coding/codecs/ilbc/bw_expand.h b/modules/audio_coding/codecs/ilbc/bw_expand.h
index ee9e45a..d25325c 100644
--- a/modules/audio_coding/codecs/ilbc/bw_expand.h
+++ b/modules/audio_coding/codecs/ilbc/bw_expand.h
@@ -26,11 +26,11 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_BwExpand(
- int16_t *out, /* (o) the bandwidth expanded lpc coefficients */
- int16_t *in, /* (i) the lpc coefficients before bandwidth
- expansion */
- int16_t *coef, /* (i) the bandwidth expansion factor Q15 */
+ int16_t* out, /* (o) the bandwidth expanded lpc coefficients */
+ int16_t* in, /* (i) the lpc coefficients before bandwidth
+ expansion */
+ int16_t* coef, /* (i) the bandwidth expansion factor Q15 */
int16_t length /* (i) the length of lpc coefficient vectors */
- );
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/cb_mem_energy.h b/modules/audio_coding/codecs/ilbc/cb_mem_energy.h
index e8e2fe9..894f5d0 100644
--- a/modules/audio_coding/codecs/ilbc/cb_mem_energy.h
+++ b/modules/audio_coding/codecs/ilbc/cb_mem_energy.h
@@ -21,14 +21,14 @@
void WebRtcIlbcfix_CbMemEnergy(
size_t range,
- int16_t *CB, /* (i) The CB memory (1:st section) */
- int16_t *filteredCB, /* (i) The filtered CB memory (2:nd section) */
- size_t lMem, /* (i) Length of the CB memory */
- size_t lTarget, /* (i) Length of the target vector */
- int16_t *energyW16, /* (o) Energy in the CB vectors */
- int16_t *energyShifts, /* (o) Shift value of the energy */
- int scale, /* (i) The scaling of all energy values */
- size_t base_size /* (i) Index to where energy values should be stored */
- );
+ int16_t* CB, /* (i) The CB memory (1:st section) */
+ int16_t* filteredCB, /* (i) The filtered CB memory (2:nd section) */
+ size_t lMem, /* (i) Length of the CB memory */
+ size_t lTarget, /* (i) Length of the target vector */
+ int16_t* energyW16, /* (o) Energy in the CB vectors */
+ int16_t* energyShifts, /* (o) Shift value of the energy */
+ int scale, /* (i) The scaling of all energy values */
+ size_t base_size /* (i) Index to where energy values should be stored */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.h b/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.h
index 00eb017..b7b972f 100644
--- a/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.h
+++ b/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.h
@@ -20,12 +20,12 @@
#define MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_CB_MEM_ENERGY_AUGMENTATION_H_
void WebRtcIlbcfix_CbMemEnergyAugmentation(
- int16_t *interpSamples, /* (i) The interpolated samples */
- int16_t *CBmem, /* (i) The CB memory */
- int scale, /* (i) The scaling of all energy values */
- size_t base_size, /* (i) Index to where energy values should be stored */
- int16_t *energyW16, /* (o) Energy in the CB vectors */
- int16_t *energyShifts /* (o) Shift value of the energy */
- );
+ int16_t* interpSamples, /* (i) The interpolated samples */
+ int16_t* CBmem, /* (i) The CB memory */
+ int scale, /* (i) The scaling of all energy values */
+ size_t base_size, /* (i) Index to where energy values should be stored */
+ int16_t* energyW16, /* (o) Energy in the CB vectors */
+ int16_t* energyShifts /* (o) Shift value of the energy */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.h b/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.h
index af8e658..5511ef1 100644
--- a/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.h
+++ b/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.h
@@ -20,14 +20,14 @@
#define MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_CB_MEM_ENERGY_CALC_H_
void WebRtcIlbcfix_CbMemEnergyCalc(
- int32_t energy, /* (i) input start energy */
- size_t range, /* (i) number of iterations */
- int16_t *ppi, /* (i) input pointer 1 */
- int16_t *ppo, /* (i) input pointer 2 */
- int16_t *energyW16, /* (o) Energy in the CB vectors */
- int16_t *energyShifts, /* (o) Shift value of the energy */
- int scale, /* (i) The scaling of all energy values */
- size_t base_size /* (i) Index to where energy values should be stored */
- );
+ int32_t energy, /* (i) input start energy */
+ size_t range, /* (i) number of iterations */
+ int16_t* ppi, /* (i) input pointer 1 */
+ int16_t* ppo, /* (i) input pointer 2 */
+ int16_t* energyW16, /* (o) Energy in the CB vectors */
+ int16_t* energyShifts, /* (o) Shift value of the energy */
+ int scale, /* (i) The scaling of all energy values */
+ size_t base_size /* (i) Index to where energy values should be stored */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/cb_search.h b/modules/audio_coding/codecs/ilbc/cb_search.h
index c8626c5..393a2de 100644
--- a/modules/audio_coding/codecs/ilbc/cb_search.h
+++ b/modules/audio_coding/codecs/ilbc/cb_search.h
@@ -20,16 +20,16 @@
#define MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_CB_SEARCH_H_
void WebRtcIlbcfix_CbSearch(
- IlbcEncoder *iLBCenc_inst,
+ IlbcEncoder* iLBCenc_inst,
/* (i) the encoder state structure */
- int16_t *index, /* (o) Codebook indices */
- int16_t *gain_index, /* (o) Gain quantization indices */
- int16_t *intarget, /* (i) Target vector for encoding */
- int16_t *decResidual,/* (i) Decoded residual for codebook construction */
- size_t lMem, /* (i) Length of buffer */
- size_t lTarget, /* (i) Length of vector */
- int16_t *weightDenum,/* (i) weighting filter coefficients in Q12 */
- size_t block /* (i) the subblock number */
- );
+ int16_t* index, /* (o) Codebook indices */
+ int16_t* gain_index, /* (o) Gain quantization indices */
+ int16_t* intarget, /* (i) Target vector for encoding */
+ int16_t* decResidual, /* (i) Decoded residual for codebook construction */
+ size_t lMem, /* (i) Length of buffer */
+ size_t lTarget, /* (i) Length of vector */
+ int16_t* weightDenum, /* (i) weighting filter coefficients in Q12 */
+ size_t block /* (i) the subblock number */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/cb_search_core.h b/modules/audio_coding/codecs/ilbc/cb_search_core.h
index 3210668..af5a1db 100644
--- a/modules/audio_coding/codecs/ilbc/cb_search_core.h
+++ b/modules/audio_coding/codecs/ilbc/cb_search_core.h
@@ -22,19 +22,19 @@
#include "modules/audio_coding/codecs/ilbc/defines.h"
void WebRtcIlbcfix_CbSearchCore(
- int32_t *cDot, /* (i) Cross Correlation */
- size_t range, /* (i) Search range */
- int16_t stage, /* (i) Stage of this search */
- int16_t *inverseEnergy, /* (i) Inversed energy */
- int16_t *inverseEnergyShift, /* (i) Shifts of inversed energy
+ int32_t* cDot, /* (i) Cross Correlation */
+ size_t range, /* (i) Search range */
+ int16_t stage, /* (i) Stage of this search */
+ int16_t* inverseEnergy, /* (i) Inversed energy */
+ int16_t* inverseEnergyShift, /* (i) Shifts of inversed energy
with the offset 2*16-29 */
- int32_t *Crit, /* (o) The criteria */
- size_t *bestIndex, /* (o) Index that corresponds to
- maximum criteria (in this
- vector) */
- int32_t *bestCrit, /* (o) Value of critera for the
- chosen index */
- int16_t *bestCritSh); /* (o) The domain of the chosen
- criteria */
+ int32_t* Crit, /* (o) The criteria */
+ size_t* bestIndex, /* (o) Index that corresponds to
+ maximum criteria (in this
+ vector) */
+ int32_t* bestCrit, /* (o) Value of critera for the
+ chosen index */
+ int16_t* bestCritSh); /* (o) The domain of the chosen
+ criteria */
#endif
diff --git a/modules/audio_coding/codecs/ilbc/cb_update_best_index.h b/modules/audio_coding/codecs/ilbc/cb_update_best_index.h
index a4a4cde..3f57d48 100644
--- a/modules/audio_coding/codecs/ilbc/cb_update_best_index.h
+++ b/modules/audio_coding/codecs/ilbc/cb_update_best_index.h
@@ -22,17 +22,17 @@
#include "modules/audio_coding/codecs/ilbc/defines.h"
void WebRtcIlbcfix_CbUpdateBestIndex(
- int32_t CritNew, /* (i) New Potentially best Criteria */
- int16_t CritNewSh, /* (i) Shift value of above Criteria */
- size_t IndexNew, /* (i) Index of new Criteria */
- int32_t cDotNew, /* (i) Cross dot of new index */
- int16_t invEnergyNew, /* (i) Inversed energy new index */
- int16_t energyShiftNew, /* (i) Energy shifts of new index */
- int32_t *CritMax, /* (i/o) Maximum Criteria (so far) */
- int16_t *shTotMax, /* (i/o) Shifts of maximum criteria */
- size_t *bestIndex, /* (i/o) Index that corresponds to
- maximum criteria */
- int16_t *bestGain); /* (i/o) Gain in Q14 that corresponds
- to maximum criteria */
+ int32_t CritNew, /* (i) New Potentially best Criteria */
+ int16_t CritNewSh, /* (i) Shift value of above Criteria */
+ size_t IndexNew, /* (i) Index of new Criteria */
+ int32_t cDotNew, /* (i) Cross dot of new index */
+ int16_t invEnergyNew, /* (i) Inversed energy new index */
+ int16_t energyShiftNew, /* (i) Energy shifts of new index */
+ int32_t* CritMax, /* (i/o) Maximum Criteria (so far) */
+ int16_t* shTotMax, /* (i/o) Shifts of maximum criteria */
+ size_t* bestIndex, /* (i/o) Index that corresponds to
+ maximum criteria */
+ int16_t* bestGain); /* (i/o) Gain in Q14 that corresponds
+ to maximum criteria */
#endif
diff --git a/modules/audio_coding/codecs/ilbc/chebyshev.h b/modules/audio_coding/codecs/ilbc/chebyshev.h
index 46eef6b..64b2f49 100644
--- a/modules/audio_coding/codecs/ilbc/chebyshev.h
+++ b/modules/audio_coding/codecs/ilbc/chebyshev.h
@@ -30,8 +30,8 @@
int16_t WebRtcIlbcfix_Chebyshev(
/* (o) Result of C(x) */
- int16_t x, /* (i) Value to the Chevyshev polynomial */
- int16_t *f /* (i) The coefficients in the polynomial */
- );
+ int16_t x, /* (i) Value to the Chevyshev polynomial */
+ int16_t* f /* (i) The coefficients in the polynomial */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/comp_corr.h b/modules/audio_coding/codecs/ilbc/comp_corr.h
index f54dca2..1e6b296 100644
--- a/modules/audio_coding/codecs/ilbc/comp_corr.h
+++ b/modules/audio_coding/codecs/ilbc/comp_corr.h
@@ -26,14 +26,13 @@
* of last subframe at given lag.
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_CompCorr(
- int32_t *corr, /* (o) cross correlation */
- int32_t *ener, /* (o) energy */
- int16_t *buffer, /* (i) signal buffer */
- size_t lag, /* (i) pitch lag */
- size_t bLen, /* (i) length of buffer */
- size_t sRange, /* (i) correlation search length */
- int16_t scale /* (i) number of rightshifts to use */
+void WebRtcIlbcfix_CompCorr(int32_t* corr, /* (o) cross correlation */
+ int32_t* ener, /* (o) energy */
+ int16_t* buffer, /* (i) signal buffer */
+ size_t lag, /* (i) pitch lag */
+ size_t bLen, /* (i) length of buffer */
+ size_t sRange, /* (i) correlation search length */
+ int16_t scale /* (i) number of rightshifts to use */
);
#endif
diff --git a/modules/audio_coding/codecs/ilbc/constants.h b/modules/audio_coding/codecs/ilbc/constants.h
index 6864f16..3c32c62 100644
--- a/modules/audio_coding/codecs/ilbc/constants.h
+++ b/modules/audio_coding/codecs/ilbc/constants.h
@@ -79,7 +79,8 @@
/* enhancer definitions */
-extern const int16_t WebRtcIlbcfix_kEnhPolyPhaser[ENH_UPS0][ENH_FLO_MULT2_PLUS1];
+extern const int16_t WebRtcIlbcfix_kEnhPolyPhaser[ENH_UPS0]
+ [ENH_FLO_MULT2_PLUS1];
extern const int16_t WebRtcIlbcfix_kEnhWt[];
extern const size_t WebRtcIlbcfix_kEnhPlocs[];
diff --git a/modules/audio_coding/codecs/ilbc/create_augmented_vec.h b/modules/audio_coding/codecs/ilbc/create_augmented_vec.h
index ca8b371..28c9400 100644
--- a/modules/audio_coding/codecs/ilbc/create_augmented_vec.h
+++ b/modules/audio_coding/codecs/ilbc/create_augmented_vec.h
@@ -27,8 +27,8 @@
*----------------------------------------------------------------*/
void WebRtcIlbcfix_CreateAugmentedVec(
- size_t index, /* (i) Index for the augmented vector to be
- created */
+ size_t index, /* (i) Index for the augmented vector to be
+ created */
const int16_t* buffer, /* (i) Pointer to the end of the codebook memory
that is used for creation of the augmented
codebook */
diff --git a/modules/audio_coding/codecs/ilbc/decode.h b/modules/audio_coding/codecs/ilbc/decode.h
index ecc968e..c5f35f4 100644
--- a/modules/audio_coding/codecs/ilbc/decode.h
+++ b/modules/audio_coding/codecs/ilbc/decode.h
@@ -31,8 +31,8 @@
const uint16_t* bytes, /* (i) encoded signal bits */
IlbcDecoder* iLBCdec_inst, /* (i/o) the decoder state
structure */
- int16_t mode /* (i) 0: bad packet, PLC,
- 1: normal */
+ int16_t mode /* (i) 0: bad packet, PLC,
+ 1: normal */
) RTC_WARN_UNUSED_RESULT;
#endif
diff --git a/modules/audio_coding/codecs/ilbc/decoder_interpolate_lsf.h b/modules/audio_coding/codecs/ilbc/decoder_interpolate_lsf.h
index 416fc36..48d43ec 100644
--- a/modules/audio_coding/codecs/ilbc/decoder_interpolate_lsf.h
+++ b/modules/audio_coding/codecs/ilbc/decoder_interpolate_lsf.h
@@ -26,13 +26,13 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_DecoderInterpolateLsp(
- int16_t *syntdenum, /* (o) synthesis filter coefficients */
- int16_t *weightdenum, /* (o) weighting denumerator
+ int16_t* syntdenum, /* (o) synthesis filter coefficients */
+ int16_t* weightdenum, /* (o) weighting denumerator
coefficients */
- int16_t *lsfdeq, /* (i) dequantized lsf coefficients */
- int16_t length, /* (i) length of lsf coefficient vector */
- IlbcDecoder *iLBCdec_inst
+ int16_t* lsfdeq, /* (i) dequantized lsf coefficients */
+ int16_t length, /* (i) length of lsf coefficient vector */
+ IlbcDecoder* iLBCdec_inst
/* (i) the decoder state structure */
- );
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/defines.h b/modules/audio_coding/codecs/ilbc/defines.h
index 6100801..9a4a196 100644
--- a/modules/audio_coding/codecs/ilbc/defines.h
+++ b/modules/audio_coding/codecs/ilbc/defines.h
@@ -25,103 +25,109 @@
/* general codec settings */
-#define FS 8000
-#define BLOCKL_20MS 160
-#define BLOCKL_30MS 240
-#define BLOCKL_MAX 240
-#define NSUB_20MS 4
-#define NSUB_30MS 6
-#define NSUB_MAX 6
-#define NASUB_20MS 2
-#define NASUB_30MS 4
-#define NASUB_MAX 4
-#define SUBL 40
-#define STATE_LEN 80
-#define STATE_SHORT_LEN_30MS 58
-#define STATE_SHORT_LEN_20MS 57
+#define FS 8000
+#define BLOCKL_20MS 160
+#define BLOCKL_30MS 240
+#define BLOCKL_MAX 240
+#define NSUB_20MS 4
+#define NSUB_30MS 6
+#define NSUB_MAX 6
+#define NASUB_20MS 2
+#define NASUB_30MS 4
+#define NASUB_MAX 4
+#define SUBL 40
+#define STATE_LEN 80
+#define STATE_SHORT_LEN_30MS 58
+#define STATE_SHORT_LEN_20MS 57
/* LPC settings */
-#define LPC_FILTERORDER 10
-#define LPC_LOOKBACK 60
-#define LPC_N_20MS 1
-#define LPC_N_30MS 2
-#define LPC_N_MAX 2
-#define LPC_ASYMDIFF 20
-#define LSF_NSPLIT 3
-#define LSF_NUMBER_OF_STEPS 4
-#define LPC_HALFORDER 5
+#define LPC_FILTERORDER 10
+#define LPC_LOOKBACK 60
+#define LPC_N_20MS 1
+#define LPC_N_30MS 2
+#define LPC_N_MAX 2
+#define LPC_ASYMDIFF 20
+#define LSF_NSPLIT 3
+#define LSF_NUMBER_OF_STEPS 4
+#define LPC_HALFORDER 5
#define COS_GRID_POINTS 60
/* cb settings */
-#define CB_NSTAGES 3
-#define CB_EXPAND 2
-#define CB_MEML 147
-#define CB_FILTERLEN (2*4)
-#define CB_HALFFILTERLEN 4
-#define CB_RESRANGE 34
-#define CB_MAXGAIN_FIXQ6 83 /* error = -0.24% */
-#define CB_MAXGAIN_FIXQ14 21299
+#define CB_NSTAGES 3
+#define CB_EXPAND 2
+#define CB_MEML 147
+#define CB_FILTERLEN (2 * 4)
+#define CB_HALFFILTERLEN 4
+#define CB_RESRANGE 34
+#define CB_MAXGAIN_FIXQ6 83 /* error = -0.24% */
+#define CB_MAXGAIN_FIXQ14 21299
/* enhancer */
-#define ENH_BLOCKL 80 /* block length */
-#define ENH_BLOCKL_HALF (ENH_BLOCKL/2)
-#define ENH_HL 3 /* 2*ENH_HL+1 is number blocks
- in said second sequence */
-#define ENH_SLOP 2 /* max difference estimated and
- correct pitch period */
-#define ENH_PLOCSL 8 /* pitch-estimates and
- pitch-locations buffer length */
-#define ENH_OVERHANG 2
-#define ENH_UPS0 4 /* upsampling rate */
-#define ENH_FL0 3 /* 2*FLO+1 is the length of each filter */
-#define ENH_FLO_MULT2_PLUS1 7
-#define ENH_VECTL (ENH_BLOCKL+2*ENH_FL0)
-#define ENH_CORRDIM (2*ENH_SLOP+1)
-#define ENH_NBLOCKS (BLOCKL/ENH_BLOCKL)
-#define ENH_NBLOCKS_EXTRA 5
-#define ENH_NBLOCKS_TOT 8 /* ENH_NBLOCKS+ENH_NBLOCKS_EXTRA */
-#define ENH_BUFL (ENH_NBLOCKS_TOT)*ENH_BLOCKL
-#define ENH_BUFL_FILTEROVERHEAD 3
-#define ENH_A0 819 /* Q14 */
-#define ENH_A0_MINUS_A0A0DIV4 848256041 /* Q34 */
-#define ENH_A0DIV2 26843546 /* Q30 */
+#define ENH_BLOCKL 80 /* block length */
+#define ENH_BLOCKL_HALF (ENH_BLOCKL / 2)
+#define ENH_HL \
+ 3 /* 2*ENH_HL+1 is number blocks \
+ in said second \
+ sequence */
+#define ENH_SLOP \
+ 2 /* max difference estimated and \
+ correct pitch period */
+#define ENH_PLOCSL \
+ 8 /* pitch-estimates and \
+ pitch-locations buffer \
+ length */
+#define ENH_OVERHANG 2
+#define ENH_UPS0 4 /* upsampling rate */
+#define ENH_FL0 3 /* 2*FLO+1 is the length of each filter */
+#define ENH_FLO_MULT2_PLUS1 7
+#define ENH_VECTL (ENH_BLOCKL + 2 * ENH_FL0)
+#define ENH_CORRDIM (2 * ENH_SLOP + 1)
+#define ENH_NBLOCKS (BLOCKL / ENH_BLOCKL)
+#define ENH_NBLOCKS_EXTRA 5
+#define ENH_NBLOCKS_TOT 8 /* ENH_NBLOCKS+ENH_NBLOCKS_EXTRA */
+#define ENH_BUFL (ENH_NBLOCKS_TOT) * ENH_BLOCKL
+#define ENH_BUFL_FILTEROVERHEAD 3
+#define ENH_A0 819 /* Q14 */
+#define ENH_A0_MINUS_A0A0DIV4 848256041 /* Q34 */
+#define ENH_A0DIV2 26843546 /* Q30 */
/* PLC */
/* Down sampling */
-#define FILTERORDER_DS_PLUS1 7
-#define DELAY_DS 3
-#define FACTOR_DS 2
+#define FILTERORDER_DS_PLUS1 7
+#define DELAY_DS 3
+#define FACTOR_DS 2
/* bit stream defs */
-#define NO_OF_BYTES_20MS 38
-#define NO_OF_BYTES_30MS 50
-#define NO_OF_WORDS_20MS 19
-#define NO_OF_WORDS_30MS 25
-#define STATE_BITS 3
-#define BYTE_LEN 8
-#define ULP_CLASSES 3
+#define NO_OF_BYTES_20MS 38
+#define NO_OF_BYTES_30MS 50
+#define NO_OF_WORDS_20MS 19
+#define NO_OF_WORDS_30MS 25
+#define STATE_BITS 3
+#define BYTE_LEN 8
+#define ULP_CLASSES 3
/* help parameters */
-#define TWO_PI_FIX 25736 /* Q12 */
+#define TWO_PI_FIX 25736 /* Q12 */
/* Constants for codebook search and creation */
-#define ST_MEM_L_TBL 85
-#define MEM_LF_TBL 147
-
+#define ST_MEM_L_TBL 85
+#define MEM_LF_TBL 147
/* Struct for the bits */
typedef struct iLBC_bits_t_ {
- int16_t lsf[LSF_NSPLIT*LPC_N_MAX];
- int16_t cb_index[CB_NSTAGES*(NASUB_MAX+1)]; /* First CB_NSTAGES values contains extra CB index */
- int16_t gain_index[CB_NSTAGES*(NASUB_MAX+1)]; /* First CB_NSTAGES values contains extra CB gain */
+ int16_t lsf[LSF_NSPLIT * LPC_N_MAX];
+ int16_t cb_index[CB_NSTAGES * (NASUB_MAX + 1)]; /* First CB_NSTAGES values
+ contains extra CB index */
+ int16_t gain_index[CB_NSTAGES * (NASUB_MAX + 1)]; /* First CB_NSTAGES values
+ contains extra CB gain */
size_t idxForMax;
int16_t state_first;
int16_t idxVec[STATE_SHORT_LEN_30MS];
@@ -131,7 +137,6 @@
/* type definition encoder instance */
typedef struct IlbcEncoder_ {
-
/* flag for frame size mode */
int16_t mode;
@@ -172,7 +177,6 @@
/* type definition decoder instance */
typedef struct IlbcDecoder_ {
-
/* flag for frame size mode */
int16_t mode;
@@ -199,13 +203,13 @@
int16_t prevScale, prevPLI;
size_t prevLag;
- int16_t prevLpc[LPC_FILTERORDER+1];
- int16_t prevResidual[NSUB_MAX*SUBL];
+ int16_t prevLpc[LPC_FILTERORDER + 1];
+ int16_t prevResidual[NSUB_MAX * SUBL];
int16_t seed;
/* previous synthesis filter parameters */
- int16_t old_syntdenum[(LPC_FILTERORDER + 1)*NSUB_MAX];
+ int16_t old_syntdenum[(LPC_FILTERORDER + 1) * NSUB_MAX];
/* state of output HP filter */
int16_t hpimemx[2];
@@ -213,7 +217,7 @@
/* enhancer state information */
int use_enhancer;
- int16_t enh_buf[ENH_BUFL+ENH_BUFL_FILTEROVERHEAD];
+ int16_t enh_buf[ENH_BUFL + ENH_BUFL_FILTEROVERHEAD];
size_t enh_period[ENH_NBLOCKS_TOT];
} IlbcDecoder;
diff --git a/modules/audio_coding/codecs/ilbc/do_plc.h b/modules/audio_coding/codecs/ilbc/do_plc.h
index 37af305..2fbae1d 100644
--- a/modules/audio_coding/codecs/ilbc/do_plc.h
+++ b/modules/audio_coding/codecs/ilbc/do_plc.h
@@ -27,15 +27,15 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_DoThePlc(
- int16_t *PLCresidual, /* (o) concealed residual */
- int16_t *PLClpc, /* (o) concealed LP parameters */
- int16_t PLI, /* (i) packet loss indicator
- 0 - no PL, 1 = PL */
- int16_t *decresidual, /* (i) decoded residual */
- int16_t *lpc, /* (i) decoded LPC (only used for no PL) */
- size_t inlag, /* (i) pitch lag */
- IlbcDecoder *iLBCdec_inst
+ int16_t* PLCresidual, /* (o) concealed residual */
+ int16_t* PLClpc, /* (o) concealed LP parameters */
+ int16_t PLI, /* (i) packet loss indicator
+ 0 - no PL, 1 = PL */
+ int16_t* decresidual, /* (i) decoded residual */
+ int16_t* lpc, /* (i) decoded LPC (only used for no PL) */
+ size_t inlag, /* (i) pitch lag */
+ IlbcDecoder* iLBCdec_inst
/* (i/o) decoder instance */
- );
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/encode.h b/modules/audio_coding/codecs/ilbc/encode.h
index 8a3928c..db00e2c 100644
--- a/modules/audio_coding/codecs/ilbc/encode.h
+++ b/modules/audio_coding/codecs/ilbc/encode.h
@@ -26,10 +26,10 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_EncodeImpl(
- uint16_t *bytes, /* (o) encoded data bits iLBC */
- const int16_t *block, /* (i) speech vector to encode */
- IlbcEncoder *iLBCenc_inst /* (i/o) the general encoder
+ uint16_t* bytes, /* (o) encoded data bits iLBC */
+ const int16_t* block, /* (i) speech vector to encode */
+ IlbcEncoder* iLBCenc_inst /* (i/o) the general encoder
state */
- );
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/energy_inverse.h b/modules/audio_coding/codecs/ilbc/energy_inverse.h
index 0404f7d..359a9e2 100644
--- a/modules/audio_coding/codecs/ilbc/energy_inverse.h
+++ b/modules/audio_coding/codecs/ilbc/energy_inverse.h
@@ -24,9 +24,10 @@
/* Inverses the in vector in into Q29 domain */
void WebRtcIlbcfix_EnergyInverse(
- int16_t *energy, /* (i/o) Energy and inverse
- energy (in Q29) */
- size_t noOfEnergies); /* (i) The length of the energy
- vector */
+ int16_t*
+ energy, /* (i/o) Energy and inverse
+ energy (in Q29) */
+ size_t noOfEnergies); /* (i) The length of the energy
+ vector */
#endif
diff --git a/modules/audio_coding/codecs/ilbc/enh_upsample.h b/modules/audio_coding/codecs/ilbc/enh_upsample.h
index e9a68f4..b427eca 100644
--- a/modules/audio_coding/codecs/ilbc/enh_upsample.h
+++ b/modules/audio_coding/codecs/ilbc/enh_upsample.h
@@ -26,8 +26,8 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_EnhUpsample(
- int32_t *useq1, /* (o) upsampled output sequence */
- int16_t *seq1 /* (i) unupsampled sequence */
- );
+ int32_t* useq1, /* (o) upsampled output sequence */
+ int16_t* seq1 /* (i) unupsampled sequence */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/enhancer.h b/modules/audio_coding/codecs/ilbc/enhancer.h
index 7e20eb1..1a6131b 100644
--- a/modules/audio_coding/codecs/ilbc/enhancer.h
+++ b/modules/audio_coding/codecs/ilbc/enhancer.h
@@ -27,13 +27,13 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Enhancer(
- int16_t *odata, /* (o) smoothed block, dimension blockl */
- int16_t *idata, /* (i) data buffer used for enhancing */
- size_t idatal, /* (i) dimension idata */
+ int16_t* odata, /* (o) smoothed block, dimension blockl */
+ int16_t* idata, /* (i) data buffer used for enhancing */
+ size_t idatal, /* (i) dimension idata */
size_t centerStartPos, /* (i) first sample current block within idata */
- size_t *period, /* (i) pitch period array (pitch bward-in time) */
- const size_t *plocs, /* (i) locations where period array values valid */
- size_t periodl /* (i) dimension of period and plocs */
- );
+ size_t* period, /* (i) pitch period array (pitch bward-in time) */
+ const size_t* plocs, /* (i) locations where period array values valid */
+ size_t periodl /* (i) dimension of period and plocs */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/enhancer_interface.h b/modules/audio_coding/codecs/ilbc/enhancer_interface.h
index e305161..de45715 100644
--- a/modules/audio_coding/codecs/ilbc/enhancer_interface.h
+++ b/modules/audio_coding/codecs/ilbc/enhancer_interface.h
@@ -26,9 +26,8 @@
*---------------------------------------------------------------*/
size_t // (o) Estimated lag in end of in[]
- WebRtcIlbcfix_EnhancerInterface(
- int16_t* out, // (o) enhanced signal
- const int16_t* in, // (i) unenhanced signal
- IlbcDecoder* iLBCdec_inst); // (i) buffers etc
+WebRtcIlbcfix_EnhancerInterface(int16_t* out, // (o) enhanced signal
+ const int16_t* in, // (i) unenhanced signal
+ IlbcDecoder* iLBCdec_inst); // (i) buffers etc
#endif
diff --git a/modules/audio_coding/codecs/ilbc/filtered_cb_vecs.h b/modules/audio_coding/codecs/ilbc/filtered_cb_vecs.h
index f57e9c4..c51ac39 100644
--- a/modules/audio_coding/codecs/ilbc/filtered_cb_vecs.h
+++ b/modules/audio_coding/codecs/ilbc/filtered_cb_vecs.h
@@ -28,11 +28,11 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_FilteredCbVecs(
- int16_t *cbvectors, /* (o) Codebook vector for the higher section */
- int16_t *CBmem, /* (i) Codebook memory that is filtered to create a
- second CB section */
- size_t lMem, /* (i) Length of codebook memory */
- size_t samples /* (i) Number of samples to filter */
- );
+ int16_t* cbvectors, /* (o) Codebook vector for the higher section */
+ int16_t* CBmem, /* (i) Codebook memory that is filtered to create a
+ second CB section */
+ size_t lMem, /* (i) Length of codebook memory */
+ size_t samples /* (i) Number of samples to filter */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/frame_classify.h b/modules/audio_coding/codecs/ilbc/frame_classify.h
index 60b3249..43c6e57 100644
--- a/modules/audio_coding/codecs/ilbc/frame_classify.h
+++ b/modules/audio_coding/codecs/ilbc/frame_classify.h
@@ -21,9 +21,9 @@
size_t WebRtcIlbcfix_FrameClassify(
/* (o) Index to the max-energy sub frame */
- IlbcEncoder *iLBCenc_inst,
+ IlbcEncoder* iLBCenc_inst,
/* (i/o) the encoder state structure */
- int16_t *residualFIX /* (i) lpc residual signal */
- );
+ int16_t* residualFIX /* (i) lpc residual signal */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/gain_dequant.h b/modules/audio_coding/codecs/ilbc/gain_dequant.h
index 6989372..86cc787 100644
--- a/modules/audio_coding/codecs/ilbc/gain_dequant.h
+++ b/modules/audio_coding/codecs/ilbc/gain_dequant.h
@@ -30,7 +30,7 @@
/* (o) quantized gain value (Q14) */
int16_t index, /* (i) quantization index */
int16_t maxIn, /* (i) maximum of unquantized gain (Q14) */
- int16_t stage /* (i) The stage of the search */
- );
+ int16_t stage /* (i) The stage of the search */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/gain_quant.h b/modules/audio_coding/codecs/ilbc/gain_quant.h
index bc5a936..51c0bc9 100644
--- a/modules/audio_coding/codecs/ilbc/gain_quant.h
+++ b/modules/audio_coding/codecs/ilbc/gain_quant.h
@@ -25,11 +25,12 @@
* quantizer for the gain in the gain-shape coding of residual
*---------------------------------------------------------------*/
-int16_t WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */
- int16_t gain, /* (i) gain value Q14 */
- int16_t maxIn, /* (i) maximum of gain value Q14 */
- int16_t stage, /* (i) The stage of the search */
- int16_t *index /* (o) quantization index */
- );
+int16_t
+WebRtcIlbcfix_GainQuant( /* (o) quantized gain value */
+ int16_t gain, /* (i) gain value Q14 */
+ int16_t maxIn, /* (i) maximum of gain value Q14 */
+ int16_t stage, /* (i) The stage of the search */
+ int16_t* index /* (o) quantization index */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/get_lsp_poly.h b/modules/audio_coding/codecs/ilbc/get_lsp_poly.h
index 1351b8b..d469409 100644
--- a/modules/audio_coding/codecs/ilbc/get_lsp_poly.h
+++ b/modules/audio_coding/codecs/ilbc/get_lsp_poly.h
@@ -40,8 +40,7 @@
* }
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_GetLspPoly(
- int16_t *lsp, /* (i) LSP in Q15 */
- int32_t *f); /* (o) polonymial in Q24 */
+void WebRtcIlbcfix_GetLspPoly(int16_t* lsp, /* (i) LSP in Q15 */
+ int32_t* f); /* (o) polonymial in Q24 */
#endif
diff --git a/modules/audio_coding/codecs/ilbc/get_sync_seq.h b/modules/audio_coding/codecs/ilbc/get_sync_seq.h
index 5c72956..2281b06 100644
--- a/modules/audio_coding/codecs/ilbc/get_sync_seq.h
+++ b/modules/audio_coding/codecs/ilbc/get_sync_seq.h
@@ -26,15 +26,15 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_GetSyncSeq(
- int16_t *idata, /* (i) original data */
- size_t idatal, /* (i) dimension of data */
+ int16_t* idata, /* (i) original data */
+ size_t idatal, /* (i) dimension of data */
size_t centerStartPos, /* (i) where current block starts */
- size_t *period, /* (i) rough-pitch-period array (Q-2) */
- const size_t *plocs, /* (i) where periods of period array are taken (Q-2) */
- size_t periodl, /* (i) dimension period array */
- size_t hl, /* (i) 2*hl+1 is the number of sequences */
- int16_t *surround /* (i/o) The contribution from this sequence
- summed with earlier contributions */
- );
+ size_t* period, /* (i) rough-pitch-period array (Q-2) */
+ const size_t* plocs, /* (i) where periods of period array are taken (Q-2) */
+ size_t periodl, /* (i) dimension period array */
+ size_t hl, /* (i) 2*hl+1 is the number of sequences */
+ int16_t* surround /* (i/o) The contribution from this sequence
+ summed with earlier contributions */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/hp_input.h b/modules/audio_coding/codecs/ilbc/hp_input.h
index f354dd9..ac0d26b 100644
--- a/modules/audio_coding/codecs/ilbc/hp_input.h
+++ b/modules/audio_coding/codecs/ilbc/hp_input.h
@@ -22,13 +22,13 @@
#include "modules/audio_coding/codecs/ilbc/defines.h"
void WebRtcIlbcfix_HpInput(
- int16_t *signal, /* (i/o) signal vector */
- int16_t *ba, /* (i) B- and A-coefficients (2:nd order)
- {b[0] b[1] b[2] -a[1] -a[2]} a[0]
- is assumed to be 1.0 */
- int16_t *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
- yhi[n-2] ylow[n-2] */
- int16_t *x, /* (i/o) Filter state x[n-1] x[n-2] */
+ int16_t* signal, /* (i/o) signal vector */
+ int16_t* ba, /* (i) B- and A-coefficients (2:nd order)
+ {b[0] b[1] b[2] -a[1] -a[2]}
+ a[0] is assumed to be 1.0 */
+ int16_t* y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
+ yhi[n-2] ylow[n-2] */
+ int16_t* x, /* (i/o) Filter state x[n-1] x[n-2] */
size_t len); /* (i) Number of samples to filter */
#endif
diff --git a/modules/audio_coding/codecs/ilbc/hp_output.h b/modules/audio_coding/codecs/ilbc/hp_output.h
index a060a9d..88ecdb5 100644
--- a/modules/audio_coding/codecs/ilbc/hp_output.h
+++ b/modules/audio_coding/codecs/ilbc/hp_output.h
@@ -22,13 +22,13 @@
#include "modules/audio_coding/codecs/ilbc/defines.h"
void WebRtcIlbcfix_HpOutput(
- int16_t *signal, /* (i/o) signal vector */
- int16_t *ba, /* (i) B- and A-coefficients (2:nd order)
- {b[0] b[1] b[2] -a[1] -a[2]} a[0]
- is assumed to be 1.0 */
- int16_t *y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
+ int16_t* signal, /* (i/o) signal vector */
+ int16_t* ba, /* (i) B- and A-coefficients (2:nd order)
+ {b[0] b[1] b[2] -a[1] -a[2]} a[0]
+ is assumed to be 1.0 */
+ int16_t* y, /* (i/o) Filter state yhi[n-1] ylow[n-1]
yhi[n-2] ylow[n-2] */
- int16_t *x, /* (i/o) Filter state x[n-1] x[n-2] */
- size_t len); /* (i) Number of samples to filter */
+ int16_t* x, /* (i/o) Filter state x[n-1] x[n-2] */
+ size_t len); /* (i) Number of samples to filter */
#endif
diff --git a/modules/audio_coding/codecs/ilbc/ilbc.h b/modules/audio_coding/codecs/ilbc/ilbc.h
index 7836489..4c12665 100644
--- a/modules/audio_coding/codecs/ilbc/ilbc.h
+++ b/modules/audio_coding/codecs/ilbc/ilbc.h
@@ -40,216 +40,214 @@
*/
#define ILBC_SPEECH 1
-#define ILBC_CNG 2
+#define ILBC_CNG 2
#ifdef __cplusplus
extern "C" {
#endif
- /****************************************************************************
- * WebRtcIlbcfix_XxxAssign(...)
- *
- * These functions assigns the encoder/decoder instance to the specified
- * memory location
- *
- * Input:
- * - XXX_xxxinst : Pointer to created instance that should be
- * assigned
- * - ILBCXXX_inst_Addr : Pointer to the desired memory space
- * - size : The size that this structure occupies (in Word16)
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+/****************************************************************************
+ * WebRtcIlbcfix_XxxAssign(...)
+ *
+ * These functions assigns the encoder/decoder instance to the specified
+ * memory location
+ *
+ * Input:
+ * - XXX_xxxinst : Pointer to created instance that should be
+ * assigned
+ * - ILBCXXX_inst_Addr : Pointer to the desired memory space
+ * - size : The size that this structure occupies (in Word16)
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- int16_t WebRtcIlbcfix_EncoderAssign(IlbcEncoderInstance **iLBC_encinst,
- int16_t *ILBCENC_inst_Addr,
- int16_t *size);
- int16_t WebRtcIlbcfix_DecoderAssign(IlbcDecoderInstance **iLBC_decinst,
- int16_t *ILBCDEC_inst_Addr,
- int16_t *size);
+int16_t WebRtcIlbcfix_EncoderAssign(IlbcEncoderInstance** iLBC_encinst,
+ int16_t* ILBCENC_inst_Addr,
+ int16_t* size);
+int16_t WebRtcIlbcfix_DecoderAssign(IlbcDecoderInstance** iLBC_decinst,
+ int16_t* ILBCDEC_inst_Addr,
+ int16_t* size);
+/****************************************************************************
+ * WebRtcIlbcfix_XxxAssign(...)
+ *
+ * These functions create a instance to the specified structure
+ *
+ * Input:
+ * - XXX_inst : Pointer to created instance that should be created
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- /****************************************************************************
- * WebRtcIlbcfix_XxxAssign(...)
- *
- * These functions create a instance to the specified structure
- *
- * Input:
- * - XXX_inst : Pointer to created instance that should be created
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+int16_t WebRtcIlbcfix_EncoderCreate(IlbcEncoderInstance** iLBC_encinst);
+int16_t WebRtcIlbcfix_DecoderCreate(IlbcDecoderInstance** iLBC_decinst);
- int16_t WebRtcIlbcfix_EncoderCreate(IlbcEncoderInstance **iLBC_encinst);
- int16_t WebRtcIlbcfix_DecoderCreate(IlbcDecoderInstance **iLBC_decinst);
+/****************************************************************************
+ * WebRtcIlbcfix_XxxFree(...)
+ *
+ * These functions frees the dynamic memory of a specified instance
+ *
+ * Input:
+ * - XXX_inst : Pointer to created instance that should be freed
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- /****************************************************************************
- * WebRtcIlbcfix_XxxFree(...)
- *
- * These functions frees the dynamic memory of a specified instance
- *
- * Input:
- * - XXX_inst : Pointer to created instance that should be freed
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+int16_t WebRtcIlbcfix_EncoderFree(IlbcEncoderInstance* iLBC_encinst);
+int16_t WebRtcIlbcfix_DecoderFree(IlbcDecoderInstance* iLBC_decinst);
- int16_t WebRtcIlbcfix_EncoderFree(IlbcEncoderInstance *iLBC_encinst);
- int16_t WebRtcIlbcfix_DecoderFree(IlbcDecoderInstance *iLBC_decinst);
+/****************************************************************************
+ * WebRtcIlbcfix_EncoderInit(...)
+ *
+ * This function initializes a iLBC instance
+ *
+ * Input:
+ * - iLBCenc_inst : iLBC instance, i.e. the user that should receive
+ * be initialized
+ * - frameLen : The frame length of the codec 20/30 (ms)
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
+int16_t WebRtcIlbcfix_EncoderInit(IlbcEncoderInstance* iLBCenc_inst,
+ int16_t frameLen);
- /****************************************************************************
- * WebRtcIlbcfix_EncoderInit(...)
- *
- * This function initializes a iLBC instance
- *
- * Input:
- * - iLBCenc_inst : iLBC instance, i.e. the user that should receive
- * be initialized
- * - frameLen : The frame length of the codec 20/30 (ms)
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+/****************************************************************************
+ * WebRtcIlbcfix_Encode(...)
+ *
+ * This function encodes one iLBC frame. Input speech length has be a
+ * multiple of the frame length.
+ *
+ * Input:
+ * - iLBCenc_inst : iLBC instance, i.e. the user that should encode
+ * a package
+ * - speechIn : Input speech vector
+ * - len : Samples in speechIn (160, 240, 320 or 480)
+ *
+ * Output:
+ * - encoded : The encoded data vector
+ *
+ * Return value : >0 - Length (in bytes) of coded data
+ * -1 - Error
+ */
- int16_t WebRtcIlbcfix_EncoderInit(IlbcEncoderInstance *iLBCenc_inst,
- int16_t frameLen);
+int WebRtcIlbcfix_Encode(IlbcEncoderInstance* iLBCenc_inst,
+ const int16_t* speechIn,
+ size_t len,
+ uint8_t* encoded);
- /****************************************************************************
- * WebRtcIlbcfix_Encode(...)
- *
- * This function encodes one iLBC frame. Input speech length has be a
- * multiple of the frame length.
- *
- * Input:
- * - iLBCenc_inst : iLBC instance, i.e. the user that should encode
- * a package
- * - speechIn : Input speech vector
- * - len : Samples in speechIn (160, 240, 320 or 480)
- *
- * Output:
- * - encoded : The encoded data vector
- *
- * Return value : >0 - Length (in bytes) of coded data
- * -1 - Error
- */
+/****************************************************************************
+ * WebRtcIlbcfix_DecoderInit(...)
+ *
+ * This function initializes a iLBC instance with either 20 or 30 ms frames
+ * Alternatively the WebRtcIlbcfix_DecoderInit_XXms can be used. Then it's
+ * not needed to specify the frame length with a variable.
+ *
+ * Input:
+ * - IlbcDecoderInstance : iLBC decoder instance
+ * - frameLen : The frame length of the codec 20/30 (ms)
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- int WebRtcIlbcfix_Encode(IlbcEncoderInstance *iLBCenc_inst,
- const int16_t *speechIn,
- size_t len,
- uint8_t* encoded);
+int16_t WebRtcIlbcfix_DecoderInit(IlbcDecoderInstance* iLBCdec_inst,
+ int16_t frameLen);
+void WebRtcIlbcfix_DecoderInit20Ms(IlbcDecoderInstance* iLBCdec_inst);
+void WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance* iLBCdec_inst);
- /****************************************************************************
- * WebRtcIlbcfix_DecoderInit(...)
- *
- * This function initializes a iLBC instance with either 20 or 30 ms frames
- * Alternatively the WebRtcIlbcfix_DecoderInit_XXms can be used. Then it's
- * not needed to specify the frame length with a variable.
- *
- * Input:
- * - IlbcDecoderInstance : iLBC decoder instance
- * - frameLen : The frame length of the codec 20/30 (ms)
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+/****************************************************************************
+ * WebRtcIlbcfix_Decode(...)
+ *
+ * This function decodes a packet with iLBC frame(s). Output speech length
+ * will be a multiple of 160 or 240 samples ((160 or 240)*frames/packet).
+ *
+ * Input:
+ * - iLBCdec_inst : iLBC instance, i.e. the user that should decode
+ * a packet
+ * - encoded : Encoded iLBC frame(s)
+ * - len : Bytes in encoded vector
+ *
+ * Output:
+ * - decoded : The decoded vector
+ * - speechType : 1 normal, 2 CNG
+ *
+ * Return value : >0 - Samples in decoded vector
+ * -1 - Error
+ */
- int16_t WebRtcIlbcfix_DecoderInit(IlbcDecoderInstance *iLBCdec_inst,
- int16_t frameLen);
- void WebRtcIlbcfix_DecoderInit20Ms(IlbcDecoderInstance* iLBCdec_inst);
- void WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance* iLBCdec_inst);
+int WebRtcIlbcfix_Decode(IlbcDecoderInstance* iLBCdec_inst,
+ const uint8_t* encoded,
+ size_t len,
+ int16_t* decoded,
+ int16_t* speechType);
+int WebRtcIlbcfix_Decode20Ms(IlbcDecoderInstance* iLBCdec_inst,
+ const uint8_t* encoded,
+ size_t len,
+ int16_t* decoded,
+ int16_t* speechType);
+int WebRtcIlbcfix_Decode30Ms(IlbcDecoderInstance* iLBCdec_inst,
+ const uint8_t* encoded,
+ size_t len,
+ int16_t* decoded,
+ int16_t* speechType);
- /****************************************************************************
- * WebRtcIlbcfix_Decode(...)
- *
- * This function decodes a packet with iLBC frame(s). Output speech length
- * will be a multiple of 160 or 240 samples ((160 or 240)*frames/packet).
- *
- * Input:
- * - iLBCdec_inst : iLBC instance, i.e. the user that should decode
- * a packet
- * - encoded : Encoded iLBC frame(s)
- * - len : Bytes in encoded vector
- *
- * Output:
- * - decoded : The decoded vector
- * - speechType : 1 normal, 2 CNG
- *
- * Return value : >0 - Samples in decoded vector
- * -1 - Error
- */
+/****************************************************************************
+ * WebRtcIlbcfix_DecodePlc(...)
+ *
+ * This function conducts PLC for iLBC frame(s). Output speech length
+ * will be a multiple of 160 or 240 samples.
+ *
+ * Input:
+ * - iLBCdec_inst : iLBC instance, i.e. the user that should perform
+ * a PLC
+ * - noOfLostFrames : Number of PLC frames to produce
+ *
+ * Output:
+ * - decoded : The "decoded" vector
+ *
+ * Return value : Samples in decoded PLC vector
+ */
- int WebRtcIlbcfix_Decode(IlbcDecoderInstance* iLBCdec_inst,
- const uint8_t* encoded,
- size_t len,
- int16_t* decoded,
- int16_t* speechType);
- int WebRtcIlbcfix_Decode20Ms(IlbcDecoderInstance* iLBCdec_inst,
- const uint8_t* encoded,
- size_t len,
+size_t WebRtcIlbcfix_DecodePlc(IlbcDecoderInstance* iLBCdec_inst,
int16_t* decoded,
- int16_t* speechType);
- int WebRtcIlbcfix_Decode30Ms(IlbcDecoderInstance* iLBCdec_inst,
- const uint8_t* encoded,
- size_t len,
- int16_t* decoded,
- int16_t* speechType);
+ size_t noOfLostFrames);
- /****************************************************************************
- * WebRtcIlbcfix_DecodePlc(...)
- *
- * This function conducts PLC for iLBC frame(s). Output speech length
- * will be a multiple of 160 or 240 samples.
- *
- * Input:
- * - iLBCdec_inst : iLBC instance, i.e. the user that should perform
- * a PLC
- * - noOfLostFrames : Number of PLC frames to produce
- *
- * Output:
- * - decoded : The "decoded" vector
- *
- * Return value : Samples in decoded PLC vector
- */
+/****************************************************************************
+ * WebRtcIlbcfix_NetEqPlc(...)
+ *
+ * This function updates the decoder when a packet loss has occured, but it
+ * does not produce any PLC data. Function can be used if another PLC method
+ * is used (i.e NetEq).
+ *
+ * Input:
+ * - iLBCdec_inst : iLBC instance that should be updated
+ * - noOfLostFrames : Number of lost frames
+ *
+ * Output:
+ * - decoded : The "decoded" vector (nothing in this case)
+ *
+ * Return value : Samples in decoded PLC vector
+ */
- size_t WebRtcIlbcfix_DecodePlc(IlbcDecoderInstance *iLBCdec_inst,
- int16_t *decoded,
- size_t noOfLostFrames);
+size_t WebRtcIlbcfix_NetEqPlc(IlbcDecoderInstance* iLBCdec_inst,
+ int16_t* decoded,
+ size_t noOfLostFrames);
- /****************************************************************************
- * WebRtcIlbcfix_NetEqPlc(...)
- *
- * This function updates the decoder when a packet loss has occured, but it
- * does not produce any PLC data. Function can be used if another PLC method
- * is used (i.e NetEq).
- *
- * Input:
- * - iLBCdec_inst : iLBC instance that should be updated
- * - noOfLostFrames : Number of lost frames
- *
- * Output:
- * - decoded : The "decoded" vector (nothing in this case)
- *
- * Return value : Samples in decoded PLC vector
- */
+/****************************************************************************
+ * WebRtcIlbcfix_version(...)
+ *
+ * This function returns the version number of iLBC
+ *
+ * Output:
+ * - version : Version number of iLBC (maximum 20 char)
+ */
- size_t WebRtcIlbcfix_NetEqPlc(IlbcDecoderInstance *iLBCdec_inst,
- int16_t *decoded,
- size_t noOfLostFrames);
-
- /****************************************************************************
- * WebRtcIlbcfix_version(...)
- *
- * This function returns the version number of iLBC
- *
- * Output:
- * - version : Version number of iLBC (maximum 20 char)
- */
-
- void WebRtcIlbcfix_version(char *version);
+void WebRtcIlbcfix_version(char* version);
#ifdef __cplusplus
}
diff --git a/modules/audio_coding/codecs/ilbc/ilbc_unittest.cc b/modules/audio_coding/codecs/ilbc/ilbc_unittest.cc
index b8d3c7c..5ec1219 100644
--- a/modules/audio_coding/codecs/ilbc/ilbc_unittest.cc
+++ b/modules/audio_coding/codecs/ilbc/ilbc_unittest.cc
@@ -71,7 +71,7 @@
TEST_P(SplitIlbcTest, NumFrames) {
AudioDecoderIlbcImpl decoder;
const size_t frame_length_samples = frame_length_ms_ * 8;
- const auto generate_payload = [] (size_t payload_length_bytes) {
+ const auto generate_payload = [](size_t payload_length_bytes) {
rtc::Buffer payload(payload_length_bytes);
// Fill payload with increasing integers {0, 1, 2, ...}.
for (size_t i = 0; i < payload.size(); ++i) {
@@ -104,7 +104,8 @@
// The maximum is defined by the largest payload length that can be uniquely
// resolved to a frame size of either 38 bytes (20 ms) or 50 bytes (30 ms).
INSTANTIATE_TEST_CASE_P(
- IlbcTest, SplitIlbcTest,
+ IlbcTest,
+ SplitIlbcTest,
::testing::Values(std::pair<int, int>(1, 20), // 1 frame, 20 ms.
std::pair<int, int>(2, 20), // 2 frames, 20 ms.
std::pair<int, int>(3, 20), // And so on.
diff --git a/modules/audio_coding/codecs/ilbc/index_conv_dec.h b/modules/audio_coding/codecs/ilbc/index_conv_dec.h
index 03a721b..4f08ce0 100644
--- a/modules/audio_coding/codecs/ilbc/index_conv_dec.h
+++ b/modules/audio_coding/codecs/ilbc/index_conv_dec.h
@@ -21,8 +21,7 @@
#include "modules/audio_coding/codecs/ilbc/defines.h"
-void WebRtcIlbcfix_IndexConvDec(
- int16_t *index /* (i/o) Codebook indexes */
+void WebRtcIlbcfix_IndexConvDec(int16_t* index /* (i/o) Codebook indexes */
);
#endif
diff --git a/modules/audio_coding/codecs/ilbc/index_conv_enc.h b/modules/audio_coding/codecs/ilbc/index_conv_enc.h
index 9938448..f899499 100644
--- a/modules/audio_coding/codecs/ilbc/index_conv_enc.h
+++ b/modules/audio_coding/codecs/ilbc/index_conv_enc.h
@@ -25,8 +25,7 @@
* Convert the codebook indexes to make the search easier
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_IndexConvEnc(
- int16_t *index /* (i/o) Codebook indexes */
+void WebRtcIlbcfix_IndexConvEnc(int16_t* index /* (i/o) Codebook indexes */
);
#endif
diff --git a/modules/audio_coding/codecs/ilbc/init_decode.h b/modules/audio_coding/codecs/ilbc/init_decode.h
index 49bd61c..fdcf9f0 100644
--- a/modules/audio_coding/codecs/ilbc/init_decode.h
+++ b/modules/audio_coding/codecs/ilbc/init_decode.h
@@ -25,11 +25,12 @@
* Initiation of decoder instance.
*---------------------------------------------------------------*/
-int WebRtcIlbcfix_InitDecode( /* (o) Number of decoded samples */
- IlbcDecoder *iLBCdec_inst, /* (i/o) Decoder instance */
- int16_t mode, /* (i) frame size mode */
- int use_enhancer /* (i) 1 to use enhancer
- 0 to run without enhancer */
- );
+int WebRtcIlbcfix_InitDecode(/* (o) Number of decoded samples */
+ IlbcDecoder*
+ iLBCdec_inst, /* (i/o) Decoder instance */
+ int16_t mode, /* (i) frame size mode */
+ int use_enhancer /* (i) 1 to use enhancer
+ 0 to run without enhancer */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/init_encode.h b/modules/audio_coding/codecs/ilbc/init_encode.h
index d9b2971..f91a9b0 100644
--- a/modules/audio_coding/codecs/ilbc/init_encode.h
+++ b/modules/audio_coding/codecs/ilbc/init_encode.h
@@ -25,9 +25,10 @@
* Initiation of encoder instance.
*---------------------------------------------------------------*/
-int WebRtcIlbcfix_InitEncode( /* (o) Number of bytes encoded */
- IlbcEncoder *iLBCenc_inst, /* (i/o) Encoder instance */
- int16_t mode /* (i) frame size mode */
- );
+int WebRtcIlbcfix_InitEncode(/* (o) Number of bytes encoded */
+ IlbcEncoder*
+ iLBCenc_inst, /* (i/o) Encoder instance */
+ int16_t mode /* (i) frame size mode */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/interpolate.h b/modules/audio_coding/codecs/ilbc/interpolate.h
index fc360b4..9f03236 100644
--- a/modules/audio_coding/codecs/ilbc/interpolate.h
+++ b/modules/audio_coding/codecs/ilbc/interpolate.h
@@ -26,10 +26,10 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Interpolate(
- int16_t *out, /* (o) output vector */
- int16_t *in1, /* (i) first input vector */
- int16_t *in2, /* (i) second input vector */
- int16_t coef, /* (i) weight coefficient in Q14 */
+ int16_t* out, /* (o) output vector */
+ int16_t* in1, /* (i) first input vector */
+ int16_t* in2, /* (i) second input vector */
+ int16_t coef, /* (i) weight coefficient in Q14 */
int16_t length); /* (i) number of sample is vectors */
#endif
diff --git a/modules/audio_coding/codecs/ilbc/interpolate_samples.h b/modules/audio_coding/codecs/ilbc/interpolate_samples.h
index f522f93..264a101 100644
--- a/modules/audio_coding/codecs/ilbc/interpolate_samples.h
+++ b/modules/audio_coding/codecs/ilbc/interpolate_samples.h
@@ -26,9 +26,9 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_InterpolateSamples(
- int16_t *interpSamples, /* (o) The interpolated samples */
- int16_t *CBmem, /* (i) The CB memory */
- size_t lMem /* (i) Length of the CB memory */
- );
+ int16_t* interpSamples, /* (o) The interpolated samples */
+ int16_t* CBmem, /* (i) The CB memory */
+ size_t lMem /* (i) Length of the CB memory */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/lpc_encode.h b/modules/audio_coding/codecs/ilbc/lpc_encode.h
index 7255705..256fa49 100644
--- a/modules/audio_coding/codecs/ilbc/lpc_encode.h
+++ b/modules/audio_coding/codecs/ilbc/lpc_encode.h
@@ -26,14 +26,14 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_LpcEncode(
- int16_t *syntdenum, /* (i/o) synthesis filter coefficients
- before/after encoding */
- int16_t *weightdenum, /* (i/o) weighting denumerator coefficients
+ int16_t* syntdenum, /* (i/o) synthesis filter coefficients
before/after encoding */
- int16_t *lsf_index, /* (o) lsf quantization index */
- int16_t *data, /* (i) Speech to do LPC analysis on */
- IlbcEncoder *iLBCenc_inst
+ int16_t* weightdenum, /* (i/o) weighting denumerator coefficients
+ before/after encoding */
+ int16_t* lsf_index, /* (o) lsf quantization index */
+ int16_t* data, /* (i) Speech to do LPC analysis on */
+ IlbcEncoder* iLBCenc_inst
/* (i/o) the encoder state structure */
- );
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/lsf_check.h b/modules/audio_coding/codecs/ilbc/lsf_check.h
index f92e0cc..d367c1d 100644
--- a/modules/audio_coding/codecs/ilbc/lsf_check.h
+++ b/modules/audio_coding/codecs/ilbc/lsf_check.h
@@ -25,9 +25,8 @@
* check for stability of lsf coefficients
*---------------------------------------------------------------*/
-int WebRtcIlbcfix_LsfCheck(
- int16_t *lsf, /* LSF parameters */
- int dim, /* dimension of LSF */
- int NoAn); /* No of analysis per frame */
+int WebRtcIlbcfix_LsfCheck(int16_t* lsf, /* LSF parameters */
+ int dim, /* dimension of LSF */
+ int NoAn); /* No of analysis per frame */
#endif
diff --git a/modules/audio_coding/codecs/ilbc/lsf_interpolate_to_poly_dec.h b/modules/audio_coding/codecs/ilbc/lsf_interpolate_to_poly_dec.h
index 4a6c0d5..016897a 100644
--- a/modules/audio_coding/codecs/ilbc/lsf_interpolate_to_poly_dec.h
+++ b/modules/audio_coding/codecs/ilbc/lsf_interpolate_to_poly_dec.h
@@ -26,12 +26,12 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_LspInterpolate2PolyDec(
- int16_t *a, /* (o) lpc coefficients Q12 */
- int16_t *lsf1, /* (i) first set of lsf coefficients Q13 */
- int16_t *lsf2, /* (i) second set of lsf coefficients Q13 */
+ int16_t* a, /* (o) lpc coefficients Q12 */
+ int16_t* lsf1, /* (i) first set of lsf coefficients Q13 */
+ int16_t* lsf2, /* (i) second set of lsf coefficients Q13 */
int16_t coef, /* (i) weighting coefficient to use between
lsf1 and lsf2 Q14 */
- int16_t length /* (i) length of coefficient vectors */
- );
+ int16_t length /* (i) length of coefficient vectors */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/lsf_interpolate_to_poly_enc.h b/modules/audio_coding/codecs/ilbc/lsf_interpolate_to_poly_enc.h
index 74863c6..9cb0dd9 100644
--- a/modules/audio_coding/codecs/ilbc/lsf_interpolate_to_poly_enc.h
+++ b/modules/audio_coding/codecs/ilbc/lsf_interpolate_to_poly_enc.h
@@ -27,12 +27,12 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_LsfInterpolate2PloyEnc(
- int16_t *a, /* (o) lpc coefficients Q12 */
- int16_t *lsf1, /* (i) first set of lsf coefficients Q13 */
- int16_t *lsf2, /* (i) second set of lsf coefficients Q13 */
- int16_t coef, /* (i) weighting coefficient to use between
- lsf1 and lsf2 Q14 */
+ int16_t* a, /* (o) lpc coefficients Q12 */
+ int16_t* lsf1, /* (i) first set of lsf coefficients Q13 */
+ int16_t* lsf2, /* (i) second set of lsf coefficients Q13 */
+ int16_t coef, /* (i) weighting coefficient to use between
+ lsf1 and lsf2 Q14 */
int16_t length /* (i) length of coefficient vectors */
- );
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/lsf_to_lsp.h b/modules/audio_coding/codecs/ilbc/lsf_to_lsp.h
index 80c0798..921101a 100644
--- a/modules/audio_coding/codecs/ilbc/lsf_to_lsp.h
+++ b/modules/audio_coding/codecs/ilbc/lsf_to_lsp.h
@@ -26,9 +26,9 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Lsf2Lsp(
- int16_t *lsf, /* (i) lsf in Q13 values between 0 and pi */
- int16_t *lsp, /* (o) lsp in Q15 values between -1 and 1 */
+ int16_t* lsf, /* (i) lsf in Q13 values between 0 and pi */
+ int16_t* lsp, /* (o) lsp in Q15 values between -1 and 1 */
int16_t m /* (i) number of coefficients */
- );
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/lsf_to_poly.h b/modules/audio_coding/codecs/ilbc/lsf_to_poly.h
index 68c4dd0..e551836 100644
--- a/modules/audio_coding/codecs/ilbc/lsf_to_poly.h
+++ b/modules/audio_coding/codecs/ilbc/lsf_to_poly.h
@@ -26,8 +26,8 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Lsf2Poly(
- int16_t *a, /* (o) predictor coefficients (order = 10) in Q12 */
- int16_t *lsf /* (i) line spectral frequencies in Q13 */
- );
+ int16_t* a, /* (o) predictor coefficients (order = 10) in Q12 */
+ int16_t* lsf /* (i) line spectral frequencies in Q13 */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/lsp_to_lsf.h b/modules/audio_coding/codecs/ilbc/lsp_to_lsf.h
index 666a99a..358786e 100644
--- a/modules/audio_coding/codecs/ilbc/lsp_to_lsf.h
+++ b/modules/audio_coding/codecs/ilbc/lsp_to_lsf.h
@@ -26,10 +26,10 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Lsp2Lsf(
- int16_t *lsp, /* (i) lsp vector -1...+1 in Q15 */
- int16_t *lsf, /* (o) Lsf vector 0...Pi in Q13
+ int16_t* lsp, /* (i) lsp vector -1...+1 in Q15 */
+ int16_t* lsf, /* (o) Lsf vector 0...Pi in Q13
(ordered, so that lsf[i]<lsf[i+1]) */
- int16_t m /* (i) Number of coefficients */
- );
+ int16_t m /* (i) Number of coefficients */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/my_corr.h b/modules/audio_coding/codecs/ilbc/my_corr.h
index 7c6eb19..21deea5 100644
--- a/modules/audio_coding/codecs/ilbc/my_corr.h
+++ b/modules/audio_coding/codecs/ilbc/my_corr.h
@@ -25,12 +25,11 @@
* compute cross correlation between sequences
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_MyCorr(
- int32_t* corr, /* (o) correlation of seq1 and seq2 */
- const int16_t* seq1, /* (i) first sequence */
- size_t dim1, /* (i) dimension first seq1 */
- const int16_t* seq2, /* (i) second sequence */
- size_t dim2 /* (i) dimension seq2 */
+void WebRtcIlbcfix_MyCorr(int32_t* corr, /* (o) correlation of seq1 and seq2 */
+ const int16_t* seq1, /* (i) first sequence */
+ size_t dim1, /* (i) dimension first seq1 */
+ const int16_t* seq2, /* (i) second sequence */
+ size_t dim2 /* (i) dimension seq2 */
);
#endif
diff --git a/modules/audio_coding/codecs/ilbc/nearest_neighbor.h b/modules/audio_coding/codecs/ilbc/nearest_neighbor.h
index d541fb7..68b5c59 100644
--- a/modules/audio_coding/codecs/ilbc/nearest_neighbor.h
+++ b/modules/audio_coding/codecs/ilbc/nearest_neighbor.h
@@ -27,10 +27,10 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_NearestNeighbor(
- size_t* index, /* (o) index of array element closest to value */
+ size_t* index, /* (o) index of array element closest to value */
const size_t* array, /* (i) data array (Q2) */
- size_t value, /* (i) value (Q2) */
- size_t arlength /* (i) dimension of data array (==ENH_NBLOCKS_TOT) */
- );
+ size_t value, /* (i) value (Q2) */
+ size_t arlength /* (i) dimension of data array (==ENH_NBLOCKS_TOT) */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/pack_bits.h b/modules/audio_coding/codecs/ilbc/pack_bits.h
index 8ae3013..8dcf41c 100644
--- a/modules/audio_coding/codecs/ilbc/pack_bits.h
+++ b/modules/audio_coding/codecs/ilbc/pack_bits.h
@@ -25,10 +25,10 @@
* unpacking of bits from bitstream, i.e., vector of bytes
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_PackBits(
- uint16_t *bitstream, /* (o) The packetized bitstream */
- iLBC_bits *enc_bits, /* (i) Encoded bits */
- int16_t mode /* (i) Codec mode (20 or 30) */
- );
+void WebRtcIlbcfix_PackBits(
+ uint16_t* bitstream, /* (o) The packetized bitstream */
+ iLBC_bits* enc_bits, /* (i) Encoded bits */
+ int16_t mode /* (i) Codec mode (20 or 30) */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/poly_to_lsf.h b/modules/audio_coding/codecs/ilbc/poly_to_lsf.h
index f930c45..8a68d07 100644
--- a/modules/audio_coding/codecs/ilbc/poly_to_lsf.h
+++ b/modules/audio_coding/codecs/ilbc/poly_to_lsf.h
@@ -25,9 +25,8 @@
* conversion from lpc coefficients to lsf coefficients
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_Poly2Lsf(
- int16_t *lsf, /* (o) lsf coefficients (Q13) */
- int16_t *a /* (i) A coefficients (Q12) */
+void WebRtcIlbcfix_Poly2Lsf(int16_t* lsf, /* (o) lsf coefficients (Q13) */
+ int16_t* a /* (i) A coefficients (Q12) */
);
#endif
diff --git a/modules/audio_coding/codecs/ilbc/poly_to_lsp.h b/modules/audio_coding/codecs/ilbc/poly_to_lsp.h
index e53aa20..76378f2 100644
--- a/modules/audio_coding/codecs/ilbc/poly_to_lsp.h
+++ b/modules/audio_coding/codecs/ilbc/poly_to_lsp.h
@@ -27,10 +27,10 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Poly2Lsp(
- int16_t *a, /* (o) A coefficients in Q12 */
- int16_t *lsp, /* (i) LSP coefficients in Q15 */
- int16_t *old_lsp /* (i) old LSP coefficients that are used if the new
+ int16_t* a, /* (o) A coefficients in Q12 */
+ int16_t* lsp, /* (i) LSP coefficients in Q15 */
+ int16_t* old_lsp /* (i) old LSP coefficients that are used if the new
coefficients turn out to be unstable */
- );
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/refiner.h b/modules/audio_coding/codecs/ilbc/refiner.h
index 707be7f..87d0de7 100644
--- a/modules/audio_coding/codecs/ilbc/refiner.h
+++ b/modules/audio_coding/codecs/ilbc/refiner.h
@@ -30,14 +30,14 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Refiner(
- size_t *updStartPos, /* (o) updated start point (Q-2) */
- int16_t *idata, /* (i) original data buffer */
- size_t idatal, /* (i) dimension of idata */
+ size_t* updStartPos, /* (o) updated start point (Q-2) */
+ int16_t* idata, /* (i) original data buffer */
+ size_t idatal, /* (i) dimension of idata */
size_t centerStartPos, /* (i) beginning center segment */
- size_t estSegPos, /* (i) estimated beginning other segment (Q-2) */
- int16_t *surround, /* (i/o) The contribution from this sequence
- summed with earlier contributions */
- int16_t gain /* (i) Gain to use for this sequence */
- );
+ size_t estSegPos, /* (i) estimated beginning other segment (Q-2) */
+ int16_t* surround, /* (i/o) The contribution from this sequence
+ summed with earlier contributions */
+ int16_t gain /* (i) Gain to use for this sequence */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/simple_interpolate_lsf.h b/modules/audio_coding/codecs/ilbc/simple_interpolate_lsf.h
index 61a5625..317f613 100644
--- a/modules/audio_coding/codecs/ilbc/simple_interpolate_lsf.h
+++ b/modules/audio_coding/codecs/ilbc/simple_interpolate_lsf.h
@@ -26,21 +26,21 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_SimpleInterpolateLsf(
- int16_t *syntdenum, /* (o) the synthesis filter denominator
- resulting from the quantized
- interpolated lsf Q12 */
- int16_t *weightdenum, /* (o) the weighting filter denominator
+ int16_t* syntdenum, /* (o) the synthesis filter denominator
+ resulting from the quantized
+ interpolated lsf Q12 */
+ int16_t* weightdenum, /* (o) the weighting filter denominator
resulting from the unquantized
interpolated lsf Q12 */
- int16_t *lsf, /* (i) the unquantized lsf coefficients Q13 */
- int16_t *lsfdeq, /* (i) the dequantized lsf coefficients Q13 */
- int16_t *lsfold, /* (i) the unquantized lsf coefficients of
- the previous signal frame Q13 */
- int16_t *lsfdeqold, /* (i) the dequantized lsf coefficients of the
- previous signal frame Q13 */
- int16_t length, /* (i) should equate FILTERORDER */
- IlbcEncoder *iLBCenc_inst
+ int16_t* lsf, /* (i) the unquantized lsf coefficients Q13 */
+ int16_t* lsfdeq, /* (i) the dequantized lsf coefficients Q13 */
+ int16_t* lsfold, /* (i) the unquantized lsf coefficients of
+ the previous signal frame Q13 */
+ int16_t* lsfdeqold, /* (i) the dequantized lsf coefficients of the
+ previous signal frame Q13 */
+ int16_t length, /* (i) should equate FILTERORDER */
+ IlbcEncoder* iLBCenc_inst
/* (i/o) the encoder state structure */
- );
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/simple_lpc_analysis.h b/modules/audio_coding/codecs/ilbc/simple_lpc_analysis.h
index 5eaa3d7..3b0548d 100644
--- a/modules/audio_coding/codecs/ilbc/simple_lpc_analysis.h
+++ b/modules/audio_coding/codecs/ilbc/simple_lpc_analysis.h
@@ -26,10 +26,10 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_SimpleLpcAnalysis(
- int16_t *lsf, /* (o) lsf coefficients */
- int16_t *data, /* (i) new block of speech */
- IlbcEncoder *iLBCenc_inst
+ int16_t* lsf, /* (o) lsf coefficients */
+ int16_t* data, /* (i) new block of speech */
+ IlbcEncoder* iLBCenc_inst
/* (i/o) the encoder state structure */
- );
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/simple_lsf_dequant.h b/modules/audio_coding/codecs/ilbc/simple_lsf_dequant.h
index d78d714..ee18486 100644
--- a/modules/audio_coding/codecs/ilbc/simple_lsf_dequant.h
+++ b/modules/audio_coding/codecs/ilbc/simple_lsf_dequant.h
@@ -26,9 +26,9 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_SimpleLsfDeQ(
- int16_t *lsfdeq, /* (o) dequantized lsf coefficients */
- int16_t *index, /* (i) quantization index */
- int16_t lpc_n /* (i) number of LPCs */
- );
+ int16_t* lsfdeq, /* (o) dequantized lsf coefficients */
+ int16_t* index, /* (i) quantization index */
+ int16_t lpc_n /* (i) number of LPCs */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/simple_lsf_quant.h b/modules/audio_coding/codecs/ilbc/simple_lsf_quant.h
index 5e4e6f1..74fb0be 100644
--- a/modules/audio_coding/codecs/ilbc/simple_lsf_quant.h
+++ b/modules/audio_coding/codecs/ilbc/simple_lsf_quant.h
@@ -26,12 +26,12 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_SimpleLsfQ(
- int16_t *lsfdeq, /* (o) dequantized lsf coefficients
+ int16_t* lsfdeq, /* (o) dequantized lsf coefficients
(dimension FILTERORDER) Q13 */
- int16_t *index, /* (o) quantization index */
- int16_t *lsf, /* (i) the lsf coefficient vector to be
- quantized (dimension FILTERORDER) Q13 */
- int16_t lpc_n /* (i) number of lsf sets to quantize */
- );
+ int16_t* index, /* (o) quantization index */
+ int16_t* lsf, /* (i) the lsf coefficient vector to be
+ quantized (dimension FILTERORDER) Q13 */
+ int16_t lpc_n /* (i) number of lsf sets to quantize */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/smooth.h b/modules/audio_coding/codecs/ilbc/smooth.h
index a8d1706..52e7ff9 100644
--- a/modules/audio_coding/codecs/ilbc/smooth.h
+++ b/modules/audio_coding/codecs/ilbc/smooth.h
@@ -25,12 +25,11 @@
* find the smoothed output data
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_Smooth(
- int16_t *odata, /* (o) smoothed output */
- int16_t *current, /* (i) the un enhanced residual for
- this block */
- int16_t *surround /* (i) The approximation from the
- surrounding sequences */
+void WebRtcIlbcfix_Smooth(int16_t* odata, /* (o) smoothed output */
+ int16_t* current, /* (i) the un enhanced residual for
+ this block */
+ int16_t* surround /* (i) The approximation from the
+ surrounding sequences */
);
#endif
diff --git a/modules/audio_coding/codecs/ilbc/smooth_out_data.h b/modules/audio_coding/codecs/ilbc/smooth_out_data.h
index 6370d10..df946e3 100644
--- a/modules/audio_coding/codecs/ilbc/smooth_out_data.h
+++ b/modules/audio_coding/codecs/ilbc/smooth_out_data.h
@@ -25,11 +25,9 @@
* help function to WebRtcIlbcfix_Smooth()
*---------------------------------------------------------------*/
-int32_t WebRtcIlbcfix_Smooth_odata(
- int16_t *odata,
- int16_t *psseq,
- int16_t *surround,
- int16_t C);
-
+int32_t WebRtcIlbcfix_Smooth_odata(int16_t* odata,
+ int16_t* psseq,
+ int16_t* surround,
+ int16_t C);
#endif
diff --git a/modules/audio_coding/codecs/ilbc/sort_sq.h b/modules/audio_coding/codecs/ilbc/sort_sq.h
index f3c01ef..1fe7fbf 100644
--- a/modules/audio_coding/codecs/ilbc/sort_sq.h
+++ b/modules/audio_coding/codecs/ilbc/sort_sq.h
@@ -26,11 +26,11 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_SortSq(
- int16_t *xq, /* (o) the quantized value */
- int16_t *index, /* (o) the quantization index */
- int16_t x, /* (i) the value to quantize */
- const int16_t *cb, /* (i) the quantization codebook */
- int16_t cb_size /* (i) the size of the quantization codebook */
- );
+ int16_t* xq, /* (o) the quantized value */
+ int16_t* index, /* (o) the quantization index */
+ int16_t x, /* (i) the value to quantize */
+ const int16_t* cb, /* (i) the quantization codebook */
+ int16_t cb_size /* (i) the size of the quantization codebook */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/split_vq.h b/modules/audio_coding/codecs/ilbc/split_vq.h
index a758159..6bc2db6 100644
--- a/modules/audio_coding/codecs/ilbc/split_vq.h
+++ b/modules/audio_coding/codecs/ilbc/split_vq.h
@@ -26,13 +26,13 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_SplitVq(
- int16_t *qX, /* (o) the quantized vector in Q13 */
- int16_t *index, /* (o) a vector of indexes for all vector
+ int16_t* qX, /* (o) the quantized vector in Q13 */
+ int16_t* index, /* (o) a vector of indexes for all vector
codebooks in the split */
- int16_t *X, /* (i) the vector to quantize */
- int16_t *CB, /* (i) the quantizer codebook in Q13 */
- int16_t *dim, /* (i) the dimension of X and qX */
- int16_t *cbsize /* (i) the number of vectors in the codebook */
- );
+ int16_t* X, /* (i) the vector to quantize */
+ int16_t* CB, /* (i) the quantizer codebook in Q13 */
+ int16_t* dim, /* (i) the dimension of X and qX */
+ int16_t* cbsize /* (i) the number of vectors in the codebook */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/state_construct.h b/modules/audio_coding/codecs/ilbc/state_construct.h
index 9339f65..0dadf48 100644
--- a/modules/audio_coding/codecs/ilbc/state_construct.h
+++ b/modules/audio_coding/codecs/ilbc/state_construct.h
@@ -26,10 +26,10 @@
void WebRtcIlbcfix_StateConstruct(
size_t idxForMax, /* (i) 6-bit index for the quantization of
max amplitude */
- int16_t *idxVec, /* (i) vector of quantization indexes */
- int16_t *syntDenum, /* (i) synthesis filter denumerator */
- int16_t *Out_fix, /* (o) the decoded state vector */
- size_t len /* (i) length of a state vector */
- );
+ int16_t* idxVec, /* (i) vector of quantization indexes */
+ int16_t* syntDenum, /* (i) synthesis filter denumerator */
+ int16_t* Out_fix, /* (o) the decoded state vector */
+ size_t len /* (i) length of a state vector */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/state_search.h b/modules/audio_coding/codecs/ilbc/state_search.h
index 976edca..1ad27ce 100644
--- a/modules/audio_coding/codecs/ilbc/state_search.h
+++ b/modules/audio_coding/codecs/ilbc/state_search.h
@@ -26,13 +26,13 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_StateSearch(
- IlbcEncoder *iLBCenc_inst,
+ IlbcEncoder* iLBCenc_inst,
/* (i) Encoder instance */
- iLBC_bits *iLBC_encbits,/* (i/o) Encoded bits (output idxForMax
- and idxVec, input state_first) */
- int16_t *residual, /* (i) target residual vector */
- int16_t *syntDenum, /* (i) lpc synthesis filter */
- int16_t *weightDenum /* (i) weighting filter denuminator */
- );
+ iLBC_bits* iLBC_encbits, /* (i/o) Encoded bits (output idxForMax
+ and idxVec, input state_first) */
+ int16_t* residual, /* (i) target residual vector */
+ int16_t* syntDenum, /* (i) lpc synthesis filter */
+ int16_t* weightDenum /* (i) weighting filter denuminator */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/swap_bytes.h b/modules/audio_coding/codecs/ilbc/swap_bytes.h
index 63930d4..381b73a 100644
--- a/modules/audio_coding/codecs/ilbc/swap_bytes.h
+++ b/modules/audio_coding/codecs/ilbc/swap_bytes.h
@@ -26,9 +26,9 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_SwapBytes(
- const uint16_t* input, /* (i) the sequence to swap */
- size_t wordLength, /* (i) number or uint16_t to swap */
- uint16_t* output /* (o) the swapped sequence */
- );
+ const uint16_t* input, /* (i) the sequence to swap */
+ size_t wordLength, /* (i) number or uint16_t to swap */
+ uint16_t* output /* (o) the swapped sequence */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/unpack_bits.h b/modules/audio_coding/codecs/ilbc/unpack_bits.h
index b2e622f..4fd0a80 100644
--- a/modules/audio_coding/codecs/ilbc/unpack_bits.h
+++ b/modules/audio_coding/codecs/ilbc/unpack_bits.h
@@ -25,10 +25,13 @@
* unpacking of bits from bitstream, i.e., vector of bytes
*---------------------------------------------------------------*/
-int16_t WebRtcIlbcfix_UnpackBits( /* (o) "Empty" frame indicator */
- const uint16_t *bitstream, /* (i) The packatized bitstream */
- iLBC_bits *enc_bits, /* (o) Paramerers from bitstream */
- int16_t mode /* (i) Codec mode (20 or 30) */
- );
+int16_t
+WebRtcIlbcfix_UnpackBits(/* (o) "Empty" frame indicator */
+ const uint16_t*
+ bitstream, /* (i) The packatized bitstream */
+ iLBC_bits*
+ enc_bits, /* (o) Paramerers from bitstream */
+ int16_t mode /* (i) Codec mode (20 or 30) */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/vq3.h b/modules/audio_coding/codecs/ilbc/vq3.h
index 6d3dc3a..ceaff8d 100644
--- a/modules/audio_coding/codecs/ilbc/vq3.h
+++ b/modules/audio_coding/codecs/ilbc/vq3.h
@@ -26,11 +26,11 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Vq3(
- int16_t *Xq, /* (o) the quantized vector (Q13) */
- int16_t *index, /* (o) the quantization index */
- int16_t *CB, /* (i) the vector quantization codebook (Q13) */
- int16_t *X, /* (i) the vector to quantize (Q13) */
- int16_t n_cb /* (i) the number of vectors in the codebook */
- );
+ int16_t* Xq, /* (o) the quantized vector (Q13) */
+ int16_t* index, /* (o) the quantization index */
+ int16_t* CB, /* (i) the vector quantization codebook (Q13) */
+ int16_t* X, /* (i) the vector to quantize (Q13) */
+ int16_t n_cb /* (i) the number of vectors in the codebook */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/vq4.h b/modules/audio_coding/codecs/ilbc/vq4.h
index c7f5271..8dbedc9 100644
--- a/modules/audio_coding/codecs/ilbc/vq4.h
+++ b/modules/audio_coding/codecs/ilbc/vq4.h
@@ -26,11 +26,11 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Vq4(
- int16_t *Xq, /* (o) the quantized vector (Q13) */
- int16_t *index, /* (o) the quantization index */
- int16_t *CB, /* (i) the vector quantization codebook (Q13) */
- int16_t *X, /* (i) the vector to quantize (Q13) */
- int16_t n_cb /* (i) the number of vectors in the codebook */
- );
+ int16_t* Xq, /* (o) the quantized vector (Q13) */
+ int16_t* index, /* (o) the quantization index */
+ int16_t* CB, /* (i) the vector quantization codebook (Q13) */
+ int16_t* X, /* (i) the vector to quantize (Q13) */
+ int16_t n_cb /* (i) the number of vectors in the codebook */
+ );
#endif
diff --git a/modules/audio_coding/codecs/ilbc/window32_w32.h b/modules/audio_coding/codecs/ilbc/window32_w32.h
index c348d1d..0cef084 100644
--- a/modules/audio_coding/codecs/ilbc/window32_w32.h
+++ b/modules/audio_coding/codecs/ilbc/window32_w32.h
@@ -25,11 +25,10 @@
* window multiplication
*---------------------------------------------------------------*/
-void WebRtcIlbcfix_Window32W32(
- int32_t *z, /* Output */
- int32_t *x, /* Input (same domain as Output)*/
- const int32_t *y, /* Q31 Window */
- size_t N /* length to process */
+void WebRtcIlbcfix_Window32W32(int32_t* z, /* Output */
+ int32_t* x, /* Input (same domain as Output)*/
+ const int32_t* y, /* Q31 Window */
+ size_t N /* length to process */
);
#endif
diff --git a/modules/audio_coding/codecs/ilbc/xcorr_coef.h b/modules/audio_coding/codecs/ilbc/xcorr_coef.h
index cd58b60..e6c3d3f 100644
--- a/modules/audio_coding/codecs/ilbc/xcorr_coef.h
+++ b/modules/audio_coding/codecs/ilbc/xcorr_coef.h
@@ -27,12 +27,12 @@
*---------------------------------------------------------------*/
size_t WebRtcIlbcfix_XcorrCoef(
- int16_t *target, /* (i) first array */
- int16_t *regressor, /* (i) second array */
- size_t subl, /* (i) dimension arrays */
- size_t searchLen, /* (i) the search lenght */
- size_t offset, /* (i) samples offset between arrays */
- int16_t step /* (i) +1 or -1 */
- );
+ int16_t* target, /* (i) first array */
+ int16_t* regressor, /* (i) second array */
+ size_t subl, /* (i) dimension arrays */
+ size_t searchLen, /* (i) the search lenght */
+ size_t offset, /* (i) samples offset between arrays */
+ int16_t step /* (i) +1 or -1 */
+ );
#endif
diff --git a/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h b/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
index 696b799..cbf15fc 100644
--- a/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
+++ b/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
@@ -90,9 +90,8 @@
template <typename T>
size_t AudioEncoderIsacT<T>::Num10MsFramesInNextPacket() const {
const int samples_in_next_packet = T::GetNewFrameLen(isac_state_);
- return static_cast<size_t>(
- rtc::CheckedDivExact(samples_in_next_packet,
- rtc::CheckedDivExact(SampleRateHz(), 100)));
+ return static_cast<size_t>(rtc::CheckedDivExact(
+ samples_in_next_packet, rtc::CheckedDivExact(SampleRateHz(), 100)));
}
template <typename T>
@@ -123,8 +122,7 @@
}
size_t encoded_bytes = encoded->AppendData(
- kSufficientEncodeBufferSizeBytes,
- [&] (rtc::ArrayView<uint8_t> encoded) {
+ kSufficientEncodeBufferSizeBytes, [&](rtc::ArrayView<uint8_t> encoded) {
int r = T::Encode(isac_state_, audio.data(), encoded.data());
RTC_CHECK_GE(r, 0) << "Encode failed (error code "
diff --git a/modules/audio_coding/codecs/isac/fix/include/isacfix.h b/modules/audio_coding/codecs/isac/fix/include/isacfix.h
index ef194ca..626b3c7 100644
--- a/modules/audio_coding/codecs/isac/fix/include/isacfix.h
+++ b/modules/audio_coding/codecs/isac/fix/include/isacfix.h
@@ -16,622 +16,591 @@
#include "modules/audio_coding/codecs/isac/bandwidth_info.h"
#include "typedefs.h" // NOLINT(build/include)
-typedef struct {
- void *dummy;
-} ISACFIX_MainStruct;
-
+typedef struct { void* dummy; } ISACFIX_MainStruct;
#if defined(__cplusplus)
extern "C" {
#endif
+/**************************************************************************
+ * WebRtcIsacfix_AssignSize(...)
+ *
+ * Functions used when malloc is not allowed
+ * Output the number of bytes needed to allocate for iSAC struct.
+ *
+ */
- /**************************************************************************
- * WebRtcIsacfix_AssignSize(...)
- *
- * Functions used when malloc is not allowed
- * Output the number of bytes needed to allocate for iSAC struct.
- *
- */
+int16_t WebRtcIsacfix_AssignSize(int* sizeinbytes);
- int16_t WebRtcIsacfix_AssignSize(int *sizeinbytes);
+/**************************************************************************
+ * WebRtcIsacfix_Assign(...)
+ *
+ * Functions used when malloc is not allowed, it
+ * places a struct at the given address.
+ *
+ * Input:
+ * - *ISAC_main_inst : a pointer to the coder instance.
+ * - ISACFIX_inst_Addr : address of the memory where a space is
+ * for iSAC structure.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- /**************************************************************************
- * WebRtcIsacfix_Assign(...)
- *
- * Functions used when malloc is not allowed, it
- * places a struct at the given address.
- *
- * Input:
- * - *ISAC_main_inst : a pointer to the coder instance.
- * - ISACFIX_inst_Addr : address of the memory where a space is
- * for iSAC structure.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+int16_t WebRtcIsacfix_Assign(ISACFIX_MainStruct** inst,
+ void* ISACFIX_inst_Addr);
- int16_t WebRtcIsacfix_Assign(ISACFIX_MainStruct **inst,
- void *ISACFIX_inst_Addr);
+/****************************************************************************
+ * WebRtcIsacfix_Create(...)
+ *
+ * This function creates an ISAC instance, which will contain the state
+ * information for one coding/decoding channel.
+ *
+ * Input:
+ * - *ISAC_main_inst : a pointer to the coder instance.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- /****************************************************************************
- * WebRtcIsacfix_Create(...)
- *
- * This function creates an ISAC instance, which will contain the state
- * information for one coding/decoding channel.
- *
- * Input:
- * - *ISAC_main_inst : a pointer to the coder instance.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+int16_t WebRtcIsacfix_Create(ISACFIX_MainStruct** ISAC_main_inst);
- int16_t WebRtcIsacfix_Create(ISACFIX_MainStruct **ISAC_main_inst);
+/****************************************************************************
+ * WebRtcIsacfix_Free(...)
+ *
+ * This function frees the ISAC instance created at the beginning.
+ *
+ * Input:
+ * - ISAC_main_inst : a ISAC instance.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
+int16_t WebRtcIsacfix_Free(ISACFIX_MainStruct* ISAC_main_inst);
- /****************************************************************************
- * WebRtcIsacfix_Free(...)
- *
- * This function frees the ISAC instance created at the beginning.
- *
- * Input:
- * - ISAC_main_inst : a ISAC instance.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+/****************************************************************************
+ * WebRtcIsacfix_EncoderInit(...)
+ *
+ * This function initializes an ISAC instance prior to the encoder calls.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - CodingMode : 0 - Bit rate and frame length are automatically
+ * adjusted to available bandwidth on
+ * transmission channel.
+ * 1 - User sets a frame length and a target bit
+ * rate which is taken as the maximum short-term
+ * average bit rate.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- int16_t WebRtcIsacfix_Free(ISACFIX_MainStruct *ISAC_main_inst);
+int16_t WebRtcIsacfix_EncoderInit(ISACFIX_MainStruct* ISAC_main_inst,
+ int16_t CodingMode);
+/****************************************************************************
+ * WebRtcIsacfix_Encode(...)
+ *
+ * This function encodes 10ms frame(s) and inserts it into a package.
+ * Input speech length has to be 160 samples (10ms). The encoder buffers those
+ * 10ms frames until it reaches the chosen Framesize (480 or 960 samples
+ * corresponding to 30 or 60 ms frames), and then proceeds to the encoding.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - speechIn : input speech vector.
+ *
+ * Output:
+ * - encoded : the encoded data vector
+ *
+ * Return value : >0 - Length (in bytes) of coded data
+ * 0 - The buffer didn't reach the chosen framesize
+ * so it keeps buffering speech samples.
+ * -1 - Error
+ */
- /****************************************************************************
- * WebRtcIsacfix_EncoderInit(...)
- *
- * This function initializes an ISAC instance prior to the encoder calls.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - CodingMode : 0 - Bit rate and frame length are automatically
- * adjusted to available bandwidth on
- * transmission channel.
- * 1 - User sets a frame length and a target bit
- * rate which is taken as the maximum short-term
- * average bit rate.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+int WebRtcIsacfix_Encode(ISACFIX_MainStruct* ISAC_main_inst,
+ const int16_t* speechIn,
+ uint8_t* encoded);
- int16_t WebRtcIsacfix_EncoderInit(ISACFIX_MainStruct *ISAC_main_inst,
- int16_t CodingMode);
-
-
- /****************************************************************************
- * WebRtcIsacfix_Encode(...)
- *
- * This function encodes 10ms frame(s) and inserts it into a package.
- * Input speech length has to be 160 samples (10ms). The encoder buffers those
- * 10ms frames until it reaches the chosen Framesize (480 or 960 samples
- * corresponding to 30 or 60 ms frames), and then proceeds to the encoding.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - speechIn : input speech vector.
- *
- * Output:
- * - encoded : the encoded data vector
- *
- * Return value : >0 - Length (in bytes) of coded data
- * 0 - The buffer didn't reach the chosen framesize
- * so it keeps buffering speech samples.
- * -1 - Error
- */
-
- int WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst,
- const int16_t *speechIn,
- uint8_t* encoded);
-
-
-
- /****************************************************************************
- * WebRtcIsacfix_EncodeNb(...)
- *
- * This function encodes 10ms narrow band (8 kHz sampling) frame(s) and inserts
- * it into a package. Input speech length has to be 80 samples (10ms). The encoder
- * interpolates into wide-band (16 kHz sampling) buffers those
- * 10ms frames until it reaches the chosen Framesize (480 or 960 wide-band samples
- * corresponding to 30 or 60 ms frames), and then proceeds to the encoding.
- *
- * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - speechIn : input speech vector.
- *
- * Output:
- * - encoded : the encoded data vector
- *
- * Return value : >0 - Length (in bytes) of coded data
- * 0 - The buffer didn't reach the chosen framesize
- * so it keeps buffering speech samples.
- * -1 - Error
- */
-
+/****************************************************************************
+ * WebRtcIsacfix_EncodeNb(...)
+ *
+ * This function encodes 10ms narrow band (8 kHz sampling) frame(s) and inserts
+ * it into a package. Input speech length has to be 80 samples (10ms). The
+ * encoder interpolates into wide-band (16 kHz sampling) buffers those 10ms
+ * frames until it reaches the chosen Framesize (480 or 960 wide-band samples
+ * corresponding to 30 or 60 ms frames), and then proceeds to the encoding.
+ *
+ * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - speechIn : input speech vector.
+ *
+ * Output:
+ * - encoded : the encoded data vector
+ *
+ * Return value : >0 - Length (in bytes) of coded data
+ * 0 - The buffer didn't reach the chosen framesize
+ * so it keeps buffering speech samples.
+ * -1 - Error
+ */
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
- int16_t WebRtcIsacfix_EncodeNb(ISACFIX_MainStruct *ISAC_main_inst,
- const int16_t *speechIn,
- int16_t *encoded);
-#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
+int16_t WebRtcIsacfix_EncodeNb(ISACFIX_MainStruct* ISAC_main_inst,
+ const int16_t* speechIn,
+ int16_t* encoded);
+#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
+/****************************************************************************
+ * WebRtcIsacfix_DecoderInit(...)
+ *
+ * This function initializes an ISAC instance prior to the decoder calls.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ */
+void WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct* ISAC_main_inst);
- /****************************************************************************
- * WebRtcIsacfix_DecoderInit(...)
- *
- * This function initializes an ISAC instance prior to the decoder calls.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- */
+/****************************************************************************
+ * WebRtcIsacfix_UpdateBwEstimate1(...)
+ *
+ * This function updates the estimate of the bandwidth.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - encoded : encoded ISAC frame(s).
+ * - packet_size : size of the packet in bytes.
+ * - rtp_seq_number : the RTP number of the packet.
+ * - arr_ts : the arrival time of the packet (from NetEq)
+ * in samples.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- void WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct* ISAC_main_inst);
+int16_t WebRtcIsacfix_UpdateBwEstimate1(ISACFIX_MainStruct* ISAC_main_inst,
+ const uint8_t* encoded,
+ size_t packet_size,
+ uint16_t rtp_seq_number,
+ uint32_t arr_ts);
- /****************************************************************************
- * WebRtcIsacfix_UpdateBwEstimate1(...)
- *
- * This function updates the estimate of the bandwidth.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - encoded : encoded ISAC frame(s).
- * - packet_size : size of the packet in bytes.
- * - rtp_seq_number : the RTP number of the packet.
- * - arr_ts : the arrival time of the packet (from NetEq)
- * in samples.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+/****************************************************************************
+ * WebRtcIsacfix_UpdateBwEstimate(...)
+ *
+ * This function updates the estimate of the bandwidth.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - encoded : encoded ISAC frame(s).
+ * - packet_size : size of the packet in bytes.
+ * - rtp_seq_number : the RTP number of the packet.
+ * - send_ts : the send time of the packet from RTP header,
+ * in samples.
+ * - arr_ts : the arrival time of the packet (from NetEq)
+ * in samples.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- int16_t WebRtcIsacfix_UpdateBwEstimate1(ISACFIX_MainStruct *ISAC_main_inst,
- const uint8_t* encoded,
- size_t packet_size,
- uint16_t rtp_seq_number,
- uint32_t arr_ts);
+int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct* ISAC_main_inst,
+ const uint8_t* encoded,
+ size_t packet_size,
+ uint16_t rtp_seq_number,
+ uint32_t send_ts,
+ uint32_t arr_ts);
- /****************************************************************************
- * WebRtcIsacfix_UpdateBwEstimate(...)
- *
- * This function updates the estimate of the bandwidth.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - encoded : encoded ISAC frame(s).
- * - packet_size : size of the packet in bytes.
- * - rtp_seq_number : the RTP number of the packet.
- * - send_ts : the send time of the packet from RTP header,
- * in samples.
- * - arr_ts : the arrival time of the packet (from NetEq)
- * in samples.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+/****************************************************************************
+ * WebRtcIsacfix_Decode(...)
+ *
+ * This function decodes an ISAC frame. Output speech length
+ * will be a multiple of 480 samples: 480 or 960 samples,
+ * depending on the framesize (30 or 60 ms).
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - encoded : encoded ISAC frame(s)
+ * - len : bytes in encoded vector
+ *
+ * Output:
+ * - decoded : The decoded vector
+ *
+ * Return value : >0 - number of samples in decoded vector
+ * -1 - Error
+ */
- int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst,
- const uint8_t* encoded,
- size_t packet_size,
- uint16_t rtp_seq_number,
- uint32_t send_ts,
- uint32_t arr_ts);
+int WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst,
+ const uint8_t* encoded,
+ size_t len,
+ int16_t* decoded,
+ int16_t* speechType);
- /****************************************************************************
- * WebRtcIsacfix_Decode(...)
- *
- * This function decodes an ISAC frame. Output speech length
- * will be a multiple of 480 samples: 480 or 960 samples,
- * depending on the framesize (30 or 60 ms).
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - encoded : encoded ISAC frame(s)
- * - len : bytes in encoded vector
- *
- * Output:
- * - decoded : The decoded vector
- *
- * Return value : >0 - number of samples in decoded vector
- * -1 - Error
- */
+/****************************************************************************
+ * WebRtcIsacfix_DecodeNb(...)
+ *
+ * This function decodes a ISAC frame in narrow-band (8 kHz sampling).
+ * Output speech length will be a multiple of 240 samples: 240 or 480 samples,
+ * depending on the framesize (30 or 60 ms).
+ *
+ * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - encoded : encoded ISAC frame(s)
+ * - len : bytes in encoded vector
+ *
+ * Output:
+ * - decoded : The decoded vector
+ *
+ * Return value : >0 - number of samples in decoded vector
+ * -1 - Error
+ */
- int WebRtcIsacfix_Decode(ISACFIX_MainStruct *ISAC_main_inst,
- const uint8_t* encoded,
+#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
+int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct* ISAC_main_inst,
+ const uint16_t* encoded,
size_t len,
- int16_t *decoded,
- int16_t *speechType);
+ int16_t* decoded,
+ int16_t* speechType);
+#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
-
- /****************************************************************************
- * WebRtcIsacfix_DecodeNb(...)
- *
- * This function decodes a ISAC frame in narrow-band (8 kHz sampling).
- * Output speech length will be a multiple of 240 samples: 240 or 480 samples,
- * depending on the framesize (30 or 60 ms).
- *
- * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - encoded : encoded ISAC frame(s)
- * - len : bytes in encoded vector
- *
- * Output:
- * - decoded : The decoded vector
- *
- * Return value : >0 - number of samples in decoded vector
- * -1 - Error
- */
+/****************************************************************************
+ * WebRtcIsacfix_DecodePlcNb(...)
+ *
+ * This function conducts PLC for ISAC frame(s) in narrow-band (8kHz sampling).
+ * Output speech length will be "240*noOfLostFrames" samples
+ * that equevalent of "30*noOfLostFrames" millisecond.
+ *
+ * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - noOfLostFrames : Number of PLC frames (240 sample=30ms) to produce
+ * NOTE! Maximum number is 2 (480 samples = 60ms)
+ *
+ * Output:
+ * - decoded : The decoded vector
+ *
+ * Return value : Number of samples in decoded PLC vector
+ */
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
- int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst,
- const uint16_t *encoded,
- size_t len,
- int16_t *decoded,
- int16_t *speechType);
-#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
+size_t WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct* ISAC_main_inst,
+ int16_t* decoded,
+ size_t noOfLostFrames);
+#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
+/****************************************************************************
+ * WebRtcIsacfix_DecodePlc(...)
+ *
+ * This function conducts PLC for ISAC frame(s) in wide-band (16kHz sampling).
+ * Output speech length will be "480*noOfLostFrames" samples
+ * that is equevalent of "30*noOfLostFrames" millisecond.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - noOfLostFrames : Number of PLC frames (480sample = 30ms)
+ * to produce
+ * NOTE! Maximum number is 2 (960 samples = 60ms)
+ *
+ * Output:
+ * - decoded : The decoded vector
+ *
+ * Return value : Number of samples in decoded PLC vector
+ */
- /****************************************************************************
- * WebRtcIsacfix_DecodePlcNb(...)
- *
- * This function conducts PLC for ISAC frame(s) in narrow-band (8kHz sampling).
- * Output speech length will be "240*noOfLostFrames" samples
- * that equevalent of "30*noOfLostFrames" millisecond.
- *
- * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - noOfLostFrames : Number of PLC frames (240 sample=30ms) to produce
- * NOTE! Maximum number is 2 (480 samples = 60ms)
- *
- * Output:
- * - decoded : The decoded vector
- *
- * Return value : Number of samples in decoded PLC vector
- */
+size_t WebRtcIsacfix_DecodePlc(ISACFIX_MainStruct* ISAC_main_inst,
+ int16_t* decoded,
+ size_t noOfLostFrames);
-#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
- size_t WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct *ISAC_main_inst,
- int16_t *decoded,
- size_t noOfLostFrames);
-#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
+/****************************************************************************
+ * WebRtcIsacfix_ReadFrameLen(...)
+ *
+ * This function returns the length of the frame represented in the packet.
+ *
+ * Input:
+ * - encoded : Encoded bitstream
+ * - encoded_len_bytes : Length of the bitstream in bytes.
+ *
+ * Output:
+ * - frameLength : Length of frame in packet (in samples)
+ *
+ */
+int16_t WebRtcIsacfix_ReadFrameLen(const uint8_t* encoded,
+ size_t encoded_len_bytes,
+ size_t* frameLength);
+/****************************************************************************
+ * WebRtcIsacfix_Control(...)
+ *
+ * This function sets the limit on the short-term average bit rate and the
+ * frame length. Should be used only in Instantaneous mode.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - rate : limit on the short-term average bit rate,
+ * in bits/second (between 10000 and 32000)
+ * - framesize : number of milliseconds per frame (30 or 60)
+ *
+ * Return value : 0 - ok
+ * -1 - Error
+ */
+int16_t WebRtcIsacfix_Control(ISACFIX_MainStruct* ISAC_main_inst,
+ int16_t rate,
+ int framesize);
- /****************************************************************************
- * WebRtcIsacfix_DecodePlc(...)
- *
- * This function conducts PLC for ISAC frame(s) in wide-band (16kHz sampling).
- * Output speech length will be "480*noOfLostFrames" samples
- * that is equevalent of "30*noOfLostFrames" millisecond.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - noOfLostFrames : Number of PLC frames (480sample = 30ms)
- * to produce
- * NOTE! Maximum number is 2 (960 samples = 60ms)
- *
- * Output:
- * - decoded : The decoded vector
- *
- * Return value : Number of samples in decoded PLC vector
- */
+void WebRtcIsacfix_SetInitialBweBottleneck(ISACFIX_MainStruct* ISAC_main_inst,
+ int bottleneck_bits_per_second);
- size_t WebRtcIsacfix_DecodePlc(ISACFIX_MainStruct *ISAC_main_inst,
- int16_t *decoded,
- size_t noOfLostFrames );
+/****************************************************************************
+ * WebRtcIsacfix_ControlBwe(...)
+ *
+ * This function sets the initial values of bottleneck and frame-size if
+ * iSAC is used in channel-adaptive mode. Through this API, users can
+ * enforce a frame-size for all values of bottleneck. Then iSAC will not
+ * automatically change the frame-size.
+ *
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - rateBPS : initial value of bottleneck in bits/second
+ * 10000 <= rateBPS <= 32000 is accepted
+ * - frameSizeMs : number of milliseconds per frame (30 or 60)
+ * - enforceFrameSize : 1 to enforce the given frame-size through out
+ * the adaptation process, 0 to let iSAC change
+ * the frame-size if required.
+ *
+ * Return value : 0 - ok
+ * -1 - Error
+ */
+int16_t WebRtcIsacfix_ControlBwe(ISACFIX_MainStruct* ISAC_main_inst,
+ int16_t rateBPS,
+ int frameSizeMs,
+ int16_t enforceFrameSize);
- /****************************************************************************
- * WebRtcIsacfix_ReadFrameLen(...)
- *
- * This function returns the length of the frame represented in the packet.
- *
- * Input:
- * - encoded : Encoded bitstream
- * - encoded_len_bytes : Length of the bitstream in bytes.
- *
- * Output:
- * - frameLength : Length of frame in packet (in samples)
- *
- */
+/****************************************************************************
+ * WebRtcIsacfix_version(...)
+ *
+ * This function returns the version number.
+ *
+ * Output:
+ * - version : Pointer to character string
+ *
+ */
- int16_t WebRtcIsacfix_ReadFrameLen(const uint8_t* encoded,
- size_t encoded_len_bytes,
- size_t* frameLength);
+void WebRtcIsacfix_version(char* version);
- /****************************************************************************
- * WebRtcIsacfix_Control(...)
- *
- * This function sets the limit on the short-term average bit rate and the
- * frame length. Should be used only in Instantaneous mode.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - rate : limit on the short-term average bit rate,
- * in bits/second (between 10000 and 32000)
- * - framesize : number of milliseconds per frame (30 or 60)
- *
- * Return value : 0 - ok
- * -1 - Error
- */
+/****************************************************************************
+ * WebRtcIsacfix_GetErrorCode(...)
+ *
+ * This function can be used to check the error code of an iSAC instance. When
+ * a function returns -1 a error code will be set for that instance. The
+ * function below extract the code of the last error that occured in the
+ * specified instance.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance
+ *
+ * Return value : Error code
+ */
- int16_t WebRtcIsacfix_Control(ISACFIX_MainStruct *ISAC_main_inst,
- int16_t rate,
- int framesize);
+int16_t WebRtcIsacfix_GetErrorCode(ISACFIX_MainStruct* ISAC_main_inst);
- void WebRtcIsacfix_SetInitialBweBottleneck(ISACFIX_MainStruct* ISAC_main_inst,
- int bottleneck_bits_per_second);
+/****************************************************************************
+ * WebRtcIsacfix_GetUplinkBw(...)
+ *
+ * This function return iSAC send bitrate
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC instance
+ *
+ * Return value : <0 Error code
+ * else bitrate
+ */
- /****************************************************************************
- * WebRtcIsacfix_ControlBwe(...)
- *
- * This function sets the initial values of bottleneck and frame-size if
- * iSAC is used in channel-adaptive mode. Through this API, users can
- * enforce a frame-size for all values of bottleneck. Then iSAC will not
- * automatically change the frame-size.
- *
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - rateBPS : initial value of bottleneck in bits/second
- * 10000 <= rateBPS <= 32000 is accepted
- * - frameSizeMs : number of milliseconds per frame (30 or 60)
- * - enforceFrameSize : 1 to enforce the given frame-size through out
- * the adaptation process, 0 to let iSAC change
- * the frame-size if required.
- *
- * Return value : 0 - ok
- * -1 - Error
- */
+int32_t WebRtcIsacfix_GetUplinkBw(ISACFIX_MainStruct* ISAC_main_inst);
- int16_t WebRtcIsacfix_ControlBwe(ISACFIX_MainStruct *ISAC_main_inst,
- int16_t rateBPS,
- int frameSizeMs,
- int16_t enforceFrameSize);
+/****************************************************************************
+ * WebRtcIsacfix_SetMaxPayloadSize(...)
+ *
+ * This function sets a limit for the maximum payload size of iSAC. The same
+ * value is used both for 30 and 60 msec packets.
+ * The absolute max will be valid until next time the function is called.
+ * NOTE! This function may override the function WebRtcIsacfix_SetMaxRate()
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC instance
+ * - maxPayloadBytes : maximum size of the payload in bytes
+ * valid values are between 100 and 400 bytes
+ *
+ *
+ * Return value : 0 if sucessful
+ * -1 if error happens
+ */
+int16_t WebRtcIsacfix_SetMaxPayloadSize(ISACFIX_MainStruct* ISAC_main_inst,
+ int16_t maxPayloadBytes);
+/****************************************************************************
+ * WebRtcIsacfix_SetMaxRate(...)
+ *
+ * This function sets the maximum rate which the codec may not exceed for a
+ * singel packet. The maximum rate is set in bits per second.
+ * The codec has an absolute maximum rate of 53400 bits per second (200 bytes
+ * per 30 msec).
+ * It is possible to set a maximum rate between 32000 and 53400 bits per second.
+ *
+ * The rate limit is valid until next time the function is called.
+ *
+ * NOTE! Packet size will never go above the value set if calling
+ * WebRtcIsacfix_SetMaxPayloadSize() (default max packet size is 400 bytes).
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC instance
+ * - maxRateInBytes : maximum rate in bits per second,
+ * valid values are 32000 to 53400 bits
+ *
+ * Return value : 0 if sucessful
+ * -1 if error happens
+ */
- /****************************************************************************
- * WebRtcIsacfix_version(...)
- *
- * This function returns the version number.
- *
- * Output:
- * - version : Pointer to character string
- *
- */
+int16_t WebRtcIsacfix_SetMaxRate(ISACFIX_MainStruct* ISAC_main_inst,
+ int32_t maxRate);
- void WebRtcIsacfix_version(char *version);
+/****************************************************************************
+ * WebRtcIsacfix_CreateInternal(...)
+ *
+ * This function creates the memory that is used to store data in the encoder
+ *
+ * Input:
+ * - *ISAC_main_inst : a pointer to the coder instance.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
+int16_t WebRtcIsacfix_CreateInternal(ISACFIX_MainStruct* ISAC_main_inst);
- /****************************************************************************
- * WebRtcIsacfix_GetErrorCode(...)
- *
- * This function can be used to check the error code of an iSAC instance. When
- * a function returns -1 a error code will be set for that instance. The
- * function below extract the code of the last error that occured in the
- * specified instance.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance
- *
- * Return value : Error code
- */
+/****************************************************************************
+ * WebRtcIsacfix_FreeInternal(...)
+ *
+ * This function frees the internal memory for storing encoder data.
+ *
+ * Input:
+ * - ISAC_main_inst : an ISAC instance.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- int16_t WebRtcIsacfix_GetErrorCode(ISACFIX_MainStruct *ISAC_main_inst);
+int16_t WebRtcIsacfix_FreeInternal(ISACFIX_MainStruct* ISAC_main_inst);
+/****************************************************************************
+ * WebRtcIsacfix_GetNewBitStream(...)
+ *
+ * This function returns encoded data, with the recieved bwe-index in the
+ * stream. It should always return a complete packet, i.e. only called once
+ * even for 60 msec frames
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - bweIndex : index of bandwidth estimate to put in new
+ * bitstream - scale : factor for rate change (0.4 ~=> half the
+ * rate, 1 no change).
+ *
+ * Output:
+ * - encoded : the encoded data vector
+ *
+ * Return value : >0 - Length (in bytes) of coded data
+ * -1 - Error
+ */
- /****************************************************************************
- * WebRtcIsacfix_GetUplinkBw(...)
- *
- * This function return iSAC send bitrate
- *
- * Input:
- * - ISAC_main_inst : iSAC instance
- *
- * Return value : <0 Error code
- * else bitrate
- */
+int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct* ISAC_main_inst,
+ int16_t bweIndex,
+ float scale,
+ uint8_t* encoded);
- int32_t WebRtcIsacfix_GetUplinkBw(ISACFIX_MainStruct *ISAC_main_inst);
+/****************************************************************************
+ * WebRtcIsacfix_GetDownLinkBwIndex(...)
+ *
+ * This function returns index representing the Bandwidth estimate from
+ * other side to this side.
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC struct
+ *
+ * Output:
+ * - rateIndex : Bandwidth estimate to transmit to other side.
+ *
+ */
+int16_t WebRtcIsacfix_GetDownLinkBwIndex(ISACFIX_MainStruct* ISAC_main_inst,
+ int16_t* rateIndex);
- /****************************************************************************
- * WebRtcIsacfix_SetMaxPayloadSize(...)
- *
- * This function sets a limit for the maximum payload size of iSAC. The same
- * value is used both for 30 and 60 msec packets.
- * The absolute max will be valid until next time the function is called.
- * NOTE! This function may override the function WebRtcIsacfix_SetMaxRate()
- *
- * Input:
- * - ISAC_main_inst : iSAC instance
- * - maxPayloadBytes : maximum size of the payload in bytes
- * valid values are between 100 and 400 bytes
- *
- *
- * Return value : 0 if sucessful
- * -1 if error happens
- */
+/****************************************************************************
+ * WebRtcIsacfix_UpdateUplinkBw(...)
+ *
+ * This function takes an index representing the Bandwidth estimate from
+ * this side to other side and updates BWE.
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC struct
+ * - rateIndex : Bandwidth estimate from other side.
+ *
+ */
- int16_t WebRtcIsacfix_SetMaxPayloadSize(ISACFIX_MainStruct *ISAC_main_inst,
- int16_t maxPayloadBytes);
+int16_t WebRtcIsacfix_UpdateUplinkBw(ISACFIX_MainStruct* ISAC_main_inst,
+ int16_t rateIndex);
+/****************************************************************************
+ * WebRtcIsacfix_ReadBwIndex(...)
+ *
+ * This function returns the index of the Bandwidth estimate from the bitstream.
+ *
+ * Input:
+ * - encoded : Encoded bitstream
+ * - encoded_len_bytes : Length of the bitstream in bytes.
+ *
+ * Output:
+ * - rateIndex : Bandwidth estimate in bitstream
+ *
+ */
- /****************************************************************************
- * WebRtcIsacfix_SetMaxRate(...)
- *
- * This function sets the maximum rate which the codec may not exceed for a
- * singel packet. The maximum rate is set in bits per second.
- * The codec has an absolute maximum rate of 53400 bits per second (200 bytes
- * per 30 msec).
- * It is possible to set a maximum rate between 32000 and 53400 bits per second.
- *
- * The rate limit is valid until next time the function is called.
- *
- * NOTE! Packet size will never go above the value set if calling
- * WebRtcIsacfix_SetMaxPayloadSize() (default max packet size is 400 bytes).
- *
- * Input:
- * - ISAC_main_inst : iSAC instance
- * - maxRateInBytes : maximum rate in bits per second,
- * valid values are 32000 to 53400 bits
- *
- * Return value : 0 if sucessful
- * -1 if error happens
- */
+int16_t WebRtcIsacfix_ReadBwIndex(const uint8_t* encoded,
+ size_t encoded_len_bytes,
+ int16_t* rateIndex);
- int16_t WebRtcIsacfix_SetMaxRate(ISACFIX_MainStruct *ISAC_main_inst,
- int32_t maxRate);
+/****************************************************************************
+ * WebRtcIsacfix_GetNewFrameLen(...)
+ *
+ * This function return the next frame length (in samples) of iSAC.
+ *
+ * Input:
+ * -ISAC_main_inst : iSAC instance
+ *
+ * Return value : frame lenght in samples
+ */
- /****************************************************************************
- * WebRtcIsacfix_CreateInternal(...)
- *
- * This function creates the memory that is used to store data in the encoder
- *
- * Input:
- * - *ISAC_main_inst : a pointer to the coder instance.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+int16_t WebRtcIsacfix_GetNewFrameLen(ISACFIX_MainStruct* ISAC_main_inst);
- int16_t WebRtcIsacfix_CreateInternal(ISACFIX_MainStruct *ISAC_main_inst);
+/* Fills in an IsacBandwidthInfo struct. */
+void WebRtcIsacfix_GetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst,
+ IsacBandwidthInfo* bwinfo);
-
- /****************************************************************************
- * WebRtcIsacfix_FreeInternal(...)
- *
- * This function frees the internal memory for storing encoder data.
- *
- * Input:
- * - ISAC_main_inst : an ISAC instance.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
-
- int16_t WebRtcIsacfix_FreeInternal(ISACFIX_MainStruct *ISAC_main_inst);
-
-
- /****************************************************************************
- * WebRtcIsacfix_GetNewBitStream(...)
- *
- * This function returns encoded data, with the recieved bwe-index in the
- * stream. It should always return a complete packet, i.e. only called once
- * even for 60 msec frames
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - bweIndex : index of bandwidth estimate to put in new bitstream
- * - scale : factor for rate change (0.4 ~=> half the rate, 1 no change).
- *
- * Output:
- * - encoded : the encoded data vector
- *
- * Return value : >0 - Length (in bytes) of coded data
- * -1 - Error
- */
-
- int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct *ISAC_main_inst,
- int16_t bweIndex,
- float scale,
- uint8_t* encoded);
-
-
- /****************************************************************************
- * WebRtcIsacfix_GetDownLinkBwIndex(...)
- *
- * This function returns index representing the Bandwidth estimate from
- * other side to this side.
- *
- * Input:
- * - ISAC_main_inst : iSAC struct
- *
- * Output:
- * - rateIndex : Bandwidth estimate to transmit to other side.
- *
- */
-
- int16_t WebRtcIsacfix_GetDownLinkBwIndex(ISACFIX_MainStruct* ISAC_main_inst,
- int16_t* rateIndex);
-
-
- /****************************************************************************
- * WebRtcIsacfix_UpdateUplinkBw(...)
- *
- * This function takes an index representing the Bandwidth estimate from
- * this side to other side and updates BWE.
- *
- * Input:
- * - ISAC_main_inst : iSAC struct
- * - rateIndex : Bandwidth estimate from other side.
- *
- */
-
- int16_t WebRtcIsacfix_UpdateUplinkBw(ISACFIX_MainStruct* ISAC_main_inst,
- int16_t rateIndex);
-
-
- /****************************************************************************
- * WebRtcIsacfix_ReadBwIndex(...)
- *
- * This function returns the index of the Bandwidth estimate from the bitstream.
- *
- * Input:
- * - encoded : Encoded bitstream
- * - encoded_len_bytes : Length of the bitstream in bytes.
- *
- * Output:
- * - rateIndex : Bandwidth estimate in bitstream
- *
- */
-
- int16_t WebRtcIsacfix_ReadBwIndex(const uint8_t* encoded,
- size_t encoded_len_bytes,
- int16_t* rateIndex);
-
-
- /****************************************************************************
- * WebRtcIsacfix_GetNewFrameLen(...)
- *
- * This function return the next frame length (in samples) of iSAC.
- *
- * Input:
- * -ISAC_main_inst : iSAC instance
- *
- * Return value : frame lenght in samples
- */
-
- int16_t WebRtcIsacfix_GetNewFrameLen(ISACFIX_MainStruct *ISAC_main_inst);
-
- /* Fills in an IsacBandwidthInfo struct. */
- void WebRtcIsacfix_GetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst,
- IsacBandwidthInfo* bwinfo);
-
- /* Uses the values from an IsacBandwidthInfo struct. */
- void WebRtcIsacfix_SetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst,
- const IsacBandwidthInfo* bwinfo);
+/* Uses the values from an IsacBandwidthInfo struct. */
+void WebRtcIsacfix_SetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst,
+ const IsacBandwidthInfo* bwinfo);
#if defined(__cplusplus)
}
#endif
-
-
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_INCLUDE_ISACFIX_H_ */
diff --git a/modules/audio_coding/codecs/isac/fix/source/arith_routins.h b/modules/audio_coding/codecs/isac/fix/source/arith_routins.h
index 25eeecf..cc4ed55 100644
--- a/modules/audio_coding/codecs/isac/fix/source/arith_routins.h
+++ b/modules/audio_coding/codecs/isac/fix/source/arith_routins.h
@@ -35,12 +35,10 @@
* Return value : 0 if ok,
* <0 otherwise.
*/
-int WebRtcIsacfix_EncLogisticMulti2(
- Bitstr_enc *streamData,
- int16_t *dataQ7,
- const uint16_t *env,
- const int16_t lenData);
-
+int WebRtcIsacfix_EncLogisticMulti2(Bitstr_enc* streamData,
+ int16_t* dataQ7,
+ const uint16_t* env,
+ const int16_t lenData);
/****************************************************************************
* WebRtcIsacfix_EncTerminate(...)
@@ -53,8 +51,7 @@
*
* Return value : number of bytes in the stream
*/
-int16_t WebRtcIsacfix_EncTerminate(Bitstr_enc *streamData);
-
+int16_t WebRtcIsacfix_EncTerminate(Bitstr_enc* streamData);
/****************************************************************************
* WebRtcIsacfix_DecLogisticMulti2(...)
@@ -73,12 +70,10 @@
* Return value : number of bytes in the stream so far
* <0 if error detected
*/
-int WebRtcIsacfix_DecLogisticMulti2(
- int16_t *data,
- Bitstr_dec *streamData,
- const int32_t *env,
- const int16_t lenData);
-
+int WebRtcIsacfix_DecLogisticMulti2(int16_t* data,
+ Bitstr_dec* streamData,
+ const int32_t* env,
+ const int16_t lenData);
/****************************************************************************
* WebRtcIsacfix_EncHistMulti(...)
@@ -94,12 +89,10 @@
* Return value : 0 if ok
* <0 if error detected
*/
-int WebRtcIsacfix_EncHistMulti(
- Bitstr_enc *streamData,
- const int16_t *data,
- const uint16_t *const *cdf,
- const int16_t lenData);
-
+int WebRtcIsacfix_EncHistMulti(Bitstr_enc* streamData,
+ const int16_t* data,
+ const uint16_t* const* cdf,
+ const int16_t lenData);
/****************************************************************************
* WebRtcIsacfix_DecHistBisectMulti(...)
@@ -121,13 +114,11 @@
* Return value : number of bytes in the stream
* <0 if error detected
*/
-int16_t WebRtcIsacfix_DecHistBisectMulti(
- int16_t *data,
- Bitstr_dec *streamData,
- const uint16_t *const *cdf,
- const uint16_t *cdfSize,
- const int16_t lenData);
-
+int16_t WebRtcIsacfix_DecHistBisectMulti(int16_t* data,
+ Bitstr_dec* streamData,
+ const uint16_t* const* cdf,
+ const uint16_t* cdfSize,
+ const int16_t lenData);
/****************************************************************************
* WebRtcIsacfix_DecHistOneStepMulti(...)
@@ -149,11 +140,10 @@
* Return value : number of bytes in original stream
* <0 if error detected
*/
-int16_t WebRtcIsacfix_DecHistOneStepMulti(
- int16_t *data,
- Bitstr_dec *streamData,
- const uint16_t *const *cdf,
- const uint16_t *initIndex,
- const int16_t lenData);
+int16_t WebRtcIsacfix_DecHistOneStepMulti(int16_t* data,
+ Bitstr_dec* streamData,
+ const uint16_t* const* cdf,
+ const uint16_t* initIndex,
+ const int16_t lenData);
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_ARITH_ROUTINS_H_ */
diff --git a/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.h b/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.h
index 67f8d07..f8ac1ef 100644
--- a/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.h
+++ b/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.h
@@ -32,8 +32,7 @@
* Return value : 0
*/
-int32_t WebRtcIsacfix_InitBandwidthEstimator(BwEstimatorstr *bwest_str);
-
+int32_t WebRtcIsacfix_InitBandwidthEstimator(BwEstimatorstr* bwest_str);
/****************************************************************************
* WebRtcIsacfix_UpdateUplinkBwImpl(...)
@@ -56,16 +55,17 @@
* -1 otherwise
*/
-int32_t WebRtcIsacfix_UpdateUplinkBwImpl(BwEstimatorstr *bwest_str,
- const uint16_t rtp_number,
- const int16_t frameSize,
- const uint32_t send_ts,
- const uint32_t arr_ts,
- const size_t pksize,
- const uint16_t Index);
+int32_t WebRtcIsacfix_UpdateUplinkBwImpl(BwEstimatorstr* bwest_str,
+ const uint16_t rtp_number,
+ const int16_t frameSize,
+ const uint32_t send_ts,
+ const uint32_t arr_ts,
+ const size_t pksize,
+ const uint16_t Index);
-/* Update receiving estimates. Used when we only receive BWE index, no iSAC data packet. */
-int16_t WebRtcIsacfix_UpdateUplinkBwRec(BwEstimatorstr *bwest_str,
+/* Update receiving estimates. Used when we only receive BWE index, no iSAC data
+ * packet. */
+int16_t WebRtcIsacfix_UpdateUplinkBwRec(BwEstimatorstr* bwest_str,
const int16_t Index);
/****************************************************************************
@@ -80,19 +80,19 @@
* Return:
* bandwith and jitter index (0..23)
*/
-uint16_t WebRtcIsacfix_GetDownlinkBwIndexImpl(BwEstimatorstr *bwest_str);
+uint16_t WebRtcIsacfix_GetDownlinkBwIndexImpl(BwEstimatorstr* bwest_str);
/* Returns the bandwidth estimation (in bps) */
-uint16_t WebRtcIsacfix_GetDownlinkBandwidth(const BwEstimatorstr *bwest_str);
+uint16_t WebRtcIsacfix_GetDownlinkBandwidth(const BwEstimatorstr* bwest_str);
/* Returns the bandwidth that iSAC should send with in bps */
-int16_t WebRtcIsacfix_GetUplinkBandwidth(const BwEstimatorstr *bwest_str);
+int16_t WebRtcIsacfix_GetUplinkBandwidth(const BwEstimatorstr* bwest_str);
/* Returns the max delay (in ms) */
-int16_t WebRtcIsacfix_GetDownlinkMaxDelay(const BwEstimatorstr *bwest_str);
+int16_t WebRtcIsacfix_GetDownlinkMaxDelay(const BwEstimatorstr* bwest_str);
/* Returns the max delay value from the other side in ms */
-int16_t WebRtcIsacfix_GetUplinkMaxDelay(const BwEstimatorstr *bwest_str);
+int16_t WebRtcIsacfix_GetUplinkMaxDelay(const BwEstimatorstr* bwest_str);
/* Fills in an IsacExternalBandwidthInfo struct. */
void WebRtcIsacfixBw_GetBandwidthInfo(BwEstimatorstr* bwest_str,
@@ -106,29 +106,31 @@
* update amount of data in bottle neck buffer and burst handling
* returns minimum payload size (bytes)
*/
-uint16_t WebRtcIsacfix_GetMinBytes(RateModel *State,
- int16_t StreamSize, /* bytes in bitstream */
- const int16_t FrameLen, /* ms per frame */
- const int16_t BottleNeck, /* bottle neck rate; excl headers (bps) */
- const int16_t DelayBuildUp); /* max delay from bottle neck buffering (ms) */
+uint16_t WebRtcIsacfix_GetMinBytes(
+ RateModel* State,
+ int16_t StreamSize, /* bytes in bitstream */
+ const int16_t FrameLen, /* ms per frame */
+ const int16_t BottleNeck, /* bottle neck rate; excl headers (bps) */
+ const int16_t DelayBuildUp); /* max delay from bottle neck buffering (ms) */
/*
* update long-term average bitrate and amount of data in buffer
*/
-void WebRtcIsacfix_UpdateRateModel(RateModel *State,
- int16_t StreamSize, /* bytes in bitstream */
- const int16_t FrameSamples, /* samples per frame */
- const int16_t BottleNeck); /* bottle neck rate; excl headers (bps) */
+void WebRtcIsacfix_UpdateRateModel(
+ RateModel* State,
+ int16_t StreamSize, /* bytes in bitstream */
+ const int16_t FrameSamples, /* samples per frame */
+ const int16_t BottleNeck); /* bottle neck rate; excl headers (bps) */
-
-void WebRtcIsacfix_InitRateModel(RateModel *State);
+void WebRtcIsacfix_InitRateModel(RateModel* State);
/* Returns the new framelength value (input argument: bottle_neck) */
-int16_t WebRtcIsacfix_GetNewFrameLength(int16_t bottle_neck, int16_t current_framelength);
+int16_t WebRtcIsacfix_GetNewFrameLength(int16_t bottle_neck,
+ int16_t current_framelength);
/* Returns the new SNR value (input argument: bottle_neck) */
-//returns snr in Q10
+// returns snr in Q10
int16_t WebRtcIsacfix_GetSnr(int16_t bottle_neck, int16_t framesamples);
-
-#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_BANDWIDTH_ESTIMATOR_H_ */
+#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_BANDWIDTH_ESTIMATOR_H_ \
+ */
diff --git a/modules/audio_coding/codecs/isac/fix/source/codec.h b/modules/audio_coding/codecs/isac/fix/source/codec.h
index 9876bd6..c95b53f 100644
--- a/modules/audio_coding/codecs/isac/fix/source/codec.h
+++ b/modules/audio_coding/codecs/isac/fix/source/codec.h
@@ -38,7 +38,7 @@
void WebRtcIsacfix_DecodePlcImpl(int16_t* decoded,
IsacFixDecoderInstance* ISACdec_obj,
- size_t* current_framesample );
+ size_t* current_framesample);
int WebRtcIsacfix_EncodeImpl(int16_t* in,
IsacFixEncoderInstance* ISACenc_obj,
@@ -64,7 +64,6 @@
void WebRtcIsacfix_InitPlc(PLCstr* State);
-
/* transform functions */
void WebRtcIsacfix_InitTransform(void);
diff --git a/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h b/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h
index ba7bcde..b4251ce 100644
--- a/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h
+++ b/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h
@@ -22,91 +22,79 @@
#include "modules/audio_coding/codecs/isac/fix/source/structs.h"
/* decode complex spectrum (return number of bytes in stream) */
-int WebRtcIsacfix_DecodeSpec(Bitstr_dec *streamdata,
- int16_t *frQ7,
- int16_t *fiQ7,
+int WebRtcIsacfix_DecodeSpec(Bitstr_dec* streamdata,
+ int16_t* frQ7,
+ int16_t* fiQ7,
int16_t AvgPitchGain_Q12);
/* encode complex spectrum */
-int WebRtcIsacfix_EncodeSpec(const int16_t *fr,
- const int16_t *fi,
- Bitstr_enc *streamdata,
+int WebRtcIsacfix_EncodeSpec(const int16_t* fr,
+ const int16_t* fi,
+ Bitstr_enc* streamdata,
int16_t AvgPitchGain_Q12);
-
/* decode & dequantize LPC Coef */
-int WebRtcIsacfix_DecodeLpcCoef(Bitstr_dec *streamdata,
- int32_t *LPCCoefQ17,
- int32_t *gain_lo_hiQ17,
- int16_t *outmodel);
+int WebRtcIsacfix_DecodeLpcCoef(Bitstr_dec* streamdata,
+ int32_t* LPCCoefQ17,
+ int32_t* gain_lo_hiQ17,
+ int16_t* outmodel);
-int WebRtcIsacfix_DecodeLpc(int32_t *gain_lo_hiQ17,
- int16_t *LPCCoef_loQ15,
- int16_t *LPCCoef_hiQ15,
- Bitstr_dec *streamdata,
- int16_t *outmodel);
+int WebRtcIsacfix_DecodeLpc(int32_t* gain_lo_hiQ17,
+ int16_t* LPCCoef_loQ15,
+ int16_t* LPCCoef_hiQ15,
+ Bitstr_dec* streamdata,
+ int16_t* outmodel);
/* quantize & code LPC Coef */
-int WebRtcIsacfix_EncodeLpc(int32_t *gain_lo_hiQ17,
- int16_t *LPCCoef_loQ15,
- int16_t *LPCCoef_hiQ15,
- int16_t *model,
- int32_t *sizeQ11,
- Bitstr_enc *streamdata,
+int WebRtcIsacfix_EncodeLpc(int32_t* gain_lo_hiQ17,
+ int16_t* LPCCoef_loQ15,
+ int16_t* LPCCoef_hiQ15,
+ int16_t* model,
+ int32_t* sizeQ11,
+ Bitstr_enc* streamdata,
IsacSaveEncoderData* encData,
- transcode_obj *transcodeParam);
+ transcode_obj* transcodeParam);
-int WebRtcIsacfix_EstCodeLpcGain(int32_t *gain_lo_hiQ17,
- Bitstr_enc *streamdata,
+int WebRtcIsacfix_EstCodeLpcGain(int32_t* gain_lo_hiQ17,
+ Bitstr_enc* streamdata,
IsacSaveEncoderData* encData);
/* decode & dequantize RC */
-int WebRtcIsacfix_DecodeRcCoef(Bitstr_dec *streamdata,
- int16_t *RCQ15);
+int WebRtcIsacfix_DecodeRcCoef(Bitstr_dec* streamdata, int16_t* RCQ15);
/* quantize & code RC */
-int WebRtcIsacfix_EncodeRcCoef(int16_t *RCQ15,
- Bitstr_enc *streamdata);
+int WebRtcIsacfix_EncodeRcCoef(int16_t* RCQ15, Bitstr_enc* streamdata);
/* decode & dequantize squared Gain */
-int WebRtcIsacfix_DecodeGain2(Bitstr_dec *streamdata,
- int32_t *Gain2);
+int WebRtcIsacfix_DecodeGain2(Bitstr_dec* streamdata, int32_t* Gain2);
/* quantize & code squared Gain (input is squared gain) */
-int WebRtcIsacfix_EncodeGain2(int32_t *gain2,
- Bitstr_enc *streamdata);
+int WebRtcIsacfix_EncodeGain2(int32_t* gain2, Bitstr_enc* streamdata);
-int WebRtcIsacfix_EncodePitchGain(int16_t *PitchGains_Q12,
- Bitstr_enc *streamdata,
+int WebRtcIsacfix_EncodePitchGain(int16_t* PitchGains_Q12,
+ Bitstr_enc* streamdata,
IsacSaveEncoderData* encData);
-int WebRtcIsacfix_EncodePitchLag(int16_t *PitchLagQ7,
- int16_t *PitchGain_Q12,
- Bitstr_enc *streamdata,
+int WebRtcIsacfix_EncodePitchLag(int16_t* PitchLagQ7,
+ int16_t* PitchGain_Q12,
+ Bitstr_enc* streamdata,
IsacSaveEncoderData* encData);
-int WebRtcIsacfix_DecodePitchGain(Bitstr_dec *streamdata,
- int16_t *PitchGain_Q12);
+int WebRtcIsacfix_DecodePitchGain(Bitstr_dec* streamdata,
+ int16_t* PitchGain_Q12);
-int WebRtcIsacfix_DecodePitchLag(Bitstr_dec *streamdata,
- int16_t *PitchGain_Q12,
- int16_t *PitchLagQ7);
+int WebRtcIsacfix_DecodePitchLag(Bitstr_dec* streamdata,
+ int16_t* PitchGain_Q12,
+ int16_t* PitchLagQ7);
-int WebRtcIsacfix_DecodeFrameLen(Bitstr_dec *streamdata,
- size_t *framelength);
+int WebRtcIsacfix_DecodeFrameLen(Bitstr_dec* streamdata, size_t* framelength);
+int WebRtcIsacfix_EncodeFrameLen(int16_t framelength, Bitstr_enc* streamdata);
-int WebRtcIsacfix_EncodeFrameLen(int16_t framelength,
- Bitstr_enc *streamdata);
+int WebRtcIsacfix_DecodeSendBandwidth(Bitstr_dec* streamdata, int16_t* BWno);
-int WebRtcIsacfix_DecodeSendBandwidth(Bitstr_dec *streamdata,
- int16_t *BWno);
+int WebRtcIsacfix_EncodeReceiveBandwidth(int16_t* BWno, Bitstr_enc* streamdata);
-
-int WebRtcIsacfix_EncodeReceiveBandwidth(int16_t *BWno,
- Bitstr_enc *streamdata);
-
-void WebRtcIsacfix_TranscodeLpcCoef(int32_t *tmpcoeffs_gQ6,
- int16_t *index_gQQ);
+void WebRtcIsacfix_TranscodeLpcCoef(int32_t* tmpcoeffs_gQ6, int16_t* index_gQQ);
// Pointer functions for LPC transforms.
diff --git a/modules/audio_coding/codecs/isac/fix/source/fft.h b/modules/audio_coding/codecs/isac/fix/source/fft.h
index 61ec515..4fe9b96 100644
--- a/modules/audio_coding/codecs/isac/fix/source/fft.h
+++ b/modules/audio_coding/codecs/isac/fix/source/fft.h
@@ -32,8 +32,8 @@
#include "modules/audio_coding/codecs/isac/fix/source/structs.h"
-int16_t WebRtcIsacfix_FftRadix16Fastest(int16_t RexQx[], int16_t ImxQx[], int16_t iSign);
-
-
+int16_t WebRtcIsacfix_FftRadix16Fastest(int16_t RexQx[],
+ int16_t ImxQx[],
+ int16_t iSign);
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_FFT_H_ */
diff --git a/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h b/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h
index 1c34969..8d97347 100644
--- a/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h
+++ b/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h
@@ -42,44 +42,41 @@
#endif
typedef void (*AllpassFilter2FixDec16)(
- int16_t *data_ch1, // Input and output in channel 1, in Q0
- int16_t *data_ch2, // Input and output in channel 2, in Q0
- const int16_t *factor_ch1, // Scaling factor for channel 1, in Q15
- const int16_t *factor_ch2, // Scaling factor for channel 2, in Q15
+ int16_t* data_ch1, // Input and output in channel 1, in Q0
+ int16_t* data_ch2, // Input and output in channel 2, in Q0
+ const int16_t* factor_ch1, // Scaling factor for channel 1, in Q15
+ const int16_t* factor_ch2, // Scaling factor for channel 2, in Q15
const int length, // Length of the data buffers
- int32_t *filter_state_ch1, // Filter state for channel 1, in Q16
- int32_t *filter_state_ch2); // Filter state for channel 2, in Q16
+ int32_t* filter_state_ch1, // Filter state for channel 1, in Q16
+ int32_t* filter_state_ch2); // Filter state for channel 2, in Q16
extern AllpassFilter2FixDec16 WebRtcIsacfix_AllpassFilter2FixDec16;
-void WebRtcIsacfix_AllpassFilter2FixDec16C(
- int16_t *data_ch1,
- int16_t *data_ch2,
- const int16_t *factor_ch1,
- const int16_t *factor_ch2,
- const int length,
- int32_t *filter_state_ch1,
- int32_t *filter_state_ch2);
+void WebRtcIsacfix_AllpassFilter2FixDec16C(int16_t* data_ch1,
+ int16_t* data_ch2,
+ const int16_t* factor_ch1,
+ const int16_t* factor_ch2,
+ const int length,
+ int32_t* filter_state_ch1,
+ int32_t* filter_state_ch2);
#if defined(WEBRTC_HAS_NEON)
-void WebRtcIsacfix_AllpassFilter2FixDec16Neon(
- int16_t *data_ch1,
- int16_t *data_ch2,
- const int16_t *factor_ch1,
- const int16_t *factor_ch2,
- const int length,
- int32_t *filter_state_ch1,
- int32_t *filter_state_ch2);
+void WebRtcIsacfix_AllpassFilter2FixDec16Neon(int16_t* data_ch1,
+ int16_t* data_ch2,
+ const int16_t* factor_ch1,
+ const int16_t* factor_ch2,
+ const int length,
+ int32_t* filter_state_ch1,
+ int32_t* filter_state_ch2);
#endif
#if defined(MIPS_DSP_R1_LE)
-void WebRtcIsacfix_AllpassFilter2FixDec16MIPS(
- int16_t *data_ch1,
- int16_t *data_ch2,
- const int16_t *factor_ch1,
- const int16_t *factor_ch2,
- const int length,
- int32_t *filter_state_ch1,
- int32_t *filter_state_ch2);
+void WebRtcIsacfix_AllpassFilter2FixDec16MIPS(int16_t* data_ch1,
+ int16_t* data_ch2,
+ const int16_t* factor_ch1,
+ const int16_t* factor_ch2,
+ const int length,
+ int32_t* filter_state_ch1,
+ int32_t* filter_state_ch2);
#endif
#if defined(__cplusplus) || defined(c_plusplus)
diff --git a/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc b/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc
index d17f4a5..0727d58 100644
--- a/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc
+++ b/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc
@@ -21,8 +21,8 @@
protected:
// Pass a function pointer to the Tester function.
void RTC_NO_SANITIZE("signed-integer-overflow") // bugs.webrtc.org/5513
- CalculateResidualEnergyTester(AllpassFilter2FixDec16
- AllpassFilter2FixDec16Function) {
+ CalculateResidualEnergyTester(
+ AllpassFilter2FixDec16 AllpassFilter2FixDec16Function) {
const int kSamples = QLOOKAHEAD;
const int kState = 2;
int16_t data_ch1[kSamples] = {0};
@@ -31,12 +31,14 @@
int32_t state_ch2[kState] = {0};
const int32_t out_state_ch1[kState] = {-809122714, 1645972152};
const int32_t out_state_ch2[kState] = {428019288, 1057309936};
- const int32_t out_data_ch1[kSamples] = {0, 0, 347, 10618, 16718, -7089,
- 32767, 16913, 27042, 8377, -22973, -28372, -27603, -14804, 398, -25332,
- -11200, 18044, 25223, -6839, 1116, -23984, 32717, 7364};
- const int32_t out_data_ch2[kSamples] = {0, 0, 3010, 22351, 21106, 16969,
- -2095, -664, 3513, -30980, 32767, -23839, 13335, 20289, -6831, 339,
- -17207, 32767, 4959, 6177, 32767, 16599, -4747, 20504};
+ const int32_t out_data_ch1[kSamples] = {
+ 0, 0, 347, 10618, 16718, -7089, 32767, 16913,
+ 27042, 8377, -22973, -28372, -27603, -14804, 398, -25332,
+ -11200, 18044, 25223, -6839, 1116, -23984, 32717, 7364};
+ const int32_t out_data_ch2[kSamples] = {
+ 0, 0, 3010, 22351, 21106, 16969, -2095, -664,
+ 3513, -30980, 32767, -23839, 13335, 20289, -6831, 339,
+ -17207, 32767, 4959, 6177, 32767, 16599, -4747, 20504};
int sign = 1;
for (int i = 0; i < kSamples; i++) {
@@ -46,13 +48,9 @@
// UBSan: -1 * -2147483648 cannot be represented in type 'int'
};
- AllpassFilter2FixDec16Function(data_ch1,
- data_ch2,
- WebRtcIsacfix_kUpperApFactorsQ15,
- WebRtcIsacfix_kLowerApFactorsQ15,
- kSamples,
- state_ch1,
- state_ch2);
+ AllpassFilter2FixDec16Function(
+ data_ch1, data_ch2, WebRtcIsacfix_kUpperApFactorsQ15,
+ WebRtcIsacfix_kLowerApFactorsQ15, kSamples, state_ch1, state_ch2);
for (int i = 0; i < kSamples; i++) {
EXPECT_EQ(out_data_ch1[i], data_ch1[i]);
@@ -77,13 +75,13 @@
int16_t in[kSamples];
int32_t state[2] = {12345, 987654};
#ifdef WEBRTC_ARCH_ARM_V7
- int32_t out[kSamples] = {-1040, -1035, -22875, -1397, -27604, 20018, 7917,
- -1279, -8552, -14494, -7558, -23537, -27258, -30554, -32768, -3432, -32768,
- 25215, -27536, 22436};
+ int32_t out[kSamples] = {-1040, -1035, -22875, -1397, -27604, 20018, 7917,
+ -1279, -8552, -14494, -7558, -23537, -27258, -30554,
+ -32768, -3432, -32768, 25215, -27536, 22436};
#else
- int32_t out[kSamples] = {-1040, -1035, -22875, -1397, -27604, 20017, 7915,
- -1280, -8554, -14496, -7561, -23541, -27263, -30560, -32768, -3441, -32768,
- 25203, -27550, 22419};
+ int32_t out[kSamples] = {-1040, -1035, -22875, -1397, -27604, 20017, 7915,
+ -1280, -8554, -14496, -7561, -23541, -27263, -30560,
+ -32768, -3441, -32768, 25203, -27550, 22419};
#endif
HighpassFilterFixDec32 WebRtcIsacfix_HighpassFilterFixDec32;
#if defined(MIPS_DSP_R1_LE)
@@ -98,7 +96,7 @@
}
WebRtcIsacfix_HighpassFilterFixDec32(in, kSamples,
- WebRtcIsacfix_kHPStCoeffOut1Q30, state);
+ WebRtcIsacfix_kHPStCoeffOut1Q30, state);
for (int i = 0; i < kSamples; i++) {
EXPECT_EQ(out[i], in[i]);
diff --git a/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc b/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc
index fa52986..2ab8d6a 100644
--- a/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc
+++ b/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc
@@ -23,34 +23,37 @@
int32_t r_buffer[kOrder + 2] = {0};
// Test an overflow case.
- const int16_t x_buffer_0[kBuffer] = {0, 0, 3010, 22351, 21106, 16969, -2095,
- -664, 3513, -30980, 32767, -23839, 13335, 20289, -6831, 339, -17207,
- 32767, 4959, 6177, 32767, 16599, -4747, 20504, 3513, -30980, 32767,
- -23839, 13335, 20289, 0, -16969, -2095, -664, 3513, 31981, 32767,
- -13839, 23336, 30281};
- const int32_t r_expected_0[kOrder + 2] = {1872498461, -224288754, 203789985,
- 483400487, -208272635, 2436500, 137785322, 266600814, -208486262,
- 329510080, 137949184, -161738972, -26894267, 237630192};
+ const int16_t x_buffer_0[kBuffer] = {
+ 0, 0, 3010, 22351, 21106, 16969, -2095, -664,
+ 3513, -30980, 32767, -23839, 13335, 20289, -6831, 339,
+ -17207, 32767, 4959, 6177, 32767, 16599, -4747, 20504,
+ 3513, -30980, 32767, -23839, 13335, 20289, 0, -16969,
+ -2095, -664, 3513, 31981, 32767, -13839, 23336, 30281};
+ const int32_t r_expected_0[kOrder + 2] = {
+ 1872498461, -224288754, 203789985, 483400487, -208272635,
+ 2436500, 137785322, 266600814, -208486262, 329510080,
+ 137949184, -161738972, -26894267, 237630192};
- WebRtcIsacfix_AutocorrFixFunction(r_buffer, x_buffer_0,
- kBuffer, kOrder + 1, &scale);
+ WebRtcIsacfix_AutocorrFixFunction(r_buffer, x_buffer_0, kBuffer, kOrder + 1,
+ &scale);
for (int i = 0; i < kOrder + 2; i++) {
EXPECT_EQ(r_expected_0[i], r_buffer[i]);
}
EXPECT_EQ(3, scale);
// Test a no-overflow case.
- const int16_t x_buffer_1[kBuffer] = {0, 0, 300, 21, 206, 169, -295,
- -664, 3513, -300, 327, -29, 15, 289, -6831, 339, -107,
- 37, 59, 6177, 327, 169, -4747, 204, 313, -980, 767,
- -9, 135, 289, 0, -6969, -2095, -664, 0, 1, 7,
- -39, 236, 281};
- const int32_t r_expected_1[kOrder + 2] = {176253864, 8126617, 1983287,
- -26196788, -3487363, -42839676, -24644043, 3469813, 30559879, 31905045,
- 5101567, 29328896, -55787438, -13163978};
+ const int16_t x_buffer_1[kBuffer] = {
+ 0, 0, 300, 21, 206, 169, -295, -664, 3513, -300,
+ 327, -29, 15, 289, -6831, 339, -107, 37, 59, 6177,
+ 327, 169, -4747, 204, 313, -980, 767, -9, 135, 289,
+ 0, -6969, -2095, -664, 0, 1, 7, -39, 236, 281};
+ const int32_t r_expected_1[kOrder + 2] = {
+ 176253864, 8126617, 1983287, -26196788, -3487363,
+ -42839676, -24644043, 3469813, 30559879, 31905045,
+ 5101567, 29328896, -55787438, -13163978};
- WebRtcIsacfix_AutocorrFixFunction(r_buffer, x_buffer_1,
- kBuffer, kOrder + 1, &scale);
+ WebRtcIsacfix_AutocorrFixFunction(r_buffer, x_buffer_1, kBuffer, kOrder + 1,
+ &scale);
for (int i = 0; i < kOrder + 2; i++) {
EXPECT_EQ(r_expected_1[i], r_buffer[i]);
}
diff --git a/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.h b/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.h
index d6d1e8f..40a99e8 100644
--- a/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.h
+++ b/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.h
@@ -24,19 +24,19 @@
#include "modules/audio_coding/codecs/isac/fix/source/structs.h"
-void WebRtcIsacfix_GetVars(const int16_t *input,
- const int16_t *pitchGains_Q12,
- uint32_t *oldEnergy,
- int16_t *varscale);
+void WebRtcIsacfix_GetVars(const int16_t* input,
+ const int16_t* pitchGains_Q12,
+ uint32_t* oldEnergy,
+ int16_t* varscale);
-void WebRtcIsacfix_GetLpcCoef(int16_t *inLoQ0,
- int16_t *inHiQ0,
- MaskFiltstr_enc *maskdata,
+void WebRtcIsacfix_GetLpcCoef(int16_t* inLoQ0,
+ int16_t* inHiQ0,
+ MaskFiltstr_enc* maskdata,
int16_t snrQ10,
- const int16_t *pitchGains_Q12,
- int32_t *gain_lo_hiQ17,
- int16_t *lo_coeffQ15,
- int16_t *hi_coeffQ15);
+ const int16_t* pitchGains_Q12,
+ int32_t* gain_lo_hiQ17,
+ int16_t* lo_coeffQ15,
+ int16_t* hi_coeffQ15);
typedef int32_t (*CalculateResidualEnergy)(int lpc_order,
int32_t q_val_corr,
diff --git a/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model_unittest.cc b/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model_unittest.cc
index 1604cc4..dbcf420 100644
--- a/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model_unittest.cc
+++ b/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model_unittest.cc
@@ -16,21 +16,21 @@
class LpcMaskingModelTest : public testing::Test {
protected:
// Pass a function pointer to the Tester function.
- void CalculateResidualEnergyTester(CalculateResidualEnergy
- CalculateResidualEnergyFunction) {
+ void CalculateResidualEnergyTester(
+ CalculateResidualEnergy CalculateResidualEnergyFunction) {
const int kIntOrder = 10;
const int32_t kInt32QDomain = 5;
const int kIntShift = 11;
- int16_t a[kIntOrder + 1] = {32760, 122, 7, 0, -32760, -3958,
- -48, 18745, 498, 9, 23456};
- int32_t corr[kIntOrder + 1] = {11443647, -27495, 0,
- 98745, -11443600, 1, 1, 498, 9, 888, 23456};
+ int16_t a[kIntOrder + 1] = {32760, 122, 7, 0, -32760, -3958,
+ -48, 18745, 498, 9, 23456};
+ int32_t corr[kIntOrder + 1] = {11443647, -27495, 0, 98745, -11443600, 1,
+ 1, 498, 9, 888, 23456};
int q_shift_residual = 0;
int32_t residual_energy = 0;
// Test the code path where (residual_energy >= 0x10000).
- residual_energy = CalculateResidualEnergyFunction(kIntOrder,
- kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
+ residual_energy = CalculateResidualEnergyFunction(
+ kIntOrder, kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
EXPECT_EQ(1789023310, residual_energy);
EXPECT_EQ(2, q_shift_residual);
@@ -40,8 +40,8 @@
a[i] = 24575 >> i;
corr[i] = i;
}
- residual_energy = CalculateResidualEnergyFunction(kIntOrder,
- kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
+ residual_energy = CalculateResidualEnergyFunction(
+ kIntOrder, kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
EXPECT_EQ(1595279092, residual_energy);
EXPECT_EQ(26, q_shift_residual);
@@ -49,8 +49,8 @@
for (int i = 0; i < kIntOrder + 1; i++) {
a[i] = 2457 >> i;
}
- residual_energy = CalculateResidualEnergyFunction(kIntOrder,
- kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
+ residual_energy = CalculateResidualEnergyFunction(
+ kIntOrder, kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
EXPECT_EQ(2029266944, residual_energy);
EXPECT_EQ(33, q_shift_residual);
}
diff --git a/modules/audio_coding/codecs/isac/fix/source/lpc_tables.h b/modules/audio_coding/codecs/isac/fix/source/lpc_tables.h
index 05c53dd..c51f2ca 100644
--- a/modules/audio_coding/codecs/isac/fix/source/lpc_tables.h
+++ b/modules/audio_coding/codecs/isac/fix/source/lpc_tables.h
@@ -26,10 +26,10 @@
extern const uint16_t WebRtcIsacfix_kSelIndShape[108];
/* cdf array for model indicator */
-extern const uint16_t WebRtcIsacfix_kModelCdf[KLT_NUM_MODELS+1];
+extern const uint16_t WebRtcIsacfix_kModelCdf[KLT_NUM_MODELS + 1];
/* pointer to cdf array for model indicator */
-extern const uint16_t *WebRtcIsacfix_kModelCdfPtr[1];
+extern const uint16_t* WebRtcIsacfix_kModelCdfPtr[1];
/* initial cdf index for decoder of model indicator */
extern const uint16_t WebRtcIsacfix_kModelInitIndex[1];
@@ -70,9 +70,9 @@
extern const uint16_t WebRtcIsacfix_kCdfShape[2059];
/* pointers to cdf tables for quantizer indices */
-extern const uint16_t *WebRtcIsacfix_kCdfGainPtr[KLT_NUM_MODELS][12];
+extern const uint16_t* WebRtcIsacfix_kCdfGainPtr[KLT_NUM_MODELS][12];
-extern const uint16_t *WebRtcIsacfix_kCdfShapePtr[KLT_NUM_MODELS][108];
+extern const uint16_t* WebRtcIsacfix_kCdfShapePtr[KLT_NUM_MODELS][108];
/* code length for all coefficients using different models */
extern const int16_t WebRtcIsacfix_kCodeLenGainQ11[392];
diff --git a/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h b/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h
index 994cce7..4303c82 100644
--- a/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h
+++ b/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h
@@ -20,21 +20,22 @@
#include "modules/audio_coding/codecs/isac/fix/source/structs.h"
-void WebRtcIsacfix_PitchAnalysis(const int16_t *in, /* PITCH_FRAME_LEN samples */
- int16_t *outQ0, /* PITCH_FRAME_LEN+QLOOKAHEAD samples */
- PitchAnalysisStruct *State,
- int16_t *lagsQ7,
- int16_t *PitchGains_Q12);
+void WebRtcIsacfix_PitchAnalysis(
+ const int16_t* in, /* PITCH_FRAME_LEN samples */
+ int16_t* outQ0, /* PITCH_FRAME_LEN+QLOOKAHEAD samples */
+ PitchAnalysisStruct* State,
+ int16_t* lagsQ7,
+ int16_t* PitchGains_Q12);
-void WebRtcIsacfix_InitialPitch(const int16_t *in,
- PitchAnalysisStruct *State,
- int16_t *qlags);
+void WebRtcIsacfix_InitialPitch(const int16_t* in,
+ PitchAnalysisStruct* State,
+ int16_t* qlags);
-void WebRtcIsacfix_PitchFilter(int16_t *indatFix,
- int16_t *outdatQQ,
- PitchFiltstr *pfp,
- int16_t *lagsQ7,
- int16_t *gainsQ12,
+void WebRtcIsacfix_PitchFilter(int16_t* indatFix,
+ int16_t* outdatQQ,
+ PitchFiltstr* pfp,
+ int16_t* lagsQ7,
+ int16_t* gainsQ12,
int16_t type);
void WebRtcIsacfix_PitchFilterCore(int loopNumber,
@@ -48,17 +49,18 @@
int16_t* outputBuf,
int* index2);
-void WebRtcIsacfix_PitchFilterGains(const int16_t *indatQ0,
- PitchFiltstr *pfp,
- int16_t *lagsQ7,
- int16_t *gainsQ12);
+void WebRtcIsacfix_PitchFilterGains(const int16_t* indatQ0,
+ PitchFiltstr* pfp,
+ int16_t* lagsQ7,
+ int16_t* gainsQ12);
-void WebRtcIsacfix_DecimateAllpass32(const int16_t *in,
- int32_t *state_in, /* array of size: 2*ALLPASSSECTIONS+1 */
- int16_t N, /* number of input samples */
- int16_t *out); /* array of size N/2 */
+void WebRtcIsacfix_DecimateAllpass32(
+ const int16_t* in,
+ int32_t* state_in, /* array of size: 2*ALLPASSSECTIONS+1 */
+ int16_t N, /* number of input samples */
+ int16_t* out); /* array of size N/2 */
-int32_t WebRtcIsacfix_Log2Q8( uint32_t x );
+int32_t WebRtcIsacfix_Log2Q8(uint32_t x);
void WebRtcIsacfix_PCorr2Q32(const int16_t* in, int32_t* logcorQ8);
diff --git a/modules/audio_coding/codecs/isac/fix/source/pitch_gain_tables.h b/modules/audio_coding/codecs/isac/fix/source/pitch_gain_tables.h
index fe4d288..2b5f54e 100644
--- a/modules/audio_coding/codecs/isac/fix/source/pitch_gain_tables.h
+++ b/modules/audio_coding/codecs/isac/fix/source/pitch_gain_tables.h
@@ -11,7 +11,8 @@
/*
* pitch_gain_tables.h
*
- * This file contains tables for the pitch filter side-info in the entropy coder.
+ * This file contains tables for the pitch filter side-info in the entropy
+ * coder.
*
*/
@@ -20,7 +21,8 @@
#include "typedefs.h" // NOLINT(build/include)
-/********************* Pitch Filter Gain Coefficient Tables ************************/
+/********************* Pitch Filter Gain Coefficient Tables
+ * ************************/
/* cdf for quantized pitch filter gains */
extern const uint16_t WebRtcIsacfix_kPitchGainCdf[255];
diff --git a/modules/audio_coding/codecs/isac/fix/source/pitch_lag_tables.h b/modules/audio_coding/codecs/isac/fix/source/pitch_lag_tables.h
index a8c0c3a..f834eab 100644
--- a/modules/audio_coding/codecs/isac/fix/source/pitch_lag_tables.h
+++ b/modules/audio_coding/codecs/isac/fix/source/pitch_lag_tables.h
@@ -11,7 +11,8 @@
/*
* pitch_lag_tables.h
*
- * This file contains tables for the pitch filter side-info in the entropy coder.
+ * This file contains tables for the pitch filter side-info in the entropy
+ * coder.
*
*/
@@ -20,7 +21,8 @@
#include "typedefs.h" // NOLINT(build/include)
-/********************* Pitch Filter Lag Coefficient Tables ************************/
+/********************* Pitch Filter Lag Coefficient Tables
+ * ************************/
/* tables for use with small pitch gain */
@@ -30,7 +32,7 @@
extern const uint16_t WebRtcIsacfix_kPitchLagCdf3Lo[2];
extern const uint16_t WebRtcIsacfix_kPitchLagCdf4Lo[10];
-extern const uint16_t *WebRtcIsacfix_kPitchLagPtrLo[4];
+extern const uint16_t* WebRtcIsacfix_kPitchLagPtrLo[4];
/* size of first cdf table */
extern const uint16_t WebRtcIsacfix_kPitchLagSizeLo[1];
@@ -46,8 +48,6 @@
extern const int16_t WebRtcIsacfix_kMeanLag2Lo[19];
extern const int16_t WebRtcIsacfix_kMeanLag4Lo[9];
-
-
/* tables for use with medium pitch gain */
/* cdfs for quantized pitch lags */
@@ -56,7 +56,7 @@
extern const uint16_t WebRtcIsacfix_kPitchLagCdf3Mid[2];
extern const uint16_t WebRtcIsacfix_kPitchLagCdf4Mid[20];
-extern const uint16_t *WebRtcIsacfix_kPitchLagPtrMid[4];
+extern const uint16_t* WebRtcIsacfix_kPitchLagPtrMid[4];
/* size of first cdf table */
extern const uint16_t WebRtcIsacfix_kPitchLagSizeMid[1];
@@ -72,7 +72,6 @@
extern const int16_t WebRtcIsacfix_kMeanLag2Mid[35];
extern const int16_t WebRtcIsacfix_kMeanLag4Mid[19];
-
/* tables for use with large pitch gain */
/* cdfs for quantized pitch lags */
@@ -81,7 +80,7 @@
extern const uint16_t WebRtcIsacfix_kPitchLagCdf3Hi[2];
extern const uint16_t WebRtcIsacfix_kPitchLagCdf4Hi[35];
-extern const uint16_t *WebRtcIsacfix_kPitchLagPtrHi[4];
+extern const uint16_t* WebRtcIsacfix_kPitchLagPtrHi[4];
/* size of first cdf table */
extern const uint16_t WebRtcIsacfix_kPitchLagSizeHi[1];
@@ -97,5 +96,4 @@
extern const int16_t WebRtcIsacfix_kMeanLag2Hi[67];
extern const int16_t WebRtcIsacfix_kMeanLag4Hi[34];
-
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_PITCH_LAG_TABLES_H_ */
diff --git a/modules/audio_coding/codecs/isac/fix/source/settings.h b/modules/audio_coding/codecs/isac/fix/source/settings.h
index 34c0efe..03a2d05 100644
--- a/modules/audio_coding/codecs/isac/fix/source/settings.h
+++ b/modules/audio_coding/codecs/isac/fix/source/settings.h
@@ -18,84 +18,82 @@
#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_SETTINGS_H_
#define MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_SETTINGS_H_
-
/* sampling frequency (Hz) */
-#define FS 16000
+#define FS 16000
/* 1.5 times Sampling frequency */
-#define FS_1_HALF (uint32_t) 24000
+#define FS_1_HALF (uint32_t)24000
/* Three times Sampling frequency */
-#define FS3 (uint32_t) 48000
+#define FS3 (uint32_t)48000
/* Eight times Sampling frequency */
-#define FS8 (uint32_t) 128000
+#define FS8 (uint32_t)128000
/* number of samples per frame (either 480 (30ms) or 960 (60ms)) */
-#define INITIAL_FRAMESAMPLES 960
+#define INITIAL_FRAMESAMPLES 960
/* miliseconds */
-#define FRAMESIZE 30
+#define FRAMESIZE 30
/* number of samples per frame processed in the encoder (30ms) */
-#define FRAMESAMPLES 480 /* ((FRAMESIZE*FS)/1000) */
-#define FRAMESAMPLES_HALF 240
+#define FRAMESAMPLES 480 /* ((FRAMESIZE*FS)/1000) */
+#define FRAMESAMPLES_HALF 240
/* max number of samples per frame (= 60 ms frame) */
-#define MAX_FRAMESAMPLES 960
+#define MAX_FRAMESAMPLES 960
/* number of samples per 10ms frame */
-#define FRAMESAMPLES_10ms 160 /* ((10*FS)/1000) */
+#define FRAMESAMPLES_10ms 160 /* ((10*FS)/1000) */
/* Number of samples per 1 ms */
-#define SAMPLES_PER_MSEC 16
+#define SAMPLES_PER_MSEC 16
/* number of subframes */
-#define SUBFRAMES 6
+#define SUBFRAMES 6
/* length of a subframe */
-#define UPDATE 80
+#define UPDATE 80
/* length of half a subframe (low/high band) */
-#define HALF_SUBFRAMELEN 40 /* (UPDATE/2) */
-/* samples of look ahead (in a half-band, so actually half the samples of look ahead @ FS) */
-#define QLOOKAHEAD 24 /* 3 ms */
+#define HALF_SUBFRAMELEN 40 /* (UPDATE/2) */
+/* samples of look ahead (in a half-band, so actually half the samples of look
+ * ahead @ FS) */
+#define QLOOKAHEAD 24 /* 3 ms */
/* order of AR model in spectral entropy coder */
-#define AR_ORDER 6
-#define MAX_ORDER 13
-#define LEVINSON_MAX_ORDER 12
+#define AR_ORDER 6
+#define MAX_ORDER 13
+#define LEVINSON_MAX_ORDER 12
/* window length (masking analysis) */
-#define WINLEN 256
+#define WINLEN 256
/* order of low-band pole filter used to approximate masking curve */
-#define ORDERLO 12
+#define ORDERLO 12
/* order of hi-band pole filter used to approximate masking curve */
-#define ORDERHI 6
+#define ORDERHI 6
-#define KLT_NUM_AVG_GAIN 0
-#define KLT_NUM_AVG_SHAPE 0
-#define KLT_NUM_MODELS 3
-#define LPC_SHAPE_ORDER 18 /* (ORDERLO + ORDERHI) */
+#define KLT_NUM_AVG_GAIN 0
+#define KLT_NUM_AVG_SHAPE 0
+#define KLT_NUM_MODELS 3
+#define LPC_SHAPE_ORDER 18 /* (ORDERLO + ORDERHI) */
-#define KLT_ORDER_GAIN 12 /* (2 * SUBFRAMES) */
-#define KLT_ORDER_SHAPE 108 /* (LPC_SHAPE_ORDER * SUBFRAMES) */
-
-
+#define KLT_ORDER_GAIN 12 /* (2 * SUBFRAMES) */
+#define KLT_ORDER_SHAPE 108 /* (LPC_SHAPE_ORDER * SUBFRAMES) */
/* order for post_filter_bank */
-#define POSTQORDER 3
+#define POSTQORDER 3
/* order for pre-filterbank */
-#define QORDER 3
+#define QORDER 3
/* for decimator */
-#define ALLPASSSECTIONS 2
+#define ALLPASSSECTIONS 2
/* The number of composite all-pass filter factors */
-#define NUMBEROFCOMPOSITEAPSECTIONS 4
+#define NUMBEROFCOMPOSITEAPSECTIONS 4
/* The number of all-pass filter factors in an upper or lower channel*/
-#define NUMBEROFCHANNELAPSECTIONS 2
+#define NUMBEROFCHANNELAPSECTIONS 2
-
-
-#define DPMIN_Q10 -10240 /* -10.00 in Q10 */
-#define DPMAX_Q10 10240 /* 10.00 in Q10 */
-#define MINBITS_Q10 10240 /* 10.0 in Q10 */
-
+#define DPMIN_Q10 -10240 /* -10.00 in Q10 */
+#define DPMAX_Q10 10240 /* 10.00 in Q10 */
+#define MINBITS_Q10 10240 /* 10.0 in Q10 */
/* array size for byte stream in number of Word16. */
-#define STREAM_MAXW16 300 /* The old maximum size still needed for the decoding */
-#define STREAM_MAXW16_30MS 100 /* 100 Word16 = 200 bytes = 53.4 kbit/s @ 30 ms.framelength */
-#define STREAM_MAXW16_60MS 200 /* 200 Word16 = 400 bytes = 53.4 kbit/s @ 60 ms.framelength */
+#define STREAM_MAXW16 \
+ 300 /* The old maximum size still needed for the decoding */
+#define STREAM_MAXW16_30MS \
+ 100 /* 100 Word16 = 200 bytes = 53.4 kbit/s @ 30 ms.framelength */
+#define STREAM_MAXW16_60MS \
+ 200 /* 200 Word16 = 400 bytes = 53.4 kbit/s @ 60 ms.framelength */
/* This is used only at the decoder bit-stream struct.
* - The encoder and decoder bitstream containers are of different size because
* old iSAC limited the encoded bitstream to 600 bytes. But newer versions
@@ -110,106 +108,104 @@
/* storage size for bit counts */
//#define BIT_COUNTER_SIZE 30
/* maximum order of any AR model or filter */
-#define MAX_AR_MODEL_ORDER 12
+#define MAX_AR_MODEL_ORDER 12
/* Maximum number of iterations allowed to limit payload size */
-#define MAX_PAYLOAD_LIMIT_ITERATION 1
+#define MAX_PAYLOAD_LIMIT_ITERATION 1
/* Bandwidth estimator */
-#define MIN_ISAC_BW 10000 /* Minimum bandwidth in bits per sec */
-#define MAX_ISAC_BW 32000 /* Maxmum bandwidth in bits per sec */
-#define MIN_ISAC_MD 5 /* Minimum Max Delay in ?? */
-#define MAX_ISAC_MD 25 /* Maxmum Max Delay in ?? */
-#define DELAY_CORRECTION_MAX 717
-#define DELAY_CORRECTION_MED 819
-#define Thld_30_60 18000
-#define Thld_60_30 27000
+#define MIN_ISAC_BW 10000 /* Minimum bandwidth in bits per sec */
+#define MAX_ISAC_BW 32000 /* Maxmum bandwidth in bits per sec */
+#define MIN_ISAC_MD 5 /* Minimum Max Delay in ?? */
+#define MAX_ISAC_MD 25 /* Maxmum Max Delay in ?? */
+#define DELAY_CORRECTION_MAX 717
+#define DELAY_CORRECTION_MED 819
+#define Thld_30_60 18000
+#define Thld_60_30 27000
-/* assumed header size; we don't know the exact number (header compression may be used) */
-#define HEADER_SIZE 35 /* bytes */
-#define INIT_FRAME_LEN 60
-#define INIT_BN_EST 20000
-#define INIT_BN_EST_Q7 2560000 /* 20 kbps in Q7 */
-#define INIT_REC_BN_EST_Q5 789312 /* INIT_BN_EST + INIT_HDR_RATE in Q5 */
+/* assumed header size; we don't know the exact number (header compression may
+ * be used) */
+#define HEADER_SIZE 35 /* bytes */
+#define INIT_FRAME_LEN 60
+#define INIT_BN_EST 20000
+#define INIT_BN_EST_Q7 2560000 /* 20 kbps in Q7 */
+#define INIT_REC_BN_EST_Q5 789312 /* INIT_BN_EST + INIT_HDR_RATE in Q5 */
/* 8738 in Q18 is ~ 1/30 */
-/* #define INIT_HDR_RATE (((HEADER_SIZE * 8 * 1000) * 8738) >> NUM_BITS_TO_SHIFT (INIT_FRAME_LEN)) */
-#define INIT_HDR_RATE 4666
+/* #define INIT_HDR_RATE (((HEADER_SIZE * 8 * 1000) * 8738) >> NUM_BITS_TO_SHIFT
+ * (INIT_FRAME_LEN)) */
+#define INIT_HDR_RATE 4666
/* number of packets in a row for a high rate burst */
-#define BURST_LEN 3
+#define BURST_LEN 3
/* ms, max time between two full bursts */
-#define BURST_INTERVAL 800
+#define BURST_INTERVAL 800
/* number of packets in a row for initial high rate burst */
-#define INIT_BURST_LEN 5
+#define INIT_BURST_LEN 5
/* bits/s, rate for the first BURST_LEN packets */
-#define INIT_RATE 10240000 /* INIT_BN_EST in Q9 */
-
+#define INIT_RATE 10240000 /* INIT_BN_EST in Q9 */
/* For pitch analysis */
-#define PITCH_FRAME_LEN 240 /* (FRAMESAMPLES/2) 30 ms */
-#define PITCH_MAX_LAG 140 /* 57 Hz */
-#define PITCH_MIN_LAG 20 /* 400 Hz */
-#define PITCH_MIN_LAG_Q8 5120 /* 256 * PITCH_MIN_LAG */
-#define OFFSET_Q8 768 /* 256 * 3 */
+#define PITCH_FRAME_LEN 240 /* (FRAMESAMPLES/2) 30 ms */
+#define PITCH_MAX_LAG 140 /* 57 Hz */
+#define PITCH_MIN_LAG 20 /* 400 Hz */
+#define PITCH_MIN_LAG_Q8 5120 /* 256 * PITCH_MIN_LAG */
+#define OFFSET_Q8 768 /* 256 * 3 */
-#define PITCH_MAX_GAIN_Q12 1843 /* 0.45 */
-#define PITCH_LAG_SPAN2 65 /* (PITCH_MAX_LAG/2-PITCH_MIN_LAG/2+5) */
-#define PITCH_CORR_LEN2 60 /* 15 ms */
-#define PITCH_CORR_STEP2 60 /* (PITCH_FRAME_LEN/4) */
-#define PITCH_SUBFRAMES 4
-#define PITCH_SUBFRAME_LEN 60 /* (PITCH_FRAME_LEN/PITCH_SUBFRAMES) */
+#define PITCH_MAX_GAIN_Q12 1843 /* 0.45 */
+#define PITCH_LAG_SPAN2 65 /* (PITCH_MAX_LAG/2-PITCH_MIN_LAG/2+5) */
+#define PITCH_CORR_LEN2 60 /* 15 ms */
+#define PITCH_CORR_STEP2 60 /* (PITCH_FRAME_LEN/4) */
+#define PITCH_SUBFRAMES 4
+#define PITCH_SUBFRAME_LEN 60 /* (PITCH_FRAME_LEN/PITCH_SUBFRAMES) */
/* For pitch filter */
-#define PITCH_BUFFSIZE 190 /* (PITCH_MAX_LAG + 50) Extra 50 for fraction and LP filters */
-#define PITCH_INTBUFFSIZE 430 /* (PITCH_FRAME_LEN+PITCH_BUFFSIZE) */
-#define PITCH_FRACS 8
-#define PITCH_FRACORDER 9
-#define PITCH_DAMPORDER 5
-
+#define PITCH_BUFFSIZE \
+ 190 /* (PITCH_MAX_LAG + 50) Extra 50 for fraction and LP filters */
+#define PITCH_INTBUFFSIZE 430 /* (PITCH_FRAME_LEN+PITCH_BUFFSIZE) */
+#define PITCH_FRACS 8
+#define PITCH_FRACORDER 9
+#define PITCH_DAMPORDER 5
/* Order of high pass filter */
-#define HPORDER 2
-
+#define HPORDER 2
/* PLC */
-#define DECAY_RATE 10 /* Q15, 20% of decay every lost frame apllied linearly sample by sample*/
-#define PLC_WAS_USED 1
-#define PLC_NOT_USED 3
-#define RECOVERY_OVERLAP 80
-#define RESAMP_RES 256
-#define RESAMP_RES_BIT 8
-
-
+#define DECAY_RATE \
+ 10 /* Q15, 20% of decay every lost frame apllied linearly sample by sample*/
+#define PLC_WAS_USED 1
+#define PLC_NOT_USED 3
+#define RECOVERY_OVERLAP 80
+#define RESAMP_RES 256
+#define RESAMP_RES_BIT 8
/* Define Error codes */
/* 6000 General */
-#define ISAC_MEMORY_ALLOCATION_FAILED 6010
-#define ISAC_MODE_MISMATCH 6020
-#define ISAC_DISALLOWED_BOTTLENECK 6030
-#define ISAC_DISALLOWED_FRAME_LENGTH 6040
+#define ISAC_MEMORY_ALLOCATION_FAILED 6010
+#define ISAC_MODE_MISMATCH 6020
+#define ISAC_DISALLOWED_BOTTLENECK 6030
+#define ISAC_DISALLOWED_FRAME_LENGTH 6040
/* 6200 Bandwidth estimator */
-#define ISAC_RANGE_ERROR_BW_ESTIMATOR 6240
+#define ISAC_RANGE_ERROR_BW_ESTIMATOR 6240
/* 6400 Encoder */
-#define ISAC_ENCODER_NOT_INITIATED 6410
-#define ISAC_DISALLOWED_CODING_MODE 6420
-#define ISAC_DISALLOWED_FRAME_MODE_ENCODER 6430
-#define ISAC_DISALLOWED_BITSTREAM_LENGTH 6440
-#define ISAC_PAYLOAD_LARGER_THAN_LIMIT 6450
+#define ISAC_ENCODER_NOT_INITIATED 6410
+#define ISAC_DISALLOWED_CODING_MODE 6420
+#define ISAC_DISALLOWED_FRAME_MODE_ENCODER 6430
+#define ISAC_DISALLOWED_BITSTREAM_LENGTH 6440
+#define ISAC_PAYLOAD_LARGER_THAN_LIMIT 6450
/* 6600 Decoder */
-#define ISAC_DECODER_NOT_INITIATED 6610
-#define ISAC_EMPTY_PACKET 6620
+#define ISAC_DECODER_NOT_INITIATED 6610
+#define ISAC_EMPTY_PACKET 6620
#define ISAC_PACKET_TOO_SHORT 6625
-#define ISAC_DISALLOWED_FRAME_MODE_DECODER 6630
-#define ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH 6640
-#define ISAC_RANGE_ERROR_DECODE_BANDWIDTH 6650
-#define ISAC_RANGE_ERROR_DECODE_PITCH_GAIN 6660
-#define ISAC_RANGE_ERROR_DECODE_PITCH_LAG 6670
-#define ISAC_RANGE_ERROR_DECODE_LPC 6680
-#define ISAC_RANGE_ERROR_DECODE_SPECTRUM 6690
-#define ISAC_LENGTH_MISMATCH 6730
+#define ISAC_DISALLOWED_FRAME_MODE_DECODER 6630
+#define ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH 6640
+#define ISAC_RANGE_ERROR_DECODE_BANDWIDTH 6650
+#define ISAC_RANGE_ERROR_DECODE_PITCH_GAIN 6660
+#define ISAC_RANGE_ERROR_DECODE_PITCH_LAG 6670
+#define ISAC_RANGE_ERROR_DECODE_LPC 6680
+#define ISAC_RANGE_ERROR_DECODE_SPECTRUM 6690
+#define ISAC_LENGTH_MISMATCH 6730
/* 6800 Call setup formats */
-#define ISAC_INCOMPATIBLE_FORMATS 6810
-
+#define ISAC_INCOMPATIBLE_FORMATS 6810
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_SETTINGS_H_ */
diff --git a/modules/audio_coding/codecs/isac/fix/source/spectrum_ar_model_tables.h b/modules/audio_coding/codecs/isac/fix/source/spectrum_ar_model_tables.h
index 04fddf5..4ac5c0b 100644
--- a/modules/audio_coding/codecs/isac/fix/source/spectrum_ar_model_tables.h
+++ b/modules/audio_coding/codecs/isac/fix/source/spectrum_ar_model_tables.h
@@ -62,15 +62,15 @@
/* quantization boundary levels for reflection coefficients */
extern const int16_t WebRtcIsacfix_kRcBound[12];
-/* initial indices for AR reflection coefficient quantizer and cdf table search */
+/* initial indices for AR reflection coefficient quantizer and cdf table search
+ */
extern const uint16_t WebRtcIsacfix_kRcInitInd[AR_ORDER];
/* pointers to AR cdf tables */
-extern const uint16_t *WebRtcIsacfix_kRcCdfPtr[AR_ORDER];
+extern const uint16_t* WebRtcIsacfix_kRcCdfPtr[AR_ORDER];
/* pointers to AR representation levels tables */
-extern const int16_t *WebRtcIsacfix_kRcLevPtr[AR_ORDER];
-
+extern const int16_t* WebRtcIsacfix_kRcLevPtr[AR_ORDER];
/******************** GAIN Coefficient Tables ***********************/
/* cdf for Gain coefficient */
@@ -83,7 +83,7 @@
extern const int32_t WebRtcIsacfix_kGain2Bound[19];
/* pointer to Gain cdf table */
-extern const uint16_t *WebRtcIsacfix_kGainPtr[1];
+extern const uint16_t* WebRtcIsacfix_kGainPtr[1];
/* Gain initial index for gain quantizer and cdf table search */
extern const uint16_t WebRtcIsacfix_kGainInitInd[1];
@@ -92,4 +92,5 @@
/* Cosine table */
extern const int16_t WebRtcIsacfix_kCos[6][60];
-#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_SPECTRUM_AR_MODEL_TABLES_H_ */
+#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_SPECTRUM_AR_MODEL_TABLES_H_ \
+ */
diff --git a/modules/audio_coding/codecs/isac/fix/source/structs.h b/modules/audio_coding/codecs/isac/fix/source/structs.h
index 7a14e5c..352eef0 100644
--- a/modules/audio_coding/codecs/isac/fix/source/structs.h
+++ b/modules/audio_coding/codecs/isac/fix/source/structs.h
@@ -18,7 +18,6 @@
#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_STRUCTS_H_
#define MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_STRUCTS_H_
-
#include "common_audio/signal_processing/include/signal_processing_library.h"
#include "modules/audio_coding/codecs/isac/bandwidth_info.h"
#include "modules/audio_coding/codecs/isac/fix/source/settings.h"
@@ -26,72 +25,58 @@
/* Bitstream struct for decoder */
typedef struct Bitstreamstruct_dec {
-
- uint16_t stream[INTERNAL_STREAM_SIZE_W16]; /* Array bytestream to decode */
- uint32_t W_upper; /* Upper boundary of interval W */
- uint32_t streamval;
- uint16_t stream_index; /* Index to the current position in bytestream */
- int16_t full; /* 0 - first byte in memory filled, second empty*/
+ uint16_t stream[INTERNAL_STREAM_SIZE_W16]; /* Array bytestream to decode */
+ uint32_t W_upper; /* Upper boundary of interval W */
+ uint32_t streamval;
+ uint16_t stream_index; /* Index to the current position in bytestream */
+ int16_t full; /* 0 - first byte in memory filled, second empty*/
/* 1 - both bytes are empty (we just filled the previous memory */
- size_t stream_size; /* The size of stream in bytes. */
+ size_t stream_size; /* The size of stream in bytes. */
} Bitstr_dec;
/* Bitstream struct for encoder */
typedef struct Bitstreamstruct_enc {
-
- uint16_t stream[STREAM_MAXW16_60MS]; /* Vector for adding encoded bytestream */
- uint32_t W_upper; /* Upper boundary of interval W */
- uint32_t streamval;
- uint16_t stream_index; /* Index to the current position in bytestream */
- int16_t full; /* 0 - first byte in memory filled, second empty*/
+ uint16_t
+ stream[STREAM_MAXW16_60MS]; /* Vector for adding encoded bytestream */
+ uint32_t W_upper; /* Upper boundary of interval W */
+ uint32_t streamval;
+ uint16_t stream_index; /* Index to the current position in bytestream */
+ int16_t full; /* 0 - first byte in memory filled, second empty*/
/* 1 - both bytes are empty (we just filled the previous memory */
} Bitstr_enc;
-
typedef struct {
-
int16_t DataBufferLoQ0[WINLEN];
int16_t DataBufferHiQ0[WINLEN];
- int32_t CorrBufLoQQ[ORDERLO+1];
- int32_t CorrBufHiQQ[ORDERHI+1];
+ int32_t CorrBufLoQQ[ORDERLO + 1];
+ int32_t CorrBufHiQQ[ORDERHI + 1];
- int16_t CorrBufLoQdom[ORDERLO+1];
- int16_t CorrBufHiQdom[ORDERHI+1];
+ int16_t CorrBufLoQdom[ORDERLO + 1];
+ int16_t CorrBufHiQdom[ORDERHI + 1];
- int32_t PreStateLoGQ15[ORDERLO+1];
- int32_t PreStateHiGQ15[ORDERHI+1];
+ int32_t PreStateLoGQ15[ORDERLO + 1];
+ int32_t PreStateHiGQ15[ORDERHI + 1];
uint32_t OldEnergy;
} MaskFiltstr_enc;
-
-
typedef struct {
-
- int16_t PostStateLoGQ0[ORDERLO+1];
- int16_t PostStateHiGQ0[ORDERHI+1];
+ int16_t PostStateLoGQ0[ORDERLO + 1];
+ int16_t PostStateHiGQ0[ORDERHI + 1];
uint32_t OldEnergy;
} MaskFiltstr_dec;
-
-
-
-
-
-
-
typedef struct {
+ // state vectors for each of the two analysis filters
- //state vectors for each of the two analysis filters
-
- int32_t INSTAT1_fix[2*(QORDER-1)];
- int32_t INSTAT2_fix[2*(QORDER-1)];
+ int32_t INSTAT1_fix[2 * (QORDER - 1)];
+ int32_t INSTAT2_fix[2 * (QORDER - 1)];
int16_t INLABUF1_fix[QLOOKAHEAD];
int16_t INLABUF2_fix[QLOOKAHEAD];
@@ -100,12 +85,10 @@
} PreFiltBankstr;
-
typedef struct {
-
- //state vectors for each of the two analysis filters
- int32_t STATE_0_LOWER_fix[2*POSTQORDER];
- int32_t STATE_0_UPPER_fix[2*POSTQORDER];
+ // state vectors for each of the two analysis filters
+ int32_t STATE_0_LOWER_fix[2 * POSTQORDER];
+ int32_t STATE_0_UPPER_fix[2 * POSTQORDER];
/* High pass filter */
@@ -115,8 +98,6 @@
} PostFiltBankstr;
typedef struct {
-
-
/* data buffer for pitch filter */
int16_t ubufQQ[PITCH_BUFFSIZE];
@@ -129,42 +110,35 @@
} PitchFiltstr;
-
-
typedef struct {
+ // for inital estimator
+ int16_t dec_buffer16[PITCH_CORR_LEN2 + PITCH_CORR_STEP2 + PITCH_MAX_LAG / 2 -
+ PITCH_FRAME_LEN / 2 + 2];
+ int32_t decimator_state32[2 * ALLPASSSECTIONS + 1];
+ int16_t inbuf[QLOOKAHEAD];
- //for inital estimator
- int16_t dec_buffer16[PITCH_CORR_LEN2+PITCH_CORR_STEP2+PITCH_MAX_LAG/2-PITCH_FRAME_LEN/2+2];
- int32_t decimator_state32[2*ALLPASSSECTIONS+1];
- int16_t inbuf[QLOOKAHEAD];
-
- PitchFiltstr PFstr_wght;
- PitchFiltstr PFstr;
-
+ PitchFiltstr PFstr_wght;
+ PitchFiltstr PFstr;
} PitchAnalysisStruct;
-
typedef struct {
/* Parameters used in PLC to avoid re-computation */
/* --- residual signals --- */
- int16_t prevPitchInvIn[FRAMESAMPLES/2];
- int16_t prevPitchInvOut[PITCH_MAX_LAG + 10]; // [FRAMESAMPLES/2]; save 90
- int32_t prevHP[PITCH_MAX_LAG + 10]; // [FRAMESAMPLES/2]; save 90
-
+ int16_t prevPitchInvIn[FRAMESAMPLES / 2];
+ int16_t prevPitchInvOut[PITCH_MAX_LAG + 10]; // [FRAMESAMPLES/2]; save 90
+ int32_t prevHP[PITCH_MAX_LAG + 10]; // [FRAMESAMPLES/2]; save 90
int16_t decayCoeffPriodic; /* how much to supress a sample */
int16_t decayCoeffNoise;
- int16_t used; /* if PLC is used */
+ int16_t used; /* if PLC is used */
-
- int16_t *lastPitchLP; // [FRAMESAMPLES/2]; saved 240;
-
+ int16_t* lastPitchLP; // [FRAMESAMPLES/2]; saved 240;
/* --- LPC side info --- */
- int16_t lofilt_coefQ15[ ORDERLO ];
- int16_t hifilt_coefQ15[ ORDERHI ];
+ int16_t lofilt_coefQ15[ORDERLO];
+ int16_t hifilt_coefQ15[ORDERHI];
int32_t gain_lo_hiQ17[2];
/* --- LTP side info --- */
@@ -173,95 +147,101 @@
int16_t lastPitchLag_Q7;
/* --- Add-overlap in recovery packet --- */
- int16_t overlapLP[ RECOVERY_OVERLAP ]; // [FRAMESAMPLES/2]; saved 160
+ int16_t overlapLP[RECOVERY_OVERLAP]; // [FRAMESAMPLES/2]; saved 160
int16_t pitchCycles;
int16_t A;
int16_t B;
size_t pitchIndex;
size_t stretchLag;
- int16_t *prevPitchLP; // [ FRAMESAMPLES/2 ]; saved 240
+ int16_t* prevPitchLP; // [ FRAMESAMPLES/2 ]; saved 240
int16_t seed;
int16_t std;
} PLCstr;
-
-
/* Have instance of struct together with other iSAC structs */
typedef struct {
-
- int16_t prevFrameSizeMs; /* Previous frame size (in ms) */
- uint16_t prevRtpNumber; /* Previous RTP timestamp from received packet */
+ int16_t prevFrameSizeMs; /* Previous frame size (in ms) */
+ uint16_t prevRtpNumber; /* Previous RTP timestamp from received packet */
/* (in samples relative beginning) */
- uint32_t prevSendTime; /* Send time for previous packet, from RTP header */
- uint32_t prevArrivalTime; /* Arrival time for previous packet (in ms using timeGetTime()) */
- uint16_t prevRtpRate; /* rate of previous packet, derived from RTP timestamps (in bits/s) */
- uint32_t lastUpdate; /* Time since the last update of the Bottle Neck estimate (in samples) */
- uint32_t lastReduction; /* Time sinse the last reduction (in samples) */
- int32_t countUpdates; /* How many times the estimate was update in the beginning */
+ uint32_t prevSendTime; /* Send time for previous packet, from RTP header */
+ uint32_t prevArrivalTime; /* Arrival time for previous packet (in ms using
+ timeGetTime()) */
+ uint16_t
+ prevRtpRate; /* rate of previous packet, derived from RTP timestamps (in
+ bits/s) */
+ uint32_t
+ lastUpdate; /* Time since the last update of the Bottle Neck estimate (in
+ samples) */
+ uint32_t lastReduction; /* Time sinse the last reduction (in samples) */
+ int32_t countUpdates; /* How many times the estimate was update in the
+ beginning */
- /* The estimated bottle neck rate from there to here (in bits/s) */
- uint32_t recBw;
- uint32_t recBwInv;
- uint32_t recBwAvg;
- uint32_t recBwAvgQ;
+ /* The estimated bottle neck rate from there to here (in bits/s) */
+ uint32_t recBw;
+ uint32_t recBwInv;
+ uint32_t recBwAvg;
+ uint32_t recBwAvgQ;
- uint32_t minBwInv;
- uint32_t maxBwInv;
+ uint32_t minBwInv;
+ uint32_t maxBwInv;
- /* The estimated mean absolute jitter value, as seen on this side (in ms) */
- int32_t recJitter;
- int32_t recJitterShortTerm;
- int32_t recJitterShortTermAbs;
- int32_t recMaxDelay;
- int32_t recMaxDelayAvgQ;
+ /* The estimated mean absolute jitter value, as seen on this side (in ms) */
+ int32_t recJitter;
+ int32_t recJitterShortTerm;
+ int32_t recJitterShortTermAbs;
+ int32_t recMaxDelay;
+ int32_t recMaxDelayAvgQ;
+ int16_t recHeaderRate; /* (assumed) bitrate for headers (bps) */
- int16_t recHeaderRate; /* (assumed) bitrate for headers (bps) */
+ uint32_t sendBwAvg; /* The estimated bottle neck rate from here to there (in
+ bits/s) */
+ int32_t
+ sendMaxDelayAvg; /* The estimated mean absolute jitter value, as seen on
+ the other siee (in ms) */
- uint32_t sendBwAvg; /* The estimated bottle neck rate from here to there (in bits/s) */
- int32_t sendMaxDelayAvg; /* The estimated mean absolute jitter value, as seen on the other siee (in ms) */
-
-
- int16_t countRecPkts; /* number of packets received since last update */
- int16_t highSpeedRec; /* flag for marking that a high speed network has been detected downstream */
+ int16_t countRecPkts; /* number of packets received since last update */
+ int16_t highSpeedRec; /* flag for marking that a high speed network has been
+ detected downstream */
/* number of consecutive pkts sent during which the bwe estimate has
- remained at a value greater than the downstream threshold for determining highspeed network */
- int16_t countHighSpeedRec;
+ remained at a value greater than the downstream threshold for determining
+ highspeed network */
+ int16_t countHighSpeedRec;
- /* flag indicating bwe should not adjust down immediately for very late pckts */
- int16_t inWaitPeriod;
+ /* flag indicating bwe should not adjust down immediately for very late pckts
+ */
+ int16_t inWaitPeriod;
/* variable holding the time of the start of a window of time when
bwe should not adjust down immediately for very late pckts */
- uint32_t startWaitPeriod;
+ uint32_t startWaitPeriod;
/* number of consecutive pkts sent during which the bwe estimate has
- remained at a value greater than the upstream threshold for determining highspeed network */
- int16_t countHighSpeedSent;
+ remained at a value greater than the upstream threshold for determining
+ highspeed network */
+ int16_t countHighSpeedSent;
- /* flag indicated the desired number of packets over threshold rate have been sent and
- bwe will assume the connection is over broadband network */
- int16_t highSpeedSend;
+ /* flag indicated the desired number of packets over threshold rate have been
+ sent and bwe will assume the connection is over broadband network */
+ int16_t highSpeedSend;
IsacBandwidthInfo external_bw_info;
} BwEstimatorstr;
-
typedef struct {
-
/* boolean, flags if previous packet exceeded B.N. */
- int16_t PrevExceed;
+ int16_t PrevExceed;
/* ms */
- int16_t ExceedAgo;
+ int16_t ExceedAgo;
/* packets left to send in current burst */
- int16_t BurstCounter;
+ int16_t BurstCounter;
/* packets */
- int16_t InitCounter;
+ int16_t InitCounter;
/* ms remaining in buffer when next packet will be sent */
- int16_t StillBuffered;
+ int16_t StillBuffered;
} RateModel;
@@ -271,112 +251,107 @@
handle 60 ms of data.
*/
typedef struct {
-
/* Used to keep track of if it is first or second part of 60 msec packet */
- int startIdx;
+ int startIdx;
/* Frame length in samples */
- int16_t framelength;
+ int16_t framelength;
/* Pitch Gain */
- int16_t pitchGain_index[2];
+ int16_t pitchGain_index[2];
/* Pitch Lag */
- int32_t meanGain[2];
- int16_t pitchIndex[PITCH_SUBFRAMES*2];
+ int32_t meanGain[2];
+ int16_t pitchIndex[PITCH_SUBFRAMES * 2];
/* LPC */
- int32_t LPCcoeffs_g[12*2]; /* KLT_ORDER_GAIN = 12 */
- int16_t LPCindex_s[108*2]; /* KLT_ORDER_SHAPE = 108 */
- int16_t LPCindex_g[12*2]; /* KLT_ORDER_GAIN = 12 */
+ int32_t LPCcoeffs_g[12 * 2]; /* KLT_ORDER_GAIN = 12 */
+ int16_t LPCindex_s[108 * 2]; /* KLT_ORDER_SHAPE = 108 */
+ int16_t LPCindex_g[12 * 2]; /* KLT_ORDER_GAIN = 12 */
/* Encode Spec */
- int16_t fre[FRAMESAMPLES];
- int16_t fim[FRAMESAMPLES];
- int16_t AvgPitchGain[2];
+ int16_t fre[FRAMESAMPLES];
+ int16_t fim[FRAMESAMPLES];
+ int16_t AvgPitchGain[2];
/* Used in adaptive mode only */
- int minBytes;
+ int minBytes;
} IsacSaveEncoderData;
typedef struct {
-
- Bitstr_enc bitstr_obj;
- MaskFiltstr_enc maskfiltstr_obj;
- PreFiltBankstr prefiltbankstr_obj;
- PitchFiltstr pitchfiltstr_obj;
+ Bitstr_enc bitstr_obj;
+ MaskFiltstr_enc maskfiltstr_obj;
+ PreFiltBankstr prefiltbankstr_obj;
+ PitchFiltstr pitchfiltstr_obj;
PitchAnalysisStruct pitchanalysisstr_obj;
- RateModel rate_data_obj;
+ RateModel rate_data_obj;
- int16_t buffer_index;
- int16_t current_framesamples;
+ int16_t buffer_index;
+ int16_t current_framesamples;
- int16_t data_buffer_fix[FRAMESAMPLES]; // the size was MAX_FRAMESAMPLES
+ int16_t data_buffer_fix[FRAMESAMPLES]; // the size was MAX_FRAMESAMPLES
- int16_t frame_nb;
- int16_t BottleNeck;
- int16_t MaxDelay;
- int16_t new_framelength;
- int16_t s2nr;
- uint16_t MaxBits;
+ int16_t frame_nb;
+ int16_t BottleNeck;
+ int16_t MaxDelay;
+ int16_t new_framelength;
+ int16_t s2nr;
+ uint16_t MaxBits;
- int16_t bitstr_seed;
+ int16_t bitstr_seed;
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
- PostFiltBankstr interpolatorstr_obj;
+ PostFiltBankstr interpolatorstr_obj;
#endif
- IsacSaveEncoderData *SaveEnc_ptr;
- int16_t payloadLimitBytes30; /* Maximum allowed number of bits for a 30 msec packet */
- int16_t payloadLimitBytes60; /* Maximum allowed number of bits for a 30 msec packet */
- int16_t maxPayloadBytes; /* Maximum allowed number of bits for both 30 and 60 msec packet */
- int16_t maxRateInBytes; /* Maximum allowed rate in bytes per 30 msec packet */
- int16_t enforceFrameSize; /* If set iSAC will never change packet size */
+ IsacSaveEncoderData* SaveEnc_ptr;
+ int16_t payloadLimitBytes30; /* Maximum allowed number of bits for a 30 msec
+ packet */
+ int16_t payloadLimitBytes60; /* Maximum allowed number of bits for a 30 msec
+ packet */
+ int16_t maxPayloadBytes; /* Maximum allowed number of bits for both 30 and 60
+ msec packet */
+ int16_t maxRateInBytes; /* Maximum allowed rate in bytes per 30 msec packet */
+ int16_t enforceFrameSize; /* If set iSAC will never change packet size */
} IsacFixEncoderInstance;
-
typedef struct {
-
- Bitstr_dec bitstr_obj;
- MaskFiltstr_dec maskfiltstr_obj;
- PostFiltBankstr postfiltbankstr_obj;
- PitchFiltstr pitchfiltstr_obj;
- PLCstr plcstr_obj; /* TS; for packet loss concealment */
+ Bitstr_dec bitstr_obj;
+ MaskFiltstr_dec maskfiltstr_obj;
+ PostFiltBankstr postfiltbankstr_obj;
+ PitchFiltstr pitchfiltstr_obj;
+ PLCstr plcstr_obj; /* TS; for packet loss concealment */
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
- PreFiltBankstr decimatorstr_obj;
+ PreFiltBankstr decimatorstr_obj;
#endif
} IsacFixDecoderInstance;
-
-
typedef struct {
-
IsacFixEncoderInstance ISACenc_obj;
IsacFixDecoderInstance ISACdec_obj;
- BwEstimatorstr bwestimator_obj;
- int16_t CodingMode; /* 0 = adaptive; 1 = instantaneous */
- int16_t errorcode;
- int16_t initflag; /* 0 = nothing initiated; 1 = encoder or decoder */
+ BwEstimatorstr bwestimator_obj;
+ int16_t CodingMode; /* 0 = adaptive; 1 = instantaneous */
+ int16_t errorcode;
+ int16_t initflag; /* 0 = nothing initiated; 1 = encoder or decoder */
/* not initiated; 2 = all initiated */
} ISACFIX_SubStruct;
-
typedef struct {
- int32_t lpcGains[12]; /* 6 lower-band & 6 upper-band we may need to double it for 60*/
+ int32_t lpcGains
+ [12]; /* 6 lower-band & 6 upper-band we may need to double it for 60*/
/* */
- uint32_t W_upper; /* Upper boundary of interval W */
- uint32_t streamval;
- uint16_t stream_index; /* Index to the current position in bytestream */
- int16_t full; /* 0 - first byte in memory filled, second empty*/
+ uint32_t W_upper; /* Upper boundary of interval W */
+ uint32_t streamval;
+ uint16_t stream_index; /* Index to the current position in bytestream */
+ int16_t full; /* 0 - first byte in memory filled, second empty*/
/* 1 - both bytes are empty (we just filled the previous memory */
- uint16_t beforeLastWord;
- uint16_t lastWord;
+ uint16_t beforeLastWord;
+ uint16_t lastWord;
} transcode_obj;
+// Bitstr_enc myBitStr;
-//Bitstr_enc myBitStr;
-
-#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_STRUCTS_H_ */
+#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_STRUCTS_H_ */
diff --git a/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc b/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc
index 347b049..a058530 100644
--- a/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc
+++ b/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc
@@ -12,147 +12,156 @@
#include "system_wrappers/include/cpu_features_wrapper.h"
#include "test/gtest.h"
-static const int kSamples = FRAMESAMPLES/2;
+static const int kSamples = FRAMESAMPLES / 2;
static const int32_t spec2time_out_expected_1[kSamples] = {
- -3366470, -2285227,
- -3415765, -2310215, -3118030, -2222470, -3030254, -2192091, -3423170,
- -2216041, -3305541, -2171936, -3195767, -2095779, -3153304, -2157560,
- -3071167, -2032108, -3101190, -1972016, -3103824, -2089118, -3139811,
- -1898337, -3102801, -2055082, -3029665, -1854140, -2962586, -1966454,
- -3071167, -1894588, -2851743, -1917315, -2848087, -1594932, -2799242,
- -1462184, -2845887, -1437599, -2691776, -1329637, -2770659, -1268491,
- -2625161, -1578991, -2460299, -1186385, -2365613, -1039354, -2322608,
- -958518, -2271749, -789860, -2254538, -850308, -2384436, -850959, -2133734,
- -587678, -2093316, -495115, -1973364, -475177, -1801282, -173507,
- -1848516, -158015, -1792018, -62648, -1643313, 214746, -1500758, 267077,
- -1450193, 560521, -1521579, 675283, -1345408, 857559, -1300822, 1116332,
- -1294533, 1241117, -1070027, 1263503, -983816, 1529821, -1019586,
- 1910421, -955420, 2073688, -836459, 2401105, -653905, 2690474, -731425,
- 2930131, -935234, 3299500, -875978, 3523432, -878906, 3924822, -1081630,
- 4561267, -1203023, 5105274, -1510983, 6052762, -2294646, 7021597,
- -3108053, 8826736, -4935222, 11678789, -8442713, 18725700, -21526692,
- 25420577, 19589811, -28108666, 12634054, -14483066, 6263217, -9979706,
- 3665661, -7909736, 2531530, -6434896, 1700772, -5525393, 1479473,
- -4894262, 1231760, -4353044, 1032940, -3786590, 941152, -3331614,
- 665090, -2851619, 830696, -2762201, 958007, -2483118, 788233, -2184965,
- 804825, -1967306, 1007255, -1862474, 920889, -1457506, 755406, -1405841,
- 890230, -1302124, 1161599, -701867, 1154163, -1083366, 1204743, -513581,
- 1547264, -650636, 1493384, -285543, 1771863, -277906, 1841343, -9078,
- 1751863, 230222, 1819578, 207170, 1978972, 398137, 2106468, 552155,
- 1997624, 685213, 2129520, 601078, 2238736, 944591, 2441879, 1194178,
- 2355280, 986124, 2393328, 1049005, 2417944, 1208368, 2489516, 1352023,
- 2572118, 1445283, 2856081, 1532997, 2742279, 1615877, 2915274, 1808036,
- 2856871, 1806936, 3241747, 1622461, 2978558, 1841297, 3010378, 1923666,
- 3271367, 2126700, 3070935, 1956958, 3107588, 2128405, 3288872, 2114911,
- 3315952, 2406651, 3344038, 2370199, 3368980, 2144361, 3305030, 2183803,
- 3401450, 2523102, 3405463, 2452475, 3463355, 2421678, 3551968, 2431949,
- 3477251, 2148125, 3244489, 2174090};
+ -3366470, -2285227, -3415765, -2310215, -3118030, -2222470, -3030254,
+ -2192091, -3423170, -2216041, -3305541, -2171936, -3195767, -2095779,
+ -3153304, -2157560, -3071167, -2032108, -3101190, -1972016, -3103824,
+ -2089118, -3139811, -1898337, -3102801, -2055082, -3029665, -1854140,
+ -2962586, -1966454, -3071167, -1894588, -2851743, -1917315, -2848087,
+ -1594932, -2799242, -1462184, -2845887, -1437599, -2691776, -1329637,
+ -2770659, -1268491, -2625161, -1578991, -2460299, -1186385, -2365613,
+ -1039354, -2322608, -958518, -2271749, -789860, -2254538, -850308,
+ -2384436, -850959, -2133734, -587678, -2093316, -495115, -1973364,
+ -475177, -1801282, -173507, -1848516, -158015, -1792018, -62648,
+ -1643313, 214746, -1500758, 267077, -1450193, 560521, -1521579,
+ 675283, -1345408, 857559, -1300822, 1116332, -1294533, 1241117,
+ -1070027, 1263503, -983816, 1529821, -1019586, 1910421, -955420,
+ 2073688, -836459, 2401105, -653905, 2690474, -731425, 2930131,
+ -935234, 3299500, -875978, 3523432, -878906, 3924822, -1081630,
+ 4561267, -1203023, 5105274, -1510983, 6052762, -2294646, 7021597,
+ -3108053, 8826736, -4935222, 11678789, -8442713, 18725700, -21526692,
+ 25420577, 19589811, -28108666, 12634054, -14483066, 6263217, -9979706,
+ 3665661, -7909736, 2531530, -6434896, 1700772, -5525393, 1479473,
+ -4894262, 1231760, -4353044, 1032940, -3786590, 941152, -3331614,
+ 665090, -2851619, 830696, -2762201, 958007, -2483118, 788233,
+ -2184965, 804825, -1967306, 1007255, -1862474, 920889, -1457506,
+ 755406, -1405841, 890230, -1302124, 1161599, -701867, 1154163,
+ -1083366, 1204743, -513581, 1547264, -650636, 1493384, -285543,
+ 1771863, -277906, 1841343, -9078, 1751863, 230222, 1819578,
+ 207170, 1978972, 398137, 2106468, 552155, 1997624, 685213,
+ 2129520, 601078, 2238736, 944591, 2441879, 1194178, 2355280,
+ 986124, 2393328, 1049005, 2417944, 1208368, 2489516, 1352023,
+ 2572118, 1445283, 2856081, 1532997, 2742279, 1615877, 2915274,
+ 1808036, 2856871, 1806936, 3241747, 1622461, 2978558, 1841297,
+ 3010378, 1923666, 3271367, 2126700, 3070935, 1956958, 3107588,
+ 2128405, 3288872, 2114911, 3315952, 2406651, 3344038, 2370199,
+ 3368980, 2144361, 3305030, 2183803, 3401450, 2523102, 3405463,
+ 2452475, 3463355, 2421678, 3551968, 2431949, 3477251, 2148125,
+ 3244489, 2174090};
static const int32_t spec2time_out_expected_2[kSamples] = {
- 1691694, -2499988, -2035547,
- 1060469, 988634, -2044502, -306271, 2041000, 201454, -2289456, 93694,
- 2129427, -369152, -1887834, 860796, 2089102, -929424, -1673956, 1395291,
- 1785651, -1619673, -1380109, 1963449, 1093311, -2111007, -840456,
- 2372786, 578119, -2242702, 89774, 2463304, -132717, -2121480, 643634,
- 2277636, -1125999, -1995858, 1543748, 2227861, -1483779, -1495491,
- 2102642, 1833876, -1920568, -958378, 2485101, 772261, -2454257, -24942,
- 2918714, 136838, -2500453, 816118, 3039735, -746560, -2365815, 1586396,
- 2714951, -1511696, -1942334, 2571792, 2182827, -2325335, -1311543,
- 3055970, 1367220, -2737182, -110626, 3889222, 631008, -3280879, 853066,
- 4122279, -706638, -3334449, 2148311, 3993512, -1846301, -3004894,
- 3426779, 3329522, -3165264, -2242423, 4756866, 2557711, -4131280,
- -805259, 5702711, 1120592, -4852821, 743664, 6476444, -621186, -5465828,
- 2815787, 6768835, -3017442, -5338409, 5658126, 6838454, -5492288,
- -4682382, 8874947, 6153814, -8832561, -2649251, 12817398, 4237692,
- -13000247, 1190661, 18986363, -115738, -19693978, 9908367, 30660381,
- -10632635, -37962068, 47022884, 89744622, -42087632, 40279224,
- -88869341, -47542383, 38572364, 10441576, -30339718, -9926740, 19896578,
- 28009, -18886612, -1124047, 13232498, -4150304, -12770551, 2637074,
- 9051831, -6162211, -8713972, 4557937, 5489716, -6862312, -5532349,
- 5415449, 2791310, -6999367, -2790102, 5375806, 546222, -6486452,
- -821261, 4994973, -1278840, -5645501, 1060484, 3996285, -2503954,
- -4653629, 2220549, 3036977, -3282133, -3318585, 2780636, 1789880,
- -4004589, -2041031, 3105373, 574819, -3992722, -971004, 3001703,
- -676739, -3841508, 417284, 2897970, -1427018, -3058480, 1189948,
- 2210960, -2268992, -2603272, 1949785, 1576172, -2720404, -1891738,
- 2309456, 769178, -2975646, -707150, 2424652, -88039, -2966660, -65452,
- 2320780, -957557, -2798978, 744640, 1879794, -1672081, -2365319,
- 1253309, 1366383, -2204082, -1544367, 1801452, 613828, -2531994,
- -983847, 2064842, 118326, -2613790, -203220, 2219635, -730341, -2641861,
- 563557, 1765434, -1329916, -2272927, 1037138, 1266725, -1939220,
- -1588643, 1754528, 816552, -2376303, -1099167, 1864999, 122477,
- -2422762, -400027, 1889228, -579916, -2490353, 287139, 2011318,
- -1176657, -2502978, 812896, 1116502, -1940211};
+ 1691694, -2499988, -2035547, 1060469, 988634, -2044502, -306271,
+ 2041000, 201454, -2289456, 93694, 2129427, -369152, -1887834,
+ 860796, 2089102, -929424, -1673956, 1395291, 1785651, -1619673,
+ -1380109, 1963449, 1093311, -2111007, -840456, 2372786, 578119,
+ -2242702, 89774, 2463304, -132717, -2121480, 643634, 2277636,
+ -1125999, -1995858, 1543748, 2227861, -1483779, -1495491, 2102642,
+ 1833876, -1920568, -958378, 2485101, 772261, -2454257, -24942,
+ 2918714, 136838, -2500453, 816118, 3039735, -746560, -2365815,
+ 1586396, 2714951, -1511696, -1942334, 2571792, 2182827, -2325335,
+ -1311543, 3055970, 1367220, -2737182, -110626, 3889222, 631008,
+ -3280879, 853066, 4122279, -706638, -3334449, 2148311, 3993512,
+ -1846301, -3004894, 3426779, 3329522, -3165264, -2242423, 4756866,
+ 2557711, -4131280, -805259, 5702711, 1120592, -4852821, 743664,
+ 6476444, -621186, -5465828, 2815787, 6768835, -3017442, -5338409,
+ 5658126, 6838454, -5492288, -4682382, 8874947, 6153814, -8832561,
+ -2649251, 12817398, 4237692, -13000247, 1190661, 18986363, -115738,
+ -19693978, 9908367, 30660381, -10632635, -37962068, 47022884, 89744622,
+ -42087632, 40279224, -88869341, -47542383, 38572364, 10441576, -30339718,
+ -9926740, 19896578, 28009, -18886612, -1124047, 13232498, -4150304,
+ -12770551, 2637074, 9051831, -6162211, -8713972, 4557937, 5489716,
+ -6862312, -5532349, 5415449, 2791310, -6999367, -2790102, 5375806,
+ 546222, -6486452, -821261, 4994973, -1278840, -5645501, 1060484,
+ 3996285, -2503954, -4653629, 2220549, 3036977, -3282133, -3318585,
+ 2780636, 1789880, -4004589, -2041031, 3105373, 574819, -3992722,
+ -971004, 3001703, -676739, -3841508, 417284, 2897970, -1427018,
+ -3058480, 1189948, 2210960, -2268992, -2603272, 1949785, 1576172,
+ -2720404, -1891738, 2309456, 769178, -2975646, -707150, 2424652,
+ -88039, -2966660, -65452, 2320780, -957557, -2798978, 744640,
+ 1879794, -1672081, -2365319, 1253309, 1366383, -2204082, -1544367,
+ 1801452, 613828, -2531994, -983847, 2064842, 118326, -2613790,
+ -203220, 2219635, -730341, -2641861, 563557, 1765434, -1329916,
+ -2272927, 1037138, 1266725, -1939220, -1588643, 1754528, 816552,
+ -2376303, -1099167, 1864999, 122477, -2422762, -400027, 1889228,
+ -579916, -2490353, 287139, 2011318, -1176657, -2502978, 812896,
+ 1116502, -1940211};
static const int16_t time2spec_out_expected_1[kSamples] = {
- 20342, 23889, -10063, -9419,
- 3242, 7280, -2012, -5029, 332, 4478, -97, -3244, -891, 3117, 773, -2204,
- -1335, 2009, 1236, -1469, -1562, 1277, 1366, -815, -1619, 599, 1449, -177,
- -1507, 116, 1294, 263, -1338, -244, 1059, 553, -1045, -549, 829, 826,
- -731, -755, 516, 909, -427, -853, 189, 1004, -184, -828, -108, 888, 72,
- -700, -280, 717, 342, -611, -534, 601, 534, -374, -646, 399, 567, -171,
- -720, 234, 645, -11, -712, -26, 593, 215, -643, -172, 536, 361, -527,
- -403, 388, 550, -361, -480, 208, 623, -206, -585, 41, 578, 12, -504,
- -182, 583, 218, -437, -339, 499, 263, -354, -450, 347, 456, -193, -524,
- 212, 475, -74, -566, 94, 511, 112, -577, -201, 408, 217, -546, -295, 338,
- 387, -13, 4, -46, 2, -76, 103, -83, 108, -55, 100, -150, 131, -156, 141,
- -171, 179, -190, 128, -227, 172, -214, 215, -189, 265, -244, 322, -335,
- 337, -352, 358, -368, 362, -355, 366, -381, 403, -395, 411, -392, 446,
- -458, 504, -449, 507, -464, 452, -491, 481, -534, 486, -516, 560, -535,
- 525, -537, 559, -554, 570, -616, 591, -585, 627, -509, 588, -584, 547,
- -610, 580, -614, 635, -620, 655, -554, 546, -591, 642, -590, 660, -656,
- 629, -604, 620, -580, 617, -645, 648, -573, 612, -604, 584, -571, 597,
- -562, 627, -550, 560, -606, 529, -584, 568, -503, 532, -463, 512, -440,
- 399, -457, 437, -349, 278, -317, 257, -220, 163, -8, -61, 18, -161, 367,
- -1306};
+ 20342, 23889, -10063, -9419, 3242, 7280, -2012, -5029, 332, 4478,
+ -97, -3244, -891, 3117, 773, -2204, -1335, 2009, 1236, -1469,
+ -1562, 1277, 1366, -815, -1619, 599, 1449, -177, -1507, 116,
+ 1294, 263, -1338, -244, 1059, 553, -1045, -549, 829, 826,
+ -731, -755, 516, 909, -427, -853, 189, 1004, -184, -828,
+ -108, 888, 72, -700, -280, 717, 342, -611, -534, 601,
+ 534, -374, -646, 399, 567, -171, -720, 234, 645, -11,
+ -712, -26, 593, 215, -643, -172, 536, 361, -527, -403,
+ 388, 550, -361, -480, 208, 623, -206, -585, 41, 578,
+ 12, -504, -182, 583, 218, -437, -339, 499, 263, -354,
+ -450, 347, 456, -193, -524, 212, 475, -74, -566, 94,
+ 511, 112, -577, -201, 408, 217, -546, -295, 338, 387,
+ -13, 4, -46, 2, -76, 103, -83, 108, -55, 100,
+ -150, 131, -156, 141, -171, 179, -190, 128, -227, 172,
+ -214, 215, -189, 265, -244, 322, -335, 337, -352, 358,
+ -368, 362, -355, 366, -381, 403, -395, 411, -392, 446,
+ -458, 504, -449, 507, -464, 452, -491, 481, -534, 486,
+ -516, 560, -535, 525, -537, 559, -554, 570, -616, 591,
+ -585, 627, -509, 588, -584, 547, -610, 580, -614, 635,
+ -620, 655, -554, 546, -591, 642, -590, 660, -656, 629,
+ -604, 620, -580, 617, -645, 648, -573, 612, -604, 584,
+ -571, 597, -562, 627, -550, 560, -606, 529, -584, 568,
+ -503, 532, -463, 512, -440, 399, -457, 437, -349, 278,
+ -317, 257, -220, 163, -8, -61, 18, -161, 367, -1306};
static const int16_t time2spec_out_expected_2[kSamples] = {
- 14283, -11552, -15335, 6626,
- 7554, -2150, -6309, 1307, 4523, -4, -3908, -314, 3001, 914, -2715, -1042,
- 2094, 1272, -1715, -1399, 1263, 1508, -1021, -1534, 735, 1595, -439, -1447,
- 155, 1433, 22, -1325, -268, 1205, 424, -1030, -608, 950, 643, -733, -787,
- 661, 861, -502, -888, 331, 852, -144, -849, 19, 833, 99, -826, -154,
- 771, 368, -735, -459, 645, 513, -491, -604, 431, 630, -314, -598, 183,
- 622, -78, -612, -48, 641, 154, -645, -257, 610, 281, -529, -444, 450,
- 441, -327, -506, 274, 476, -232, -570, 117, 554, -86, -531, -21, 572,
- 151, -606, -221, 496, 322, -407, -388, 407, 394, -268, -428, 280, 505,
- -115, -588, 19, 513, -29, -539, -109, 468, 173, -501, -242, 442, 278,
- -478, -680, 656, -659, 656, -669, 602, -688, 612, -667, 612, -642, 627,
- -648, 653, -676, 596, -680, 655, -649, 678, -672, 587, -608, 637, -645,
- 637, -620, 556, -580, 553, -635, 518, -599, 583, -501, 536, -544, 473,
- -552, 583, -511, 541, -532, 563, -486, 461, -453, 486, -388, 424, -416,
- 432, -374, 399, -462, 364, -346, 293, -329, 331, -313, 281, -247, 309,
- -337, 241, -190, 207, -194, 179, -163, 155, -156, 117, -135, 107, -126,
- 29, -22, 81, -8, 17, -61, -10, 8, -37, 80, -44, 72, -88, 65, -89, 130,
- -114, 181, -215, 189, -245, 260, -288, 294, -339, 344, -396, 407, -429,
- 438, -439, 485, -556, 629, -612, 637, -645, 661, -737, 829, -830, 831,
- -1041};
+ 14283, -11552, -15335, 6626, 7554, -2150, -6309, 1307, 4523, -4,
+ -3908, -314, 3001, 914, -2715, -1042, 2094, 1272, -1715, -1399,
+ 1263, 1508, -1021, -1534, 735, 1595, -439, -1447, 155, 1433,
+ 22, -1325, -268, 1205, 424, -1030, -608, 950, 643, -733,
+ -787, 661, 861, -502, -888, 331, 852, -144, -849, 19,
+ 833, 99, -826, -154, 771, 368, -735, -459, 645, 513,
+ -491, -604, 431, 630, -314, -598, 183, 622, -78, -612,
+ -48, 641, 154, -645, -257, 610, 281, -529, -444, 450,
+ 441, -327, -506, 274, 476, -232, -570, 117, 554, -86,
+ -531, -21, 572, 151, -606, -221, 496, 322, -407, -388,
+ 407, 394, -268, -428, 280, 505, -115, -588, 19, 513,
+ -29, -539, -109, 468, 173, -501, -242, 442, 278, -478,
+ -680, 656, -659, 656, -669, 602, -688, 612, -667, 612,
+ -642, 627, -648, 653, -676, 596, -680, 655, -649, 678,
+ -672, 587, -608, 637, -645, 637, -620, 556, -580, 553,
+ -635, 518, -599, 583, -501, 536, -544, 473, -552, 583,
+ -511, 541, -532, 563, -486, 461, -453, 486, -388, 424,
+ -416, 432, -374, 399, -462, 364, -346, 293, -329, 331,
+ -313, 281, -247, 309, -337, 241, -190, 207, -194, 179,
+ -163, 155, -156, 117, -135, 107, -126, 29, -22, 81,
+ -8, 17, -61, -10, 8, -37, 80, -44, 72, -88,
+ 65, -89, 130, -114, 181, -215, 189, -245, 260, -288,
+ 294, -339, 344, -396, 407, -429, 438, -439, 485, -556,
+ 629, -612, 637, -645, 661, -737, 829, -830, 831, -1041};
class TransformTest : public testing::Test {
protected:
- TransformTest() {
- WebRtcSpl_Init();
- }
+ 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
- // large buffer but we have to test it here.
- int16_t data_in_1[kSamples] = {0};
- int16_t data_in_2[kSamples] = {0};
- int16_t data_out_1[kSamples] = {0};
- int16_t data_out_2[kSamples] = {0};
+ // Pass a function pointer to the Tester function.
+ void Time2SpecTester(Time2Spec Time2SpecFunction) {
+ // WebRtcIsacfix_Time2Spec functions hard coded the buffer lengths. It's a
+ // large buffer but we have to test it here.
+ int16_t data_in_1[kSamples] = {0};
+ int16_t data_in_2[kSamples] = {0};
+ int16_t data_out_1[kSamples] = {0};
+ int16_t data_out_2[kSamples] = {0};
- for(int i = 0; i < kSamples; i++) {
- data_in_1[i] = i * i + 1777;
- data_in_2[i] = WEBRTC_SPL_WORD16_MAX / (i + 1) + 17;
- }
+ for (int i = 0; i < kSamples; i++) {
+ data_in_1[i] = i * i + 1777;
+ data_in_2[i] = WEBRTC_SPL_WORD16_MAX / (i + 1) + 17;
+ }
- Time2SpecFunction(data_in_1, data_in_2, data_out_1, data_out_2);
+ Time2SpecFunction(data_in_1, data_in_2, data_out_1, data_out_2);
- for (int i = 0; i < kSamples; i++) {
- // We don't require bit-exact for ARM assembly code.
- EXPECT_LE(abs(time2spec_out_expected_1[i] - data_out_1[i]), 1);
- EXPECT_LE(abs(time2spec_out_expected_2[i] - data_out_2[i]), 1);
- }
- }
+ for (int i = 0; i < kSamples; i++) {
+ // We don't require bit-exact for ARM assembly code.
+ EXPECT_LE(abs(time2spec_out_expected_1[i] - data_out_1[i]), 1);
+ EXPECT_LE(abs(time2spec_out_expected_2[i] - data_out_2[i]), 1);
+ }
+ }
// Pass a function pointer to the Tester function.
void Spec2TimeTester(Spec2Time Spec2TimeFunction) {
@@ -162,7 +171,7 @@
int16_t data_in_2[kSamples] = {0};
int32_t data_out_1[kSamples] = {0};
int32_t data_out_2[kSamples] = {0};
- for(int i = 0; i < kSamples; i++) {
+ for (int i = 0; i < kSamples; i++) {
data_in_1[i] = i * i + 1777;
data_in_2[i] = WEBRTC_SPL_WORD16_MAX / (i + 1) + 17;
}
@@ -175,7 +184,6 @@
EXPECT_LE(abs(spec2time_out_expected_2[i] - data_out_2[i]), 16);
}
}
-
};
TEST_F(TransformTest, Time2SpecTest) {
diff --git a/modules/audio_coding/codecs/isac/fix/test/isac_speed_test.cc b/modules/audio_coding/codecs/isac/fix/test/isac_speed_test.cc
index fc779d8..aeca2e8 100644
--- a/modules/audio_coding/codecs/isac/fix/test/isac_speed_test.cc
+++ b/modules/audio_coding/codecs/isac/fix/test/isac_speed_test.cc
@@ -25,19 +25,21 @@
IsacSpeedTest();
void SetUp() override;
void TearDown() override;
- float EncodeABlock(int16_t* in_data, uint8_t* bit_stream,
- size_t max_bytes, size_t* encoded_bytes) override;
- float DecodeABlock(const uint8_t* bit_stream, size_t encoded_bytes,
+ float EncodeABlock(int16_t* in_data,
+ uint8_t* bit_stream,
+ size_t max_bytes,
+ size_t* encoded_bytes) override;
+ float DecodeABlock(const uint8_t* bit_stream,
+ size_t encoded_bytes,
int16_t* out_data) override;
- ISACFIX_MainStruct *ISACFIX_main_inst_;
+ ISACFIX_MainStruct* ISACFIX_main_inst_;
};
IsacSpeedTest::IsacSpeedTest()
: AudioCodecSpeedTest(kIsacBlockDurationMs,
kIsacInputSamplingKhz,
kIsacOutputSamplingKhz),
- ISACFIX_main_inst_(NULL) {
-}
+ ISACFIX_main_inst_(NULL) {}
void IsacSpeedTest::SetUp() {
AudioCodecSpeedTest::SetUp();
@@ -60,8 +62,10 @@
EXPECT_EQ(0, WebRtcIsacfix_Free(ISACFIX_main_inst_));
}
-float IsacSpeedTest::EncodeABlock(int16_t* in_data, uint8_t* bit_stream,
- size_t max_bytes, size_t* encoded_bytes) {
+float IsacSpeedTest::EncodeABlock(int16_t* in_data,
+ uint8_t* bit_stream,
+ size_t max_bytes,
+ size_t* encoded_bytes) {
// ISAC takes 10 ms everycall
const int subblocks = block_duration_ms_ / 10;
const int subblock_length = 10 * input_sampling_khz_;
@@ -70,8 +74,8 @@
clock_t clocks = clock();
size_t pointer = 0;
for (int idx = 0; idx < subblocks; idx++, pointer += subblock_length) {
- value = WebRtcIsacfix_Encode(ISACFIX_main_inst_, &in_data[pointer],
- bit_stream);
+ value =
+ WebRtcIsacfix_Encode(ISACFIX_main_inst_, &in_data[pointer], bit_stream);
if (idx == subblocks - 1)
EXPECT_GT(value, 0);
else
@@ -108,7 +112,6 @@
string("pcm"),
true)};
-INSTANTIATE_TEST_CASE_P(AllTest, IsacSpeedTest,
- ::testing::ValuesIn(param_set));
+INSTANTIATE_TEST_CASE_P(AllTest, IsacSpeedTest, ::testing::ValuesIn(param_set));
} // namespace webrtc
diff --git a/modules/audio_coding/codecs/isac/fix/test/kenny.cc b/modules/audio_coding/codecs/isac/fix/test/kenny.cc
index 4251627..fb64a2b 100644
--- a/modules/audio_coding/codecs/isac/fix/test/kenny.cc
+++ b/modules/audio_coding/codecs/isac/fix/test/kenny.cc
@@ -8,11 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <ctype.h>
#include "modules/audio_coding/codecs/isac/fix/include/isacfix.h"
#include "test/gtest.h"
@@ -22,14 +22,16 @@
// separate encoder and decoder.
/* Defines */
-#define SEED_FILE "randseed.txt" /* Used when running decoder on garbage data */
-#define MAX_FRAMESAMPLES 960 /* max number of samples per frame (= 60 ms frame) */
-#define FRAMESAMPLES_10ms 160 /* number of samples per 10ms frame */
-#define FS 16000 /* sampling frequency (Hz) */
+#define SEED_FILE \
+ "randseed.txt" /* Used when running decoder on garbage data \
+ */
+#define MAX_FRAMESAMPLES \
+ 960 /* max number of samples per frame (= 60 ms frame) */
+#define FRAMESAMPLES_10ms 160 /* number of samples per 10ms frame */
+#define FS 16000 /* sampling frequency (Hz) */
/* Function for reading audio data from PCM file */
-int readframe(int16_t *data, FILE *inp, int length) {
-
+int readframe(int16_t* data, FILE* inp, int length) {
short k, rlen, status = 0;
rlen = fread(data, sizeof(int16_t), length, inp);
@@ -45,25 +47,24 @@
// Globals needed because gtest does not provide access to argv.
// This should be reworked to use flags.
static int global_argc;
-static char **global_argv;
+static char** global_argv;
/* Struct for bottleneck model */
typedef struct {
- uint32_t send_time; /* samples */
- uint32_t arrival_time; /* samples */
- uint32_t sample_count; /* samples */
+ uint32_t send_time; /* samples */
+ uint32_t arrival_time; /* samples */
+ uint32_t sample_count; /* samples */
uint16_t rtp_number;
} BottleNeckModel;
-void get_arrival_time(int current_framesamples, /* samples */
- size_t packet_size, /* bytes */
- int bottleneck, /* excluding headers; bits/s */
- BottleNeckModel *BN_data)
-{
+void get_arrival_time(int current_framesamples, /* samples */
+ size_t packet_size, /* bytes */
+ int bottleneck, /* excluding headers; bits/s */
+ BottleNeckModel* BN_data) {
const int HeaderSize = 35;
int HeaderRate;
- HeaderRate = HeaderSize * 8 * FS / current_framesamples; /* bits/s */
+ HeaderRate = HeaderSize * 8 * FS / current_framesamples; /* bits/s */
/* everything in samples */
BN_data->sample_count = BN_data->sample_count + current_framesamples;
@@ -80,29 +81,27 @@
void get_arrival_time2(int current_framesamples,
int current_delay,
- BottleNeckModel *BN_data)
-{
+ BottleNeckModel* BN_data) {
if (current_delay == -1)
- //dropped packet
+ // dropped packet
{
BN_data->arrival_time += current_framesamples;
- }
- else if (current_delay != -2)
- {
+ } else if (current_delay != -2) {
//
- BN_data->arrival_time += (current_framesamples + ((FS/1000) * current_delay));
+ BN_data->arrival_time +=
+ (current_framesamples + ((FS / 1000) * current_delay));
}
- //else
- //current packet has same timestamp as previous packet
+ // else
+ // current packet has same timestamp as previous packet
BN_data->rtp_number++;
}
TEST(IsacFixTest, Kenny) {
int argc = global_argc;
- char **argv = global_argv;
+ char** argv = global_argv;
- char inname[100], outname[100], outbitsname[100], bottleneck_file[100];
+ char inname[100], outname[100], outbitsname[100], bottleneck_file[100];
FILE *inp, *outp, *f_bn, *outbits;
int endfile;
@@ -112,7 +111,7 @@
int errtype, h = 0, k, packetLossPercent = 0;
int16_t CodingMode;
int16_t bottleneck;
- int framesize = 30; /* ms */
+ int framesize = 30; /* ms */
int cur_framesmpls, err = 0, lostPackets = 0;
/* Runtime statistics */
@@ -133,16 +132,16 @@
int32_t payloadRate = 0;
int setControlBWE = 0;
int readLoss;
- FILE *plFile = NULL;
+ FILE* plFile = NULL;
char version_number[20];
char tmpBit[5] = ".bit";
- int totalbits =0;
- int totalsmpls =0;
+ int totalbits = 0;
+ int totalsmpls = 0;
int16_t testNum, testCE;
- FILE *fp_gns = NULL;
+ FILE* fp_gns = NULL;
int gns = 0;
int cur_delay = 0;
char gns_file[100];
@@ -151,20 +150,20 @@
int16_t lostFrame;
float scale = (float)0.7;
/* only one structure used for ISAC encoder */
- ISACFIX_MainStruct *ISAC_main_inst = NULL;
+ ISACFIX_MainStruct* ISAC_main_inst = NULL;
/* For fault test 10, garbage data */
- FILE *seedfile;
- unsigned int random_seed = (unsigned int) time(NULL);//1196764538
+ FILE* seedfile;
+ unsigned int random_seed = (unsigned int)time(NULL); // 1196764538
- BottleNeckModel BN_data;
- f_bn = NULL;
+ BottleNeckModel BN_data;
+ f_bn = NULL;
readLoss = 0;
packetLossPercent = 0;
/* Handling wrong input arguments in the command line */
- if ((argc<3) || (argc>22)) {
+ if ((argc < 3) || (argc > 22)) {
printf("\n\nWrong number of arguments or flag values.\n\n");
printf("\n");
@@ -182,61 +181,75 @@
printf(" read from a file (e.g. bottleneck.txt)\n\n");
printf("infile :Normal speech input file\n\n");
printf("outfile :Speech output file\n\n");
- printf("[-INITRATE num] :Set a new value for initial rate. Note! Only used"
- " in adaptive mode.\n\n");
- printf("[-FL num] :Set (initial) frame length in msec. Valid length"
- " are 30 and 60 msec.\n\n");
+ printf(
+ "[-INITRATE num] :Set a new value for initial rate. Note! Only used"
+ " in adaptive mode.\n\n");
+ printf(
+ "[-FL num] :Set (initial) frame length in msec. Valid length"
+ " are 30 and 60 msec.\n\n");
printf("[-FIXED_FL] :Frame length to be fixed to initial value.\n\n");
- printf("[-MAX num] :Set the limit for the payload size of iSAC"
- " in bytes. \n");
+ printf(
+ "[-MAX num] :Set the limit for the payload size of iSAC"
+ " in bytes. \n");
printf(" Minimum 100, maximum 400.\n\n");
printf("[-MAXRATE num] :Set the maxrate for iSAC in bits per second. \n");
printf(" Minimum 32000, maximum 53400.\n\n");
printf("[-F num] :if -F option is specified, the test function\n");
- printf(" will run the iSAC API fault scenario specified"
- " by the\n");
+ printf(
+ " will run the iSAC API fault scenario specified"
+ " by the\n");
printf(" supplied number.\n");
printf(" F 1 - Call encoder prior to init encoder call\n");
printf(" F 2 - Call decoder prior to init decoder call\n");
printf(" F 3 - Call decoder prior to encoder call\n");
- printf(" F 4 - Call decoder with a too short coded"
- " sequence\n");
- printf(" F 5 - Call decoder with a too long coded"
- " sequence\n");
+ printf(
+ " F 4 - Call decoder with a too short coded"
+ " sequence\n");
+ printf(
+ " F 5 - Call decoder with a too long coded"
+ " sequence\n");
printf(" F 6 - Call decoder with random bit stream\n");
- printf(" F 7 - Call init encoder/decoder at random"
- " during a call\n");
- printf(" F 8 - Call encoder/decoder without having"
- " allocated memory for \n");
+ printf(
+ " F 7 - Call init encoder/decoder at random"
+ " during a call\n");
+ printf(
+ " F 8 - Call encoder/decoder without having"
+ " allocated memory for \n");
printf(" encoder/decoder instance\n");
printf(" F 9 - Call decodeB without calling decodeA\n");
printf(" F 10 - Call decodeB with garbage data\n");
- printf("[-PL num] :if -PL option is specified 0<num<100 will "
- "specify the\n");
+ printf(
+ "[-PL num] :if -PL option is specified 0<num<100 will "
+ "specify the\n");
printf(" percentage of packet loss\n\n");
- printf("[-G file] :if -G option is specified the file given is"
- " a .gns file\n");
+ printf(
+ "[-G file] :if -G option is specified the file given is"
+ " a .gns file\n");
printf(" that represents a network profile\n\n");
printf("[-NB num] :if -NB option, use the narrowband interfaces\n");
- printf(" num=1 => encode with narrowband encoder"
- " (infile is narrowband)\n");
- printf(" num=2 => decode with narrowband decoder"
- " (outfile is narrowband)\n\n");
+ printf(
+ " num=1 => encode with narrowband encoder"
+ " (infile is narrowband)\n");
+ printf(
+ " num=2 => decode with narrowband decoder"
+ " (outfile is narrowband)\n\n");
printf("[-CE num] :Test of APIs used by Conference Engine.\n");
- printf(" CE 1 - createInternal, freeInternal,"
- " getNewBitstream \n");
+ printf(
+ " CE 1 - createInternal, freeInternal,"
+ " getNewBitstream \n");
printf(" CE 2 - transcode, getBWE \n");
printf(" CE 3 - getSendBWE, setSendBWE. \n\n");
- printf("[-RTP_INIT num] :if -RTP_INIT option is specified num will be"
- " the initial\n");
+ printf(
+ "[-RTP_INIT num] :if -RTP_INIT option is specified num will be"
+ " the initial\n");
printf(" value of the rtp sequence number.\n\n");
printf("[--isolated-script-test-perf-output=file]\n");
- printf(" :If this option is specified, perf values will be"
- " written to this file in a JSON format.\n\n");
+ printf(
+ " :If this option is specified, perf values will be"
+ " written to this file in a JSON format.\n\n");
printf("Example usage :\n\n");
printf("%s -I bottleneck.txt speechIn.pcm speechOut.pcm\n\n", argv[0]);
exit(1);
-
}
/* Print version number */
@@ -250,7 +263,7 @@
i = 1;
/* Instantaneous mode */
- if (!strcmp ("-I", argv[i])) {
+ if (!strcmp("-I", argv[i])) {
printf("\nInstantaneous BottleNeck\n");
CodingMode = 1;
i++;
@@ -265,7 +278,7 @@
for (; i < argc; i++) {
/* Set (initial) bottleneck value */
- if (!strcmp ("-INITRATE", argv[i])) {
+ if (!strcmp("-INITRATE", argv[i])) {
if (i + 1 >= argc) {
printf("-INITRATE requires a parameter.\n");
exit(1);
@@ -273,8 +286,10 @@
rateBPS = atoi(argv[i + 1]);
setControlBWE = 1;
if ((rateBPS < 10000) || (rateBPS > 32000)) {
- printf("\n%d is not a initial rate. "
- "Valid values are in the range 10000 to 32000.\n", rateBPS);
+ printf(
+ "\n%d is not a initial rate. "
+ "Valid values are in the range 10000 to 32000.\n",
+ rateBPS);
exit(1);
}
printf("\nNew initial rate: %d\n", rateBPS);
@@ -282,15 +297,17 @@
}
/* Set (initial) framelength */
- if (!strcmp ("-FL", argv[i])) {
+ if (!strcmp("-FL", argv[i])) {
if (i + 1 >= argc) {
printf("-FL requires a parameter.\n");
exit(1);
}
framesize = atoi(argv[i + 1]);
if ((framesize != 30) && (framesize != 60)) {
- printf("\n%d is not a valid frame length. "
- "Valid length are 30 and 60 msec.\n", framesize);
+ printf(
+ "\n%d is not a valid frame length. "
+ "Valid length are 30 and 60 msec.\n",
+ framesize);
exit(1);
}
printf("\nFrame Length: %d\n", framesize);
@@ -298,13 +315,13 @@
}
/* Fixed frame length */
- if (!strcmp ("-FIXED_FL", argv[i])) {
+ if (!strcmp("-FIXED_FL", argv[i])) {
fixedFL = 1;
setControlBWE = 1;
}
/* Set maximum allowed payload size in bytes */
- if (!strcmp ("-MAX", argv[i])) {
+ if (!strcmp("-MAX", argv[i])) {
if (i + 1 >= argc) {
printf("-MAX requires a parameter.\n");
exit(1);
@@ -315,7 +332,7 @@
}
/* Set maximum rate in bytes */
- if (!strcmp ("-MAXRATE", argv[i])) {
+ if (!strcmp("-MAXRATE", argv[i])) {
if (i + 1 >= argc) {
printf("-MAXRATE requires a parameter.\n");
exit(1);
@@ -326,7 +343,7 @@
}
/* Test of fault scenarious */
- if (!strcmp ("-F", argv[i])) {
+ if (!strcmp("-F", argv[i])) {
if (i + 1 >= argc) {
printf("-F requires a parameter.");
exit(1);
@@ -334,59 +351,63 @@
testNum = atoi(argv[i + 1]);
printf("\nFault test: %d\n", testNum);
if (testNum < 1 || testNum > 10) {
- printf("\n%d is not a valid Fault Scenario number."
- " Valid Fault Scenarios are numbered 1-10.\n", testNum);
+ printf(
+ "\n%d is not a valid Fault Scenario number."
+ " Valid Fault Scenarios are numbered 1-10.\n",
+ testNum);
exit(1);
}
i++;
}
/* Packet loss test */
- if (!strcmp ("-PL", argv[i])) {
+ if (!strcmp("-PL", argv[i])) {
if (i + 1 >= argc) {
printf("-PL requires a parameter.\n");
exit(1);
}
- if( isdigit( *argv[i+1] ) ) {
- packetLossPercent = atoi( argv[i+1] );
- if( (packetLossPercent < 0) | (packetLossPercent > 100) ) {
- printf( "\nInvalid packet loss perentage \n" );
- exit( 1 );
+ if (isdigit(*argv[i + 1])) {
+ packetLossPercent = atoi(argv[i + 1]);
+ if ((packetLossPercent < 0) | (packetLossPercent > 100)) {
+ printf("\nInvalid packet loss perentage \n");
+ exit(1);
}
- if( packetLossPercent > 0 ) {
- printf( "\nSimulating %d %% of independent packet loss\n",
- packetLossPercent );
+ if (packetLossPercent > 0) {
+ printf("\nSimulating %d %% of independent packet loss\n",
+ packetLossPercent);
} else {
- printf( "\nNo Packet Loss Is Simulated \n" );
+ printf("\nNo Packet Loss Is Simulated \n");
}
readLoss = 0;
} else {
readLoss = 1;
- plFile = fopen( argv[i+1], "rb" );
- if( plFile == NULL ) {
- FAIL() << "Couldn't open the frameloss file: " << argv[i+1];
+ plFile = fopen(argv[i + 1], "rb");
+ if (plFile == NULL) {
+ FAIL() << "Couldn't open the frameloss file: " << argv[i + 1];
}
- printf( "\nSimulating packet loss through the given "
- "channel file: %s\n", argv[i+1] );
+ printf(
+ "\nSimulating packet loss through the given "
+ "channel file: %s\n",
+ argv[i + 1]);
}
i++;
}
/* Random packetlosses */
- if (!strcmp ("-rnd", argv[i])) {
- srand(time(NULL) );
- printf( "\n Random pattern in lossed packets \n" );
+ if (!strcmp("-rnd", argv[i])) {
+ srand(time(NULL));
+ printf("\n Random pattern in lossed packets \n");
}
/* Use gns file */
- if (!strcmp ("-G", argv[i])) {
+ if (!strcmp("-G", argv[i])) {
if (i + 1 >= argc) {
printf("-G requires a parameter.\n");
exit(1);
}
sscanf(argv[i + 1], "%s", gns_file);
fp_gns = fopen(gns_file, "rb");
- if (fp_gns == NULL) {
+ if (fp_gns == NULL) {
FAIL() << "Cannot read file " << gns_file << ".";
}
gns = 1;
@@ -394,7 +415,7 @@
}
/* Run Narrowband interfaces (either encoder or decoder) */
- if (!strcmp ("-NB", argv[i])) {
+ if (!strcmp("-NB", argv[i])) {
if (i + 1 >= argc) {
printf("-NB requires a parameter.\n");
exit(1);
@@ -404,25 +425,27 @@
}
/* Run Conference Engine APIs */
- if (!strcmp ("-CE", argv[i])) {
+ if (!strcmp("-CE", argv[i])) {
if (i + 1 >= argc) {
printf("-CE requires a parameter.\n");
exit(1);
}
testCE = atoi(argv[i + 1]);
- if (testCE==1 || testCE==2) {
+ if (testCE == 1 || testCE == 2) {
i++;
- scale = (float)atof( argv[i+1] );
+ scale = (float)atof(argv[i + 1]);
} else if (testCE < 1 || testCE > 3) {
- printf("\n%d is not a valid CE-test number, valid Fault "
- "Scenarios are numbered 1-3\n", testCE);
+ printf(
+ "\n%d is not a valid CE-test number, valid Fault "
+ "Scenarios are numbered 1-3\n",
+ testCE);
exit(1);
}
i++;
}
/* Set initial RTP number */
- if (!strcmp ("-RTP_INIT", argv[i])) {
+ if (!strcmp("-RTP_INIT", argv[i])) {
if (i + 1 >= argc) {
printf("-RTP_INIT requires a parameter.\n");
exit(1);
@@ -442,16 +465,16 @@
/* Get Bottleneck value */
/* Gns files and bottleneck should not and can not be used simultaneously */
- bottleneck = atoi(argv[CodingMode+1]);
+ bottleneck = atoi(argv[CodingMode + 1]);
if (bottleneck == 0 && gns == 0) {
- sscanf(argv[CodingMode+1], "%s", bottleneck_file);
+ sscanf(argv[CodingMode + 1], "%s", bottleneck_file);
f_bn = fopen(bottleneck_file, "rb");
- if (f_bn == NULL) {
+ if (f_bn == NULL) {
printf("No value provided for BottleNeck\n");
FAIL() << "Cannot read file " << bottleneck_file;
} else {
int aux_var;
- printf("reading bottleneck rates from file %s\n\n",bottleneck_file);
+ printf("reading bottleneck rates from file %s\n\n", bottleneck_file);
if (fscanf(f_bn, "%d", &aux_var) == EOF) {
/* Set pointer to beginning of file */
fseek(f_bn, 0L, SEEK_SET);
@@ -481,18 +504,18 @@
outbitsname[h] = outname[h];
h++;
}
- for (k=0; k<5; k++) {
+ for (k = 0; k < 5; k++) {
outbitsname[h] = tmpBit[k];
h++;
}
- if ((inp = fopen(inname,"rb")) == NULL) {
+ if ((inp = fopen(inname, "rb")) == NULL) {
FAIL() << " iSAC: Cannot read file " << inname;
}
- if ((outp = fopen(outname,"wb")) == NULL) {
+ if ((outp = fopen(outname, "wb")) == NULL) {
FAIL() << " iSAC: Cannot write file " << outname;
}
- if ((outbits = fopen(outbitsname,"wb")) == NULL) {
+ if ((outbits = fopen(outbitsname, "wb")) == NULL) {
FAIL() << " iSAC: Cannot write file " << outbitsname;
}
printf("\nInput:%s\nOutput:%s\n\n", inname, outname);
@@ -502,30 +525,28 @@
/* Test to run decoder with garbage data */
srand(random_seed);
- if ( (seedfile = fopen(SEED_FILE, "a+t") ) == NULL ) {
+ if ((seedfile = fopen(SEED_FILE, "a+t")) == NULL) {
printf("Error: Could not open file %s\n", SEED_FILE);
- }
- else {
+ } else {
fprintf(seedfile, "%u\n", random_seed);
fclose(seedfile);
}
}
/* Runtime statistics */
- starttime = clock()/(double)CLOCKS_PER_SEC;
+ starttime = clock() / (double)CLOCKS_PER_SEC;
/* Initialize the ISAC and BN structs */
- if (testNum != 8)
- {
- if(1){
- err =WebRtcIsacfix_Create(&ISAC_main_inst);
- }else{
+ if (testNum != 8) {
+ if (1) {
+ err = WebRtcIsacfix_Create(&ISAC_main_inst);
+ } else {
/* Test the Assign functions */
int sss;
- void *ppp;
- err =WebRtcIsacfix_AssignSize(&sss);
- ppp=malloc(sss);
- err =WebRtcIsacfix_Assign(&ISAC_main_inst,ppp);
+ void* ppp;
+ err = WebRtcIsacfix_AssignSize(&sss);
+ ppp = malloc(sss);
+ err = WebRtcIsacfix_Assign(&ISAC_main_inst, ppp);
}
/* Error check */
if (err < 0) {
@@ -541,13 +562,13 @@
}
/* Init of bandwidth data */
- BN_data.send_time = 0;
- BN_data.arrival_time = 0;
- BN_data.sample_count = 0;
- BN_data.rtp_number = 0;
+ BN_data.send_time = 0;
+ BN_data.arrival_time = 0;
+ BN_data.sample_count = 0;
+ BN_data.rtp_number = 0;
/* Initialize encoder and decoder */
- framecnt= 0;
+ framecnt = 0;
endfile = 0;
if (testNum != 1) {
WebRtcIsacfix_EncoderInit(ISAC_main_inst, CodingMode);
@@ -560,10 +581,10 @@
err = WebRtcIsacfix_Control(ISAC_main_inst, bottleneck, framesize);
if (err < 0) {
/* exit if returned with error */
- errtype=WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
+ errtype = WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
printf("\n\n Error in control: %d.\n\n", errtype);
}
- } else if(setControlBWE == 1) {
+ } else if (setControlBWE == 1) {
err = WebRtcIsacfix_ControlBwe(ISAC_main_inst, rateBPS, framesize, fixedFL);
}
@@ -571,7 +592,7 @@
err = WebRtcIsacfix_SetMaxPayloadSize(ISAC_main_inst, payloadSize);
if (err < 0) {
/* exit if returned with error */
- errtype=WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
+ errtype = WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
FAIL() << "Error in SetMaxPayloadSize: " << errtype;
}
}
@@ -579,35 +600,32 @@
err = WebRtcIsacfix_SetMaxRate(ISAC_main_inst, payloadRate);
if (err < 0) {
/* exit if returned with error */
- errtype=WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
+ errtype = WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
FAIL() << "Error in SetMaxRateInBytes: " << errtype;
}
}
*speechType = 1;
-
while (endfile == 0) {
-
- if(testNum == 7 && (rand()%2 == 0)) {
+ if (testNum == 7 && (rand() % 2 == 0)) {
err = WebRtcIsacfix_EncoderInit(ISAC_main_inst, CodingMode);
/* Error check */
if (err < 0) {
- errtype=WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
+ errtype = WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
printf("\n\n Error in encoderinit: %d.\n\n", errtype);
}
WebRtcIsacfix_DecoderInit(ISAC_main_inst);
}
-
cur_framesmpls = 0;
while (1) {
/* Read 10 ms speech block */
if (nbTest != 1) {
endfile = readframe(shortdata, inp, FRAMESAMPLES_10ms);
} else {
- endfile = readframe(shortdata, inp, (FRAMESAMPLES_10ms/2));
+ endfile = readframe(shortdata, inp, (FRAMESAMPLES_10ms / 2));
}
if (testNum == 7) {
@@ -620,22 +638,18 @@
short bwe;
/* Encode */
- stream_len_int = WebRtcIsacfix_Encode(ISAC_main_inst,
- shortdata,
+ stream_len_int = WebRtcIsacfix_Encode(ISAC_main_inst, shortdata,
(uint8_t*)streamdata);
/* If packet is ready, and CE testing, call the different API
functions from the internal API. */
- if (stream_len_int>0) {
+ if (stream_len_int > 0) {
if (testCE == 1) {
err = WebRtcIsacfix_ReadBwIndex(
reinterpret_cast<const uint8_t*>(streamdata),
- static_cast<size_t>(stream_len_int),
- &bwe);
+ static_cast<size_t>(stream_len_int), &bwe);
stream_len_int = WebRtcIsacfix_GetNewBitStream(
- ISAC_main_inst,
- bwe,
- scale,
+ ISAC_main_inst, bwe, scale,
reinterpret_cast<uint8_t*>(streamdata));
} else if (testCE == 2) {
/* transcode function not supported */
@@ -646,37 +660,33 @@
err = WebRtcIsacfix_GetDownLinkBwIndex(ISAC_main_inst, &bwe);
/* Error Check */
if (err < 0) {
- errtype=WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
+ errtype = WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
printf("\nError in getSendBWE: %d.\n", errtype);
}
err = WebRtcIsacfix_UpdateUplinkBw(ISAC_main_inst, bwe);
/* Error Check */
if (err < 0) {
- errtype=WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
+ errtype = WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
printf("\nError in setBWE: %d.\n", errtype);
}
-
}
}
} else {
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
- stream_len_int = WebRtcIsacfix_EncodeNb(ISAC_main_inst,
- shortdata,
- streamdata);
+ stream_len_int =
+ WebRtcIsacfix_EncodeNb(ISAC_main_inst, shortdata, streamdata);
#else
stream_len_int = -1;
#endif
}
- }
- else
- {
+ } else {
break;
}
if (stream_len_int < 0 || err < 0) {
/* exit if returned with error */
- errtype=WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
+ errtype = WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
printf("\nError in encoder: %d.\n", errtype);
} else {
stream_len = static_cast<size_t>(stream_len_int);
@@ -705,7 +715,8 @@
}
/* exit encoder loop if the encoder returned a bitstream */
- if (stream_len != 0) break;
+ if (stream_len != 0)
+ break;
}
/* make coded sequence to short be inreasing */
@@ -722,7 +733,7 @@
if (testNum == 6) {
srand(time(NULL));
- for (i = 0; i < static_cast<int>(stream_len); i++ ) {
+ for (i = 0; i < static_cast<int>(stream_len); i++) {
streamdata[i] = rand();
}
}
@@ -740,8 +751,7 @@
/* simulate packet handling through NetEq and the modem */
if (!(testNum == 3 && framecnt == 0)) {
if (gns == 0) {
- get_arrival_time(cur_framesmpls, stream_len, bottleneck,
- &BN_data);
+ get_arrival_time(cur_framesmpls, stream_len, bottleneck, &BN_data);
} else {
get_arrival_time2(cur_framesmpls, cur_delay, &BN_data);
}
@@ -749,44 +759,38 @@
/* packet not dropped */
if (cur_delay != -1) {
-
/* Error test number 10, garbage data */
if (testNum == 10) {
- for ( i = 0; i < static_cast<int>(stream_len); i++) {
- streamdata[i] = (short) (streamdata[i] + (short) rand());
+ for (i = 0; i < static_cast<int>(stream_len); i++) {
+ streamdata[i] = (short)(streamdata[i] + (short)rand());
}
}
if (testNum != 9) {
err = WebRtcIsacfix_UpdateBwEstimate(
- ISAC_main_inst,
- reinterpret_cast<const uint8_t*>(streamdata),
- stream_len,
- BN_data.rtp_number,
- BN_data.send_time,
+ ISAC_main_inst, reinterpret_cast<const uint8_t*>(streamdata),
+ stream_len, BN_data.rtp_number, BN_data.send_time,
BN_data.arrival_time);
if (err < 0) {
/* exit if returned with error */
- errtype=WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
+ errtype = WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
printf("\nError in decoder: %d.\n", errtype);
}
}
- if( readLoss == 1 ) {
- if( fread( &lostFrame, sizeof(int16_t), 1, plFile ) != 1 ) {
- rewind( plFile );
+ if (readLoss == 1) {
+ if (fread(&lostFrame, sizeof(int16_t), 1, plFile) != 1) {
+ rewind(plFile);
}
lostFrame = !lostFrame;
} else {
- lostFrame = (rand()%100 < packetLossPercent);
+ lostFrame = (rand() % 100 < packetLossPercent);
}
-
-
/* iSAC decoding */
- if( lostFrame && framecnt > 0) {
- if (nbTest !=2) {
+ if (lostFrame && framecnt > 0) {
+ if (nbTest != 2) {
declen = static_cast<int>(
WebRtcIsacfix_DecodePlc(ISAC_main_inst, decoded, prevFrameSize));
} else {
@@ -799,32 +803,29 @@
}
lostPackets++;
} else {
- if (nbTest !=2 ) {
+ if (nbTest != 2) {
size_t FL;
/* Call getFramelen, only used here for function test */
err = WebRtcIsacfix_ReadFrameLen(
reinterpret_cast<const uint8_t*>(streamdata), stream_len, &FL);
declen = WebRtcIsacfix_Decode(
- ISAC_main_inst,
- reinterpret_cast<const uint8_t*>(streamdata),
- stream_len,
- decoded,
- speechType);
+ ISAC_main_inst, reinterpret_cast<const uint8_t*>(streamdata),
+ stream_len, decoded, speechType);
/* Error check */
if (err < 0 || declen < 0 || FL != static_cast<size_t>(declen)) {
- errtype=WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
+ errtype = WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
printf(
"\nError %d in ReadFrameLen (%s), Decode (%s), with FL %zu and "
"declen %d.\n",
errtype, err < 0 ? "yes" : "no", declen < 0 ? "yes" : "no", FL,
declen);
}
- prevFrameSize = static_cast<size_t>(declen/480);
+ prevFrameSize = static_cast<size_t>(declen / 480);
} else {
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
- declen = WebRtcIsacfix_DecodeNb( ISAC_main_inst, streamdata,
- stream_len, decoded, speechType );
+ declen = WebRtcIsacfix_DecodeNb(ISAC_main_inst, streamdata,
+ stream_len, decoded, speechType);
#else
declen = -1;
#endif
@@ -834,13 +835,12 @@
if (declen <= 0) {
/* exit if returned with error */
- errtype=WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
+ errtype = WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
printf("\nError in decoder: %d.\n", errtype);
}
/* Write decoded speech frame to file */
- if (fwrite(decoded, sizeof(int16_t),
- declen, outp) != (size_t)declen) {
+ if (fwrite(decoded, sizeof(int16_t), declen, outp) != (size_t)declen) {
FAIL();
}
// fprintf( ratefile, "%f \n", stream_len / ( ((double)declen)/
@@ -855,30 +855,28 @@
/* Error test number 10, garbage data */
if (testNum == 10) {
- if ( (seedfile = fopen(SEED_FILE, "a+t") ) == NULL ) {
- printf( "Error: Could not open file %s\n", SEED_FILE);
- }
- else {
+ if ((seedfile = fopen(SEED_FILE, "a+t")) == NULL) {
+ printf("Error: Could not open file %s\n", SEED_FILE);
+ } else {
fprintf(seedfile, "ok\n\n");
fclose(seedfile);
}
}
}
printf("\nLost Frames %d ~ %4.1f%%\n", lostPackets,
- (double)lostPackets/(double)framecnt*100.0 );
+ (double)lostPackets / (double)framecnt * 100.0);
printf("\n\ntotal bits = %d bits", totalbits);
printf("\nmeasured average bitrate = %0.3f kbits/s",
- (double)totalbits *(FS/1000) / totalsmpls);
+ (double)totalbits * (FS / 1000) / totalsmpls);
printf("\n");
/* Runtime statistics */
-
- runtime = (double)(((double)clock()/(double)CLOCKS_PER_SEC)-starttime);
- length_file = ((double)framecnt*(double)declen/FS);
+ runtime = (double)(((double)clock() / (double)CLOCKS_PER_SEC) - starttime);
+ length_file = ((double)framecnt * (double)declen / FS);
printf("\n\nLength of speech file: %.1f s\n", length_file);
- printf("Time to run iSAC: %.2f s (%.2f %% of realtime)\n\n",
- runtime, (100*runtime/length_file));
+ printf("Time to run iSAC: %.2f s (%.2f %% of realtime)\n\n", runtime,
+ (100 * runtime / length_file));
printf("\n\n_______________________________________________\n");
// Record the results with Perf test tools.
@@ -893,7 +891,7 @@
fclose(outp);
fclose(outbits);
- if ( testCE == 1) {
+ if (testCE == 1) {
WebRtcIsacfix_FreeInternal(ISAC_main_inst);
}
WebRtcIsacfix_Free(ISAC_main_inst);
diff --git a/modules/audio_coding/codecs/isac/main/include/isac.h b/modules/audio_coding/codecs/isac/main/include/isac.h
index e1ee818..1d7e075 100644
--- a/modules/audio_coding/codecs/isac/main/include/isac.h
+++ b/modules/audio_coding/codecs/isac/main/include/isac.h
@@ -16,709 +16,647 @@
#include "modules/audio_coding/codecs/isac/bandwidth_info.h"
#include "typedefs.h" // NOLINT(build/include)
-typedef struct WebRtcISACStruct ISACStruct;
+typedef struct WebRtcISACStruct ISACStruct;
#if defined(__cplusplus)
extern "C" {
#endif
- /******************************************************************************
- * WebRtcIsac_AssignSize(...)
- *
- * This function returns the size of the ISAC instance, so that the instance
- * can be created outside iSAC.
- *
- * Input:
- * - samplingRate : sampling rate of the input/output audio.
- *
- * Output:
- * - sizeinbytes : number of bytes needed to allocate for the
- * instance.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+/******************************************************************************
+ * WebRtcIsac_AssignSize(...)
+ *
+ * This function returns the size of the ISAC instance, so that the instance
+ * can be created outside iSAC.
+ *
+ * Input:
+ * - samplingRate : sampling rate of the input/output audio.
+ *
+ * Output:
+ * - sizeinbytes : number of bytes needed to allocate for the
+ * instance.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- int16_t WebRtcIsac_AssignSize(
- int* sizeinbytes);
+int16_t WebRtcIsac_AssignSize(int* sizeinbytes);
+/******************************************************************************
+ * WebRtcIsac_Assign(...)
+ *
+ * This function assignes the memory already created to the ISAC instance.
+ *
+ * Input:
+ * - *ISAC_main_inst : a pointer to the coder instance.
+ * - samplingRate : sampling rate of the input/output audio.
+ * - ISAC_inst_Addr : the already allocated memory, where we put the
+ * iSAC structure.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- /******************************************************************************
- * WebRtcIsac_Assign(...)
- *
- * This function assignes the memory already created to the ISAC instance.
- *
- * Input:
- * - *ISAC_main_inst : a pointer to the coder instance.
- * - samplingRate : sampling rate of the input/output audio.
- * - ISAC_inst_Addr : the already allocated memory, where we put the
- * iSAC structure.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+int16_t WebRtcIsac_Assign(ISACStruct** ISAC_main_inst, void* ISAC_inst_Addr);
- int16_t WebRtcIsac_Assign(
- ISACStruct** ISAC_main_inst,
- void* ISAC_inst_Addr);
+/******************************************************************************
+ * WebRtcIsac_Create(...)
+ *
+ * This function creates an ISAC instance, which will contain the state
+ * information for one coding/decoding channel.
+ *
+ * Input:
+ * - *ISAC_main_inst : a pointer to the coder instance.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
+int16_t WebRtcIsac_Create(ISACStruct** ISAC_main_inst);
- /******************************************************************************
- * WebRtcIsac_Create(...)
- *
- * This function creates an ISAC instance, which will contain the state
- * information for one coding/decoding channel.
- *
- * Input:
- * - *ISAC_main_inst : a pointer to the coder instance.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+/******************************************************************************
+ * WebRtcIsac_Free(...)
+ *
+ * This function frees the ISAC instance created at the beginning.
+ *
+ * Input:
+ * - ISAC_main_inst : an ISAC instance.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- int16_t WebRtcIsac_Create(
- ISACStruct** ISAC_main_inst);
+int16_t WebRtcIsac_Free(ISACStruct* ISAC_main_inst);
+/******************************************************************************
+ * WebRtcIsac_EncoderInit(...)
+ *
+ * This function initializes an ISAC instance prior to the encoder calls.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - CodingMode : 0 -> Bit rate and frame length are
+ * automatically adjusted to available bandwidth
+ * on transmission channel, just valid if codec
+ * is created to work in wideband mode.
+ * 1 -> User sets a frame length and a target bit
+ * rate which is taken as the maximum
+ * short-term average bit rate.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- /******************************************************************************
- * WebRtcIsac_Free(...)
- *
- * This function frees the ISAC instance created at the beginning.
- *
- * Input:
- * - ISAC_main_inst : an ISAC instance.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+int16_t WebRtcIsac_EncoderInit(ISACStruct* ISAC_main_inst, int16_t CodingMode);
- int16_t WebRtcIsac_Free(
- ISACStruct* ISAC_main_inst);
+/******************************************************************************
+ * WebRtcIsac_Encode(...)
+ *
+ * This function encodes 10ms audio blocks and inserts it into a package.
+ * Input speech length has 160 samples if operating at 16 kHz sampling
+ * rate, or 320 if operating at 32 kHz sampling rate. The encoder buffers the
+ * input audio until the whole frame is buffered then proceeds with encoding.
+ *
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - speechIn : input speech vector.
+ *
+ * Output:
+ * - encoded : the encoded data vector
+ *
+ * Return value:
+ * : >0 - Length (in bytes) of coded data
+ * : 0 - The buffer didn't reach the chosen
+ * frame-size so it keeps buffering speech
+ * samples.
+ * : -1 - Error
+ */
+int WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
+ const int16_t* speechIn,
+ uint8_t* encoded);
- /******************************************************************************
- * WebRtcIsac_EncoderInit(...)
- *
- * This function initializes an ISAC instance prior to the encoder calls.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - CodingMode : 0 -> Bit rate and frame length are
- * automatically adjusted to available bandwidth
- * on transmission channel, just valid if codec
- * is created to work in wideband mode.
- * 1 -> User sets a frame length and a target bit
- * rate which is taken as the maximum
- * short-term average bit rate.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+/******************************************************************************
+ * WebRtcIsac_DecoderInit(...)
+ *
+ * This function initializes an ISAC instance prior to the decoder calls.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ */
- int16_t WebRtcIsac_EncoderInit(
- ISACStruct* ISAC_main_inst,
- int16_t CodingMode);
+void WebRtcIsac_DecoderInit(ISACStruct* ISAC_main_inst);
+/******************************************************************************
+ * WebRtcIsac_UpdateBwEstimate(...)
+ *
+ * This function updates the estimate of the bandwidth.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - encoded : encoded ISAC frame(s).
+ * - packet_size : size of the packet.
+ * - rtp_seq_number : the RTP number of the packet.
+ * - send_ts : the RTP send timestamp, given in samples
+ * - arr_ts : the arrival time of the packet (from NetEq)
+ * in samples.
+ *
+ * Return value : 0 - Ok
+ * -1 - Error
+ */
- /******************************************************************************
- * WebRtcIsac_Encode(...)
- *
- * This function encodes 10ms audio blocks and inserts it into a package.
- * Input speech length has 160 samples if operating at 16 kHz sampling
- * rate, or 320 if operating at 32 kHz sampling rate. The encoder buffers the
- * input audio until the whole frame is buffered then proceeds with encoding.
- *
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - speechIn : input speech vector.
- *
- * Output:
- * - encoded : the encoded data vector
- *
- * Return value:
- * : >0 - Length (in bytes) of coded data
- * : 0 - The buffer didn't reach the chosen
- * frame-size so it keeps buffering speech
- * samples.
- * : -1 - Error
- */
+int16_t WebRtcIsac_UpdateBwEstimate(ISACStruct* ISAC_main_inst,
+ const uint8_t* encoded,
+ size_t packet_size,
+ uint16_t rtp_seq_number,
+ uint32_t send_ts,
+ uint32_t arr_ts);
- int WebRtcIsac_Encode(
- ISACStruct* ISAC_main_inst,
- const int16_t* speechIn,
- uint8_t* encoded);
+/******************************************************************************
+ * WebRtcIsac_Decode(...)
+ *
+ * This function decodes an ISAC frame. At 16 kHz sampling rate, the length
+ * of the output audio could be either 480 or 960 samples, equivalent to
+ * 30 or 60 ms respectively. At 32 kHz sampling rate, the length of the
+ * output audio is 960 samples, which is 30 ms.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - encoded : encoded ISAC frame(s).
+ * - len : bytes in encoded vector.
+ *
+ * Output:
+ * - decoded : The decoded vector.
+ *
+ * Return value : >0 - number of samples in decoded vector.
+ * -1 - Error.
+ */
+int WebRtcIsac_Decode(ISACStruct* ISAC_main_inst,
+ const uint8_t* encoded,
+ size_t len,
+ int16_t* decoded,
+ int16_t* speechType);
- /******************************************************************************
- * WebRtcIsac_DecoderInit(...)
- *
- * This function initializes an ISAC instance prior to the decoder calls.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- */
+/******************************************************************************
+ * WebRtcIsac_DecodePlc(...)
+ *
+ * This function conducts PLC for ISAC frame(s). Output speech length
+ * will be a multiple of frames, i.e. multiples of 30 ms audio. Therefore,
+ * the output is multiple of 480 samples if operating at 16 kHz and multiple
+ * of 960 if operating at 32 kHz.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - noOfLostFrames : Number of PLC frames to produce.
+ *
+ * Output:
+ * - decoded : The decoded vector.
+ *
+ * Return value : Number of samples in decoded PLC vector
+ */
- void WebRtcIsac_DecoderInit(ISACStruct* ISAC_main_inst);
+size_t WebRtcIsac_DecodePlc(ISACStruct* ISAC_main_inst,
+ int16_t* decoded,
+ size_t noOfLostFrames);
- /******************************************************************************
- * WebRtcIsac_UpdateBwEstimate(...)
- *
- * This function updates the estimate of the bandwidth.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - encoded : encoded ISAC frame(s).
- * - packet_size : size of the packet.
- * - rtp_seq_number : the RTP number of the packet.
- * - send_ts : the RTP send timestamp, given in samples
- * - arr_ts : the arrival time of the packet (from NetEq)
- * in samples.
- *
- * Return value : 0 - Ok
- * -1 - Error
- */
+/******************************************************************************
+ * WebRtcIsac_Control(...)
+ *
+ * This function sets the limit on the short-term average bit-rate and the
+ * frame length. Should be used only in Instantaneous mode. At 16 kHz sampling
+ * rate, an average bit-rate between 10000 to 32000 bps is valid and a
+ * frame-size of 30 or 60 ms is acceptable. At 32 kHz, an average bit-rate
+ * between 10000 to 56000 is acceptable, and the valid frame-size is 30 ms.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - rate : limit on the short-term average bit rate,
+ * in bits/second.
+ * - framesize : frame-size in millisecond.
+ *
+ * Return value : 0 - ok
+ * -1 - Error
+ */
- int16_t WebRtcIsac_UpdateBwEstimate(
- ISACStruct* ISAC_main_inst,
- const uint8_t* encoded,
- size_t packet_size,
- uint16_t rtp_seq_number,
- uint32_t send_ts,
- uint32_t arr_ts);
+int16_t WebRtcIsac_Control(ISACStruct* ISAC_main_inst,
+ int32_t rate,
+ int framesize);
+void WebRtcIsac_SetInitialBweBottleneck(ISACStruct* ISAC_main_inst,
+ int bottleneck_bits_per_second);
- /******************************************************************************
- * WebRtcIsac_Decode(...)
- *
- * This function decodes an ISAC frame. At 16 kHz sampling rate, the length
- * of the output audio could be either 480 or 960 samples, equivalent to
- * 30 or 60 ms respectively. At 32 kHz sampling rate, the length of the
- * output audio is 960 samples, which is 30 ms.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - encoded : encoded ISAC frame(s).
- * - len : bytes in encoded vector.
- *
- * Output:
- * - decoded : The decoded vector.
- *
- * Return value : >0 - number of samples in decoded vector.
- * -1 - Error.
- */
+/******************************************************************************
+ * WebRtcIsac_ControlBwe(...)
+ *
+ * This function sets the initial values of bottleneck and frame-size if
+ * iSAC is used in channel-adaptive mode. Therefore, this API is not
+ * applicable if the codec is created to operate in super-wideband mode.
+ *
+ * Through this API, users can enforce a frame-size for all values of
+ * bottleneck. Then iSAC will not automatically change the frame-size.
+ *
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - rateBPS : initial value of bottleneck in bits/second
+ * 10000 <= rateBPS <= 56000 is accepted
+ * For default bottleneck set rateBPS = 0
+ * - frameSizeMs : number of milliseconds per frame (30 or 60)
+ * - enforceFrameSize : 1 to enforce the given frame-size through
+ * out the adaptation process, 0 to let iSAC
+ * change the frame-size if required.
+ *
+ * Return value : 0 - ok
+ * -1 - Error
+ */
- int WebRtcIsac_Decode(
- ISACStruct* ISAC_main_inst,
- const uint8_t* encoded,
- size_t len,
- int16_t* decoded,
- int16_t* speechType);
+int16_t WebRtcIsac_ControlBwe(ISACStruct* ISAC_main_inst,
+ int32_t rateBPS,
+ int frameSizeMs,
+ int16_t enforceFrameSize);
+/******************************************************************************
+ * WebRtcIsac_ReadFrameLen(...)
+ *
+ * This function returns the length of the frame represented in the packet.
+ *
+ * Input:
+ * - encoded : Encoded bit-stream
+ *
+ * Output:
+ * - frameLength : Length of frame in packet (in samples)
+ *
+ */
- /******************************************************************************
- * WebRtcIsac_DecodePlc(...)
- *
- * This function conducts PLC for ISAC frame(s). Output speech length
- * will be a multiple of frames, i.e. multiples of 30 ms audio. Therefore,
- * the output is multiple of 480 samples if operating at 16 kHz and multiple
- * of 960 if operating at 32 kHz.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - noOfLostFrames : Number of PLC frames to produce.
- *
- * Output:
- * - decoded : The decoded vector.
- *
- * Return value : Number of samples in decoded PLC vector
- */
+int16_t WebRtcIsac_ReadFrameLen(ISACStruct* ISAC_main_inst,
+ const uint8_t* encoded,
+ int16_t* frameLength);
- size_t WebRtcIsac_DecodePlc(
- ISACStruct* ISAC_main_inst,
- int16_t* decoded,
- size_t noOfLostFrames);
+/******************************************************************************
+ * WebRtcIsac_version(...)
+ *
+ * This function returns the version number.
+ *
+ * Output:
+ * - version : Pointer to character string
+ *
+ */
+void WebRtcIsac_version(char* version);
- /******************************************************************************
- * WebRtcIsac_Control(...)
- *
- * This function sets the limit on the short-term average bit-rate and the
- * frame length. Should be used only in Instantaneous mode. At 16 kHz sampling
- * rate, an average bit-rate between 10000 to 32000 bps is valid and a
- * frame-size of 30 or 60 ms is acceptable. At 32 kHz, an average bit-rate
- * between 10000 to 56000 is acceptable, and the valid frame-size is 30 ms.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - rate : limit on the short-term average bit rate,
- * in bits/second.
- * - framesize : frame-size in millisecond.
- *
- * Return value : 0 - ok
- * -1 - Error
- */
+/******************************************************************************
+ * WebRtcIsac_GetErrorCode(...)
+ *
+ * This function can be used to check the error code of an iSAC instance. When
+ * a function returns -1 a error code will be set for that instance. The
+ * function below extract the code of the last error that occurred in the
+ * specified instance.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance
+ *
+ * Return value : Error code
+ */
- int16_t WebRtcIsac_Control(
- ISACStruct* ISAC_main_inst,
- int32_t rate,
- int framesize);
+int16_t WebRtcIsac_GetErrorCode(ISACStruct* ISAC_main_inst);
- void WebRtcIsac_SetInitialBweBottleneck(ISACStruct* ISAC_main_inst,
- int bottleneck_bits_per_second);
+/****************************************************************************
+ * WebRtcIsac_GetUplinkBw(...)
+ *
+ * This function outputs the target bottleneck of the codec. In
+ * channel-adaptive mode, the target bottleneck is specified through in-band
+ * signalling retreived by bandwidth estimator.
+ * In channel-independent, also called instantaneous mode, the target
+ * bottleneck is provided to the encoder by calling xxx_control(...). If
+ * xxx_control is never called the default values is returned. The default
+ * value for bottleneck at 16 kHz encoder sampling rate is 32000 bits/sec,
+ * and it is 56000 bits/sec for 32 kHz sampling rate.
+ * Note that the output is the iSAC internal operating bottleneck which might
+ * differ slightly from the one provided through xxx_control().
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC instance
+ *
+ * Output:
+ * - *bottleneck : bottleneck in bits/sec
+ *
+ * Return value : -1 if error happens
+ * 0 bit-rates computed correctly.
+ */
- /******************************************************************************
- * WebRtcIsac_ControlBwe(...)
- *
- * This function sets the initial values of bottleneck and frame-size if
- * iSAC is used in channel-adaptive mode. Therefore, this API is not
- * applicable if the codec is created to operate in super-wideband mode.
- *
- * Through this API, users can enforce a frame-size for all values of
- * bottleneck. Then iSAC will not automatically change the frame-size.
- *
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - rateBPS : initial value of bottleneck in bits/second
- * 10000 <= rateBPS <= 56000 is accepted
- * For default bottleneck set rateBPS = 0
- * - frameSizeMs : number of milliseconds per frame (30 or 60)
- * - enforceFrameSize : 1 to enforce the given frame-size through
- * out the adaptation process, 0 to let iSAC
- * change the frame-size if required.
- *
- * Return value : 0 - ok
- * -1 - Error
- */
+int16_t WebRtcIsac_GetUplinkBw(ISACStruct* ISAC_main_inst, int32_t* bottleneck);
- int16_t WebRtcIsac_ControlBwe(
- ISACStruct* ISAC_main_inst,
- int32_t rateBPS,
- int frameSizeMs,
- int16_t enforceFrameSize);
+/******************************************************************************
+ * WebRtcIsac_SetMaxPayloadSize(...)
+ *
+ * This function sets a limit for the maximum payload size of iSAC. The same
+ * value is used both for 30 and 60 ms packets. If the encoder sampling rate
+ * is 16 kHz the maximum payload size is between 120 and 400 bytes. If the
+ * encoder sampling rate is 32 kHz the maximum payload size is between 120
+ * and 600 bytes.
+ *
+ * If an out of range limit is used, the function returns -1, but the closest
+ * valid value will be applied.
+ *
+ * ---------------
+ * IMPORTANT NOTES
+ * ---------------
+ * The size of a packet is limited to the minimum of 'max-payload-size' and
+ * 'max-rate.' For instance, let's assume the max-payload-size is set to
+ * 170 bytes, and max-rate is set to 40 kbps. Note that a limit of 40 kbps
+ * translates to 150 bytes for 30ms frame-size & 300 bytes for 60ms
+ * frame-size. Then a packet with a frame-size of 30 ms is limited to 150,
+ * i.e. min(170, 150), and a packet with 60 ms frame-size is limited to
+ * 170 bytes, i.e. min(170, 300).
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC instance
+ * - maxPayloadBytes : maximum size of the payload in bytes
+ * valid values are between 120 and 400 bytes
+ * if encoder sampling rate is 16 kHz. For
+ * 32 kHz encoder sampling rate valid values
+ * are between 120 and 600 bytes.
+ *
+ * Return value : 0 if successful
+ * -1 if error happens
+ */
+int16_t WebRtcIsac_SetMaxPayloadSize(ISACStruct* ISAC_main_inst,
+ int16_t maxPayloadBytes);
- /******************************************************************************
- * WebRtcIsac_ReadFrameLen(...)
- *
- * This function returns the length of the frame represented in the packet.
- *
- * Input:
- * - encoded : Encoded bit-stream
- *
- * Output:
- * - frameLength : Length of frame in packet (in samples)
- *
- */
-
- int16_t WebRtcIsac_ReadFrameLen(
- ISACStruct* ISAC_main_inst,
- const uint8_t* encoded,
- int16_t* frameLength);
-
-
- /******************************************************************************
- * WebRtcIsac_version(...)
- *
- * This function returns the version number.
- *
- * Output:
- * - version : Pointer to character string
- *
- */
-
- void WebRtcIsac_version(
- char *version);
-
-
- /******************************************************************************
- * WebRtcIsac_GetErrorCode(...)
- *
- * This function can be used to check the error code of an iSAC instance. When
- * a function returns -1 a error code will be set for that instance. The
- * function below extract the code of the last error that occurred in the
- * specified instance.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance
- *
- * Return value : Error code
- */
-
- int16_t WebRtcIsac_GetErrorCode(
- ISACStruct* ISAC_main_inst);
-
-
- /****************************************************************************
- * WebRtcIsac_GetUplinkBw(...)
- *
- * This function outputs the target bottleneck of the codec. In
- * channel-adaptive mode, the target bottleneck is specified through in-band
- * signalling retreived by bandwidth estimator.
- * In channel-independent, also called instantaneous mode, the target
- * bottleneck is provided to the encoder by calling xxx_control(...). If
- * xxx_control is never called the default values is returned. The default
- * value for bottleneck at 16 kHz encoder sampling rate is 32000 bits/sec,
- * and it is 56000 bits/sec for 32 kHz sampling rate.
- * Note that the output is the iSAC internal operating bottleneck which might
- * differ slightly from the one provided through xxx_control().
- *
- * Input:
- * - ISAC_main_inst : iSAC instance
- *
- * Output:
- * - *bottleneck : bottleneck in bits/sec
- *
- * Return value : -1 if error happens
- * 0 bit-rates computed correctly.
- */
-
- int16_t WebRtcIsac_GetUplinkBw(
- ISACStruct* ISAC_main_inst,
- int32_t* bottleneck);
-
-
- /******************************************************************************
- * WebRtcIsac_SetMaxPayloadSize(...)
- *
- * This function sets a limit for the maximum payload size of iSAC. The same
- * value is used both for 30 and 60 ms packets. If the encoder sampling rate
- * is 16 kHz the maximum payload size is between 120 and 400 bytes. If the
- * encoder sampling rate is 32 kHz the maximum payload size is between 120
- * and 600 bytes.
- *
- * If an out of range limit is used, the function returns -1, but the closest
- * valid value will be applied.
- *
- * ---------------
- * IMPORTANT NOTES
- * ---------------
- * The size of a packet is limited to the minimum of 'max-payload-size' and
- * 'max-rate.' For instance, let's assume the max-payload-size is set to
- * 170 bytes, and max-rate is set to 40 kbps. Note that a limit of 40 kbps
- * translates to 150 bytes for 30ms frame-size & 300 bytes for 60ms
- * frame-size. Then a packet with a frame-size of 30 ms is limited to 150,
- * i.e. min(170, 150), and a packet with 60 ms frame-size is limited to
- * 170 bytes, i.e. min(170, 300).
- *
- * Input:
- * - ISAC_main_inst : iSAC instance
- * - maxPayloadBytes : maximum size of the payload in bytes
- * valid values are between 120 and 400 bytes
- * if encoder sampling rate is 16 kHz. For
- * 32 kHz encoder sampling rate valid values
- * are between 120 and 600 bytes.
- *
- * Return value : 0 if successful
- * -1 if error happens
- */
-
- int16_t WebRtcIsac_SetMaxPayloadSize(
- ISACStruct* ISAC_main_inst,
- int16_t maxPayloadBytes);
-
-
- /******************************************************************************
- * WebRtcIsac_SetMaxRate(...)
- *
- * This function sets the maximum rate which the codec may not exceed for
- * any signal packet. The maximum rate is defined and payload-size per
- * frame-size in bits per second.
- *
- * The codec has a maximum rate of 53400 bits per second (200 bytes per 30
- * ms) if the encoder sampling rate is 16kHz, and 160 kbps (600 bytes/30 ms)
- * if the encoder sampling rate is 32 kHz.
- *
- * It is possible to set a maximum rate between 32000 and 53400 bits/sec
- * in wideband mode, and 32000 to 160000 bits/sec in super-wideband mode.
- *
- * If an out of range limit is used, the function returns -1, but the closest
- * valid value will be applied.
- *
- * ---------------
- * IMPORTANT NOTES
- * ---------------
- * The size of a packet is limited to the minimum of 'max-payload-size' and
- * 'max-rate.' For instance, let's assume the max-payload-size is set to
- * 170 bytes, and max-rate is set to 40 kbps. Note that a limit of 40 kbps
- * translates to 150 bytes for 30ms frame-size & 300 bytes for 60ms
- * frame-size. Then a packet with a frame-size of 30 ms is limited to 150,
- * i.e. min(170, 150), and a packet with 60 ms frame-size is limited to
- * 170 bytes, min(170, 300).
- *
- * Input:
- * - ISAC_main_inst : iSAC instance
- * - maxRate : maximum rate in bits per second,
- * valid values are 32000 to 53400 bits/sec in
- * wideband mode, and 32000 to 160000 bits/sec in
- * super-wideband mode.
- *
- * Return value : 0 if successful
- * -1 if error happens
- */
-
- int16_t WebRtcIsac_SetMaxRate(
- ISACStruct* ISAC_main_inst,
- int32_t maxRate);
-
-
- /******************************************************************************
- * WebRtcIsac_DecSampRate()
- * Return the sampling rate of the decoded audio.
- *
- * Input:
- * - ISAC_main_inst : iSAC instance
- *
- * Return value : sampling frequency in Hertz.
- *
- */
-
- uint16_t WebRtcIsac_DecSampRate(ISACStruct* ISAC_main_inst);
-
-
- /******************************************************************************
- * WebRtcIsac_EncSampRate()
- *
- * Input:
- * - ISAC_main_inst : iSAC instance
- *
- * Return value : sampling rate in Hertz.
- *
- */
-
- uint16_t WebRtcIsac_EncSampRate(ISACStruct* ISAC_main_inst);
-
-
- /******************************************************************************
- * WebRtcIsac_SetDecSampRate()
- * Set the sampling rate of the decoder. Initialization of the decoder WILL
- * NOT overwrite the sampling rate of the encoder. The default value is 16 kHz
- * which is set when the instance is created.
- *
- * Input:
- * - ISAC_main_inst : iSAC instance
- * - sampRate : sampling rate in Hertz.
- *
- * Return value : 0 if successful
- * -1 if failed.
- */
-
- int16_t WebRtcIsac_SetDecSampRate(ISACStruct* ISAC_main_inst,
- uint16_t samp_rate_hz);
-
-
- /******************************************************************************
- * WebRtcIsac_SetEncSampRate()
- * Set the sampling rate of the encoder. Initialization of the encoder WILL
- * NOT overwrite the sampling rate of the encoder. The default value is 16 kHz
- * which is set when the instance is created. The encoding-mode and the
- * bottleneck remain unchanged by this call, however, the maximum rate and
- * maximum payload-size will reset to their default value.
- *
- * Input:
- * - ISAC_main_inst : iSAC instance
- * - sampRate : sampling rate in Hertz.
- *
- * Return value : 0 if successful
- * -1 if failed.
- */
-
- int16_t WebRtcIsac_SetEncSampRate(ISACStruct* ISAC_main_inst,
- uint16_t sample_rate_hz);
-
+/******************************************************************************
+ * WebRtcIsac_SetMaxRate(...)
+ *
+ * This function sets the maximum rate which the codec may not exceed for
+ * any signal packet. The maximum rate is defined and payload-size per
+ * frame-size in bits per second.
+ *
+ * The codec has a maximum rate of 53400 bits per second (200 bytes per 30
+ * ms) if the encoder sampling rate is 16kHz, and 160 kbps (600 bytes/30 ms)
+ * if the encoder sampling rate is 32 kHz.
+ *
+ * It is possible to set a maximum rate between 32000 and 53400 bits/sec
+ * in wideband mode, and 32000 to 160000 bits/sec in super-wideband mode.
+ *
+ * If an out of range limit is used, the function returns -1, but the closest
+ * valid value will be applied.
+ *
+ * ---------------
+ * IMPORTANT NOTES
+ * ---------------
+ * The size of a packet is limited to the minimum of 'max-payload-size' and
+ * 'max-rate.' For instance, let's assume the max-payload-size is set to
+ * 170 bytes, and max-rate is set to 40 kbps. Note that a limit of 40 kbps
+ * translates to 150 bytes for 30ms frame-size & 300 bytes for 60ms
+ * frame-size. Then a packet with a frame-size of 30 ms is limited to 150,
+ * i.e. min(170, 150), and a packet with 60 ms frame-size is limited to
+ * 170 bytes, min(170, 300).
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC instance
+ * - maxRate : maximum rate in bits per second,
+ * valid values are 32000 to 53400 bits/sec in
+ * wideband mode, and 32000 to 160000 bits/sec in
+ * super-wideband mode.
+ *
+ * Return value : 0 if successful
+ * -1 if error happens
+ */
+int16_t WebRtcIsac_SetMaxRate(ISACStruct* ISAC_main_inst, int32_t maxRate);
- /******************************************************************************
- * WebRtcIsac_GetNewBitStream(...)
- *
- * This function returns encoded data, with the recieved bwe-index in the
- * stream. If the rate is set to a value less than bottleneck of codec
- * the new bistream will be re-encoded with the given target rate.
- * It should always return a complete packet, i.e. only called once
- * even for 60 msec frames.
- *
- * NOTE 1! This function does not write in the ISACStruct, it is not allowed.
- * NOTE 2! Currently not implemented for SWB mode.
- * NOTE 3! Rates larger than the bottleneck of the codec will be limited
- * to the current bottleneck.
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - bweIndex : Index of bandwidth estimate to put in new
- * bitstream
- * - rate : target rate of the transcoder is bits/sec.
- * Valid values are the accepted rate in iSAC,
- * i.e. 10000 to 56000.
- * - isRCU : if the new bit-stream is an RCU stream.
- * Note that the rate parameter always indicates
- * the target rate of the main payload, regardless
- * of 'isRCU' value.
- *
- * Output:
- * - encoded : The encoded data vector
- *
- * Return value : >0 - Length (in bytes) of coded data
- * -1 - Error or called in SWB mode
- * NOTE! No error code is written to
- * the struct since it is only allowed to read
- * the struct.
- */
- int16_t WebRtcIsac_GetNewBitStream(
- ISACStruct* ISAC_main_inst,
- int16_t bweIndex,
- int16_t jitterInfo,
- int32_t rate,
- uint8_t* encoded,
- int16_t isRCU);
+/******************************************************************************
+ * WebRtcIsac_DecSampRate()
+ * Return the sampling rate of the decoded audio.
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC instance
+ *
+ * Return value : sampling frequency in Hertz.
+ *
+ */
+uint16_t WebRtcIsac_DecSampRate(ISACStruct* ISAC_main_inst);
+/******************************************************************************
+ * WebRtcIsac_EncSampRate()
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC instance
+ *
+ * Return value : sampling rate in Hertz.
+ *
+ */
- /****************************************************************************
- * WebRtcIsac_GetDownLinkBwIndex(...)
- *
- * This function returns index representing the Bandwidth estimate from
- * other side to this side.
- *
- * Input:
- * - ISAC_main_inst : iSAC struct
- *
- * Output:
- * - bweIndex : Bandwidth estimate to transmit to other side.
- *
- */
+uint16_t WebRtcIsac_EncSampRate(ISACStruct* ISAC_main_inst);
- int16_t WebRtcIsac_GetDownLinkBwIndex(
- ISACStruct* ISAC_main_inst,
- int16_t* bweIndex,
- int16_t* jitterInfo);
+/******************************************************************************
+ * WebRtcIsac_SetDecSampRate()
+ * Set the sampling rate of the decoder. Initialization of the decoder WILL
+ * NOT overwrite the sampling rate of the encoder. The default value is 16 kHz
+ * which is set when the instance is created.
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC instance
+ * - sampRate : sampling rate in Hertz.
+ *
+ * Return value : 0 if successful
+ * -1 if failed.
+ */
+int16_t WebRtcIsac_SetDecSampRate(ISACStruct* ISAC_main_inst,
+ uint16_t samp_rate_hz);
- /****************************************************************************
- * WebRtcIsac_UpdateUplinkBw(...)
- *
- * This function takes an index representing the Bandwidth estimate from
- * this side to other side and updates BWE.
- *
- * Input:
- * - ISAC_main_inst : iSAC struct
- * - bweIndex : Bandwidth estimate from other side.
- *
- */
+/******************************************************************************
+ * WebRtcIsac_SetEncSampRate()
+ * Set the sampling rate of the encoder. Initialization of the encoder WILL
+ * NOT overwrite the sampling rate of the encoder. The default value is 16 kHz
+ * which is set when the instance is created. The encoding-mode and the
+ * bottleneck remain unchanged by this call, however, the maximum rate and
+ * maximum payload-size will reset to their default value.
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC instance
+ * - sampRate : sampling rate in Hertz.
+ *
+ * Return value : 0 if successful
+ * -1 if failed.
+ */
- int16_t WebRtcIsac_UpdateUplinkBw(
- ISACStruct* ISAC_main_inst,
- int16_t bweIndex);
+int16_t WebRtcIsac_SetEncSampRate(ISACStruct* ISAC_main_inst,
+ uint16_t sample_rate_hz);
+/******************************************************************************
+ * WebRtcIsac_GetNewBitStream(...)
+ *
+ * This function returns encoded data, with the recieved bwe-index in the
+ * stream. If the rate is set to a value less than bottleneck of codec
+ * the new bistream will be re-encoded with the given target rate.
+ * It should always return a complete packet, i.e. only called once
+ * even for 60 msec frames.
+ *
+ * NOTE 1! This function does not write in the ISACStruct, it is not allowed.
+ * NOTE 2! Currently not implemented for SWB mode.
+ * NOTE 3! Rates larger than the bottleneck of the codec will be limited
+ * to the current bottleneck.
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - bweIndex : Index of bandwidth estimate to put in new
+ * bitstream
+ * - rate : target rate of the transcoder is bits/sec.
+ * Valid values are the accepted rate in iSAC,
+ * i.e. 10000 to 56000.
+ * - isRCU : if the new bit-stream is an RCU
+ * stream. Note that the rate parameter always indicates the target rate of the
+ * main payload, regardless of 'isRCU' value.
+ *
+ * Output:
+ * - encoded : The encoded data vector
+ *
+ * Return value : >0 - Length (in bytes) of coded data
+ * -1 - Error or called in SWB mode
+ * NOTE! No error code is written to
+ * the struct since it is only allowed to read
+ * the struct.
+ */
+int16_t WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
+ int16_t bweIndex,
+ int16_t jitterInfo,
+ int32_t rate,
+ uint8_t* encoded,
+ int16_t isRCU);
- /****************************************************************************
- * WebRtcIsac_ReadBwIndex(...)
- *
- * This function returns the index of the Bandwidth estimate from the bitstream.
- *
- * Input:
- * - encoded : Encoded bitstream
- *
- * Output:
- * - frameLength : Length of frame in packet (in samples)
- * - bweIndex : Bandwidth estimate in bitstream
- *
- */
+/****************************************************************************
+ * WebRtcIsac_GetDownLinkBwIndex(...)
+ *
+ * This function returns index representing the Bandwidth estimate from
+ * other side to this side.
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC struct
+ *
+ * Output:
+ * - bweIndex : Bandwidth estimate to transmit to other side.
+ *
+ */
- int16_t WebRtcIsac_ReadBwIndex(
- const uint8_t* encoded,
- int16_t* bweIndex);
+int16_t WebRtcIsac_GetDownLinkBwIndex(ISACStruct* ISAC_main_inst,
+ int16_t* bweIndex,
+ int16_t* jitterInfo);
+/****************************************************************************
+ * WebRtcIsac_UpdateUplinkBw(...)
+ *
+ * This function takes an index representing the Bandwidth estimate from
+ * this side to other side and updates BWE.
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC struct
+ * - bweIndex : Bandwidth estimate from other side.
+ *
+ */
+int16_t WebRtcIsac_UpdateUplinkBw(ISACStruct* ISAC_main_inst, int16_t bweIndex);
- /*******************************************************************************
- * WebRtcIsac_GetNewFrameLen(...)
- *
- * returns the frame lenght (in samples) of the next packet. In the case of channel-adaptive
- * mode, iSAC decides on its frame lenght based on the estimated bottleneck
- * this allows a user to prepare for the next packet (at the encoder)
- *
- * The primary usage is in CE to make the iSAC works in channel-adaptive mode
- *
- * Input:
- * - ISAC_main_inst : iSAC struct
- *
- * Return Value : frame lenght in samples
- *
- */
+/****************************************************************************
+ * WebRtcIsac_ReadBwIndex(...)
+ *
+ * This function returns the index of the Bandwidth estimate from the bitstream.
+ *
+ * Input:
+ * - encoded : Encoded bitstream
+ *
+ * Output:
+ * - frameLength : Length of frame in packet (in samples)
+ * - bweIndex : Bandwidth estimate in bitstream
+ *
+ */
- int16_t WebRtcIsac_GetNewFrameLen(
- ISACStruct* ISAC_main_inst);
+int16_t WebRtcIsac_ReadBwIndex(const uint8_t* encoded, int16_t* bweIndex);
+/*******************************************************************************
+ * WebRtcIsac_GetNewFrameLen(...)
+ *
+ * returns the frame lenght (in samples) of the next packet. In the case of
+ * channel-adaptive mode, iSAC decides on its frame lenght based on the
+ * estimated bottleneck this allows a user to prepare for the next packet (at
+ * the encoder)
+ *
+ * The primary usage is in CE to make the iSAC works in channel-adaptive mode
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC struct
+ *
+ * Return Value : frame lenght in samples
+ *
+ */
- /****************************************************************************
- * WebRtcIsac_GetRedPayload(...)
- *
- * Populates "encoded" with the redundant payload of the recently encoded
- * frame. This function has to be called once that WebRtcIsac_Encode(...)
- * returns a positive value. Regardless of the frame-size this function will
- * be called only once after encoding is completed.
- *
- * Input:
- * - ISAC_main_inst : iSAC struct
- *
- * Output:
- * - encoded : the encoded data vector
- *
- *
- * Return value:
- * : >0 - Length (in bytes) of coded data
- * : -1 - Error
- *
- *
- */
- int16_t WebRtcIsac_GetRedPayload(
- ISACStruct* ISAC_main_inst,
- uint8_t* encoded);
+int16_t WebRtcIsac_GetNewFrameLen(ISACStruct* ISAC_main_inst);
+/****************************************************************************
+ * WebRtcIsac_GetRedPayload(...)
+ *
+ * Populates "encoded" with the redundant payload of the recently encoded
+ * frame. This function has to be called once that WebRtcIsac_Encode(...)
+ * returns a positive value. Regardless of the frame-size this function will
+ * be called only once after encoding is completed.
+ *
+ * Input:
+ * - ISAC_main_inst : iSAC struct
+ *
+ * Output:
+ * - encoded : the encoded data vector
+ *
+ *
+ * Return value:
+ * : >0 - Length (in bytes) of coded data
+ * : -1 - Error
+ *
+ *
+ */
+int16_t WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst, uint8_t* encoded);
- /****************************************************************************
- * WebRtcIsac_DecodeRcu(...)
- *
- * This function decodes a redundant (RCU) iSAC frame. Function is called in
- * NetEq with a stored RCU payload i case of packet loss. Output speech length
- * will be a multiple of 480 samples: 480 or 960 samples,
- * depending on the framesize (30 or 60 ms).
- *
- * Input:
- * - ISAC_main_inst : ISAC instance.
- * - encoded : encoded ISAC RCU frame(s)
- * - len : bytes in encoded vector
- *
- * Output:
- * - decoded : The decoded vector
- *
- * Return value : >0 - number of samples in decoded vector
- * -1 - Error
- */
- int WebRtcIsac_DecodeRcu(
- ISACStruct* ISAC_main_inst,
- const uint8_t* encoded,
- size_t len,
- int16_t* decoded,
- int16_t* speechType);
+/****************************************************************************
+ * WebRtcIsac_DecodeRcu(...)
+ *
+ * This function decodes a redundant (RCU) iSAC frame. Function is called in
+ * NetEq with a stored RCU payload i case of packet loss. Output speech length
+ * will be a multiple of 480 samples: 480 or 960 samples,
+ * depending on the framesize (30 or 60 ms).
+ *
+ * Input:
+ * - ISAC_main_inst : ISAC instance.
+ * - encoded : encoded ISAC RCU frame(s)
+ * - len : bytes in encoded vector
+ *
+ * Output:
+ * - decoded : The decoded vector
+ *
+ * Return value : >0 - number of samples in decoded vector
+ * -1 - Error
+ */
+int WebRtcIsac_DecodeRcu(ISACStruct* ISAC_main_inst,
+ const uint8_t* encoded,
+ size_t len,
+ int16_t* decoded,
+ int16_t* speechType);
- /* Fills in an IsacBandwidthInfo struct. |inst| should be a decoder. */
- void WebRtcIsac_GetBandwidthInfo(ISACStruct* inst, IsacBandwidthInfo* bwinfo);
+/* Fills in an IsacBandwidthInfo struct. |inst| should be a decoder. */
+void WebRtcIsac_GetBandwidthInfo(ISACStruct* inst, IsacBandwidthInfo* bwinfo);
- /* Uses the values from an IsacBandwidthInfo struct. |inst| should be an
- encoder. */
- void WebRtcIsac_SetBandwidthInfo(ISACStruct* inst,
- const IsacBandwidthInfo* bwinfo);
+/* Uses the values from an IsacBandwidthInfo struct. |inst| should be an
+ encoder. */
+void WebRtcIsac_SetBandwidthInfo(ISACStruct* inst,
+ const IsacBandwidthInfo* bwinfo);
- /* If |inst| is a decoder but not an encoder: tell it what sample rate the
- encoder is using, for bandwidth estimation purposes. */
- void WebRtcIsac_SetEncSampRateInDecoder(ISACStruct* inst, int sample_rate_hz);
+/* If |inst| is a decoder but not an encoder: tell it what sample rate the
+ encoder is using, for bandwidth estimation purposes. */
+void WebRtcIsac_SetEncSampRateInDecoder(ISACStruct* inst, int sample_rate_hz);
#if defined(__cplusplus)
}
#endif
-
-
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INCLUDE_ISAC_H_ */
diff --git a/modules/audio_coding/codecs/isac/main/source/arith_routines.h b/modules/audio_coding/codecs/isac/main/source/arith_routines.h
index d001c68..6e7ea1d 100644
--- a/modules/audio_coding/codecs/isac/main/source/arith_routines.h
+++ b/modules/audio_coding/codecs/isac/main/source/arith_routines.h
@@ -21,42 +21,47 @@
#include "modules/audio_coding/codecs/isac/main/source/structs.h"
int WebRtcIsac_EncLogisticMulti2(
- Bitstr *streamdata, /* in-/output struct containing bitstream */
- int16_t *dataQ7, /* input: data vector */
- const uint16_t *env, /* input: side info vector defining the width of the pdf */
- const int N, /* input: data vector length */
+ Bitstr* streamdata, /* in-/output struct containing bitstream */
+ int16_t* dataQ7, /* input: data vector */
+ const uint16_t*
+ env, /* input: side info vector defining the width of the pdf */
+ const int N, /* input: data vector length */
const int16_t isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
/* returns the number of bytes in the stream */
-int WebRtcIsac_EncTerminate(Bitstr *streamdata); /* in-/output struct containing bitstream */
+int WebRtcIsac_EncTerminate(
+ Bitstr* streamdata); /* in-/output struct containing bitstream */
/* returns the number of bytes in the stream so far */
int WebRtcIsac_DecLogisticMulti2(
- int16_t *data, /* output: data vector */
- Bitstr *streamdata, /* in-/output struct containing bitstream */
- const uint16_t *env, /* input: side info vector defining the width of the pdf */
- const int16_t *dither, /* input: dither vector */
- const int N, /* input: data vector length */
+ int16_t* data, /* output: data vector */
+ Bitstr* streamdata, /* in-/output struct containing bitstream */
+ const uint16_t*
+ env, /* input: side info vector defining the width of the pdf */
+ const int16_t* dither, /* input: dither vector */
+ const int N, /* input: data vector length */
const int16_t isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
void WebRtcIsac_EncHistMulti(
- Bitstr *streamdata, /* in-/output struct containing bitstream */
- const int *data, /* input: data vector */
- const uint16_t *const *cdf, /* input: array of cdf arrays */
+ Bitstr* streamdata, /* in-/output struct containing bitstream */
+ const int* data, /* input: data vector */
+ const uint16_t* const* cdf, /* input: array of cdf arrays */
const int N); /* input: data vector length */
int WebRtcIsac_DecHistBisectMulti(
- int *data, /* output: data vector */
- Bitstr *streamdata, /* in-/output struct containing bitstream */
- const uint16_t *const *cdf, /* input: array of cdf arrays */
- const uint16_t *cdf_size, /* input: array of cdf table sizes+1 (power of two: 2^k) */
- const int N); /* input: data vector length */
+ int* data, /* output: data vector */
+ Bitstr* streamdata, /* in-/output struct containing bitstream */
+ const uint16_t* const* cdf, /* input: array of cdf arrays */
+ const uint16_t*
+ cdf_size, /* input: array of cdf table sizes+1 (power of two: 2^k) */
+ const int N); /* input: data vector length */
int WebRtcIsac_DecHistOneStepMulti(
- int *data, /* output: data vector */
- Bitstr *streamdata, /* in-/output struct containing bitstream */
- const uint16_t *const *cdf, /* input: array of cdf arrays */
- const uint16_t *init_index,/* input: vector of initial cdf table search entries */
- const int N); /* input: data vector length */
+ int* data, /* output: data vector */
+ Bitstr* streamdata, /* in-/output struct containing bitstream */
+ const uint16_t* const* cdf, /* input: array of cdf arrays */
+ const uint16_t*
+ init_index, /* input: vector of initial cdf table search entries */
+ const int N); /* input: data vector length */
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_ */
diff --git a/modules/audio_coding/codecs/isac/main/source/audio_encoder_isac_unittest.cc b/modules/audio_coding/codecs/isac/main/source/audio_encoder_isac_unittest.cc
index 333ab52..87ae0e0 100644
--- a/modules/audio_coding/codecs/isac/main/source/audio_encoder_isac_unittest.cc
+++ b/modules/audio_coding/codecs/isac/main/source/audio_encoder_isac_unittest.cc
@@ -29,7 +29,11 @@
// Wrap subroutine calls that test things in this, so that the error messages
// will be accompanied by stack traces that make it possible to tell which
// subroutine invocation caused the failure.
-#define S(x) do { SCOPED_TRACE(#x); x; } while (0)
+#define S(x) \
+ do { \
+ SCOPED_TRACE(#x); \
+ x; \
+ } while (0)
} // namespace
diff --git a/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h b/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h
index fbeb849..d80ff73 100644
--- a/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h
+++ b/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h
@@ -24,162 +24,151 @@
#include "modules/audio_coding/codecs/isac/main/source/settings.h"
#include "modules/audio_coding/codecs/isac/main/source/structs.h"
-#define MIN_ISAC_BW 10000
-#define MIN_ISAC_BW_LB 10000
-#define MIN_ISAC_BW_UB 25000
+#define MIN_ISAC_BW 10000
+#define MIN_ISAC_BW_LB 10000
+#define MIN_ISAC_BW_UB 25000
-#define MAX_ISAC_BW 56000
-#define MAX_ISAC_BW_UB 32000
-#define MAX_ISAC_BW_LB 32000
+#define MAX_ISAC_BW 56000
+#define MAX_ISAC_BW_UB 32000
+#define MAX_ISAC_BW_LB 32000
-#define MIN_ISAC_MD 5
-#define MAX_ISAC_MD 25
+#define MIN_ISAC_MD 5
+#define MAX_ISAC_MD 25
// assumed header size, in bytes; we don't know the exact number
// (header compression may be used)
-#define HEADER_SIZE 35
+#define HEADER_SIZE 35
// Initial Frame-Size, in ms, for Wideband & Super-Wideband Mode
-#define INIT_FRAME_LEN_WB 60
+#define INIT_FRAME_LEN_WB 60
#define INIT_FRAME_LEN_SWB 30
// Initial Bottleneck Estimate, in bits/sec, for
// Wideband & Super-wideband mode
-#define INIT_BN_EST_WB 20e3f
-#define INIT_BN_EST_SWB 56e3f
+#define INIT_BN_EST_WB 20e3f
+#define INIT_BN_EST_SWB 56e3f
// Initial Header rate (header rate depends on frame-size),
// in bits/sec, for Wideband & Super-Wideband mode.
-#define INIT_HDR_RATE_WB \
+#define INIT_HDR_RATE_WB \
((float)HEADER_SIZE * 8.0f * 1000.0f / (float)INIT_FRAME_LEN_WB)
-#define INIT_HDR_RATE_SWB \
+#define INIT_HDR_RATE_SWB \
((float)HEADER_SIZE * 8.0f * 1000.0f / (float)INIT_FRAME_LEN_SWB)
// number of packets in a row for a high rate burst
-#define BURST_LEN 3
+#define BURST_LEN 3
// ms, max time between two full bursts
-#define BURST_INTERVAL 500
+#define BURST_INTERVAL 500
// number of packets in a row for initial high rate burst
-#define INIT_BURST_LEN 5
+#define INIT_BURST_LEN 5
// bits/s, rate for the first BURST_LEN packets
-#define INIT_RATE_WB INIT_BN_EST_WB
-#define INIT_RATE_SWB INIT_BN_EST_SWB
-
+#define INIT_RATE_WB INIT_BN_EST_WB
+#define INIT_RATE_SWB INIT_BN_EST_SWB
#if defined(__cplusplus)
extern "C" {
#endif
- /* This function initializes the struct */
- /* to be called before using the struct for anything else */
- /* returns 0 if everything went fine, -1 otherwise */
- int32_t WebRtcIsac_InitBandwidthEstimator(
- BwEstimatorstr* bwest_str,
- enum IsacSamplingRate encoderSampRate,
- enum IsacSamplingRate decoderSampRate);
+/* This function initializes the struct */
+/* to be called before using the struct for anything else */
+/* returns 0 if everything went fine, -1 otherwise */
+int32_t WebRtcIsac_InitBandwidthEstimator(
+ BwEstimatorstr* bwest_str,
+ enum IsacSamplingRate encoderSampRate,
+ enum IsacSamplingRate decoderSampRate);
- /* This function updates the receiving estimate */
- /* Parameters: */
- /* rtp_number - value from RTP packet, from NetEq */
- /* frame length - length of signal frame in ms, from iSAC decoder */
- /* send_ts - value in RTP header giving send time in samples */
- /* arr_ts - value given by timeGetTime() time of arrival in samples of packet from NetEq */
- /* pksize - size of packet in bytes, from NetEq */
- /* Index - integer (range 0...23) indicating bottle neck & jitter as estimated by other side */
- /* returns 0 if everything went fine, -1 otherwise */
- int16_t WebRtcIsac_UpdateBandwidthEstimator(
- BwEstimatorstr* bwest_str,
- const uint16_t rtp_number,
- const int32_t frame_length,
- const uint32_t send_ts,
- const uint32_t arr_ts,
- const size_t pksize);
+/* This function updates the receiving estimate */
+/* Parameters: */
+/* rtp_number - value from RTP packet, from NetEq */
+/* frame length - length of signal frame in ms, from iSAC decoder */
+/* send_ts - value in RTP header giving send time in samples */
+/* arr_ts - value given by timeGetTime() time of arrival in samples of
+ * packet from NetEq */
+/* pksize - size of packet in bytes, from NetEq */
+/* Index - integer (range 0...23) indicating bottle neck & jitter as
+ * estimated by other side */
+/* returns 0 if everything went fine, -1 otherwise */
+int16_t WebRtcIsac_UpdateBandwidthEstimator(BwEstimatorstr* bwest_str,
+ const uint16_t rtp_number,
+ const int32_t frame_length,
+ const uint32_t send_ts,
+ const uint32_t arr_ts,
+ const size_t pksize);
- /* Update receiving estimates. Used when we only receive BWE index, no iSAC data packet. */
- int16_t WebRtcIsac_UpdateUplinkBwImpl(
- BwEstimatorstr* bwest_str,
- int16_t Index,
- enum IsacSamplingRate encoderSamplingFreq);
+/* Update receiving estimates. Used when we only receive BWE index, no iSAC data
+ * packet. */
+int16_t WebRtcIsac_UpdateUplinkBwImpl(
+ BwEstimatorstr* bwest_str,
+ int16_t Index,
+ enum IsacSamplingRate encoderSamplingFreq);
- /* Returns the bandwidth/jitter estimation code (integer 0...23) to put in the sending iSAC payload */
- void WebRtcIsac_GetDownlinkBwJitIndexImpl(
- BwEstimatorstr* bwest_str,
- int16_t* bottleneckIndex,
- int16_t* jitterInfo,
- enum IsacSamplingRate decoderSamplingFreq);
+/* Returns the bandwidth/jitter estimation code (integer 0...23) to put in the
+ * sending iSAC payload */
+void WebRtcIsac_GetDownlinkBwJitIndexImpl(
+ BwEstimatorstr* bwest_str,
+ int16_t* bottleneckIndex,
+ int16_t* jitterInfo,
+ enum IsacSamplingRate decoderSamplingFreq);
- /* Returns the bandwidth estimation (in bps) */
- int32_t WebRtcIsac_GetDownlinkBandwidth(
- const BwEstimatorstr *bwest_str);
+/* Returns the bandwidth estimation (in bps) */
+int32_t WebRtcIsac_GetDownlinkBandwidth(const BwEstimatorstr* bwest_str);
- /* Returns the max delay (in ms) */
- int32_t WebRtcIsac_GetDownlinkMaxDelay(
- const BwEstimatorstr *bwest_str);
+/* Returns the max delay (in ms) */
+int32_t WebRtcIsac_GetDownlinkMaxDelay(const BwEstimatorstr* bwest_str);
- /* Returns the bandwidth that iSAC should send with in bps */
- int32_t WebRtcIsac_GetUplinkBandwidth(const BwEstimatorstr* bwest_str);
+/* Returns the bandwidth that iSAC should send with in bps */
+int32_t WebRtcIsac_GetUplinkBandwidth(const BwEstimatorstr* bwest_str);
- /* Returns the max delay value from the other side in ms */
- int32_t WebRtcIsac_GetUplinkMaxDelay(
- const BwEstimatorstr *bwest_str);
+/* Returns the max delay value from the other side in ms */
+int32_t WebRtcIsac_GetUplinkMaxDelay(const BwEstimatorstr* bwest_str);
- /* Fills in an IsacExternalBandwidthInfo struct. */
- void WebRtcIsacBw_GetBandwidthInfo(
- BwEstimatorstr* bwest_str,
- enum IsacSamplingRate decoder_sample_rate_hz,
- IsacBandwidthInfo* bwinfo);
+/* Fills in an IsacExternalBandwidthInfo struct. */
+void WebRtcIsacBw_GetBandwidthInfo(BwEstimatorstr* bwest_str,
+ enum IsacSamplingRate decoder_sample_rate_hz,
+ IsacBandwidthInfo* bwinfo);
- /* Uses the values from an IsacExternalBandwidthInfo struct. */
- void WebRtcIsacBw_SetBandwidthInfo(BwEstimatorstr* bwest_str,
- const IsacBandwidthInfo* bwinfo);
+/* Uses the values from an IsacExternalBandwidthInfo struct. */
+void WebRtcIsacBw_SetBandwidthInfo(BwEstimatorstr* bwest_str,
+ const IsacBandwidthInfo* bwinfo);
- /*
- * update amount of data in bottle neck buffer and burst handling
- * returns minimum payload size (bytes)
- */
- int WebRtcIsac_GetMinBytes(
- RateModel* State,
- int StreamSize, /* bytes in bitstream */
- const int FrameLen, /* ms per frame */
- const double BottleNeck, /* bottle neck rate; excl headers (bps) */
- const double DelayBuildUp, /* max delay from bottleneck buffering (ms) */
- enum ISACBandwidth bandwidth
- /*,int16_t frequentLargePackets*/);
+/*
+ * update amount of data in bottle neck buffer and burst handling
+ * returns minimum payload size (bytes)
+ */
+int WebRtcIsac_GetMinBytes(
+ RateModel* State,
+ int StreamSize, /* bytes in bitstream */
+ const int FrameLen, /* ms per frame */
+ const double BottleNeck, /* bottle neck rate; excl headers (bps) */
+ const double DelayBuildUp, /* max delay from bottleneck buffering (ms) */
+ enum ISACBandwidth bandwidth
+ /*,int16_t frequentLargePackets*/);
- /*
- * update long-term average bitrate and amount of data in buffer
- */
- void WebRtcIsac_UpdateRateModel(
- RateModel* State,
- int StreamSize, /* bytes in bitstream */
- const int FrameSamples, /* samples per frame */
- const double BottleNeck); /* bottle neck rate; excl headers (bps) */
+/*
+ * update long-term average bitrate and amount of data in buffer
+ */
+void WebRtcIsac_UpdateRateModel(
+ RateModel* State,
+ int StreamSize, /* bytes in bitstream */
+ const int FrameSamples, /* samples per frame */
+ const double BottleNeck); /* bottle neck rate; excl headers (bps) */
+void WebRtcIsac_InitRateModel(RateModel* State);
- void WebRtcIsac_InitRateModel(
- RateModel *State);
+/* Returns the new framelength value (input argument: bottle_neck) */
+int WebRtcIsac_GetNewFrameLength(double bottle_neck, int current_framelength);
- /* Returns the new framelength value (input argument: bottle_neck) */
- int WebRtcIsac_GetNewFrameLength(
- double bottle_neck,
- int current_framelength);
+/* Returns the new SNR value (input argument: bottle_neck) */
+double WebRtcIsac_GetSnr(double bottle_neck, int new_framelength);
- /* Returns the new SNR value (input argument: bottle_neck) */
- double WebRtcIsac_GetSnr(
- double bottle_neck,
- int new_framelength);
-
-
- int16_t WebRtcIsac_UpdateUplinkJitter(
- BwEstimatorstr* bwest_str,
- int32_t index);
+int16_t WebRtcIsac_UpdateUplinkJitter(BwEstimatorstr* bwest_str, int32_t index);
#if defined(__cplusplus)
}
#endif
-
-#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_ */
+#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_ \
+ */
diff --git a/modules/audio_coding/codecs/isac/main/source/codec.h b/modules/audio_coding/codecs/isac/main/source/codec.h
index 96118ad..c386704 100644
--- a/modules/audio_coding/codecs/isac/main/source/codec.h
+++ b/modules/audio_coding/codecs/isac/main/source/codec.h
@@ -25,10 +25,12 @@
void WebRtcIsac_ResetBitstream(Bitstr* bit_stream);
-int WebRtcIsac_EstimateBandwidth(BwEstimatorstr* bwest_str, Bitstr* streamdata,
+int WebRtcIsac_EstimateBandwidth(BwEstimatorstr* bwest_str,
+ Bitstr* streamdata,
size_t packet_size,
uint16_t rtp_seq_number,
- uint32_t send_ts, uint32_t arr_ts,
+ uint32_t send_ts,
+ uint32_t arr_ts,
enum IsacSamplingRate encoderSampRate,
enum IsacSamplingRate decoderSampRate);
@@ -38,7 +40,8 @@
int16_t* current_framesamples,
int16_t isRCUPayload);
-int WebRtcIsac_DecodeRcuLb(float* signal_out, ISACLBDecStruct* ISACdec_obj,
+int WebRtcIsac_DecodeRcuLb(float* signal_out,
+ ISACLBDecStruct* ISACdec_obj,
int16_t* current_framesamples);
int WebRtcIsac_EncodeLb(const TransformTables* transform_tables,
@@ -48,15 +51,20 @@
int16_t bottleneckIndex);
int WebRtcIsac_EncodeStoredDataLb(const IsacSaveEncoderData* ISACSavedEnc_obj,
- Bitstr* ISACBitStr_obj, int BWnumber,
+ Bitstr* ISACBitStr_obj,
+ int BWnumber,
float scale);
int WebRtcIsac_EncodeStoredDataUb(
- const ISACUBSaveEncDataStruct* ISACSavedEnc_obj, Bitstr* bitStream,
- int32_t jitterInfo, float scale, enum ISACBandwidth bandwidth);
+ const ISACUBSaveEncDataStruct* ISACSavedEnc_obj,
+ Bitstr* bitStream,
+ int32_t jitterInfo,
+ float scale,
+ enum ISACBandwidth bandwidth);
int16_t WebRtcIsac_GetRedPayloadUb(
- const ISACUBSaveEncDataStruct* ISACSavedEncObj, Bitstr* bitStreamObj,
+ const ISACUBSaveEncDataStruct* ISACSavedEncObj,
+ Bitstr* bitStreamObj,
enum ISACBandwidth bandwidth);
/******************************************************************************
@@ -82,7 +90,6 @@
double* rateUBBitPerSec,
enum ISACBandwidth* bandwidthKHz);
-
/******************************************************************************
* WebRtcIsac_DecodeUb16()
*
@@ -169,7 +176,6 @@
void WebRtcIsac_InitPostFilterbank(PostFiltBankstr* postfiltdata);
-
/**************************** transform functions ****************************/
void WebRtcIsac_InitTransform(TransformTables* tables);
@@ -190,18 +196,25 @@
/***************************** filterbank functions **************************/
-void WebRtcIsac_FilterAndCombineFloat(float* InLP, float* InHP, float* Out,
+void WebRtcIsac_FilterAndCombineFloat(float* InLP,
+ float* InHP,
+ float* Out,
PostFiltBankstr* postfiltdata);
-
/************************* normalized lattice filters ************************/
-void WebRtcIsac_NormLatticeFilterMa(int orderCoef, float* stateF, float* stateG,
- float* lat_in, double* filtcoeflo,
+void WebRtcIsac_NormLatticeFilterMa(int orderCoef,
+ float* stateF,
+ float* stateG,
+ float* lat_in,
+ double* filtcoeflo,
double* lat_out);
-void WebRtcIsac_NormLatticeFilterAr(int orderCoef, float* stateF, float* stateG,
- double* lat_in, double* lo_filt_coef,
+void WebRtcIsac_NormLatticeFilterAr(int orderCoef,
+ float* stateF,
+ float* stateG,
+ double* lat_in,
+ double* lo_filt_coef,
float* lat_out);
void WebRtcIsac_Dir2Lat(double* a, int orderCoef, float* sth, float* cth);
diff --git a/modules/audio_coding/codecs/isac/main/source/crc.h b/modules/audio_coding/codecs/isac/main/source/crc.h
index b3197a1..19adbda 100644
--- a/modules/audio_coding/codecs/isac/main/source/crc.h
+++ b/modules/audio_coding/codecs/isac/main/source/crc.h
@@ -36,11 +36,6 @@
* -1 - Error
*/
-int WebRtcIsac_GetCrc(
- const int16_t* encoded,
- int no_of_word8s,
- uint32_t* crc);
-
-
+int WebRtcIsac_GetCrc(const int16_t* encoded, int no_of_word8s, uint32_t* crc);
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_CRC_H_ */
diff --git a/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.h b/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.h
index 2fa1c71..b8d918b 100644
--- a/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.h
+++ b/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.h
@@ -39,9 +39,7 @@
*
*
*/
-int16_t WebRtcIsac_RemoveLarMean(
- double* lar,
- int16_t bandwidth);
+int16_t WebRtcIsac_RemoveLarMean(double* lar, int16_t bandwidth);
/******************************************************************************
* WebRtcIsac_DecorrelateIntraVec()
@@ -59,11 +57,9 @@
* Output:
* -out : decorrelated LAR vectors.
*/
-int16_t WebRtcIsac_DecorrelateIntraVec(
- const double* inLAR,
- double* out,
- int16_t bandwidth);
-
+int16_t WebRtcIsac_DecorrelateIntraVec(const double* inLAR,
+ double* out,
+ int16_t bandwidth);
/******************************************************************************
* WebRtcIsac_DecorrelateInterVec()
@@ -82,11 +78,9 @@
* Output:
* -out : decorrelated LAR vectors.
*/
-int16_t WebRtcIsac_DecorrelateInterVec(
- const double* data,
- double* out,
- int16_t bandwidth);
-
+int16_t WebRtcIsac_DecorrelateInterVec(const double* data,
+ double* out,
+ int16_t bandwidth);
/******************************************************************************
* WebRtcIsac_QuantizeUncorrLar()
@@ -102,11 +96,7 @@
* -data : quantized version of the input.
* -idx : pointer to quantization indices.
*/
-double WebRtcIsac_QuantizeUncorrLar(
- double* data,
- int* idx,
- int16_t bandwidth);
-
+double WebRtcIsac_QuantizeUncorrLar(double* data, int* idx, int16_t bandwidth);
/******************************************************************************
* WebRtcIsac_CorrelateIntraVec()
@@ -121,11 +111,9 @@
* Output:
* -out : correlated parametrs.
*/
-int16_t WebRtcIsac_CorrelateIntraVec(
- const double* data,
- double* out,
- int16_t bandwidth);
-
+int16_t WebRtcIsac_CorrelateIntraVec(const double* data,
+ double* out,
+ int16_t bandwidth);
/******************************************************************************
* WebRtcIsac_CorrelateInterVec()
@@ -140,17 +128,15 @@
* Output:
* -out : correlated parametrs.
*/
-int16_t WebRtcIsac_CorrelateInterVec(
- const double* data,
- double* out,
- int16_t bandwidth);
-
+int16_t WebRtcIsac_CorrelateInterVec(const double* data,
+ double* out,
+ int16_t bandwidth);
/******************************************************************************
* WebRtcIsac_AddLarMean()
*
* This is the inverse of WebRtcIsac_RemoveLarMean()
- *
+ *
* Input:
* -data : pointer to mean-removed LAR:s.
* -bandwidth : indicates if the given LAR vectors belong
@@ -159,10 +145,7 @@
* Output:
* -data : pointer to LARs.
*/
-int16_t WebRtcIsac_AddLarMean(
- double* data,
- int16_t bandwidth);
-
+int16_t WebRtcIsac_AddLarMean(double* data, int16_t bandwidth);
/******************************************************************************
* WebRtcIsac_DequantizeLpcParam()
@@ -177,11 +160,9 @@
* Output:
* -out : pointer to quantized values.
*/
-int16_t WebRtcIsac_DequantizeLpcParam(
- const int* idx,
- double* out,
- int16_t bandwidth);
-
+int16_t WebRtcIsac_DequantizeLpcParam(const int* idx,
+ double* out,
+ int16_t bandwidth);
/******************************************************************************
* WebRtcIsac_ToLogDomainRemoveMean()
@@ -194,9 +175,7 @@
* Output:
* -lpcGain : mean-removed in log domain.
*/
-int16_t WebRtcIsac_ToLogDomainRemoveMean(
- double* lpGains);
-
+int16_t WebRtcIsac_ToLogDomainRemoveMean(double* lpGains);
/******************************************************************************
* WebRtcIsac_DecorrelateLPGain()
@@ -210,16 +189,13 @@
* Output:
* -out : decorrelated parameters.
*/
-int16_t WebRtcIsac_DecorrelateLPGain(
- const double* data,
- double* out);
-
+int16_t WebRtcIsac_DecorrelateLPGain(const double* data, double* out);
/******************************************************************************
* WebRtcIsac_QuantizeLpcGain()
*
* Quantize the decorrelated log-domain gains.
- *
+ *
* Input:
* -lpcGain : uncorrelated LPC gains.
*
@@ -227,10 +203,7 @@
* -idx : quantization indices
* -lpcGain : quantized value of the inpt.
*/
-double WebRtcIsac_QuantizeLpcGain(
- double* lpGains,
- int* idx);
-
+double WebRtcIsac_QuantizeLpcGain(double* lpGains, int* idx);
/******************************************************************************
* WebRtcIsac_DequantizeLpcGain()
@@ -243,10 +216,7 @@
* Output:
* -lpcGains : quantized values of the given parametes.
*/
-int16_t WebRtcIsac_DequantizeLpcGain(
- const int* idx,
- double* lpGains);
-
+int16_t WebRtcIsac_DequantizeLpcGain(const int* idx, double* lpGains);
/******************************************************************************
* WebRtcIsac_CorrelateLpcGain()
@@ -259,10 +229,7 @@
* Output:
* -out : correlated parameters.
*/
-int16_t WebRtcIsac_CorrelateLpcGain(
- const double* data,
- double* out);
-
+int16_t WebRtcIsac_CorrelateLpcGain(const double* data, double* out);
/******************************************************************************
* WebRtcIsac_AddMeanToLinearDomain()
@@ -275,8 +242,6 @@
* Output:
* -lpcGain : LPC gain in normal domain.
*/
-int16_t WebRtcIsac_AddMeanToLinearDomain(
- double* lpcGains);
-
+int16_t WebRtcIsac_AddMeanToLinearDomain(double* lpcGains);
#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ENCODE_LPC_SWB_H_
diff --git a/modules/audio_coding/codecs/isac/main/source/entropy_coding.h b/modules/audio_coding/codecs/isac/main/source/entropy_coding.h
index 7224ad0..6c2b8d3 100644
--- a/modules/audio_coding/codecs/isac/main/source/entropy_coding.h
+++ b/modules/audio_coding/codecs/isac/main/source/entropy_coding.h
@@ -46,8 +46,11 @@
* Return value : < 0 if an error occures
* 0 if succeeded.
*/
-int WebRtcIsac_DecodeSpec(Bitstr* streamdata, int16_t AvgPitchGain_Q12,
- enum ISACBand band, double* fr, double* fi);
+int WebRtcIsac_DecodeSpec(Bitstr* streamdata,
+ int16_t AvgPitchGain_Q12,
+ enum ISACBand band,
+ double* fr,
+ double* fi);
/******************************************************************************
* WebRtcIsac_EncodeSpec()
@@ -72,24 +75,31 @@
* Return value : < 0 if an error occures
* 0 if succeeded.
*/
-int WebRtcIsac_EncodeSpec(const int16_t* fr, const int16_t* fi,
- int16_t AvgPitchGain_Q12, enum ISACBand band,
+int WebRtcIsac_EncodeSpec(const int16_t* fr,
+ const int16_t* fi,
+ int16_t AvgPitchGain_Q12,
+ enum ISACBand band,
Bitstr* streamdata);
/* decode & dequantize LPC Coef */
int WebRtcIsac_DecodeLpcCoef(Bitstr* streamdata, double* LPCCoef);
-int WebRtcIsac_DecodeLpcCoefUB(Bitstr* streamdata, double* lpcVecs,
+int WebRtcIsac_DecodeLpcCoefUB(Bitstr* streamdata,
+ double* lpcVecs,
double* percepFilterGains,
int16_t bandwidth);
-int WebRtcIsac_DecodeLpc(Bitstr* streamdata, double* LPCCoef_lo,
+int WebRtcIsac_DecodeLpc(Bitstr* streamdata,
+ double* LPCCoef_lo,
double* LPCCoef_hi);
/* quantize & code LPC Coef */
-void WebRtcIsac_EncodeLpcLb(double* LPCCoef_lo, double* LPCCoef_hi,
- Bitstr* streamdata, IsacSaveEncoderData* encData);
+void WebRtcIsac_EncodeLpcLb(double* LPCCoef_lo,
+ double* LPCCoef_hi,
+ Bitstr* streamdata,
+ IsacSaveEncoderData* encData);
-void WebRtcIsac_EncodeLpcGainLb(double* LPCCoef_lo, double* LPCCoef_hi,
+void WebRtcIsac_EncodeLpcGainLb(double* LPCCoef_lo,
+ double* LPCCoef_hi,
Bitstr* streamdata,
IsacSaveEncoderData* encData);
@@ -126,7 +136,8 @@
* Return value : 0 if encoding is successful,
* <0 if failed to encode.
*/
-int16_t WebRtcIsac_EncodeLpcUB(double* lpcCoeff, Bitstr* streamdata,
+int16_t WebRtcIsac_EncodeLpcUB(double* lpcCoeff,
+ Bitstr* streamdata,
double* interpolLPCCoeff,
int16_t bandwidth,
ISACUBSaveEncDataStruct* encData);
@@ -184,9 +195,9 @@
Bitstr* streamdata,
IsacSaveEncoderData* encData);
-int WebRtcIsac_DecodePitchGain(Bitstr* streamdata,
- int16_t* PitchGain_Q12);
-int WebRtcIsac_DecodePitchLag(Bitstr* streamdata, int16_t* PitchGain_Q12,
+int WebRtcIsac_DecodePitchGain(Bitstr* streamdata, int16_t* PitchGain_Q12);
+int WebRtcIsac_DecodePitchLag(Bitstr* streamdata,
+ int16_t* PitchGain_Q12,
double* PitchLag);
int WebRtcIsac_DecodeFrameLen(Bitstr* streamdata, int16_t* framelength);
@@ -200,10 +211,10 @@
/* Step-up */
void WebRtcIsac_Rc2Poly(double* RC, int N, double* a);
-void WebRtcIsac_TranscodeLPCCoef(double* LPCCoef_lo, double* LPCCoef_hi,
+void WebRtcIsac_TranscodeLPCCoef(double* LPCCoef_lo,
+ double* LPCCoef_hi,
int* index_g);
-
/******************************************************************************
* WebRtcIsac_EncodeLpcGainUb()
* Encode LPC gains of sub-Frames.
@@ -220,10 +231,10 @@
* - lpcGainIndex : quantization indices for lpc gains, these will
* be stored to be used for FEC.
*/
-void WebRtcIsac_EncodeLpcGainUb(double* lpGains, Bitstr* streamdata,
+void WebRtcIsac_EncodeLpcGainUb(double* lpGains,
+ Bitstr* streamdata,
int* lpcGainIndex);
-
/******************************************************************************
* WebRtcIsac_EncodeLpcGainUb()
* Store LPC gains of sub-Frames in 'streamdata'.
@@ -239,7 +250,6 @@
*/
void WebRtcIsac_StoreLpcGainUb(double* lpGains, Bitstr* streamdata);
-
/******************************************************************************
* WebRtcIsac_DecodeLpcGainUb()
* Decode the LPC gain of sub-frames.
@@ -257,7 +267,6 @@
*/
int16_t WebRtcIsac_DecodeLpcGainUb(double* lpGains, Bitstr* streamdata);
-
/******************************************************************************
* WebRtcIsac_EncodeBandwidth()
* Encode if the bandwidth of encoded audio is 0-12 kHz or 0-16 kHz.
@@ -277,7 +286,6 @@
int16_t WebRtcIsac_EncodeBandwidth(enum ISACBandwidth bandwidth,
Bitstr* streamData);
-
/******************************************************************************
* WebRtcIsac_DecodeBandwidth()
* Decode the bandwidth of the encoded audio, i.e. if the bandwidth is 0-12 kHz
@@ -298,7 +306,6 @@
int16_t WebRtcIsac_DecodeBandwidth(Bitstr* streamData,
enum ISACBandwidth* bandwidth);
-
/******************************************************************************
* WebRtcIsac_EncodeJitterInfo()
* Decode the jitter information.
@@ -316,9 +323,7 @@
* Return value : 0 if succeeded.
* <0 if failed.
*/
-int16_t WebRtcIsac_EncodeJitterInfo(int32_t jitterIndex,
- Bitstr* streamData);
-
+int16_t WebRtcIsac_EncodeJitterInfo(int32_t jitterIndex, Bitstr* streamData);
/******************************************************************************
* WebRtcIsac_DecodeJitterInfo()
@@ -337,7 +342,6 @@
* Return value : 0 if succeeded.
* <0 if failed.
*/
-int16_t WebRtcIsac_DecodeJitterInfo(Bitstr* streamData,
- int32_t* jitterInfo);
+int16_t WebRtcIsac_DecodeJitterInfo(Bitstr* streamData, int32_t* jitterInfo);
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ENTROPY_CODING_H_ */
diff --git a/modules/audio_coding/codecs/isac/main/source/fft.h b/modules/audio_coding/codecs/isac/main/source/fft.h
index 9750153..34e5f94 100644
--- a/modules/audio_coding/codecs/isac/main/source/fft.h
+++ b/modules/audio_coding/codecs/isac/main/source/fft.h
@@ -34,10 +34,12 @@
/* double precision routine */
-
-int WebRtcIsac_Fftns (unsigned int ndim, const int dims[], double Re[], double Im[],
- int isign, double scaling, FFTstr *fftstate);
-
-
+int WebRtcIsac_Fftns(unsigned int ndim,
+ const int dims[],
+ double Re[],
+ double Im[],
+ int isign,
+ double scaling,
+ FFTstr* fftstate);
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FFT_H_ */
diff --git a/modules/audio_coding/codecs/isac/main/source/isac_unittest.cc b/modules/audio_coding/codecs/isac/main/source/isac_unittest.cc
index 727f0f6..3ec28cc 100644
--- a/modules/audio_coding/codecs/isac/main/source/isac_unittest.cc
+++ b/modules/audio_coding/codecs/isac/main/source/isac_unittest.cc
@@ -35,15 +35,13 @@
uint8_t bitstream_small_[7]; // Simulate sync packets.
};
-IsacTest::IsacTest()
- : isac_codec_(NULL) {
-}
+IsacTest::IsacTest() : isac_codec_(NULL) {}
void IsacTest::SetUp() {
// Read some samples from a speech file, to be used in the encode test.
FILE* input_file;
const std::string file_name =
- webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
+ webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
input_file = fopen(file_name.c_str(), "rb");
ASSERT_TRUE(input_file != NULL);
ASSERT_EQ(kIsacNumberOfSamples,
@@ -69,7 +67,8 @@
TEST_F(IsacTest, IsacCreateFree) {
EXPECT_EQ(0, WebRtcIsac_Create(&isac_codec_));
EXPECT_TRUE(isac_codec_ != NULL);
- EXPECT_EQ(0, WebRtcIsac_Free(isac_codec_));}
+ EXPECT_EQ(0, WebRtcIsac_Free(isac_codec_));
+}
TEST_F(IsacTest, IsacUpdateBWE) {
// Create encoder memory.
@@ -86,17 +85,17 @@
12345, 56789));
// Encode 60 ms of data (needed to create a first packet).
- encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
+ encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
EXPECT_EQ(0, encoded_bytes);
- encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
+ encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
EXPECT_EQ(0, encoded_bytes);
- encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
+ encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
EXPECT_EQ(0, encoded_bytes);
- encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
+ encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
EXPECT_EQ(0, encoded_bytes);
- encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
+ encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
EXPECT_EQ(0, encoded_bytes);
- encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
+ encoded_bytes = WebRtcIsac_Encode(isac_codec_, speech_data_, bitstream_);
EXPECT_GT(encoded_bytes, 0);
// Call to update bandwidth estimator with real data.
diff --git a/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h b/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h
index 30f9153..5503e2d 100644
--- a/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h
+++ b/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h
@@ -21,24 +21,26 @@
#include "modules/audio_coding/codecs/isac/main/source/settings.h"
#include "modules/audio_coding/codecs/isac/main/source/structs.h"
-void WebRtcIsac_GetLpcCoefLb(double *inLo, double *inHi, MaskFiltstr *maskdata,
- double signal_noise_ratio, const int16_t *pitchGains_Q12,
- double *lo_coeff, double *hi_coeff);
+void WebRtcIsac_GetLpcCoefLb(double* inLo,
+ double* inHi,
+ MaskFiltstr* maskdata,
+ double signal_noise_ratio,
+ const int16_t* pitchGains_Q12,
+ double* lo_coeff,
+ double* hi_coeff);
-void WebRtcIsac_GetLpcGain(
- double signal_noise_ratio,
- const double* filtCoeffVecs,
- int numVecs,
- double* gain,
- double corrLo[][UB_LPC_ORDER + 1],
- const double* varscale);
+void WebRtcIsac_GetLpcGain(double signal_noise_ratio,
+ const double* filtCoeffVecs,
+ int numVecs,
+ double* gain,
+ double corrLo[][UB_LPC_ORDER + 1],
+ const double* varscale);
-void WebRtcIsac_GetLpcCoefUb(
- double* inSignal,
- MaskFiltstr* maskdata,
- double* lpCoeff,
- double corr[][UB_LPC_ORDER + 1],
- double* varscale,
- int16_t bandwidth);
+void WebRtcIsac_GetLpcCoefUb(double* inSignal,
+ MaskFiltstr* maskdata,
+ double* lpCoeff,
+ double corr[][UB_LPC_ORDER + 1],
+ double* varscale,
+ int16_t bandwidth);
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_ANALYIS_H_ */
diff --git a/modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.h b/modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.h
index 7a5abfd..84913dd 100644
--- a/modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.h
+++ b/modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.h
@@ -46,4 +46,4 @@
extern const double WebRtcIsac_kLpcGainDecorrMat[SUBFRAMES][SUBFRAMES];
-#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_GAIN_SWB_TABLES_H_
+#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_GAIN_SWB_TABLES_H_
diff --git a/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.h b/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.h
index 7bae096..e21e15a 100644
--- a/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.h
+++ b/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.h
@@ -26,22 +26,22 @@
extern const double WebRtcIsac_kMeanLpcGain;
-extern const double WebRtcIsac_kIntraVecDecorrMatUb12[UB_LPC_ORDER][UB_LPC_ORDER];
+extern const double WebRtcIsac_kIntraVecDecorrMatUb12[UB_LPC_ORDER]
+ [UB_LPC_ORDER];
-extern const double WebRtcIsac_kInterVecDecorrMatUb12
-[UB_LPC_VEC_PER_FRAME][UB_LPC_VEC_PER_FRAME];
+extern const double WebRtcIsac_kInterVecDecorrMatUb12[UB_LPC_VEC_PER_FRAME]
+ [UB_LPC_VEC_PER_FRAME];
extern const double WebRtcIsac_kLpcShapeQStepSizeUb12;
-extern const double WebRtcIsac_kLpcShapeLeftRecPointUb12
-[UB_LPC_ORDER*UB_LPC_VEC_PER_FRAME];
+extern const double
+ WebRtcIsac_kLpcShapeLeftRecPointUb12[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
+extern const int16_t
+ WebRtcIsac_kLpcShapeNumRecPointUb12[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
-extern const int16_t WebRtcIsac_kLpcShapeNumRecPointUb12
-[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
-
-extern const uint16_t WebRtcIsac_kLpcShapeEntropySearchUb12
-[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
+extern const uint16_t
+ WebRtcIsac_kLpcShapeEntropySearchUb12[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec0Ub12[14];
@@ -59,7 +59,7 @@
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec7Ub12[49];
-extern const uint16_t* WebRtcIsac_kLpcShapeCdfMatUb12
-[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
+extern const uint16_t*
+ WebRtcIsac_kLpcShapeCdfMatUb12[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
-#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB12_TABLES_H_
+#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB12_TABLES_H_
diff --git a/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.h b/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.h
index d828b83..4d5403d 100644
--- a/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.h
+++ b/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.h
@@ -24,10 +24,11 @@
extern const double WebRtcIsac_kMeanLarUb16[UB_LPC_ORDER];
-extern const double WebRtcIsac_kIintraVecDecorrMatUb16[UB_LPC_ORDER][UB_LPC_ORDER];
+extern const double WebRtcIsac_kIintraVecDecorrMatUb16[UB_LPC_ORDER]
+ [UB_LPC_ORDER];
-extern const double WebRtcIsac_kInterVecDecorrMatUb16
-[UB16_LPC_VEC_PER_FRAME][UB16_LPC_VEC_PER_FRAME];
+extern const double WebRtcIsac_kInterVecDecorrMatUb16[UB16_LPC_VEC_PER_FRAME]
+ [UB16_LPC_VEC_PER_FRAME];
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub16[14];
@@ -61,18 +62,19 @@
extern const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub166[71];
-extern const uint16_t* WebRtcIsac_kLpcShapeCdfMatUb16
-[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
+extern const uint16_t*
+ WebRtcIsac_kLpcShapeCdfMatUb16[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
-extern const double WebRtcIsac_kLpcShapeLeftRecPointUb16
-[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
+extern const double
+ WebRtcIsac_kLpcShapeLeftRecPointUb16[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
-extern const int16_t WebRtcIsac_kLpcShapeNumRecPointUb16
-[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
+extern const int16_t
+ WebRtcIsac_kLpcShapeNumRecPointUb16[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
-extern const uint16_t WebRtcIsac_kLpcShapeEntropySearchUb16
-[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
+extern const uint16_t
+ WebRtcIsac_kLpcShapeEntropySearchUb16[UB_LPC_ORDER *
+ UB16_LPC_VEC_PER_FRAME];
extern const double WebRtcIsac_kLpcShapeQStepSizeUb16;
-#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB16_TABLES_H_
+#endif // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB16_TABLES_H_
diff --git a/modules/audio_coding/codecs/isac/main/source/lpc_tables.h b/modules/audio_coding/codecs/isac/main/source/lpc_tables.h
index 2b02557..2d92dfa 100644
--- a/modules/audio_coding/codecs/isac/main/source/lpc_tables.h
+++ b/modules/audio_coding/codecs/isac/main/source/lpc_tables.h
@@ -22,27 +22,27 @@
#include "modules/audio_coding/codecs/isac/main/source/settings.h"
-#define KLT_STEPSIZE 1.00000000
-#define KLT_NUM_AVG_GAIN 0
-#define KLT_NUM_AVG_SHAPE 0
-#define KLT_NUM_MODELS 3
-#define LPC_GAIN_SCALE 4.000f
-#define LPC_LOBAND_SCALE 2.100f
-#define LPC_LOBAND_ORDER ORDERLO
-#define LPC_HIBAND_SCALE 0.450f
-#define LPC_HIBAND_ORDER ORDERHI
-#define LPC_GAIN_ORDER 2
+#define KLT_STEPSIZE 1.00000000
+#define KLT_NUM_AVG_GAIN 0
+#define KLT_NUM_AVG_SHAPE 0
+#define KLT_NUM_MODELS 3
+#define LPC_GAIN_SCALE 4.000f
+#define LPC_LOBAND_SCALE 2.100f
+#define LPC_LOBAND_ORDER ORDERLO
+#define LPC_HIBAND_SCALE 0.450f
+#define LPC_HIBAND_ORDER ORDERHI
+#define LPC_GAIN_ORDER 2
-#define LPC_SHAPE_ORDER (LPC_LOBAND_ORDER + LPC_HIBAND_ORDER)
+#define LPC_SHAPE_ORDER (LPC_LOBAND_ORDER + LPC_HIBAND_ORDER)
-#define KLT_ORDER_GAIN (LPC_GAIN_ORDER * SUBFRAMES)
-#define KLT_ORDER_SHAPE (LPC_SHAPE_ORDER * SUBFRAMES)
+#define KLT_ORDER_GAIN (LPC_GAIN_ORDER * SUBFRAMES)
+#define KLT_ORDER_SHAPE (LPC_SHAPE_ORDER * SUBFRAMES)
/* cdf array for model indicator */
-extern const uint16_t WebRtcIsac_kQKltModelCdf[KLT_NUM_MODELS+1];
+extern const uint16_t WebRtcIsac_kQKltModelCdf[KLT_NUM_MODELS + 1];
/* pointer to cdf array for model indicator */
-extern const uint16_t *WebRtcIsac_kQKltModelCdfPtr[1];
+extern const uint16_t* WebRtcIsac_kQKltModelCdfPtr[1];
/* initial cdf index for decoder of model indicator */
extern const uint16_t WebRtcIsac_kQKltModelInitIndex[1];
@@ -78,9 +78,9 @@
extern const uint16_t WebRtcIsac_kQKltCdfShape[686];
/* pointers to cdf tables for quantizer indices */
-extern const uint16_t *WebRtcIsac_kQKltCdfPtrGain[12];
+extern const uint16_t* WebRtcIsac_kQKltCdfPtrGain[12];
-extern const uint16_t *WebRtcIsac_kQKltCdfPtrShape[108];
+extern const uint16_t* WebRtcIsac_kQKltCdfPtrShape[108];
/* left KLT transforms */
extern const double WebRtcIsac_kKltT1Gain[4];
diff --git a/modules/audio_coding/codecs/isac/main/source/os_specific_inline.h b/modules/audio_coding/codecs/isac/main/source/os_specific_inline.h
index 597dc21..f72236d 100644
--- a/modules/audio_coding/codecs/isac/main/source/os_specific_inline.h
+++ b/modules/audio_coding/codecs/isac/main/source/os_specific_inline.h
@@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_OS_SPECIFIC_INLINE_H_
#define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_OS_SPECIFIC_INLINE_H_
@@ -24,11 +23,12 @@
__asm {
fld x_dbl
fistp x_int
- };
+ }
+ ;
return x_int;
}
-#else // Do a slow but correct implementation of lrint
+#else // Do a slow but correct implementation of lrint
static __inline long int WebRtcIsac_lrint(double x_dbl) {
long int x_int;
diff --git a/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h b/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h
index c03ce62..4ab78c2 100644
--- a/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h
+++ b/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h
@@ -22,10 +22,11 @@
#include "modules/audio_coding/codecs/isac/main/source/structs.h"
-void WebRtcIsac_PitchAnalysis(const double *in, /* PITCH_FRAME_LEN samples */
- double *out, /* PITCH_FRAME_LEN+QLOOKAHEAD samples */
- PitchAnalysisStruct *State,
- double *lags,
- double *gains);
+void WebRtcIsac_PitchAnalysis(
+ const double* in, /* PITCH_FRAME_LEN samples */
+ double* out, /* PITCH_FRAME_LEN+QLOOKAHEAD samples */
+ PitchAnalysisStruct* State,
+ double* lags,
+ double* gains);
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_PITCH_ESTIMATOR_H_ */
diff --git a/modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.h b/modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.h
index fe506ee..891bcef 100644
--- a/modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.h
+++ b/modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.h
@@ -11,7 +11,8 @@
/*
* pitch_gain_tables.h
*
- * This file contains tables for the pitch filter side-info in the entropy coder.
+ * This file contains tables for the pitch filter side-info in the entropy
+ * coder.
*
*/
@@ -20,8 +21,10 @@
#include "typedefs.h" // NOLINT(build/include)
-/* header file for coding tables for the pitch filter side-info in the entropy coder */
-/********************* Pitch Filter Gain Coefficient Tables ************************/
+/* header file for coding tables for the pitch filter side-info in the entropy
+ * coder */
+/********************* Pitch Filter Gain Coefficient Tables
+ * ************************/
/* cdf for quantized pitch filter gains */
extern const uint16_t WebRtcIsac_kQPitchGainCdf[255];
diff --git a/modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.h b/modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.h
index 6a57c87..b662ab5 100644
--- a/modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.h
+++ b/modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.h
@@ -11,7 +11,8 @@
/*
* pitch_lag_tables.h
*
- * This file contains tables for the pitch filter side-info in the entropy coder.
+ * This file contains tables for the pitch filter side-info in the entropy
+ * coder.
*
*/
@@ -19,8 +20,10 @@
#define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_PITCH_LAG_TABLES_H_
#include "typedefs.h" // NOLINT(build/include)
-/* header file for coding tables for the pitch filter side-info in the entropy coder */
-/********************* Pitch Filter Lag Coefficient Tables ************************/
+/* header file for coding tables for the pitch filter side-info in the entropy
+ * coder */
+/********************* Pitch Filter Lag Coefficient Tables
+ * ************************/
/* tables for use with small pitch gain */
@@ -30,7 +33,7 @@
extern const uint16_t WebRtcIsac_kQPitchLagCdf3Lo[2];
extern const uint16_t WebRtcIsac_kQPitchLagCdf4Lo[10];
-extern const uint16_t *WebRtcIsac_kQPitchLagCdfPtrLo[4];
+extern const uint16_t* WebRtcIsac_kQPitchLagCdfPtrLo[4];
/* size of first cdf table */
extern const uint16_t WebRtcIsac_kQPitchLagCdfSizeLo[1];
@@ -49,7 +52,6 @@
extern const double WebRtcIsac_kQPitchLagStepsizeLo;
-
/* tables for use with medium pitch gain */
/* cdfs for quantized pitch lags */
@@ -58,7 +60,7 @@
extern const uint16_t WebRtcIsac_kQPitchLagCdf3Mid[2];
extern const uint16_t WebRtcIsac_kQPitchLagCdf4Mid[20];
-extern const uint16_t *WebRtcIsac_kQPitchLagCdfPtrMid[4];
+extern const uint16_t* WebRtcIsac_kQPitchLagCdfPtrMid[4];
/* size of first cdf table */
extern const uint16_t WebRtcIsac_kQPitchLagCdfSizeMid[1];
@@ -77,7 +79,6 @@
extern const double WebRtcIsac_kQPitchLagStepsizeMid;
-
/* tables for use with large pitch gain */
/* cdfs for quantized pitch lags */
@@ -86,7 +87,7 @@
extern const uint16_t WebRtcIsac_kQPitchLagCdf3Hi[2];
extern const uint16_t WebRtcIsac_kQPitchLagCdf4Hi[35];
-extern const uint16_t *WebRtcIsac_kQPitchLagCdfPtrHi[4];
+extern const uint16_t* WebRtcIsac_kQPitchLagCdfPtrHi[4];
/* size of first cdf table */
extern const uint16_t WebRtcIsac_kQPitchLagCdfSizeHi[1];
diff --git a/modules/audio_coding/codecs/isac/main/source/settings.h b/modules/audio_coding/codecs/isac/main/source/settings.h
index c08d72f..14a5be8 100644
--- a/modules/audio_coding/codecs/isac/main/source/settings.h
+++ b/modules/audio_coding/codecs/isac/main/source/settings.h
@@ -19,187 +19,181 @@
#define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SETTINGS_H_
/* sampling frequency (Hz) */
-#define FS 16000
+#define FS 16000
/* number of samples per frame (either 320 (20ms), 480 (30ms) or 960 (60ms)) */
-#define INITIAL_FRAMESAMPLES 960
-
+#define INITIAL_FRAMESAMPLES 960
#define MAXFFTSIZE 2048
#define NFACTOR 11
-
-
/* do not modify the following; this will have to be modified if we
* have a 20ms framesize option */
/**********************************************************************/
/* miliseconds */
-#define FRAMESIZE 30
+#define FRAMESIZE 30
/* number of samples per frame processed in the encoder, 480 */
-#define FRAMESAMPLES 480 /* ((FRAMESIZE*FS)/1000) */
-#define FRAMESAMPLES_HALF 240
-#define FRAMESAMPLES_QUARTER 120
+#define FRAMESAMPLES 480 /* ((FRAMESIZE*FS)/1000) */
+#define FRAMESAMPLES_HALF 240
+#define FRAMESAMPLES_QUARTER 120
/**********************************************************************/
-
-
/* max number of samples per frame (= 60 ms frame) */
-#define MAX_FRAMESAMPLES 960
-#define MAX_SWBFRAMESAMPLES (MAX_FRAMESAMPLES * 2)
+#define MAX_FRAMESAMPLES 960
+#define MAX_SWBFRAMESAMPLES (MAX_FRAMESAMPLES * 2)
/* number of samples per 10ms frame */
-#define FRAMESAMPLES_10ms ((10*FS)/1000)
-#define SWBFRAMESAMPLES_10ms (FRAMESAMPLES_10ms * 2)
+#define FRAMESAMPLES_10ms ((10 * FS) / 1000)
+#define SWBFRAMESAMPLES_10ms (FRAMESAMPLES_10ms * 2)
/* number of samples in 30 ms frame */
-#define FRAMESAMPLES_30ms 480
+#define FRAMESAMPLES_30ms 480
/* number of subframes */
-#define SUBFRAMES 6
+#define SUBFRAMES 6
/* length of a subframe */
-#define UPDATE 80
+#define UPDATE 80
/* length of half a subframe (low/high band) */
-#define HALF_SUBFRAMELEN (UPDATE/2)
+#define HALF_SUBFRAMELEN (UPDATE / 2)
/* samples of look ahead (in a half-band, so actually
* half the samples of look ahead @ FS) */
-#define QLOOKAHEAD 24 /* 3 ms */
+#define QLOOKAHEAD 24 /* 3 ms */
/* order of AR model in spectral entropy coder */
-#define AR_ORDER 6
+#define AR_ORDER 6
/* order of LP model in spectral entropy coder */
-#define LP_ORDER 0
+#define LP_ORDER 0
/* window length (masking analysis) */
-#define WINLEN 256
+#define WINLEN 256
/* order of low-band pole filter used to approximate masking curve */
-#define ORDERLO 12
+#define ORDERLO 12
/* order of hi-band pole filter used to approximate masking curve */
-#define ORDERHI 6
+#define ORDERHI 6
-#define UB_LPC_ORDER 4
-#define UB_LPC_VEC_PER_FRAME 2
-#define UB16_LPC_VEC_PER_FRAME 4
-#define UB_ACTIVE_SUBFRAMES 2
-#define UB_MAX_LPC_ORDER 6
-#define UB_INTERPOL_SEGMENTS 1
-#define UB16_INTERPOL_SEGMENTS 3
-#define LB_TOTAL_DELAY_SAMPLES 48
-enum ISACBandwidth {isac8kHz = 8, isac12kHz = 12, isac16kHz = 16};
-enum ISACBand {kIsacLowerBand = 0, kIsacUpperBand12 = 1, kIsacUpperBand16 = 2};
-enum IsacSamplingRate {kIsacWideband = 16, kIsacSuperWideband = 32};
-#define UB_LPC_GAIN_DIM SUBFRAMES
-#define FB_STATE_SIZE_WORD32 6
-
+#define UB_LPC_ORDER 4
+#define UB_LPC_VEC_PER_FRAME 2
+#define UB16_LPC_VEC_PER_FRAME 4
+#define UB_ACTIVE_SUBFRAMES 2
+#define UB_MAX_LPC_ORDER 6
+#define UB_INTERPOL_SEGMENTS 1
+#define UB16_INTERPOL_SEGMENTS 3
+#define LB_TOTAL_DELAY_SAMPLES 48
+enum ISACBandwidth { isac8kHz = 8, isac12kHz = 12, isac16kHz = 16 };
+enum ISACBand {
+ kIsacLowerBand = 0,
+ kIsacUpperBand12 = 1,
+ kIsacUpperBand16 = 2
+};
+enum IsacSamplingRate { kIsacWideband = 16, kIsacSuperWideband = 32 };
+#define UB_LPC_GAIN_DIM SUBFRAMES
+#define FB_STATE_SIZE_WORD32 6
/* order for post_filter_bank */
-#define POSTQORDER 3
+#define POSTQORDER 3
/* order for pre-filterbank */
-#define QORDER 3
+#define QORDER 3
/* another order */
-#define QORDER_ALL (POSTQORDER+QORDER-1)
+#define QORDER_ALL (POSTQORDER + QORDER - 1)
/* for decimator */
-#define ALLPASSSECTIONS 2
-
+#define ALLPASSSECTIONS 2
/* array size for byte stream in number of bytes. */
/* The old maximum size still needed for the decoding */
-#define STREAM_SIZE_MAX 600
-#define STREAM_SIZE_MAX_30 200 /* 200 bytes=53.4 kbps @ 30 ms.framelength */
-#define STREAM_SIZE_MAX_60 400 /* 400 bytes=53.4 kbps @ 60 ms.framelength */
+#define STREAM_SIZE_MAX 600
+#define STREAM_SIZE_MAX_30 200 /* 200 bytes=53.4 kbps @ 30 ms.framelength */
+#define STREAM_SIZE_MAX_60 400 /* 400 bytes=53.4 kbps @ 60 ms.framelength */
/* storage size for bit counts */
-#define BIT_COUNTER_SIZE 30
+#define BIT_COUNTER_SIZE 30
/* maximum order of any AR model or filter */
-#define MAX_AR_MODEL_ORDER 12//50
-
+#define MAX_AR_MODEL_ORDER 12 // 50
/* For pitch analysis */
-#define PITCH_FRAME_LEN (FRAMESAMPLES_HALF) /* 30 ms */
-#define PITCH_MAX_LAG 140 /* 57 Hz */
-#define PITCH_MIN_LAG 20 /* 400 Hz */
-#define PITCH_MAX_GAIN 0.45
-#define PITCH_MAX_GAIN_06 0.27 /* PITCH_MAX_GAIN*0.6 */
-#define PITCH_MAX_GAIN_Q12 1843
-#define PITCH_LAG_SPAN2 (PITCH_MAX_LAG/2-PITCH_MIN_LAG/2+5)
-#define PITCH_CORR_LEN2 60 /* 15 ms */
-#define PITCH_CORR_STEP2 (PITCH_FRAME_LEN/4)
-#define PITCH_BW 11 /* half the band width of correlation surface */
-#define PITCH_SUBFRAMES 4
-#define PITCH_GRAN_PER_SUBFRAME 5
-#define PITCH_SUBFRAME_LEN (PITCH_FRAME_LEN/PITCH_SUBFRAMES)
-#define PITCH_UPDATE (PITCH_SUBFRAME_LEN/PITCH_GRAN_PER_SUBFRAME)
+#define PITCH_FRAME_LEN (FRAMESAMPLES_HALF) /* 30 ms */
+#define PITCH_MAX_LAG 140 /* 57 Hz */
+#define PITCH_MIN_LAG 20 /* 400 Hz */
+#define PITCH_MAX_GAIN 0.45
+#define PITCH_MAX_GAIN_06 0.27 /* PITCH_MAX_GAIN*0.6 */
+#define PITCH_MAX_GAIN_Q12 1843
+#define PITCH_LAG_SPAN2 (PITCH_MAX_LAG / 2 - PITCH_MIN_LAG / 2 + 5)
+#define PITCH_CORR_LEN2 60 /* 15 ms */
+#define PITCH_CORR_STEP2 (PITCH_FRAME_LEN / 4)
+#define PITCH_BW 11 /* half the band width of correlation surface */
+#define PITCH_SUBFRAMES 4
+#define PITCH_GRAN_PER_SUBFRAME 5
+#define PITCH_SUBFRAME_LEN (PITCH_FRAME_LEN / PITCH_SUBFRAMES)
+#define PITCH_UPDATE (PITCH_SUBFRAME_LEN / PITCH_GRAN_PER_SUBFRAME)
/* maximum number of peaks to be examined in correlation surface */
-#define PITCH_MAX_NUM_PEAKS 10
-#define PITCH_PEAK_DECAY 0.85
+#define PITCH_MAX_NUM_PEAKS 10
+#define PITCH_PEAK_DECAY 0.85
/* For weighting filter */
-#define PITCH_WLPCORDER 6
-#define PITCH_WLPCWINLEN PITCH_FRAME_LEN
-#define PITCH_WLPCASYM 0.3 /* asymmetry parameter */
-#define PITCH_WLPCBUFLEN PITCH_WLPCWINLEN
+#define PITCH_WLPCORDER 6
+#define PITCH_WLPCWINLEN PITCH_FRAME_LEN
+#define PITCH_WLPCASYM 0.3 /* asymmetry parameter */
+#define PITCH_WLPCBUFLEN PITCH_WLPCWINLEN
/* For pitch filter */
/* Extra 50 for fraction and LP filters */
-#define PITCH_BUFFSIZE (PITCH_MAX_LAG + 50)
-#define PITCH_INTBUFFSIZE (PITCH_FRAME_LEN+PITCH_BUFFSIZE)
+#define PITCH_BUFFSIZE (PITCH_MAX_LAG + 50)
+#define PITCH_INTBUFFSIZE (PITCH_FRAME_LEN + PITCH_BUFFSIZE)
/* Max rel. step for interpolation */
-#define PITCH_UPSTEP 1.5
+#define PITCH_UPSTEP 1.5
/* Max rel. step for interpolation */
-#define PITCH_DOWNSTEP 0.67
-#define PITCH_FRACS 8
-#define PITCH_FRACORDER 9
-#define PITCH_DAMPORDER 5
-#define PITCH_FILTDELAY 1.5f
+#define PITCH_DOWNSTEP 0.67
+#define PITCH_FRACS 8
+#define PITCH_FRACORDER 9
+#define PITCH_DAMPORDER 5
+#define PITCH_FILTDELAY 1.5f
/* stepsize for quantization of the pitch Gain */
-#define PITCH_GAIN_STEPSIZE 0.125
-
-
+#define PITCH_GAIN_STEPSIZE 0.125
/* Order of high pass filter */
-#define HPORDER 2
+#define HPORDER 2
/* some mathematical constants */
/* log2(exp) */
-#define LOG2EXP 1.44269504088896
-#define PI 3.14159265358979
+#define LOG2EXP 1.44269504088896
+#define PI 3.14159265358979
/* Maximum number of iterations allowed to limit payload size */
-#define MAX_PAYLOAD_LIMIT_ITERATION 5
+#define MAX_PAYLOAD_LIMIT_ITERATION 5
/* Redundant Coding */
-#define RCU_BOTTLENECK_BPS 16000
-#define RCU_TRANSCODING_SCALE 0.40f
-#define RCU_TRANSCODING_SCALE_INVERSE 2.5f
+#define RCU_BOTTLENECK_BPS 16000
+#define RCU_TRANSCODING_SCALE 0.40f
+#define RCU_TRANSCODING_SCALE_INVERSE 2.5f
-#define RCU_TRANSCODING_SCALE_UB 0.50f
-#define RCU_TRANSCODING_SCALE_UB_INVERSE 2.0f
+#define RCU_TRANSCODING_SCALE_UB 0.50f
+#define RCU_TRANSCODING_SCALE_UB_INVERSE 2.0f
/* Define Error codes */
/* 6000 General */
-#define ISAC_MEMORY_ALLOCATION_FAILED 6010
-#define ISAC_MODE_MISMATCH 6020
-#define ISAC_DISALLOWED_BOTTLENECK 6030
-#define ISAC_DISALLOWED_FRAME_LENGTH 6040
-#define ISAC_UNSUPPORTED_SAMPLING_FREQUENCY 6050
+#define ISAC_MEMORY_ALLOCATION_FAILED 6010
+#define ISAC_MODE_MISMATCH 6020
+#define ISAC_DISALLOWED_BOTTLENECK 6030
+#define ISAC_DISALLOWED_FRAME_LENGTH 6040
+#define ISAC_UNSUPPORTED_SAMPLING_FREQUENCY 6050
/* 6200 Bandwidth estimator */
-#define ISAC_RANGE_ERROR_BW_ESTIMATOR 6240
+#define ISAC_RANGE_ERROR_BW_ESTIMATOR 6240
/* 6400 Encoder */
-#define ISAC_ENCODER_NOT_INITIATED 6410
-#define ISAC_DISALLOWED_CODING_MODE 6420
-#define ISAC_DISALLOWED_FRAME_MODE_ENCODER 6430
-#define ISAC_DISALLOWED_BITSTREAM_LENGTH 6440
-#define ISAC_PAYLOAD_LARGER_THAN_LIMIT 6450
-#define ISAC_DISALLOWED_ENCODER_BANDWIDTH 6460
+#define ISAC_ENCODER_NOT_INITIATED 6410
+#define ISAC_DISALLOWED_CODING_MODE 6420
+#define ISAC_DISALLOWED_FRAME_MODE_ENCODER 6430
+#define ISAC_DISALLOWED_BITSTREAM_LENGTH 6440
+#define ISAC_PAYLOAD_LARGER_THAN_LIMIT 6450
+#define ISAC_DISALLOWED_ENCODER_BANDWIDTH 6460
/* 6600 Decoder */
-#define ISAC_DECODER_NOT_INITIATED 6610
-#define ISAC_EMPTY_PACKET 6620
-#define ISAC_DISALLOWED_FRAME_MODE_DECODER 6630
-#define ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH 6640
-#define ISAC_RANGE_ERROR_DECODE_BANDWIDTH 6650
-#define ISAC_RANGE_ERROR_DECODE_PITCH_GAIN 6660
-#define ISAC_RANGE_ERROR_DECODE_PITCH_LAG 6670
-#define ISAC_RANGE_ERROR_DECODE_LPC 6680
-#define ISAC_RANGE_ERROR_DECODE_SPECTRUM 6690
-#define ISAC_LENGTH_MISMATCH 6730
-#define ISAC_RANGE_ERROR_DECODE_BANDWITH 6740
-#define ISAC_DISALLOWED_BANDWIDTH_MODE_DECODER 6750
-#define ISAC_DISALLOWED_LPC_MODEL 6760
+#define ISAC_DECODER_NOT_INITIATED 6610
+#define ISAC_EMPTY_PACKET 6620
+#define ISAC_DISALLOWED_FRAME_MODE_DECODER 6630
+#define ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH 6640
+#define ISAC_RANGE_ERROR_DECODE_BANDWIDTH 6650
+#define ISAC_RANGE_ERROR_DECODE_PITCH_GAIN 6660
+#define ISAC_RANGE_ERROR_DECODE_PITCH_LAG 6670
+#define ISAC_RANGE_ERROR_DECODE_LPC 6680
+#define ISAC_RANGE_ERROR_DECODE_SPECTRUM 6690
+#define ISAC_LENGTH_MISMATCH 6730
+#define ISAC_RANGE_ERROR_DECODE_BANDWITH 6740
+#define ISAC_DISALLOWED_BANDWIDTH_MODE_DECODER 6750
+#define ISAC_DISALLOWED_LPC_MODEL 6760
/* 6800 Call setup formats */
-#define ISAC_INCOMPATIBLE_FORMATS 6810
+#define ISAC_INCOMPATIBLE_FORMATS 6810
#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SETTINGS_H_ */
diff --git a/modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.h b/modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.h
index 1e656eb..d272be0 100644
--- a/modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.h
+++ b/modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.h
@@ -11,7 +11,7 @@
/*
* spectrum_ar_model_tables.h
*
- * This file contains definitions of tables with AR coefficients,
+ * This file contains definitions of tables with AR coefficients,
* Gain coefficients and cosine tables.
*
*/
@@ -45,15 +45,15 @@
/* quantization boundary levels for reflection coefficients */
extern const int16_t WebRtcIsac_kQArBoundaryLevels[NUM_AR_RC_QUANT_BAUNDARY];
-/* initial indices for AR reflection coefficient quantizer and cdf table search */
+/* initial indices for AR reflection coefficient quantizer and cdf table search
+ */
extern const uint16_t WebRtcIsac_kQArRcInitIndex[AR_ORDER];
/* pointers to AR cdf tables */
-extern const uint16_t *WebRtcIsac_kQArRcCdfPtr[AR_ORDER];
+extern const uint16_t* WebRtcIsac_kQArRcCdfPtr[AR_ORDER];
/* pointers to AR representation levels tables */
-extern const int16_t *WebRtcIsac_kQArRcLevelsPtr[AR_ORDER];
-
+extern const int16_t* WebRtcIsac_kQArRcLevelsPtr[AR_ORDER];
/******************** GAIN Coefficient Tables ***********************/
/* cdf for Gain coefficient */
@@ -66,7 +66,7 @@
extern const int32_t WebRtcIsac_kQGain2BoundaryLevels[19];
/* pointer to Gain cdf table */
-extern const uint16_t *WebRtcIsac_kQGainCdf_ptr[1];
+extern const uint16_t* WebRtcIsac_kQGainCdf_ptr[1];
/* Gain initial index for gain quantizer and cdf table search */
extern const uint16_t WebRtcIsac_kQGainInitIndex[1];
@@ -75,4 +75,5 @@
/* Cosine table */
extern const int16_t WebRtcIsac_kCos[6][60];
-#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SPECTRUM_AR_MODEL_TABLES_H_ */
+#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SPECTRUM_AR_MODEL_TABLES_H_ \
+ */
diff --git a/modules/audio_coding/codecs/isac/main/source/structs.h b/modules/audio_coding/codecs/isac/main/source/structs.h
index 8197d55..f8ac9c7 100644
--- a/modules/audio_coding/codecs/isac/main/source/structs.h
+++ b/modules/audio_coding/codecs/isac/main/source/structs.h
@@ -23,178 +23,166 @@
#include "typedefs.h" // NOLINT(build/include)
typedef struct Bitstreamstruct {
-
- uint8_t stream[STREAM_SIZE_MAX];
- uint32_t W_upper;
- uint32_t streamval;
- uint32_t stream_index;
+ uint8_t stream[STREAM_SIZE_MAX];
+ uint32_t W_upper;
+ uint32_t streamval;
+ uint32_t stream_index;
} Bitstr;
typedef struct {
+ double DataBufferLo[WINLEN];
+ double DataBufferHi[WINLEN];
- double DataBufferLo[WINLEN];
- double DataBufferHi[WINLEN];
+ double CorrBufLo[ORDERLO + 1];
+ double CorrBufHi[ORDERHI + 1];
- double CorrBufLo[ORDERLO+1];
- double CorrBufHi[ORDERHI+1];
+ float PreStateLoF[ORDERLO + 1];
+ float PreStateLoG[ORDERLO + 1];
+ float PreStateHiF[ORDERHI + 1];
+ float PreStateHiG[ORDERHI + 1];
+ float PostStateLoF[ORDERLO + 1];
+ float PostStateLoG[ORDERLO + 1];
+ float PostStateHiF[ORDERHI + 1];
+ float PostStateHiG[ORDERHI + 1];
- float PreStateLoF[ORDERLO+1];
- float PreStateLoG[ORDERLO+1];
- float PreStateHiF[ORDERHI+1];
- float PreStateHiG[ORDERHI+1];
- float PostStateLoF[ORDERLO+1];
- float PostStateLoG[ORDERLO+1];
- float PostStateHiF[ORDERHI+1];
- float PostStateHiG[ORDERHI+1];
-
- double OldEnergy;
+ double OldEnergy;
} MaskFiltstr;
-
typedef struct {
+ // state vectors for each of the two analysis filters
+ double INSTAT1[2 * (QORDER - 1)];
+ double INSTAT2[2 * (QORDER - 1)];
+ double INSTATLA1[2 * (QORDER - 1)];
+ double INSTATLA2[2 * (QORDER - 1)];
+ double INLABUF1[QLOOKAHEAD];
+ double INLABUF2[QLOOKAHEAD];
- //state vectors for each of the two analysis filters
- double INSTAT1[2*(QORDER-1)];
- double INSTAT2[2*(QORDER-1)];
- double INSTATLA1[2*(QORDER-1)];
- double INSTATLA2[2*(QORDER-1)];
- double INLABUF1[QLOOKAHEAD];
- double INLABUF2[QLOOKAHEAD];
-
- float INSTAT1_float[2*(QORDER-1)];
- float INSTAT2_float[2*(QORDER-1)];
- float INSTATLA1_float[2*(QORDER-1)];
- float INSTATLA2_float[2*(QORDER-1)];
- float INLABUF1_float[QLOOKAHEAD];
- float INLABUF2_float[QLOOKAHEAD];
+ float INSTAT1_float[2 * (QORDER - 1)];
+ float INSTAT2_float[2 * (QORDER - 1)];
+ float INSTATLA1_float[2 * (QORDER - 1)];
+ float INSTATLA2_float[2 * (QORDER - 1)];
+ float INLABUF1_float[QLOOKAHEAD];
+ float INLABUF2_float[QLOOKAHEAD];
/* High pass filter */
- double HPstates[HPORDER];
- float HPstates_float[HPORDER];
+ double HPstates[HPORDER];
+ float HPstates_float[HPORDER];
} PreFiltBankstr;
-
typedef struct {
-
- //state vectors for each of the two analysis filters
- double STATE_0_LOWER[2*POSTQORDER];
- double STATE_0_UPPER[2*POSTQORDER];
+ // state vectors for each of the two analysis filters
+ double STATE_0_LOWER[2 * POSTQORDER];
+ double STATE_0_UPPER[2 * POSTQORDER];
/* High pass filter */
- double HPstates1[HPORDER];
- double HPstates2[HPORDER];
+ double HPstates1[HPORDER];
+ double HPstates2[HPORDER];
- float STATE_0_LOWER_float[2*POSTQORDER];
- float STATE_0_UPPER_float[2*POSTQORDER];
+ float STATE_0_LOWER_float[2 * POSTQORDER];
+ float STATE_0_UPPER_float[2 * POSTQORDER];
- float HPstates1_float[HPORDER];
- float HPstates2_float[HPORDER];
+ float HPstates1_float[HPORDER];
+ float HPstates2_float[HPORDER];
} PostFiltBankstr;
typedef struct {
+ // data buffer for pitch filter
+ double ubuf[PITCH_BUFFSIZE];
- //data buffer for pitch filter
- double ubuf[PITCH_BUFFSIZE];
+ // low pass state vector
+ double ystate[PITCH_DAMPORDER];
- //low pass state vector
- double ystate[PITCH_DAMPORDER];
-
- //old lag and gain
- double oldlagp[1];
- double oldgainp[1];
+ // old lag and gain
+ double oldlagp[1];
+ double oldgainp[1];
} PitchFiltstr;
typedef struct {
+ // data buffer
+ double buffer[PITCH_WLPCBUFLEN];
- //data buffer
- double buffer[PITCH_WLPCBUFLEN];
+ // state vectors
+ double istate[PITCH_WLPCORDER];
+ double weostate[PITCH_WLPCORDER];
+ double whostate[PITCH_WLPCORDER];
- //state vectors
- double istate[PITCH_WLPCORDER];
- double weostate[PITCH_WLPCORDER];
- double whostate[PITCH_WLPCORDER];
-
- //LPC window -> should be a global array because constant
- double window[PITCH_WLPCWINLEN];
+ // LPC window -> should be a global array because constant
+ double window[PITCH_WLPCWINLEN];
} WeightFiltstr;
typedef struct {
+ // for inital estimator
+ double dec_buffer[PITCH_CORR_LEN2 + PITCH_CORR_STEP2 + PITCH_MAX_LAG / 2 -
+ PITCH_FRAME_LEN / 2 + 2];
+ double decimator_state[2 * ALLPASSSECTIONS + 1];
+ double hp_state[2];
- //for inital estimator
- double dec_buffer[PITCH_CORR_LEN2 + PITCH_CORR_STEP2 +
- PITCH_MAX_LAG/2 - PITCH_FRAME_LEN/2+2];
- double decimator_state[2*ALLPASSSECTIONS+1];
- double hp_state[2];
+ double whitened_buf[QLOOKAHEAD];
- double whitened_buf[QLOOKAHEAD];
+ double inbuf[QLOOKAHEAD];
- double inbuf[QLOOKAHEAD];
-
- PitchFiltstr PFstr_wght;
- PitchFiltstr PFstr;
+ PitchFiltstr PFstr_wght;
+ PitchFiltstr PFstr;
WeightFiltstr Wghtstr;
} PitchAnalysisStruct;
-
-
/* Have instance of struct together with other iSAC structs */
typedef struct {
-
/* Previous frame length (in ms) */
- int32_t prev_frame_length;
+ int32_t prev_frame_length;
/* Previous RTP timestamp from received
packet (in samples relative beginning) */
- int32_t prev_rec_rtp_number;
+ int32_t prev_rec_rtp_number;
/* Send timestamp for previous packet (in ms using timeGetTime()) */
- uint32_t prev_rec_send_ts;
+ uint32_t prev_rec_send_ts;
/* Arrival time for previous packet (in ms using timeGetTime()) */
- uint32_t prev_rec_arr_ts;
+ uint32_t prev_rec_arr_ts;
/* rate of previous packet, derived from RTP timestamps (in bits/s) */
- float prev_rec_rtp_rate;
+ float prev_rec_rtp_rate;
/* Time sinse the last update of the BN estimate (in ms) */
- uint32_t last_update_ts;
+ uint32_t last_update_ts;
/* Time sinse the last reduction (in ms) */
- uint32_t last_reduction_ts;
+ uint32_t last_reduction_ts;
/* How many times the estimate was update in the beginning */
- int32_t count_tot_updates_rec;
+ int32_t count_tot_updates_rec;
/* The estimated bottle neck rate from there to here (in bits/s) */
- int32_t rec_bw;
- float rec_bw_inv;
- float rec_bw_avg;
- float rec_bw_avg_Q;
+ int32_t rec_bw;
+ float rec_bw_inv;
+ float rec_bw_avg;
+ float rec_bw_avg_Q;
/* The estimated mean absolute jitter value,
as seen on this side (in ms) */
- float rec_jitter;
- float rec_jitter_short_term;
- float rec_jitter_short_term_abs;
- float rec_max_delay;
- float rec_max_delay_avg_Q;
+ float rec_jitter;
+ float rec_jitter_short_term;
+ float rec_jitter_short_term_abs;
+ float rec_max_delay;
+ float rec_max_delay_avg_Q;
/* (assumed) bitrate for headers (bps) */
- float rec_header_rate;
+ float rec_header_rate;
/* The estimated bottle neck rate from here to there (in bits/s) */
- float send_bw_avg;
+ float send_bw_avg;
/* The estimated mean absolute jitter value, as seen on
the other siee (in ms) */
- float send_max_delay_avg;
+ float send_max_delay_avg;
// number of packets received since last update
int num_pkts_rec;
@@ -217,35 +205,31 @@
int change_to_WB;
- uint32_t senderTimestamp;
- uint32_t receiverTimestamp;
- //enum IsacSamplingRate incomingStreamSampFreq;
- uint16_t numConsecLatePkts;
- float consecLatency;
- int16_t inWaitLatePkts;
+ uint32_t senderTimestamp;
+ uint32_t receiverTimestamp;
+ // enum IsacSamplingRate incomingStreamSampFreq;
+ uint16_t numConsecLatePkts;
+ float consecLatency;
+ int16_t inWaitLatePkts;
IsacBandwidthInfo external_bw_info;
} BwEstimatorstr;
-
typedef struct {
-
/* boolean, flags if previous packet exceeded B.N. */
- int PrevExceed;
+ int PrevExceed;
/* ms */
- int ExceedAgo;
+ int ExceedAgo;
/* packets left to send in current burst */
- int BurstCounter;
+ int BurstCounter;
/* packets */
- int InitCounter;
+ int InitCounter;
/* ms remaining in buffer when next packet will be sent */
double StillBuffered;
} RateModel;
-
typedef struct {
-
unsigned int SpaceAlloced;
unsigned int MaxPermAlloced;
double Tmp0[MAXFFTSIZE];
@@ -253,36 +237,34 @@
double Tmp2[MAXFFTSIZE];
double Tmp3[MAXFFTSIZE];
int Perm[MAXFFTSIZE];
- int factor [NFACTOR];
+ int factor[NFACTOR];
} FFTstr;
-
/* The following strutc is used to store data from encoding, to make it
fast and easy to construct a new bitstream with a different Bandwidth
estimate. All values (except framelength and minBytes) is double size to
handle 60 ms of data.
*/
typedef struct {
-
/* Used to keep track of if it is first or second part of 60 msec packet */
- int startIdx;
+ int startIdx;
/* Frame length in samples */
int16_t framelength;
/* Pitch Gain */
- int pitchGain_index[2];
+ int pitchGain_index[2];
/* Pitch Lag */
- double meanGain[2];
- int pitchIndex[PITCH_SUBFRAMES*2];
+ double meanGain[2];
+ int pitchIndex[PITCH_SUBFRAMES * 2];
/* LPC */
- int LPCindex_s[108*2]; /* KLT_ORDER_SHAPE = 108 */
- int LPCindex_g[12*2]; /* KLT_ORDER_GAIN = 12 */
- double LPCcoeffs_lo[(ORDERLO+1)*SUBFRAMES*2];
- double LPCcoeffs_hi[(ORDERHI+1)*SUBFRAMES*2];
+ int LPCindex_s[108 * 2]; /* KLT_ORDER_SHAPE = 108 */
+ int LPCindex_g[12 * 2]; /* KLT_ORDER_GAIN = 12 */
+ double LPCcoeffs_lo[(ORDERLO + 1) * SUBFRAMES * 2];
+ double LPCcoeffs_hi[(ORDERHI + 1) * SUBFRAMES * 2];
/* Encode Spec */
int16_t fre[FRAMESAMPLES];
@@ -290,59 +272,54 @@
int16_t AvgPitchGain[2];
/* Used in adaptive mode only */
- int minBytes;
+ int minBytes;
} IsacSaveEncoderData;
-
typedef struct {
+ int indexLPCShape[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
+ double lpcGain[SUBFRAMES << 1];
+ int lpcGainIndex[SUBFRAMES << 1];
- int indexLPCShape[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME];
- double lpcGain[SUBFRAMES<<1];
- int lpcGainIndex[SUBFRAMES<<1];
-
- Bitstr bitStreamObj;
+ Bitstr bitStreamObj;
int16_t realFFT[FRAMESAMPLES_HALF];
int16_t imagFFT[FRAMESAMPLES_HALF];
} ISACUBSaveEncDataStruct;
-
-
typedef struct {
-
- Bitstr bitstr_obj;
- MaskFiltstr maskfiltstr_obj;
- PreFiltBankstr prefiltbankstr_obj;
- PitchFiltstr pitchfiltstr_obj;
+ Bitstr bitstr_obj;
+ MaskFiltstr maskfiltstr_obj;
+ PreFiltBankstr prefiltbankstr_obj;
+ PitchFiltstr pitchfiltstr_obj;
PitchAnalysisStruct pitchanalysisstr_obj;
- FFTstr fftstr_obj;
+ FFTstr fftstr_obj;
IsacSaveEncoderData SaveEnc_obj;
- int buffer_index;
- int16_t current_framesamples;
+ int buffer_index;
+ int16_t current_framesamples;
- float data_buffer_float[FRAMESAMPLES_30ms];
+ float data_buffer_float[FRAMESAMPLES_30ms];
- int frame_nb;
- double bottleneck;
- int16_t new_framelength;
- double s2nr;
+ int frame_nb;
+ double bottleneck;
+ int16_t new_framelength;
+ double s2nr;
/* Maximum allowed number of bits for a 30 msec packet */
- int16_t payloadLimitBytes30;
+ int16_t payloadLimitBytes30;
/* Maximum allowed number of bits for a 30 msec packet */
- int16_t payloadLimitBytes60;
+ int16_t payloadLimitBytes60;
/* Maximum allowed number of bits for both 30 and 60 msec packet */
- int16_t maxPayloadBytes;
+ int16_t maxPayloadBytes;
/* Maximum allowed rate in bytes per 30 msec packet */
- int16_t maxRateInBytes;
+ int16_t maxRateInBytes;
/*---
If set to 1 iSAC will not addapt the frame-size, if used in
channel-adaptive mode. The initial value will be used for all rates.
---*/
- int16_t enforceFrameSize;
+ int16_t enforceFrameSize;
/*-----
This records the BWE index the encoder injected into the bit-stream.
@@ -351,64 +328,53 @@
a recursive procedure (WebRtcIsac_GetDownlinkBwJitIndexImpl) and has to be
called only once per each encode.
-----*/
- int16_t lastBWIdx;
+ int16_t lastBWIdx;
} ISACLBEncStruct;
typedef struct {
-
- Bitstr bitstr_obj;
- MaskFiltstr maskfiltstr_obj;
- PreFiltBankstr prefiltbankstr_obj;
- FFTstr fftstr_obj;
+ Bitstr bitstr_obj;
+ MaskFiltstr maskfiltstr_obj;
+ PreFiltBankstr prefiltbankstr_obj;
+ FFTstr fftstr_obj;
ISACUBSaveEncDataStruct SaveEnc_obj;
- int buffer_index;
- float data_buffer_float[MAX_FRAMESAMPLES +
- LB_TOTAL_DELAY_SAMPLES];
- double bottleneck;
+ int buffer_index;
+ float data_buffer_float[MAX_FRAMESAMPLES + LB_TOTAL_DELAY_SAMPLES];
+ double bottleneck;
/* Maximum allowed number of bits for a 30 msec packet */
- //int16_t payloadLimitBytes30;
+ // int16_t payloadLimitBytes30;
/* Maximum allowed number of bits for both 30 and 60 msec packet */
- //int16_t maxPayloadBytes;
- int16_t maxPayloadSizeBytes;
+ // int16_t maxPayloadBytes;
+ int16_t maxPayloadSizeBytes;
- double lastLPCVec[UB_LPC_ORDER];
- int16_t numBytesUsed;
- int16_t lastJitterInfo;
+ double lastLPCVec[UB_LPC_ORDER];
+ int16_t numBytesUsed;
+ int16_t lastJitterInfo;
} ISACUBEncStruct;
-
-
typedef struct {
-
- Bitstr bitstr_obj;
- MaskFiltstr maskfiltstr_obj;
+ Bitstr bitstr_obj;
+ MaskFiltstr maskfiltstr_obj;
PostFiltBankstr postfiltbankstr_obj;
- PitchFiltstr pitchfiltstr_obj;
- FFTstr fftstr_obj;
+ PitchFiltstr pitchfiltstr_obj;
+ FFTstr fftstr_obj;
} ISACLBDecStruct;
typedef struct {
-
- Bitstr bitstr_obj;
- MaskFiltstr maskfiltstr_obj;
+ Bitstr bitstr_obj;
+ MaskFiltstr maskfiltstr_obj;
PostFiltBankstr postfiltbankstr_obj;
- FFTstr fftstr_obj;
+ FFTstr fftstr_obj;
} ISACUBDecStruct;
-
-
typedef struct {
-
ISACLBEncStruct ISACencLB_obj;
ISACLBDecStruct ISACdecLB_obj;
} ISACLBStruct;
-
typedef struct {
-
ISACUBEncStruct ISACencUB_obj;
ISACUBDecStruct ISACdecUB_obj;
} ISACUBStruct;
@@ -420,14 +386,14 @@
*/
typedef struct {
/* 6 lower-band & 6 upper-band */
- double loFiltGain[SUBFRAMES];
- double hiFiltGain[SUBFRAMES];
+ double loFiltGain[SUBFRAMES];
+ double hiFiltGain[SUBFRAMES];
/* Upper boundary of interval W */
uint32_t W_upper;
uint32_t streamval;
/* Index to the current position in bytestream */
uint32_t stream_index;
- uint8_t stream[3];
+ uint8_t stream[3];
} transcode_obj;
typedef struct {
@@ -443,46 +409,46 @@
typedef struct {
// lower-band codec instance
- ISACLBStruct instLB;
+ ISACLBStruct instLB;
// upper-band codec instance
- ISACUBStruct instUB;
+ ISACUBStruct instUB;
// Bandwidth Estimator and model for the rate.
- BwEstimatorstr bwestimator_obj;
- RateModel rate_data_obj;
- double MaxDelay;
+ BwEstimatorstr bwestimator_obj;
+ RateModel rate_data_obj;
+ double MaxDelay;
/* 0 = adaptive; 1 = instantaneous */
- int16_t codingMode;
+ int16_t codingMode;
// overall bottleneck of the codec
- int32_t bottleneck;
+ int32_t bottleneck;
// QMF Filter state
- int32_t analysisFBState1[FB_STATE_SIZE_WORD32];
- int32_t analysisFBState2[FB_STATE_SIZE_WORD32];
- int32_t synthesisFBState1[FB_STATE_SIZE_WORD32];
- int32_t synthesisFBState2[FB_STATE_SIZE_WORD32];
+ int32_t analysisFBState1[FB_STATE_SIZE_WORD32];
+ int32_t analysisFBState2[FB_STATE_SIZE_WORD32];
+ int32_t synthesisFBState1[FB_STATE_SIZE_WORD32];
+ int32_t synthesisFBState2[FB_STATE_SIZE_WORD32];
// Error Code
- int16_t errorCode;
+ int16_t errorCode;
// bandwidth of the encoded audio 8, 12 or 16 kHz
- enum ISACBandwidth bandwidthKHz;
+ enum ISACBandwidth bandwidthKHz;
// Sampling rate of audio, encoder and decode, 8 or 16 kHz
enum IsacSamplingRate encoderSamplingRateKHz;
enum IsacSamplingRate decoderSamplingRateKHz;
// Flag to keep track of initializations, lower & upper-band
// encoder and decoder.
- int16_t initFlag;
+ int16_t initFlag;
// Flag to to indicate signal bandwidth switch
- int16_t resetFlag_8kHz;
+ int16_t resetFlag_8kHz;
// Maximum allowed rate, measured in Bytes per 30 ms.
- int16_t maxRateBytesPer30Ms;
+ int16_t maxRateBytesPer30Ms;
// Maximum allowed payload-size, measured in Bytes.
- int16_t maxPayloadSizeBytes;
+ int16_t maxPayloadSizeBytes;
/* The expected sampling rate of the input signal. Valid values are 16000
* and 32000. This is not the operation sampling rate of the codec. */
uint16_t in_sample_rate_hz;
diff --git a/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc b/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc
index cedcb9d..35a8832 100644
--- a/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc
+++ b/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc
@@ -11,11 +11,11 @@
// ReleaseTest-API.cpp : Defines the entry point for the console application.
//
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <ctype.h>
#include <iostream>
/* include API */
@@ -24,10 +24,13 @@
#include "rtc_base/format_macros.h"
/* Defines */
-#define SEED_FILE "randseed.txt" /* Used when running decoder on garbage data */
-#define MAX_FRAMESAMPLES 960 /* max number of samples per frame
- (= 60 ms frame & 16 kHz) or
- (= 30 ms frame & 32 kHz) */
+#define SEED_FILE \
+ "randseed.txt" /* Used when running decoder on garbage data \
+ */
+#define MAX_FRAMESAMPLES \
+ 960 /* max number of samples per frame \
+ (= 60 ms frame & 16 kHz) or \
+ (= 30 ms frame & 32 kHz) */
#define FRAMESAMPLES_10ms 160 /* number of samples per 10ms frame */
#define SWBFRAMESAMPLES_10ms 320
//#define FS 16000 /* sampling frequency (Hz) */
@@ -42,7 +45,7 @@
int main(int argc, char* argv[]) {
char inname[100], outname[100], bottleneck_file[100], vadfile[100];
- FILE* inp, *outp, * f_bn = NULL, * vadp = NULL, *bandwidthp;
+ FILE *inp, *outp, *f_bn = NULL, *vadp = NULL, *bandwidthp;
int framecnt, endfile;
size_t i;
@@ -230,8 +233,10 @@
rateBPS = atoi(argv[i + 1]);
setControlBWE = 1;
if ((rateBPS < 10000) || (rateBPS > 32000)) {
- printf("\n%d is not a initial rate. Valid values are in the range "
- "10000 to 32000.\n", rateBPS);
+ printf(
+ "\n%d is not a initial rate. Valid values are in the range "
+ "10000 to 32000.\n",
+ rateBPS);
exit(0);
}
printf("New initial rate: %d\n", rateBPS);
@@ -242,8 +247,10 @@
if (!strcmp("-FL", argv[i])) {
framesize = atoi(argv[i + 1]);
if ((framesize != 30) && (framesize != 60)) {
- printf("\n%d is not a valid frame length. Valid length are 30 and 60 "
- "msec.\n", framesize);
+ printf(
+ "\n%d is not a valid frame length. Valid length are 30 and 60 "
+ "msec.\n",
+ framesize);
exit(0);
}
setControlBWE = 1;
@@ -277,8 +284,10 @@
testNum = atoi(argv[i + 1]);
printf("Fault test: %d\n", testNum);
if (testNum < 1 || testNum > 10) {
- printf("\n%d is not a valid Fault Scenario number. Valid Fault "
- "Scenarios are numbered 1-10.\n", testNum);
+ printf(
+ "\n%d is not a valid Fault Scenario number. Valid Fault "
+ "Scenarios are numbered 1-10.\n",
+ testNum);
exit(0);
}
i++;
@@ -336,8 +345,10 @@
sscanf(argv[i], "%s", bottleneck_file);
f_bn = fopen(bottleneck_file, "rb");
if (f_bn == NULL) {
- printf("Error No value provided for BottleNeck and cannot read file "
- "%s.\n", bottleneck_file);
+ printf(
+ "Error No value provided for BottleNeck and cannot read file "
+ "%s.\n",
+ bottleneck_file);
exit(0);
} else {
printf("reading bottleneck rates from file %s\n\n", bottleneck_file);
@@ -637,8 +648,8 @@
}
if (fwrite(streamDataTransCoding, sizeof(uint8_t),
- streamLenTransCoding, transcodingBitstream) !=
- streamLenTransCoding) {
+ streamLenTransCoding,
+ transcodingBitstream) != streamLenTransCoding) {
return -1;
}
@@ -718,8 +729,7 @@
fprintf(stderr, "Error in RED trans-coding\n");
exit(0);
}
- streamLenTransCoding =
- static_cast<size_t>(streamLenTransCoding_int);
+ streamLenTransCoding = static_cast<size_t>(streamLenTransCoding_int);
}
}
diff --git a/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc b/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc
index 23de079..59a3ade 100644
--- a/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc
+++ b/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc
@@ -18,16 +18,14 @@
#include "modules/audio_coding/codecs/isac/main/include/isac.h"
#include "modules/audio_coding/codecs/isac/main/util/utility.h"
-#define MAX_FILE_NAME 500
+#define MAX_FILE_NAME 500
#define MAX_NUM_CLIENTS 2
-
#define NUM_CLIENTS 2
using namespace std;
-int main(int argc, char* argv[])
-{
+int main(int argc, char* argv[]) {
char fileNameWB[MAX_FILE_NAME];
char fileNameSWB[MAX_FILE_NAME];
@@ -68,21 +66,18 @@
printf(" iSAC-swb version %s\n", versionNumber);
printf("____________________________________________\n");
-
- fileNameWB[0] = '\0';
+ fileNameWB[0] = '\0';
fileNameSWB[0] = '\0';
char myFlag[20];
strcpy(myFlag, "-wb");
// READ THE WIDEBAND AND SUPER-WIDEBAND FILE NAMES
- if(readParamString(argc, argv, myFlag, fileNameWB, MAX_FILE_NAME) <= 0)
- {
+ if (readParamString(argc, argv, myFlag, fileNameWB, MAX_FILE_NAME) <= 0) {
printf("No wideband file is specified");
}
strcpy(myFlag, "-swb");
- if(readParamString(argc, argv, myFlag, fileNameSWB, MAX_FILE_NAME) <= 0)
- {
+ if (readParamString(argc, argv, myFlag, fileNameSWB, MAX_FILE_NAME) <= 0) {
printf("No super-wideband file is specified");
}
@@ -97,16 +92,15 @@
strcpy(myFlag, "-I");
short codingMode = readSwitch(argc, argv, myFlag);
- for(clientCntr = 0; clientCntr < NUM_CLIENTS; clientCntr++)
- {
+ for (clientCntr = 0; clientCntr < NUM_CLIENTS; clientCntr++) {
codecInstance[clientCntr] = NULL;
printf("\n");
printf("Client %d\n", clientCntr + 1);
printf("---------\n");
- printf("Starting %s",
- (encoderSampRate[clientCntr] == 16000)
- ? "wideband":"super-wideband");
+ printf("Starting %s", (encoderSampRate[clientCntr] == 16000)
+ ? "wideband"
+ : "super-wideband");
// Open output File Name
OPEN_FILE_WB(outFile[clientCntr], outFileName[clientCntr]);
@@ -114,30 +108,27 @@
samplesIn10ms[clientCntr] = encoderSampRate[clientCntr] * 10;
- if(codingMode == 1)
- {
- bottleneck[clientCntr] = (clientCntr)? bnSWB:bnWB;
- }
- else
- {
- bottleneck[clientCntr] = (clientCntr)? minBn:maxBn;
+ if (codingMode == 1) {
+ bottleneck[clientCntr] = (clientCntr) ? bnSWB : bnWB;
+ } else {
+ bottleneck[clientCntr] = (clientCntr) ? minBn : maxBn;
}
printf("Bottleneck....................... %0.3f kbits/sec \n",
bottleneck[clientCntr] / 1000.0);
// coding-mode
- printf("Encoding Mode.................... %s\n",
- (codingMode == 1)? "Channel-Independent (Instantaneous)":"Adaptive");
+ printf(
+ "Encoding Mode.................... %s\n",
+ (codingMode == 1) ? "Channel-Independent (Instantaneous)" : "Adaptive");
lenEncodedInBytes[clientCntr] = 0;
lenAudioIn10ms[clientCntr] = 0;
lenEncodedInBytesTmp[clientCntr] = 0;
lenAudioIn10msTmp[clientCntr] = 0;
- packetData[clientCntr] = (BottleNeckModel*)new(BottleNeckModel);
- if(packetData[clientCntr] == NULL)
- {
+ packetData[clientCntr] = (BottleNeckModel*)new (BottleNeckModel);
+ if (packetData[clientCntr] == NULL) {
printf("Could not allocate memory for packetData \n");
return -1;
}
@@ -145,24 +136,22 @@
memset(resamplerState[clientCntr], 0, sizeof(int32_t) * 8);
}
- for(clientCntr = 0; clientCntr < NUM_CLIENTS; clientCntr++)
- {
+ for (clientCntr = 0; clientCntr < NUM_CLIENTS; clientCntr++) {
// Create
- if(WebRtcIsac_Create(&codecInstance[clientCntr]))
- {
+ if (WebRtcIsac_Create(&codecInstance[clientCntr])) {
printf("Could not creat client %d\n", clientCntr + 1);
return -1;
}
- WebRtcIsac_SetEncSampRate(codecInstance[clientCntr], encoderSampRate[clientCntr]);
+ WebRtcIsac_SetEncSampRate(codecInstance[clientCntr],
+ encoderSampRate[clientCntr]);
- WebRtcIsac_SetDecSampRate(codecInstance[clientCntr],
- encoderSampRate[clientCntr + (1 - ((clientCntr & 1)<<1))]);
+ WebRtcIsac_SetDecSampRate(
+ codecInstance[clientCntr],
+ encoderSampRate[clientCntr + (1 - ((clientCntr & 1) << 1))]);
// Initialize Encoder
- if(WebRtcIsac_EncoderInit(codecInstance[clientCntr],
- codingMode) < 0)
- {
+ if (WebRtcIsac_EncoderInit(codecInstance[clientCntr], codingMode) < 0) {
printf("Could not initialize client, %d\n", clientCntr + 1);
return -1;
}
@@ -170,12 +159,10 @@
WebRtcIsac_DecoderInit(codecInstance[clientCntr]);
// setup Rate if in Instantaneous mode
- if(codingMode != 0)
- {
+ if (codingMode != 0) {
// ONLY Clients who are not in Adaptive mode
- if(WebRtcIsac_Control(codecInstance[clientCntr],
- bottleneck[clientCntr], 30) < 0)
- {
+ if (WebRtcIsac_Control(codecInstance[clientCntr], bottleneck[clientCntr],
+ 30) < 0) {
printf("Could not setup bottleneck and frame-size for client %d\n",
clientCntr + 1);
return -1;
@@ -183,7 +170,6 @@
}
}
-
size_t streamLen;
short numSamplesRead;
size_t lenDecodedAudio;
@@ -192,7 +178,7 @@
printf("\n");
short num10ms[MAX_NUM_CLIENTS];
- memset(num10ms, 0, sizeof(short)*MAX_NUM_CLIENTS);
+ memset(num10ms, 0, sizeof(short) * MAX_NUM_CLIENTS);
FILE* arrivalTimeFile1 = fopen("arrivalTime1.dat", "wb");
FILE* arrivalTimeFile2 = fopen("arrivalTime2.dat", "wb");
short numPrint[MAX_NUM_CLIENTS];
@@ -205,61 +191,60 @@
short audioBuff60ms[60 * 32];
short resampledAudio60ms[60 * 32];
- unsigned short bitStream[600+600];
+ unsigned short bitStream[600 + 600];
short speechType[1];
short numSampFreqChanged = 0;
- while(numSampFreqChanged < 10)
- {
- for(clientCntr = 0; clientCntr < NUM_CLIENTS; clientCntr++)
- {
+ while (numSampFreqChanged < 10) {
+ for (clientCntr = 0; clientCntr < NUM_CLIENTS; clientCntr++) {
// Encoding/decoding for this pair of clients, if there is
// audio for any of them
- //if(audioLeft[clientCntr] || audioLeft[clientCntr + 1])
+ // if(audioLeft[clientCntr] || audioLeft[clientCntr + 1])
//{
- //for(pairCntr = 0; pairCntr < 2; pairCntr++)
+ // for(pairCntr = 0; pairCntr < 2; pairCntr++)
//{
- senderIdx = clientCntr; // + pairCntr;
- receiverIdx = 1 - clientCntr;// + (1 - pairCntr);
+ senderIdx = clientCntr; // + pairCntr;
+ receiverIdx = 1 - clientCntr; // + (1 - pairCntr);
- //if(num10ms[senderIdx] > 6)
+ // if(num10ms[senderIdx] > 6)
//{
// printf("Too many frames read for client %d",
// senderIdx + 1);
// return -1;
//}
- numSamplesRead = (short)fread(audioBuff10ms, sizeof(short),
- samplesIn10ms[senderIdx], inFile[senderIdx]);
- if(numSamplesRead != samplesIn10ms[senderIdx])
- {
+ numSamplesRead =
+ (short)fread(audioBuff10ms, sizeof(short), samplesIn10ms[senderIdx],
+ inFile[senderIdx]);
+ if (numSamplesRead != samplesIn10ms[senderIdx]) {
// file finished switch encoder sampling frequency.
- printf("Changing Encoder Sampling frequency in client %d to ", senderIdx+1);
+ printf("Changing Encoder Sampling frequency in client %d to ",
+ senderIdx + 1);
fclose(inFile[senderIdx]);
numSampFreqChanged++;
- if(encoderSampRate[senderIdx] == 16000)
- {
+ if (encoderSampRate[senderIdx] == 16000) {
printf("super-wideband.\n");
OPEN_FILE_RB(inFile[senderIdx], fileNameSWB);
encoderSampRate[senderIdx] = 32000;
- }
- else
- {
+ } else {
printf("wideband.\n");
OPEN_FILE_RB(inFile[senderIdx], fileNameWB);
encoderSampRate[senderIdx] = 16000;
}
- WebRtcIsac_SetEncSampRate(codecInstance[senderIdx], encoderSampRate[senderIdx]);
- WebRtcIsac_SetDecSampRate(codecInstance[receiverIdx], encoderSampRate[senderIdx]);
+ WebRtcIsac_SetEncSampRate(codecInstance[senderIdx],
+ encoderSampRate[senderIdx]);
+ WebRtcIsac_SetDecSampRate(codecInstance[receiverIdx],
+ encoderSampRate[senderIdx]);
samplesIn10ms[clientCntr] = encoderSampRate[clientCntr] * 10;
- numSamplesRead = (short)fread(audioBuff10ms, sizeof(short),
- samplesIn10ms[senderIdx], inFile[senderIdx]);
- if(numSamplesRead != samplesIn10ms[senderIdx])
- {
+ numSamplesRead =
+ (short)fread(audioBuff10ms, sizeof(short), samplesIn10ms[senderIdx],
+ inFile[senderIdx]);
+ if (numSamplesRead != samplesIn10ms[senderIdx]) {
printf(" File %s for client %d has not enough audio\n",
- (encoderSampRate[senderIdx]==16000)? "wideband":"super-wideband",
+ (encoderSampRate[senderIdx] == 16000) ? "wideband"
+ : "super-wideband",
senderIdx + 1);
return -1;
}
@@ -267,39 +252,34 @@
num10ms[senderIdx]++;
// sanity check
- //if(num10ms[senderIdx] > 6)
+ // if(num10ms[senderIdx] > 6)
//{
- // printf("Client %d has got more than 60 ms audio and encoded no packet.\n",
+ // printf("Client %d has got more than 60 ms audio and encoded no
+ // packet.\n",
// senderIdx);
// return -1;
//}
// Encode
-
int streamLen_int = WebRtcIsac_Encode(codecInstance[senderIdx],
- audioBuff10ms,
- (uint8_t*)bitStream);
+ audioBuff10ms, (uint8_t*)bitStream);
int16_t ggg;
if (streamLen_int > 0) {
if ((WebRtcIsac_ReadFrameLen(
codecInstance[receiverIdx],
- reinterpret_cast<const uint8_t*>(bitStream),
- &ggg)) < 0)
+ reinterpret_cast<const uint8_t*>(bitStream), &ggg)) < 0)
printf("ERROR\n");
}
// Sanity check
- if(streamLen_int < 0)
- {
+ if (streamLen_int < 0) {
printf(" Encoder error in client %d \n", senderIdx + 1);
return -1;
}
streamLen = static_cast<size_t>(streamLen_int);
-
- if(streamLen > 0)
- {
+ if (streamLen > 0) {
// Packet generated; model sending through a channel, do bandwidth
// estimation at the receiver and decode.
lenEncodedInBytes[senderIdx] += streamLen;
@@ -308,32 +288,30 @@
lenAudioIn10msTmp[senderIdx] += (unsigned int)num10ms[senderIdx];
// Print after ~5 sec.
- if(lenAudioIn10msTmp[senderIdx] >= 100)
- {
+ if (lenAudioIn10msTmp[senderIdx] >= 100) {
numPrint[senderIdx]++;
- printf(" %d, %6.3f => %6.3f ", senderIdx+1,
+ printf(" %d, %6.3f => %6.3f ", senderIdx + 1,
bottleneck[senderIdx] / 1000.0,
lenEncodedInBytesTmp[senderIdx] * 0.8 /
- lenAudioIn10msTmp[senderIdx]);
+ lenAudioIn10msTmp[senderIdx]);
- if(codingMode == 0)
- {
+ if (codingMode == 0) {
int32_t bn;
WebRtcIsac_GetUplinkBw(codecInstance[senderIdx], &bn);
printf("[%d] ", bn);
}
- //int16_t rateIndexLB;
- //int16_t rateIndexUB;
- //WebRtcIsac_GetDownLinkBwIndex(codecInstance[receiverIdx],
+ // int16_t rateIndexLB;
+ // int16_t rateIndexUB;
+ // WebRtcIsac_GetDownLinkBwIndex(codecInstance[receiverIdx],
// &rateIndexLB, &rateIndexUB);
- //printf(" (%2d, %2d) ", rateIndexLB, rateIndexUB);
+ // printf(" (%2d, %2d) ", rateIndexLB, rateIndexUB);
cout << flush;
lenEncodedInBytesTmp[senderIdx] = 0;
- lenAudioIn10msTmp[senderIdx] = 0;
- //if(senderIdx == (NUM_CLIENTS - 1))
+ lenAudioIn10msTmp[senderIdx] = 0;
+ // if(senderIdx == (NUM_CLIENTS - 1))
//{
- printf(" %0.1f \n", lenAudioIn10ms[senderIdx] * 10. /1000);
+ printf(" %0.1f \n", lenAudioIn10ms[senderIdx] * 10. / 1000);
//}
// After ~20 sec change the bottleneck.
@@ -385,23 +363,20 @@
// model a channel of given bottleneck, to get the receive timestamp
get_arrival_time(num10ms[senderIdx] * samplesIn10ms[senderIdx],
- streamLen, bottleneck[senderIdx], packetData[senderIdx],
- encoderSampRate[senderIdx]*1000, encoderSampRate[senderIdx]*1000);
+ streamLen, bottleneck[senderIdx],
+ packetData[senderIdx],
+ encoderSampRate[senderIdx] * 1000,
+ encoderSampRate[senderIdx] * 1000);
// Write the arrival time.
- if(senderIdx == 0)
- {
+ if (senderIdx == 0) {
if (fwrite(&(packetData[senderIdx]->arrival_time),
- sizeof(unsigned int),
- 1, arrivalTimeFile1) != 1) {
+ sizeof(unsigned int), 1, arrivalTimeFile1) != 1) {
return -1;
}
- }
- else
- {
+ } else {
if (fwrite(&(packetData[senderIdx]->arrival_time),
- sizeof(unsigned int),
- 1, arrivalTimeFile2) != 1) {
+ sizeof(unsigned int), 1, arrivalTimeFile2) != 1) {
return -1;
}
}
@@ -409,8 +384,7 @@
// BWE
if (WebRtcIsac_UpdateBwEstimate(
codecInstance[receiverIdx],
- reinterpret_cast<const uint8_t*>(bitStream),
- streamLen,
+ reinterpret_cast<const uint8_t*>(bitStream), streamLen,
packetData[senderIdx]->rtp_number,
packetData[senderIdx]->sample_count,
packetData[senderIdx]->arrival_time) < 0) {
@@ -419,34 +393,27 @@
}
/**/
// Decode
- int lenDecodedAudio_int = WebRtcIsac_Decode(
- codecInstance[receiverIdx],
- reinterpret_cast<const uint8_t*>(bitStream),
- streamLen,
- audioBuff60ms,
- speechType);
- if(lenDecodedAudio_int < 0)
- {
+ int lenDecodedAudio_int =
+ WebRtcIsac_Decode(codecInstance[receiverIdx],
+ reinterpret_cast<const uint8_t*>(bitStream),
+ streamLen, audioBuff60ms, speechType);
+ if (lenDecodedAudio_int < 0) {
printf(" Decoder error in client %d \n", receiverIdx + 1);
return -1;
}
lenDecodedAudio = static_cast<size_t>(lenDecodedAudio_int);
- if(encoderSampRate[senderIdx] == 16000)
- {
- WebRtcSpl_UpsampleBy2(audioBuff60ms, lenDecodedAudio, resampledAudio60ms,
+ if (encoderSampRate[senderIdx] == 16000) {
+ WebRtcSpl_UpsampleBy2(audioBuff60ms, lenDecodedAudio,
+ resampledAudio60ms,
resamplerState[receiverIdx]);
if (fwrite(resampledAudio60ms, sizeof(short), lenDecodedAudio << 1,
- outFile[receiverIdx]) !=
- lenDecodedAudio << 1) {
+ outFile[receiverIdx]) != lenDecodedAudio << 1) {
return -1;
}
- }
- else
- {
+ } else {
if (fwrite(audioBuff60ms, sizeof(short), lenDecodedAudio,
- outFile[receiverIdx]) !=
- lenDecodedAudio) {
+ outFile[receiverIdx]) != lenDecodedAudio) {
return -1;
}
}
diff --git a/modules/audio_coding/codecs/isac/main/util/utility.h b/modules/audio_coding/codecs/isac/main/util/utility.h
index b5882a5..1acc542 100644
--- a/modules/audio_coding/codecs/isac/main/util/utility.h
+++ b/modules/audio_coding/codecs/isac/main/util/utility.h
@@ -11,134 +11,98 @@
#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_UTIL_UTILITY_H_
#define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_UTIL_UTILITY_H_
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
#if defined(__cplusplus)
extern "C" {
#endif
-#define OPEN_FILE_WB(filePtr, fullPath) \
- do \
- { \
- if(fullPath != NULL) \
- { \
- filePtr = fopen(fullPath, "wb"); \
- if(filePtr == NULL) \
- { \
- printf("could not open %s to write to.", fullPath); \
- return -1; \
- } \
- } \
- else \
- { \
- filePtr = NULL; \
- } \
- }while(0)
+#define OPEN_FILE_WB(filePtr, fullPath) \
+ do { \
+ if (fullPath != NULL) { \
+ filePtr = fopen(fullPath, "wb"); \
+ if (filePtr == NULL) { \
+ printf("could not open %s to write to.", fullPath); \
+ return -1; \
+ } \
+ } else { \
+ filePtr = NULL; \
+ } \
+ } while (0)
-#define OPEN_FILE_AB(filePtr, fullPath) \
- do \
- { \
- if(fullPath != NULL) \
- { \
- filePtr = fopen(fullPath, "ab"); \
- if(filePtr == NULL) \
- { \
- printf("could not open %s to write to.", fullPath); \
- return -1; \
- } \
- } \
- else \
- { \
- filePtr = NULL; \
- } \
- }while(0)
+#define OPEN_FILE_AB(filePtr, fullPath) \
+ do { \
+ if (fullPath != NULL) { \
+ filePtr = fopen(fullPath, "ab"); \
+ if (filePtr == NULL) { \
+ printf("could not open %s to write to.", fullPath); \
+ return -1; \
+ } \
+ } else { \
+ filePtr = NULL; \
+ } \
+ } while (0)
-#define OPEN_FILE_RB(filePtr, fullPath) \
- do \
- { \
- if(fullPath != NULL) \
- { \
- filePtr = fopen(fullPath, "rb"); \
- if(filePtr == NULL) \
- { \
- printf("could not open %s to read from.", fullPath); \
- return -1; \
- } \
- } \
- else \
- { \
- filePtr = NULL; \
- } \
- }while(0)
+#define OPEN_FILE_RB(filePtr, fullPath) \
+ do { \
+ if (fullPath != NULL) { \
+ filePtr = fopen(fullPath, "rb"); \
+ if (filePtr == NULL) { \
+ printf("could not open %s to read from.", fullPath); \
+ return -1; \
+ } \
+ } else { \
+ filePtr = NULL; \
+ } \
+ } while (0)
-#define WRITE_FILE_D(bufferPtr, len, filePtr) \
- do \
- { \
- if(filePtr != NULL) \
- { \
- double dummy[1000]; \
- int cntr; \
- for(cntr = 0; cntr < (len); cntr++) \
- { \
- dummy[cntr] = (double)bufferPtr[cntr]; \
- } \
- fwrite(dummy, sizeof(double), len, filePtr); \
- fflush(filePtr); \
- } \
- } while(0)
+#define WRITE_FILE_D(bufferPtr, len, filePtr) \
+ do { \
+ if (filePtr != NULL) { \
+ double dummy[1000]; \
+ int cntr; \
+ for (cntr = 0; cntr < (len); cntr++) { \
+ dummy[cntr] = (double)bufferPtr[cntr]; \
+ } \
+ fwrite(dummy, sizeof(double), len, filePtr); \
+ fflush(filePtr); \
+ } \
+ } while (0)
- typedef struct {
- unsigned int whenPackGeneratedMs;
- unsigned int whenPrevPackLeftMs;
- unsigned int sendTimeMs ; /* milisecond */
- unsigned int arrival_time; /* samples */
- unsigned int sample_count; /* samples, also used as "send time stamp" */
- unsigned int rtp_number;
- } BottleNeckModel;
+typedef struct {
+ unsigned int whenPackGeneratedMs;
+ unsigned int whenPrevPackLeftMs;
+ unsigned int sendTimeMs; /* milisecond */
+ unsigned int arrival_time; /* samples */
+ unsigned int sample_count; /* samples, also used as "send time stamp" */
+ unsigned int rtp_number;
+} BottleNeckModel;
- void get_arrival_time(
- int current_framesamples, /* samples */
- size_t packet_size, /* bytes */
- int bottleneck, /* excluding headers; bits/s */
- BottleNeckModel* BN_data,
- short senderSampFreqHz,
- short receiverSampFreqHz);
+void get_arrival_time(int current_framesamples, /* samples */
+ size_t packet_size, /* bytes */
+ int bottleneck, /* excluding headers; bits/s */
+ BottleNeckModel* BN_data,
+ short senderSampFreqHz,
+ short receiverSampFreqHz);
- /* function for reading audio data from PCM file */
- int readframe(
- short* data,
- FILE* inp,
- int length);
+/* function for reading audio data from PCM file */
+int readframe(short* data, FILE* inp, int length);
- short readSwitch(
- int argc,
- char* argv[],
- char* strID);
+short readSwitch(int argc, char* argv[], char* strID);
- double readParamDouble(
- int argc,
- char* argv[],
- char* strID,
- double defaultVal);
+double readParamDouble(int argc, char* argv[], char* strID, double defaultVal);
- int readParamInt(
- int argc,
- char* argv[],
- char* strID,
- int defaultVal);
+int readParamInt(int argc, char* argv[], char* strID, int defaultVal);
- int readParamString(
- int argc,
- char* argv[],
- char* strID,
- char* stringParam,
- int maxSize);
+int readParamString(int argc,
+ char* argv[],
+ char* strID,
+ char* stringParam,
+ int maxSize);
#if defined(__cplusplus)
}
#endif
-
-
#endif
diff --git a/modules/audio_coding/codecs/legacy_encoded_audio_frame.cc b/modules/audio_coding/codecs/legacy_encoded_audio_frame.cc
index 6d322a8..0bf3b19 100644
--- a/modules/audio_coding/codecs/legacy_encoded_audio_frame.cc
+++ b/modules/audio_coding/codecs/legacy_encoded_audio_frame.cc
@@ -68,10 +68,9 @@
split_size_bytes * timestamps_per_ms / bytes_per_ms);
size_t byte_offset;
uint32_t timestamp_offset;
- for (byte_offset = 0, timestamp_offset = 0;
- byte_offset < payload.size();
+ for (byte_offset = 0, timestamp_offset = 0; byte_offset < payload.size();
byte_offset += split_size_bytes,
- timestamp_offset += timestamps_per_chunk) {
+ timestamp_offset += timestamps_per_chunk) {
split_size_bytes =
std::min(split_size_bytes, payload.size() - byte_offset);
rtc::Buffer new_payload(payload.data() + byte_offset, split_size_bytes);
diff --git a/modules/audio_coding/codecs/legacy_encoded_audio_frame_unittest.cc b/modules/audio_coding/codecs/legacy_encoded_audio_frame_unittest.cc
index e2dd445..9079bcd 100644
--- a/modules/audio_coding/codecs/legacy_encoded_audio_frame_unittest.cc
+++ b/modules/audio_coding/codecs/legacy_encoded_audio_frame_unittest.cc
@@ -97,20 +97,15 @@
// 40 ms -> 20 + 20 ms
// 50 ms -> 25 + 25 ms
// 60 ms -> 30 + 30 ms
- ExpectedSplit expected_splits[] = {
- {10, 1, {10}},
- {20, 1, {20}},
- {30, 1, {30}},
- {40, 2, {20, 20}},
- {50, 2, {25, 25}},
- {60, 2, {30, 30}}
- };
+ ExpectedSplit expected_splits[] = {{10, 1, {10}}, {20, 1, {20}},
+ {30, 1, {30}}, {40, 2, {20, 20}},
+ {50, 2, {25, 25}}, {60, 2, {30, 30}}};
for (const auto& expected_split : expected_splits) {
// The payload values are set to steadily increase (modulo 256), so that the
// resulting frames can be checked and we can be reasonably certain no
// sample was missed or repeated.
- const auto generate_payload = [] (size_t num_bytes) {
+ const auto generate_payload = [](size_t num_bytes) {
rtc::Buffer payload(num_bytes);
uint8_t value = 0;
// Allow wrap-around of value in counter below.
diff --git a/modules/audio_coding/codecs/opus/audio_encoder_opus.cc b/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
index fc6d544..05d3b72 100644
--- a/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
+++ b/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
@@ -613,20 +613,17 @@
const size_t max_encoded_bytes = SufficientOutputBufferSize();
EncodedInfo info;
- info.encoded_bytes =
- encoded->AppendData(
- max_encoded_bytes, [&] (rtc::ArrayView<uint8_t> encoded) {
- int status = WebRtcOpus_Encode(
- inst_, &input_buffer_[0],
- rtc::CheckedDivExact(input_buffer_.size(),
- config_.num_channels),
- rtc::saturated_cast<int16_t>(max_encoded_bytes),
- encoded.data());
+ info.encoded_bytes = encoded->AppendData(
+ max_encoded_bytes, [&](rtc::ArrayView<uint8_t> encoded) {
+ int status = WebRtcOpus_Encode(
+ inst_, &input_buffer_[0],
+ rtc::CheckedDivExact(input_buffer_.size(), config_.num_channels),
+ rtc::saturated_cast<int16_t>(max_encoded_bytes), encoded.data());
- RTC_CHECK_GE(status, 0); // Fails only if fed invalid data.
+ RTC_CHECK_GE(status, 0); // Fails only if fed invalid data.
- return static_cast<size_t>(status);
- });
+ return static_cast<size_t>(status);
+ });
input_buffer_.clear();
bool dtx_frame = (info.encoded_bytes <= 2);
diff --git a/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc b/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
index c4d37da..dde2090 100644
--- a/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
+++ b/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
@@ -753,8 +753,8 @@
EXPECT_EQ(8000, config.max_playback_rate_hz);
EXPECT_EQ(12000, config.bitrate_bps);
- config = CreateConfigWithParameters({{"maxplaybackrate", "8000"},
- {"stereo", "1"}});
+ config = CreateConfigWithParameters(
+ {{"maxplaybackrate", "8000"}, {"stereo", "1"}});
EXPECT_EQ(8000, config.max_playback_rate_hz);
EXPECT_EQ(24000, config.bitrate_bps);
}
@@ -765,8 +765,8 @@
EXPECT_EQ(8001, config.max_playback_rate_hz);
EXPECT_EQ(20000, config.bitrate_bps);
- config = CreateConfigWithParameters({{"maxplaybackrate", "8001"},
- {"stereo", "1"}});
+ config = CreateConfigWithParameters(
+ {{"maxplaybackrate", "8001"}, {"stereo", "1"}});
EXPECT_EQ(8001, config.max_playback_rate_hz);
EXPECT_EQ(40000, config.bitrate_bps);
}
@@ -777,8 +777,8 @@
EXPECT_EQ(12001, config.max_playback_rate_hz);
EXPECT_EQ(20000, config.bitrate_bps);
- config = CreateConfigWithParameters({{"maxplaybackrate", "12001"},
- {"stereo", "1"}});
+ config = CreateConfigWithParameters(
+ {{"maxplaybackrate", "12001"}, {"stereo", "1"}});
EXPECT_EQ(12001, config.max_playback_rate_hz);
EXPECT_EQ(40000, config.bitrate_bps);
}
@@ -789,8 +789,8 @@
EXPECT_EQ(16001, config.max_playback_rate_hz);
EXPECT_EQ(32000, config.bitrate_bps);
- config = CreateConfigWithParameters({{"maxplaybackrate", "16001"},
- {"stereo", "1"}});
+ config = CreateConfigWithParameters(
+ {{"maxplaybackrate", "16001"}, {"stereo", "1"}});
EXPECT_EQ(16001, config.max_playback_rate_hz);
EXPECT_EQ(64000, config.bitrate_bps);
}
@@ -801,8 +801,8 @@
EXPECT_EQ(24001, config.max_playback_rate_hz);
EXPECT_EQ(32000, config.bitrate_bps);
- config = CreateConfigWithParameters({{"maxplaybackrate", "24001"},
- {"stereo", "1"}});
+ config = CreateConfigWithParameters(
+ {{"maxplaybackrate", "24001"}, {"stereo", "1"}});
EXPECT_EQ(24001, config.max_playback_rate_hz);
EXPECT_EQ(64000, config.bitrate_bps);
}
diff --git a/modules/audio_coding/codecs/opus/opus_fec_test.cc b/modules/audio_coding/codecs/opus/opus_fec_test.cc
index 4e0a17e..f1983ae 100644
--- a/modules/audio_coding/codecs/opus/opus_fec_test.cc
+++ b/modules/audio_coding/codecs/opus/opus_fec_test.cc
@@ -83,8 +83,8 @@
rewind(fp);
// Allocate memory to contain the whole file.
- in_data_.reset(new int16_t[loop_length_samples_ +
- block_length_sample_ * channels_]);
+ in_data_.reset(
+ new int16_t[loop_length_samples_ + block_length_sample_ * channels_]);
// Copy the file into the buffer.
ASSERT_EQ(fread(&in_data_[0], sizeof(int16_t), loop_length_samples_, fp),
@@ -130,14 +130,12 @@
max_bytes_(0),
encoded_bytes_(0),
opus_encoder_(NULL),
- opus_decoder_(NULL) {
-}
+ opus_decoder_(NULL) {}
void OpusFecTest::EncodeABlock() {
- int value = WebRtcOpus_Encode(opus_encoder_,
- &in_data_[data_pointer_],
- block_length_sample_,
- max_bytes_, &bit_stream_[0]);
+ int value =
+ WebRtcOpus_Encode(opus_encoder_, &in_data_[data_pointer_],
+ block_length_sample_, max_bytes_, &bit_stream_[0]);
EXPECT_GT(value, 0);
encoded_bytes_ = static_cast<size_t>(value);
@@ -151,9 +149,9 @@
// Decode previous frame.
if (!lost_current &&
WebRtcOpus_PacketHasFec(&bit_stream_[0], encoded_bytes_) == 1) {
- value_1 = WebRtcOpus_DecodeFec(opus_decoder_, &bit_stream_[0],
- encoded_bytes_, &out_data_[0],
- &audio_type);
+ value_1 =
+ WebRtcOpus_DecodeFec(opus_decoder_, &bit_stream_[0], encoded_bytes_,
+ &out_data_[0], &audio_type);
} else {
value_1 = WebRtcOpus_DecodePlc(opus_decoder_, &out_data_[0], 1);
}
@@ -173,16 +171,14 @@
int time_now_ms, fec_frames;
int actual_packet_loss_rate;
bool lost_current, lost_previous;
- mode mode_set[3] = {{true, 0},
- {false, 0},
- {true, 50}};
+ mode mode_set[3] = {{true, 0}, {false, 0}, {true, 50}};
lost_current = false;
for (int i = 0; i < 3; i++) {
if (mode_set[i].fec) {
EXPECT_EQ(0, WebRtcOpus_EnableFec(opus_encoder_));
- EXPECT_EQ(0, WebRtcOpus_SetPacketLossRate(opus_encoder_,
- mode_set[i].target_packet_loss_rate));
+ EXPECT_EQ(0, WebRtcOpus_SetPacketLossRate(
+ opus_encoder_, mode_set[i].target_packet_loss_rate));
printf("FEC is ON, target at packet loss rate %d percent.\n",
mode_set[i].target_packet_loss_rate);
} else {
@@ -218,7 +214,7 @@
// |data_pointer_| is incremented and wrapped across
// |loop_length_samples_|.
data_pointer_ = (data_pointer_ + block_length_sample_ * channels_) %
- loop_length_samples_;
+ loop_length_samples_;
}
if (mode_set[i].fec) {
printf("%.2f percent frames has FEC.\n",
@@ -242,7 +238,6 @@
string("pcm"))};
// 64 kbps, stereo
-INSTANTIATE_TEST_CASE_P(AllTest, OpusFecTest,
- ::testing::ValuesIn(param_set));
+INSTANTIATE_TEST_CASE_P(AllTest, OpusFecTest, ::testing::ValuesIn(param_set));
} // namespace webrtc
diff --git a/modules/audio_coding/codecs/opus/opus_inst.h b/modules/audio_coding/codecs/opus/opus_inst.h
index 066fa22..2473a5c 100644
--- a/modules/audio_coding/codecs/opus/opus_inst.h
+++ b/modules/audio_coding/codecs/opus/opus_inst.h
@@ -32,5 +32,4 @@
int in_dtx_mode;
};
-
#endif // MODULES_AUDIO_CODING_CODECS_OPUS_OPUS_INST_H_
diff --git a/modules/audio_coding/codecs/opus/opus_interface.h b/modules/audio_coding/codecs/opus/opus_interface.h
index 4b8e892..0b1c64d 100644
--- a/modules/audio_coding/codecs/opus/opus_interface.h
+++ b/modules/audio_coding/codecs/opus/opus_interface.h
@@ -318,8 +318,10 @@
* Return value : >0 - Samples per channel in decoded vector
* -1 - Error
*/
-int WebRtcOpus_Decode(OpusDecInst* inst, const uint8_t* encoded,
- size_t encoded_bytes, int16_t* decoded,
+int WebRtcOpus_Decode(OpusDecInst* inst,
+ const uint8_t* encoded,
+ size_t encoded_bytes,
+ int16_t* decoded,
int16_t* audio_type);
/****************************************************************************
@@ -336,7 +338,8 @@
* Return value : >0 - number of samples in decoded PLC vector
* -1 - Error
*/
-int WebRtcOpus_DecodePlc(OpusDecInst* inst, int16_t* decoded,
+int WebRtcOpus_DecodePlc(OpusDecInst* inst,
+ int16_t* decoded,
int number_of_lost_frames);
/****************************************************************************
@@ -357,8 +360,10 @@
* 0 - No FEC data in the packet
* -1 - Error
*/
-int WebRtcOpus_DecodeFec(OpusDecInst* inst, const uint8_t* encoded,
- size_t encoded_bytes, int16_t* decoded,
+int WebRtcOpus_DecodeFec(OpusDecInst* inst,
+ const uint8_t* encoded,
+ size_t encoded_bytes,
+ int16_t* decoded,
int16_t* audio_type);
/****************************************************************************
diff --git a/modules/audio_coding/codecs/opus/opus_speed_test.cc b/modules/audio_coding/codecs/opus/opus_speed_test.cc
index ca46aa1..03b59ed 100644
--- a/modules/audio_coding/codecs/opus/opus_speed_test.cc
+++ b/modules/audio_coding/codecs/opus/opus_speed_test.cc
@@ -23,9 +23,12 @@
OpusSpeedTest();
void SetUp() override;
void TearDown() override;
- float EncodeABlock(int16_t* in_data, uint8_t* bit_stream,
- size_t max_bytes, size_t* encoded_bytes) override;
- float DecodeABlock(const uint8_t* bit_stream, size_t encoded_bytes,
+ float EncodeABlock(int16_t* in_data,
+ uint8_t* bit_stream,
+ size_t max_bytes,
+ size_t* encoded_bytes) override;
+ float DecodeABlock(const uint8_t* bit_stream,
+ size_t encoded_bytes,
int16_t* out_data) override;
WebRtcOpusEncInst* opus_encoder_;
WebRtcOpusDecInst* opus_decoder_;
@@ -36,8 +39,7 @@
kOpusSamplingKhz,
kOpusSamplingKhz),
opus_encoder_(NULL),
- opus_decoder_(NULL) {
-}
+ opus_decoder_(NULL) {}
void OpusSpeedTest::SetUp() {
AudioCodecSpeedTest::SetUp();
@@ -57,12 +59,13 @@
EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_));
}
-float OpusSpeedTest::EncodeABlock(int16_t* in_data, uint8_t* bit_stream,
- size_t max_bytes, size_t* encoded_bytes) {
+float OpusSpeedTest::EncodeABlock(int16_t* in_data,
+ uint8_t* bit_stream,
+ size_t max_bytes,
+ size_t* encoded_bytes) {
clock_t clocks = clock();
- int value = WebRtcOpus_Encode(opus_encoder_, in_data,
- input_length_sample_, max_bytes,
- bit_stream);
+ int value = WebRtcOpus_Encode(opus_encoder_, in_data, input_length_sample_,
+ max_bytes, bit_stream);
clocks = clock() - clocks;
EXPECT_GT(value, 0);
*encoded_bytes = static_cast<size_t>(value);
@@ -70,7 +73,8 @@
}
float OpusSpeedTest::DecodeABlock(const uint8_t* bit_stream,
- size_t encoded_bytes, int16_t* out_data) {
+ size_t encoded_bytes,
+ int16_t* out_data) {
int value;
int16_t audio_type;
clock_t clocks = clock();
@@ -84,13 +88,13 @@
/* Test audio length in second. */
constexpr size_t kDurationSec = 400;
-#define ADD_TEST(complexity) \
-TEST_P(OpusSpeedTest, OpusSetComplexityTest##complexity) { \
- /* Set complexity. */ \
- printf("Setting complexity to %d ...\n", complexity); \
- EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, complexity)); \
- EncodeDecode(kDurationSec); \
-}
+#define ADD_TEST(complexity) \
+ TEST_P(OpusSpeedTest, OpusSetComplexityTest##complexity) { \
+ /* Set complexity. */ \
+ printf("Setting complexity to %d ...\n", complexity); \
+ EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, complexity)); \
+ EncodeDecode(kDurationSec); \
+ }
ADD_TEST(10);
ADD_TEST(9);
@@ -136,7 +140,6 @@
string("pcm"),
true)};
-INSTANTIATE_TEST_CASE_P(AllTest, OpusSpeedTest,
- ::testing::ValuesIn(param_set));
+INSTANTIATE_TEST_CASE_P(AllTest, OpusSpeedTest, ::testing::ValuesIn(param_set));
} // namespace webrtc
diff --git a/modules/audio_coding/codecs/opus/opus_unittest.cc b/modules/audio_coding/codecs/opus/opus_unittest.cc
index 12a1585..034f8cd 100644
--- a/modules/audio_coding/codecs/opus/opus_unittest.cc
+++ b/modules/audio_coding/codecs/opus/opus_unittest.cc
@@ -58,9 +58,12 @@
int16_t* audio_type);
void SetMaxPlaybackRate(WebRtcOpusEncInst* encoder,
- opus_int32 expect, int32_t set);
+ opus_int32 expect,
+ int32_t set);
- void CheckAudioBounded(const int16_t* audio, size_t samples, size_t channels,
+ void CheckAudioBounded(const int16_t* audio,
+ size_t samples,
+ size_t channels,
uint16_t bound) const;
WebRtcOpusEncInst* opus_encoder_;
@@ -78,15 +81,15 @@
opus_decoder_(NULL),
encoded_bytes_(0),
channels_(static_cast<size_t>(::testing::get<0>(GetParam()))),
- application_(::testing::get<1>(GetParam())) {
-}
+ application_(::testing::get<1>(GetParam())) {}
-void OpusTest::PrepareSpeechData(size_t channel, int block_length_ms,
+void OpusTest::PrepareSpeechData(size_t channel,
+ int block_length_ms,
int loop_length_ms) {
- const std::string file_name =
- webrtc::test::ResourcePath((channel == 1) ?
- "audio_coding/testfile32kHz" :
- "audio_coding/teststereo32kHz", "pcm");
+ const std::string file_name = webrtc::test::ResourcePath(
+ (channel == 1) ? "audio_coding/testfile32kHz"
+ : "audio_coding/teststereo32kHz",
+ "pcm");
if (loop_length_ms < block_length_ms) {
loop_length_ms = block_length_ms;
}
@@ -100,13 +103,14 @@
int32_t set) {
opus_int32 bandwidth;
EXPECT_EQ(0, WebRtcOpus_SetMaxPlaybackRate(opus_encoder_, set));
- opus_encoder_ctl(opus_encoder_->encoder,
- OPUS_GET_MAX_BANDWIDTH(&bandwidth));
+ opus_encoder_ctl(opus_encoder_->encoder, OPUS_GET_MAX_BANDWIDTH(&bandwidth));
EXPECT_EQ(expect, bandwidth);
}
-void OpusTest::CheckAudioBounded(const int16_t* audio, size_t samples,
- size_t channels, uint16_t bound) const {
+void OpusTest::CheckAudioBounded(const int16_t* audio,
+ size_t samples,
+ size_t channels,
+ uint16_t bound) const {
for (size_t i = 0; i < samples; ++i) {
for (size_t c = 0; c < channels; ++c) {
ASSERT_GE(audio[i * channels + c], -bound);
@@ -120,16 +124,15 @@
WebRtcOpusDecInst* decoder,
int16_t* output_audio,
int16_t* audio_type) {
- int encoded_bytes_int = WebRtcOpus_Encode(
- encoder, input_audio.data(),
- rtc::CheckedDivExact(input_audio.size(), channels_),
- kMaxBytes, bitstream_);
+ int encoded_bytes_int =
+ WebRtcOpus_Encode(encoder, input_audio.data(),
+ rtc::CheckedDivExact(input_audio.size(), channels_),
+ kMaxBytes, bitstream_);
EXPECT_GE(encoded_bytes_int, 0);
encoded_bytes_ = static_cast<size_t>(encoded_bytes_int);
int est_len = WebRtcOpus_DurationEst(decoder, bitstream_, encoded_bytes_);
- int act_len = WebRtcOpus_Decode(decoder, bitstream_,
- encoded_bytes_, output_audio,
- audio_type);
+ int act_len = WebRtcOpus_Decode(decoder, bitstream_, encoded_bytes_,
+ output_audio, audio_type);
EXPECT_EQ(est_len, act_len);
return act_len;
}
@@ -141,30 +144,28 @@
const size_t samples = kOpusRateKhz * block_length_ms;
// Create encoder memory.
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_));
// Set bitrate.
- EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_,
- channels_ == 1 ? 32000 : 64000));
+ EXPECT_EQ(
+ 0, WebRtcOpus_SetBitRate(opus_encoder_, channels_ == 1 ? 32000 : 64000));
// Set input audio as silence.
std::vector<int16_t> silence(samples * channels_, 0);
// Setting DTX.
- EXPECT_EQ(0, dtx ? WebRtcOpus_EnableDtx(opus_encoder_) :
- WebRtcOpus_DisableDtx(opus_encoder_));
+ EXPECT_EQ(0, dtx ? WebRtcOpus_EnableDtx(opus_encoder_)
+ : WebRtcOpus_DisableDtx(opus_encoder_));
int16_t audio_type;
int16_t* output_data_decode = new int16_t[samples * channels_];
for (int i = 0; i < 100; ++i) {
- EXPECT_EQ(samples,
- static_cast<size_t>(EncodeDecode(
- opus_encoder_, speech_data_.GetNextBlock(), opus_decoder_,
- output_data_decode, &audio_type)));
+ EXPECT_EQ(samples, static_cast<size_t>(EncodeDecode(
+ opus_encoder_, speech_data_.GetNextBlock(),
+ opus_decoder_, output_data_decode, &audio_type)));
// If not DTX, it should never enter DTX mode. If DTX, we do not care since
// whether it enters DTX depends on the signal type.
if (!dtx) {
@@ -178,10 +179,9 @@
// We input some silent segments. In DTX mode, the encoder will stop sending.
// However, DTX may happen after a while.
for (int i = 0; i < 30; ++i) {
- EXPECT_EQ(samples,
- static_cast<size_t>(EncodeDecode(
- opus_encoder_, silence, opus_decoder_, output_data_decode,
- &audio_type)));
+ EXPECT_EQ(samples, static_cast<size_t>(
+ EncodeDecode(opus_encoder_, silence, opus_decoder_,
+ output_data_decode, &audio_type)));
if (!dtx) {
EXPECT_GT(encoded_bytes_, 1U);
EXPECT_EQ(0, opus_encoder_->in_dtx_mode);
@@ -227,10 +227,9 @@
int i = 0;
for (; i < max_dtx_frames; ++i) {
time += block_length_ms;
- EXPECT_EQ(samples,
- static_cast<size_t>(EncodeDecode(
- opus_encoder_, silence, opus_decoder_, output_data_decode,
- &audio_type)));
+ EXPECT_EQ(samples, static_cast<size_t>(
+ EncodeDecode(opus_encoder_, silence, opus_decoder_,
+ output_data_decode, &audio_type)));
if (dtx) {
if (encoded_bytes_ > 1)
break;
@@ -263,10 +262,9 @@
// Enters DTX again immediately.
time += block_length_ms;
- EXPECT_EQ(samples,
- static_cast<size_t>(EncodeDecode(
- opus_encoder_, silence, opus_decoder_, output_data_decode,
- &audio_type)));
+ EXPECT_EQ(samples, static_cast<size_t>(
+ EncodeDecode(opus_encoder_, silence, opus_decoder_,
+ output_data_decode, &audio_type)));
if (dtx) {
EXPECT_EQ(1U, encoded_bytes_); // Send 1 byte.
EXPECT_EQ(1, opus_encoder_->in_dtx_mode);
@@ -287,10 +285,9 @@
silence[0] = 10000;
if (dtx) {
// Verify that encoder/decoder can jump out from DTX mode.
- EXPECT_EQ(samples,
- static_cast<size_t>(EncodeDecode(
- opus_encoder_, silence, opus_decoder_, output_data_decode,
- &audio_type)));
+ EXPECT_EQ(samples, static_cast<size_t>(
+ EncodeDecode(opus_encoder_, silence, opus_decoder_,
+ output_data_decode, &audio_type)));
EXPECT_GT(encoded_bytes_, 1U);
EXPECT_EQ(0, opus_encoder_->in_dtx_mode);
EXPECT_EQ(0, opus_decoder_->in_dtx_mode);
@@ -375,9 +372,8 @@
// Test normal Create and Free.
TEST_P(OpusTest, OpusCreateFree) {
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_));
EXPECT_TRUE(opus_encoder_ != NULL);
EXPECT_TRUE(opus_decoder_ != NULL);
@@ -390,23 +386,20 @@
PrepareSpeechData(channels_, 20, 20);
// Create encoder memory.
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
- EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_,
- channels_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
+ EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_));
// Set bitrate.
- EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_,
- channels_ == 1 ? 32000 : 64000));
+ EXPECT_EQ(
+ 0, WebRtcOpus_SetBitRate(opus_encoder_, channels_ == 1 ? 32000 : 64000));
// Check number of channels for decoder.
EXPECT_EQ(channels_, WebRtcOpus_DecoderChannels(opus_decoder_));
// Check application mode.
opus_int32 app;
- opus_encoder_ctl(opus_encoder_->encoder,
- OPUS_GET_APPLICATION(&app));
+ opus_encoder_ctl(opus_encoder_->encoder, OPUS_GET_APPLICATION(&app));
EXPECT_EQ(application_ == 0 ? OPUS_APPLICATION_VOIP : OPUS_APPLICATION_AUDIO,
app);
@@ -429,9 +422,8 @@
EXPECT_EQ(-1, WebRtcOpus_SetBitRate(opus_encoder_, 60000));
// Create encoder memory, try with different bitrates.
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_, 30000));
EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_, 60000));
EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_, 300000));
@@ -446,9 +438,8 @@
EXPECT_EQ(-1, WebRtcOpus_SetComplexity(opus_encoder_, 9));
// Create encoder memory, try with different complexities.
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, 0));
EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, 10));
@@ -524,9 +515,8 @@
PrepareSpeechData(channels_, 20, 20);
// Create encoder memory.
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_));
// Encode & decode.
@@ -540,9 +530,9 @@
WebRtcOpus_DecoderInit(opus_decoder_);
EXPECT_EQ(kOpus20msFrameSamples,
- static_cast<size_t>(WebRtcOpus_Decode(
- opus_decoder_, bitstream_, encoded_bytes_, output_data_decode,
- &audio_type)));
+ static_cast<size_t>(
+ WebRtcOpus_Decode(opus_decoder_, bitstream_, encoded_bytes_,
+ output_data_decode, &audio_type)));
// Free memory.
delete[] output_data_decode;
@@ -556,9 +546,8 @@
EXPECT_EQ(-1, WebRtcOpus_DisableFec(opus_encoder_));
// Create encoder memory.
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
EXPECT_EQ(0, WebRtcOpus_EnableFec(opus_encoder_));
EXPECT_EQ(0, WebRtcOpus_DisableFec(opus_encoder_));
@@ -573,30 +562,25 @@
EXPECT_EQ(-1, WebRtcOpus_DisableDtx(opus_encoder_));
// Create encoder memory.
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
opus_int32 dtx;
// DTX is off by default.
- opus_encoder_ctl(opus_encoder_->encoder,
- OPUS_GET_DTX(&dtx));
+ opus_encoder_ctl(opus_encoder_->encoder, OPUS_GET_DTX(&dtx));
EXPECT_EQ(0, dtx);
// Test to enable DTX.
EXPECT_EQ(0, WebRtcOpus_EnableDtx(opus_encoder_));
- opus_encoder_ctl(opus_encoder_->encoder,
- OPUS_GET_DTX(&dtx));
+ opus_encoder_ctl(opus_encoder_->encoder, OPUS_GET_DTX(&dtx));
EXPECT_EQ(1, dtx);
// Test to disable DTX.
EXPECT_EQ(0, WebRtcOpus_DisableDtx(opus_encoder_));
- opus_encoder_ctl(opus_encoder_->encoder,
- OPUS_GET_DTX(&dtx));
+ opus_encoder_ctl(opus_encoder_->encoder, OPUS_GET_DTX(&dtx));
EXPECT_EQ(0, dtx);
-
// Free memory.
EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_));
}
@@ -630,9 +614,8 @@
EXPECT_EQ(-1, WebRtcOpus_SetPacketLossRate(opus_encoder_, 50));
// Create encoder memory.
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
EXPECT_EQ(0, WebRtcOpus_SetPacketLossRate(opus_encoder_, 50));
EXPECT_EQ(-1, WebRtcOpus_SetPacketLossRate(opus_encoder_, -1));
@@ -647,9 +630,8 @@
EXPECT_EQ(-1, WebRtcOpus_SetMaxPlaybackRate(opus_encoder_, 20000));
// Create encoder memory.
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_FULLBAND, 48000);
SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_FULLBAND, 24001);
@@ -671,14 +653,13 @@
PrepareSpeechData(channels_, 20, 20);
// Create encoder memory.
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_));
// Set bitrate.
- EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_,
- channels_== 1 ? 32000 : 64000));
+ EXPECT_EQ(
+ 0, WebRtcOpus_SetBitRate(opus_encoder_, channels_ == 1 ? 32000 : 64000));
// Check number of channels for decoder.
EXPECT_EQ(channels_, WebRtcOpus_DecoderChannels(opus_decoder_));
@@ -693,9 +674,8 @@
// Call decoder PLC.
int16_t* plc_buffer = new int16_t[kOpus20msFrameSamples * channels_];
- EXPECT_EQ(kOpus20msFrameSamples,
- static_cast<size_t>(WebRtcOpus_DecodePlc(
- opus_decoder_, plc_buffer, 1)));
+ EXPECT_EQ(kOpus20msFrameSamples, static_cast<size_t>(WebRtcOpus_DecodePlc(
+ opus_decoder_, plc_buffer, 1)));
// Free memory.
delete[] plc_buffer;
@@ -709,34 +689,33 @@
PrepareSpeechData(channels_, 20, 20);
// Create.
- EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
+ EXPECT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_));
// 10 ms. We use only first 10 ms of a 20 ms block.
auto speech_block = speech_data_.GetNextBlock();
int encoded_bytes_int = WebRtcOpus_Encode(
opus_encoder_, speech_block.data(),
- rtc::CheckedDivExact(speech_block.size(), 2 * channels_),
- kMaxBytes, bitstream_);
+ rtc::CheckedDivExact(speech_block.size(), 2 * channels_), kMaxBytes,
+ bitstream_);
EXPECT_GE(encoded_bytes_int, 0);
- EXPECT_EQ(kOpus10msFrameSamples,
- static_cast<size_t>(WebRtcOpus_DurationEst(
- opus_decoder_, bitstream_,
- static_cast<size_t>(encoded_bytes_int))));
+ EXPECT_EQ(
+ kOpus10msFrameSamples,
+ static_cast<size_t>(WebRtcOpus_DurationEst(
+ opus_decoder_, bitstream_, static_cast<size_t>(encoded_bytes_int))));
// 20 ms
speech_block = speech_data_.GetNextBlock();
- encoded_bytes_int = WebRtcOpus_Encode(
- opus_encoder_, speech_block.data(),
- rtc::CheckedDivExact(speech_block.size(), channels_),
- kMaxBytes, bitstream_);
+ encoded_bytes_int =
+ WebRtcOpus_Encode(opus_encoder_, speech_block.data(),
+ rtc::CheckedDivExact(speech_block.size(), channels_),
+ kMaxBytes, bitstream_);
EXPECT_GE(encoded_bytes_int, 0);
- EXPECT_EQ(kOpus20msFrameSamples,
- static_cast<size_t>(WebRtcOpus_DurationEst(
- opus_decoder_, bitstream_,
- static_cast<size_t>(encoded_bytes_int))));
+ EXPECT_EQ(
+ kOpus20msFrameSamples,
+ static_cast<size_t>(WebRtcOpus_DurationEst(
+ opus_decoder_, bitstream_, static_cast<size_t>(encoded_bytes_int))));
// Free memory.
EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_));
@@ -749,15 +728,13 @@
PrepareSpeechData(channels_, 20, 20 * kPackets);
// Create encoder memory.
- ASSERT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
- channels_,
- application_));
- ASSERT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_,
- channels_));
+ ASSERT_EQ(0,
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
+ ASSERT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_));
// Set bitrate.
- EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_,
- channels_ == 1 ? 32000 : 64000));
+ EXPECT_EQ(
+ 0, WebRtcOpus_SetBitRate(opus_encoder_, channels_ == 1 ? 32000 : 64000));
// Check number of channels for decoder.
EXPECT_EQ(channels_, WebRtcOpus_DecoderChannels(opus_decoder_));
@@ -776,9 +753,9 @@
WebRtcOpus_Encode(opus_encoder_, speech_block.data(),
rtc::CheckedDivExact(speech_block.size(), channels_),
kMaxBytes, bitstream_);
- if (opus_repacketizer_cat(
- rp, bitstream_,
- rtc::checked_cast<opus_int32>(encoded_bytes_)) == OPUS_OK) {
+ if (opus_repacketizer_cat(rp, bitstream_,
+ rtc::checked_cast<opus_int32>(encoded_bytes_)) ==
+ OPUS_OK) {
++num_packets;
if (num_packets == kPackets) {
break;
@@ -798,9 +775,9 @@
opus_decoder_, bitstream_, encoded_bytes_)));
EXPECT_EQ(kOpus20msFrameSamples * kPackets,
- static_cast<size_t>(WebRtcOpus_Decode(
- opus_decoder_, bitstream_, encoded_bytes_,
- output_data_decode.get(), &audio_type)));
+ static_cast<size_t>(
+ WebRtcOpus_Decode(opus_decoder_, bitstream_, encoded_bytes_,
+ output_data_decode.get(), &audio_type)));
// Free memory.
opus_repacketizer_destroy(rp);
@@ -812,5 +789,4 @@
OpusTest,
Combine(Values(1, 2), Values(0, 1)));
-
} // namespace webrtc
diff --git a/modules/audio_coding/codecs/pcm16b/pcm16b.h b/modules/audio_coding/codecs/pcm16b/pcm16b.h
index 041701a..9a3bfe9 100644
--- a/modules/audio_coding/codecs/pcm16b/pcm16b.h
+++ b/modules/audio_coding/codecs/pcm16b/pcm16b.h
@@ -38,9 +38,7 @@
* Always equal to twice the len input parameter.
*/
-size_t WebRtcPcm16b_Encode(const int16_t* speech,
- size_t len,
- uint8_t* encoded);
+size_t WebRtcPcm16b_Encode(const int16_t* speech, size_t len, uint8_t* encoded);
/****************************************************************************
* WebRtcPcm16b_Decode(...)
@@ -57,9 +55,7 @@
* Returned value : Samples in speech
*/
-size_t WebRtcPcm16b_Decode(const uint8_t* encoded,
- size_t len,
- int16_t* speech);
+size_t WebRtcPcm16b_Decode(const uint8_t* encoded, size_t len, int16_t* speech);
#ifdef __cplusplus
}
diff --git a/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc b/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc
index cd62069..2601f26 100644
--- a/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc
+++ b/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc
@@ -58,10 +58,8 @@
uint32_t rtp_timestamp,
rtc::ArrayView<const int16_t> audio,
rtc::Buffer* encoded) {
-
const size_t primary_offset = encoded->size();
- EncodedInfo info =
- speech_encoder_->Encode(rtp_timestamp, audio, encoded);
+ EncodedInfo info = speech_encoder_->Encode(rtp_timestamp, audio, encoded);
RTC_CHECK(info.redundant.empty()) << "Cannot use nested redundant encoders.";
RTC_DCHECK_EQ(encoded->size() - primary_offset, info.encoded_bytes);
diff --git a/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc b/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc
index 890ac22..0f5a811 100644
--- a/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc
+++ b/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc
@@ -48,9 +48,7 @@
.WillRepeatedly(Return(sample_rate_hz_));
}
- void TearDown() override {
- red_.reset();
- }
+ void TearDown() override { red_.reset(); }
void Encode() {
ASSERT_TRUE(red_.get() != NULL);
@@ -73,8 +71,7 @@
const int red_payload_type_;
};
-TEST_F(AudioEncoderCopyRedTest, CreateAndDestroy) {
-}
+TEST_F(AudioEncoderCopyRedTest, CreateAndDestroy) {}
TEST_F(AudioEncoderCopyRedTest, CheckSampleRatePropagation) {
EXPECT_CALL(*mock_encoder_, SampleRateHz()).WillOnce(Return(17));
diff --git a/modules/audio_coding/codecs/tools/audio_codec_speed_test.cc b/modules/audio_coding/codecs/tools/audio_codec_speed_test.cc
index d3749c1..c539152 100644
--- a/modules/audio_coding/codecs/tools/audio_codec_speed_test.cc
+++ b/modules/audio_coding/codecs/tools/audio_codec_speed_test.cc
@@ -34,8 +34,7 @@
encoded_bytes_(0),
encoding_time_ms_(0.0),
decoding_time_ms_(0.0),
- out_file_(NULL) {
-}
+ out_file_(NULL) {}
void AudioCodecSpeedTest::SetUp() {
channels_ = get<0>(GetParam());
@@ -52,8 +51,8 @@
rewind(fp);
// Allocate memory to contain the whole file.
- in_data_.reset(new int16_t[loop_length_samples_ +
- input_length_sample_ * channels_]);
+ in_data_.reset(
+ new int16_t[loop_length_samples_ + input_length_sample_ * channels_]);
data_pointer_ = 0;
@@ -111,11 +110,11 @@
time_ms = DecodeABlock(&bit_stream_[0], encoded_bytes_, &out_data_[0]);
decoding_time_ms_ += time_ms;
if (save_out_data_) {
- fwrite(&out_data_[0], sizeof(int16_t),
- output_length_sample_ * channels_, out_file_);
+ fwrite(&out_data_[0], sizeof(int16_t), output_length_sample_ * channels_,
+ out_file_);
}
data_pointer_ = (data_pointer_ + input_length_sample_ * channels_) %
- loop_length_samples_;
+ loop_length_samples_;
time_now_ms += block_duration_ms_;
}
diff --git a/modules/audio_coding/codecs/tools/audio_codec_speed_test.h b/modules/audio_coding/codecs/tools/audio_codec_speed_test.h
index 9e616e7..0214a7d 100644
--- a/modules/audio_coding/codecs/tools/audio_codec_speed_test.h
+++ b/modules/audio_coding/codecs/tools/audio_codec_speed_test.h
@@ -36,15 +36,18 @@
// 2. save the bit stream to |bit_stream| of |max_bytes| bytes in size,
// 3. assign |encoded_bytes| with the length of the bit stream (in bytes),
// 4. return the cost of time (in millisecond) spent on actual encoding.
- virtual float EncodeABlock(int16_t* in_data, uint8_t* bit_stream,
- size_t max_bytes, size_t* encoded_bytes) = 0;
+ virtual float EncodeABlock(int16_t* in_data,
+ uint8_t* bit_stream,
+ size_t max_bytes,
+ size_t* encoded_bytes) = 0;
// DecodeABlock(...) does the following:
// 1. decodes the bit stream in |bit_stream| with a length of |encoded_bytes|
// (in bytes),
// 2. save the decoded audio in |out_data|,
// 3. return the cost of time (in millisecond) spent on actual decoding.
- virtual float DecodeABlock(const uint8_t* bit_stream, size_t encoded_bytes,
+ virtual float DecodeABlock(const uint8_t* bit_stream,
+ size_t encoded_bytes,
int16_t* out_data) = 0;
// Encoding and decode an audio of |audio_duration| (in seconds) and