Fix MSVC warnings about value truncations, webrtc/common_audio/ edition.
This changes some method signatures to better reflect how callers are actually using them. This also has the tendency to make signatures more consistent about e.g. using int (instead of int16_t) for lengths of things like vectors, and using int16_t (instead of int) for e.g. counts of bits in a value. This also removes a couple of functions that were only called in unittests. BUG=3353,chromium:81439 TEST=none R=andrew@webrtc.org, bjornv@webrtc.org Review URL: https://webrtc-codereview.appspot.com/23389004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7060 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
f6ab6f86e7
commit
3cbd6c26c8
@ -85,7 +85,7 @@ FIRFilterC::FIRFilterC(const float* coefficients, size_t coefficients_length)
|
||||
for (size_t i = 0; i < coefficients_length_; ++i) {
|
||||
coefficients_[i] = coefficients[coefficients_length_ - i - 1];
|
||||
}
|
||||
memset(state_.get(), 0.f, state_length_ * sizeof(state_[0]));
|
||||
memset(state_.get(), 0, state_length_ * sizeof(state_[0]));
|
||||
}
|
||||
|
||||
void FIRFilterC::Filter(const float* in, size_t length, float* out) {
|
||||
|
@ -31,14 +31,14 @@ FIRFilterSSE2::FIRFilterSSE2(const float* coefficients,
|
||||
16))) {
|
||||
// Add zeros at the end of the coefficients.
|
||||
size_t padding = coefficients_length_ - coefficients_length;
|
||||
memset(coefficients_.get(), 0.f, padding * sizeof(coefficients_[0]));
|
||||
memset(coefficients_.get(), 0, padding * sizeof(coefficients_[0]));
|
||||
// The coefficients are reversed to compensate for the order in which the
|
||||
// input samples are acquired (most recent last).
|
||||
for (size_t i = 0; i < coefficients_length; ++i) {
|
||||
coefficients_[i + padding] = coefficients[coefficients_length - i - 1];
|
||||
}
|
||||
memset(state_.get(),
|
||||
0.f,
|
||||
0,
|
||||
(max_input_length + state_length_) * sizeof(state_[0]));
|
||||
}
|
||||
|
||||
|
@ -222,23 +222,22 @@ void SincResampler::InitializeKernel() {
|
||||
|
||||
for (int i = 0; i < kKernelSize; ++i) {
|
||||
const int idx = i + offset_idx * kKernelSize;
|
||||
const float pre_sinc = M_PI * (i - kKernelSize / 2 - subsample_offset);
|
||||
const float pre_sinc =
|
||||
static_cast<float>(M_PI * (i - kKernelSize / 2 - subsample_offset));
|
||||
kernel_pre_sinc_storage_[idx] = pre_sinc;
|
||||
|
||||
// Compute Blackman window, matching the offset of the sinc().
|
||||
const float x = (i - subsample_offset) / kKernelSize;
|
||||
const float window = kA0 - kA1 * cos(2.0 * M_PI * x) + kA2
|
||||
* cos(4.0 * M_PI * x);
|
||||
const float window = static_cast<float>(kA0 - kA1 * cos(2.0 * M_PI * x) +
|
||||
kA2 * cos(4.0 * M_PI * x));
|
||||
kernel_window_storage_[idx] = window;
|
||||
|
||||
// Compute the sinc with offset, then window the sinc() function and store
|
||||
// at the correct offset.
|
||||
if (pre_sinc == 0) {
|
||||
kernel_storage_[idx] = sinc_scale_factor * window;
|
||||
} else {
|
||||
kernel_storage_[idx] =
|
||||
window * sin(sinc_scale_factor * pre_sinc) / pre_sinc;
|
||||
}
|
||||
kernel_storage_[idx] = static_cast<float>(window *
|
||||
((pre_sinc == 0) ?
|
||||
sinc_scale_factor :
|
||||
(sin(sinc_scale_factor * pre_sinc) / pre_sinc)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -260,12 +259,10 @@ void SincResampler::SetRatio(double io_sample_rate_ratio) {
|
||||
const float window = kernel_window_storage_[idx];
|
||||
const float pre_sinc = kernel_pre_sinc_storage_[idx];
|
||||
|
||||
if (pre_sinc == 0) {
|
||||
kernel_storage_[idx] = sinc_scale_factor * window;
|
||||
} else {
|
||||
kernel_storage_[idx] =
|
||||
window * sin(sinc_scale_factor * pre_sinc) / pre_sinc;
|
||||
}
|
||||
kernel_storage_[idx] = static_cast<float>(window *
|
||||
((pre_sinc == 0) ?
|
||||
sinc_scale_factor :
|
||||
(sin(sinc_scale_factor * pre_sinc) / pre_sinc)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -289,18 +286,19 @@ void SincResampler::Resample(int frames, float* destination) {
|
||||
//
|
||||
// Note: The loop construct here can severely impact performance on ARM
|
||||
// or when built with clang. See https://codereview.chromium.org/18566009/
|
||||
for (int i = ceil((block_size_ - virtual_source_idx_) / current_io_ratio);
|
||||
for (int i = static_cast<int>(
|
||||
ceil((block_size_ - virtual_source_idx_) / current_io_ratio));
|
||||
i > 0; --i) {
|
||||
assert(virtual_source_idx_ < block_size_);
|
||||
|
||||
// |virtual_source_idx_| lies in between two kernel offsets so figure out
|
||||
// what they are.
|
||||
const int source_idx = virtual_source_idx_;
|
||||
const int source_idx = static_cast<int>(virtual_source_idx_);
|
||||
const double subsample_remainder = virtual_source_idx_ - source_idx;
|
||||
|
||||
const double virtual_offset_idx =
|
||||
subsample_remainder * kKernelOffsetCount;
|
||||
const int offset_idx = virtual_offset_idx;
|
||||
const int offset_idx = static_cast<int>(virtual_offset_idx);
|
||||
|
||||
// We'll compute "convolutions" for the two kernels which straddle
|
||||
// |virtual_source_idx_|.
|
||||
@ -347,7 +345,7 @@ void SincResampler::Resample(int frames, float* destination) {
|
||||
#undef CONVOLVE_FUNC
|
||||
|
||||
int SincResampler::ChunkSize() const {
|
||||
return block_size_ / io_sample_rate_ratio_;
|
||||
return static_cast<int>(block_size_ / io_sample_rate_ratio_);
|
||||
}
|
||||
|
||||
void SincResampler::Flush() {
|
||||
@ -373,8 +371,8 @@ float SincResampler::Convolve_C(const float* input_ptr, const float* k1,
|
||||
}
|
||||
|
||||
// Linearly interpolate the two "convolutions".
|
||||
return (1.0 - kernel_interpolation_factor) * sum1
|
||||
+ kernel_interpolation_factor * sum2;
|
||||
return static_cast<float>((1.0 - kernel_interpolation_factor) * sum1 +
|
||||
kernel_interpolation_factor * sum2);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -41,8 +41,10 @@ float SincResampler::Convolve_SSE(const float* input_ptr, const float* k1,
|
||||
}
|
||||
|
||||
// Linearly interpolate the two "convolutions".
|
||||
m_sums1 = _mm_mul_ps(m_sums1, _mm_set_ps1(1.0 - kernel_interpolation_factor));
|
||||
m_sums2 = _mm_mul_ps(m_sums2, _mm_set_ps1(kernel_interpolation_factor));
|
||||
m_sums1 = _mm_mul_ps(m_sums1, _mm_set_ps1(
|
||||
static_cast<float>(1.0 - kernel_interpolation_factor)));
|
||||
m_sums2 = _mm_mul_ps(m_sums2, _mm_set_ps1(
|
||||
static_cast<float>(kernel_interpolation_factor)));
|
||||
m_sums1 = _mm_add_ps(m_sums1, m_sums2);
|
||||
|
||||
// Sum components together.
|
||||
|
@ -17,8 +17,6 @@
|
||||
* WebRtcSpl_CopyFromEndW16()
|
||||
* WebRtcSpl_ZerosArrayW16()
|
||||
* WebRtcSpl_ZerosArrayW32()
|
||||
* WebRtcSpl_OnesArrayW16()
|
||||
* WebRtcSpl_OnesArrayW32()
|
||||
*
|
||||
* The description header can be found in signal_processing_library.h
|
||||
*
|
||||
@ -62,47 +60,21 @@ void WebRtcSpl_MemCpyReversedOrder(int16_t* dest, int16_t* source, int length)
|
||||
}
|
||||
}
|
||||
|
||||
int16_t WebRtcSpl_CopyFromEndW16(const int16_t *vector_in,
|
||||
int16_t length,
|
||||
int16_t samples,
|
||||
int16_t *vector_out)
|
||||
void WebRtcSpl_CopyFromEndW16(const int16_t *vector_in,
|
||||
int length,
|
||||
int samples,
|
||||
int16_t *vector_out)
|
||||
{
|
||||
// Copy the last <samples> of the input vector to vector_out
|
||||
WEBRTC_SPL_MEMCPY_W16(vector_out, &vector_in[length - samples], samples);
|
||||
|
||||
return samples;
|
||||
}
|
||||
|
||||
int16_t WebRtcSpl_ZerosArrayW16(int16_t *vector, int16_t length)
|
||||
void WebRtcSpl_ZerosArrayW16(int16_t *vector, int length)
|
||||
{
|
||||
WebRtcSpl_MemSetW16(vector, 0, length);
|
||||
return length;
|
||||
}
|
||||
|
||||
int16_t WebRtcSpl_ZerosArrayW32(int32_t *vector, int16_t length)
|
||||
void WebRtcSpl_ZerosArrayW32(int32_t *vector, int length)
|
||||
{
|
||||
WebRtcSpl_MemSetW32(vector, 0, length);
|
||||
return length;
|
||||
}
|
||||
|
||||
int16_t WebRtcSpl_OnesArrayW16(int16_t *vector, int16_t length)
|
||||
{
|
||||
int16_t i;
|
||||
int16_t *tmpvec = vector;
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
*tmpvec++ = 1;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
int16_t WebRtcSpl_OnesArrayW32(int32_t *vector, int16_t length)
|
||||
{
|
||||
int16_t i;
|
||||
int32_t *tmpvec = vector;
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
*tmpvec++ = 1;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
@ -17,14 +17,16 @@
|
||||
|
||||
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
||||
|
||||
int WebRtcSpl_GetScalingSquare(int16_t *in_vector, int in_vector_length, int times)
|
||||
int16_t WebRtcSpl_GetScalingSquare(int16_t* in_vector,
|
||||
int in_vector_length,
|
||||
int times)
|
||||
{
|
||||
int nbits = WebRtcSpl_GetSizeInBits(times);
|
||||
int16_t nbits = WebRtcSpl_GetSizeInBits(times);
|
||||
int i;
|
||||
int16_t smax = -1;
|
||||
int16_t sabs;
|
||||
int16_t *sptr = in_vector;
|
||||
int t;
|
||||
int16_t t;
|
||||
int looptimes = in_vector_length;
|
||||
|
||||
for (i = looptimes; i > 0; i--)
|
||||
|
@ -123,9 +123,9 @@ void WebRtcSpl_Init();
|
||||
// Get SPL Version
|
||||
int16_t WebRtcSpl_get_version(char* version, int16_t length_in_bytes);
|
||||
|
||||
int WebRtcSpl_GetScalingSquare(int16_t* in_vector,
|
||||
int in_vector_length,
|
||||
int times);
|
||||
int16_t WebRtcSpl_GetScalingSquare(int16_t* in_vector,
|
||||
int in_vector_length,
|
||||
int times);
|
||||
|
||||
// Copy and set operations. Implementation in copy_set_operations.c.
|
||||
// Descriptions at bottom of file.
|
||||
@ -138,18 +138,14 @@ void WebRtcSpl_MemSetW32(int32_t* vector,
|
||||
void WebRtcSpl_MemCpyReversedOrder(int16_t* out_vector,
|
||||
int16_t* in_vector,
|
||||
int vector_length);
|
||||
int16_t WebRtcSpl_CopyFromEndW16(const int16_t* in_vector,
|
||||
int16_t in_vector_length,
|
||||
int16_t samples,
|
||||
int16_t* out_vector);
|
||||
int16_t WebRtcSpl_ZerosArrayW16(int16_t* vector,
|
||||
int16_t vector_length);
|
||||
int16_t WebRtcSpl_ZerosArrayW32(int32_t* vector,
|
||||
int16_t vector_length);
|
||||
int16_t WebRtcSpl_OnesArrayW16(int16_t* vector,
|
||||
int16_t vector_length);
|
||||
int16_t WebRtcSpl_OnesArrayW32(int32_t* vector,
|
||||
int16_t vector_length);
|
||||
void WebRtcSpl_CopyFromEndW16(const int16_t* in_vector,
|
||||
int in_vector_length,
|
||||
int samples,
|
||||
int16_t* out_vector);
|
||||
void WebRtcSpl_ZerosArrayW16(int16_t* vector,
|
||||
int vector_length);
|
||||
void WebRtcSpl_ZerosArrayW32(int32_t* vector,
|
||||
int vector_length);
|
||||
// End: Copy and set operations.
|
||||
|
||||
|
||||
@ -931,10 +927,10 @@ void WebRtcSpl_ResetResample8khzTo48khz(WebRtcSpl_State8khzTo48khz* state);
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
void WebRtcSpl_DownsampleBy2(const int16_t* in, int16_t len,
|
||||
void WebRtcSpl_DownsampleBy2(const int16_t* in, int len,
|
||||
int16_t* out, int32_t* filtState);
|
||||
|
||||
void WebRtcSpl_UpsampleBy2(const int16_t* in, int16_t len,
|
||||
void WebRtcSpl_UpsampleBy2(const int16_t* in, int len,
|
||||
int16_t* out, int32_t* filtState);
|
||||
|
||||
/************************************************************
|
||||
@ -1110,8 +1106,6 @@ void WebRtcSpl_SynthesisQMF(const int16_t* low_band,
|
||||
// Output:
|
||||
// - out_vector : Vector with the requested samples
|
||||
//
|
||||
// Return value : Number of copied samples in |out_vector|
|
||||
//
|
||||
|
||||
//
|
||||
// WebRtcSpl_ZerosArrayW16(...)
|
||||
@ -1126,24 +1120,6 @@ void WebRtcSpl_SynthesisQMF(const int16_t* low_band,
|
||||
// Output:
|
||||
// - vector : Vector containing all zeros
|
||||
//
|
||||
// Return value : Number of samples in vector
|
||||
//
|
||||
|
||||
//
|
||||
// WebRtcSpl_OnesArrayW16(...)
|
||||
// WebRtcSpl_OnesArrayW32(...)
|
||||
//
|
||||
// Inserts the value "one" in all positions of a w16 and a w32 vector
|
||||
// respectively.
|
||||
//
|
||||
// Input:
|
||||
// - vector_length : Number of samples in vector
|
||||
//
|
||||
// Output:
|
||||
// - vector : Vector containing all ones
|
||||
//
|
||||
// Return value : Number of samples in vector
|
||||
//
|
||||
|
||||
//
|
||||
// WebRtcSpl_VectorBitShiftW16(...)
|
||||
|
@ -84,7 +84,7 @@ static __inline int16_t WebRtcSpl_SubSatW16(int16_t var1, int16_t var2) {
|
||||
|
||||
#if !defined(MIPS32_LE)
|
||||
static __inline int16_t WebRtcSpl_GetSizeInBits(uint32_t n) {
|
||||
int bits;
|
||||
int16_t bits;
|
||||
|
||||
if (0xFFFF0000 & n) {
|
||||
bits = 16;
|
||||
@ -100,8 +100,8 @@ static __inline int16_t WebRtcSpl_GetSizeInBits(uint32_t n) {
|
||||
return bits;
|
||||
}
|
||||
|
||||
static __inline int WebRtcSpl_NormW32(int32_t a) {
|
||||
int zeros;
|
||||
static __inline int16_t WebRtcSpl_NormW32(int32_t a) {
|
||||
int16_t zeros;
|
||||
|
||||
if (a == 0) {
|
||||
return 0;
|
||||
@ -123,8 +123,8 @@ static __inline int WebRtcSpl_NormW32(int32_t a) {
|
||||
return zeros;
|
||||
}
|
||||
|
||||
static __inline int WebRtcSpl_NormU32(uint32_t a) {
|
||||
int zeros;
|
||||
static __inline int16_t WebRtcSpl_NormU32(uint32_t a) {
|
||||
int16_t zeros;
|
||||
|
||||
if (a == 0) return 0;
|
||||
|
||||
@ -141,8 +141,8 @@ static __inline int WebRtcSpl_NormU32(uint32_t a) {
|
||||
return zeros;
|
||||
}
|
||||
|
||||
static __inline int WebRtcSpl_NormW16(int16_t a) {
|
||||
int zeros;
|
||||
static __inline int16_t WebRtcSpl_NormW16(int16_t a) {
|
||||
int16_t zeros;
|
||||
|
||||
if (a == 0) {
|
||||
return 0;
|
||||
|
@ -83,7 +83,7 @@ static __inline int16_t WebRtcSpl_GetSizeInBits(uint32_t n) {
|
||||
return (int16_t)(32 - tmp);
|
||||
}
|
||||
|
||||
static __inline int WebRtcSpl_NormW32(int32_t a) {
|
||||
static __inline int16_t WebRtcSpl_NormW32(int32_t a) {
|
||||
int32_t tmp = 0;
|
||||
|
||||
if (a == 0) {
|
||||
@ -95,20 +95,20 @@ static __inline int WebRtcSpl_NormW32(int32_t a) {
|
||||
|
||||
__asm __volatile ("clz %0, %1":"=r"(tmp):"r"(a));
|
||||
|
||||
return tmp - 1;
|
||||
return (int16_t)(tmp - 1);
|
||||
}
|
||||
|
||||
static __inline int WebRtcSpl_NormU32(uint32_t a) {
|
||||
static __inline int16_t WebRtcSpl_NormU32(uint32_t a) {
|
||||
int tmp = 0;
|
||||
|
||||
if (a == 0) return 0;
|
||||
|
||||
__asm __volatile ("clz %0, %1":"=r"(tmp):"r"(a));
|
||||
|
||||
return tmp;
|
||||
return (int16_t)tmp;
|
||||
}
|
||||
|
||||
static __inline int WebRtcSpl_NormW16(int16_t a) {
|
||||
static __inline int16_t WebRtcSpl_NormW16(int16_t a) {
|
||||
int32_t tmp = 0;
|
||||
|
||||
if (a == 0) {
|
||||
@ -120,7 +120,7 @@ static __inline int WebRtcSpl_NormW16(int16_t a) {
|
||||
|
||||
__asm __volatile ("clz %0, %1":"=r"(tmp):"r"(a));
|
||||
|
||||
return tmp - 17;
|
||||
return (int16_t)(tmp - 17);
|
||||
}
|
||||
|
||||
// TODO(kma): add unit test.
|
||||
|
@ -137,10 +137,10 @@ static __inline int16_t WebRtcSpl_GetSizeInBits(uint32_t n) {
|
||||
: [n] "r" (n), [i32] "r" (i32)
|
||||
);
|
||||
|
||||
return bits;
|
||||
return (int16_t)bits;
|
||||
}
|
||||
|
||||
static __inline int WebRtcSpl_NormW32(int32_t a) {
|
||||
static __inline int16_t WebRtcSpl_NormW32(int32_t a) {
|
||||
int zeros = 0;
|
||||
|
||||
__asm __volatile(
|
||||
@ -160,10 +160,10 @@ static __inline int WebRtcSpl_NormW32(int32_t a) {
|
||||
: [a] "r" (a)
|
||||
);
|
||||
|
||||
return zeros;
|
||||
return (int16_t)zeros;
|
||||
}
|
||||
|
||||
static __inline int WebRtcSpl_NormU32(uint32_t a) {
|
||||
static __inline int16_t WebRtcSpl_NormU32(uint32_t a) {
|
||||
int zeros = 0;
|
||||
|
||||
__asm __volatile(
|
||||
@ -172,10 +172,10 @@ static __inline int WebRtcSpl_NormU32(uint32_t a) {
|
||||
: [a] "r" (a)
|
||||
);
|
||||
|
||||
return (zeros & 0x1f);
|
||||
return (int16_t)(zeros & 0x1f);
|
||||
}
|
||||
|
||||
static __inline int WebRtcSpl_NormW16(int16_t a) {
|
||||
static __inline int16_t WebRtcSpl_NormW16(int16_t a) {
|
||||
int zeros = 0;
|
||||
int a0 = a << 16;
|
||||
|
||||
@ -196,7 +196,7 @@ static __inline int WebRtcSpl_NormW16(int16_t a) {
|
||||
: [a0] "r" (a0)
|
||||
);
|
||||
|
||||
return zeros;
|
||||
return (int16_t)zeros;
|
||||
}
|
||||
|
||||
static __inline int32_t WebRtc_MulAccumW16(int16_t a,
|
||||
|
@ -67,10 +67,10 @@ static const uint16_t kResampleAllpass2[3] = {12199, 37471, 60255};
|
||||
|
||||
// decimator
|
||||
#if !defined(MIPS32_LE)
|
||||
void WebRtcSpl_DownsampleBy2(const int16_t* in, int16_t len,
|
||||
void WebRtcSpl_DownsampleBy2(const int16_t* in, int len,
|
||||
int16_t* out, int32_t* filtState) {
|
||||
int32_t tmp1, tmp2, diff, in32, out32;
|
||||
int16_t i;
|
||||
int i;
|
||||
|
||||
register int32_t state0 = filtState[0];
|
||||
register int32_t state1 = filtState[1];
|
||||
@ -125,10 +125,10 @@ void WebRtcSpl_DownsampleBy2(const int16_t* in, int16_t len,
|
||||
#endif // #if defined(MIPS32_LE)
|
||||
|
||||
|
||||
void WebRtcSpl_UpsampleBy2(const int16_t* in, int16_t len,
|
||||
void WebRtcSpl_UpsampleBy2(const int16_t* in, int len,
|
||||
int16_t* out, int32_t* filtState) {
|
||||
int32_t tmp1, tmp2, diff, in32, out32;
|
||||
int16_t i;
|
||||
int i;
|
||||
|
||||
register int32_t state0 = filtState[0];
|
||||
register int32_t state1 = filtState[1];
|
||||
|
@ -29,11 +29,11 @@ static const uint16_t kResampleAllpass2[3] = {12199, 37471, 60255};
|
||||
|
||||
// decimator
|
||||
void WebRtcSpl_DownsampleBy2(const int16_t* in,
|
||||
int16_t len,
|
||||
int len,
|
||||
int16_t* out,
|
||||
int32_t* filtState) {
|
||||
int32_t out32;
|
||||
int16_t i, len1;
|
||||
int i, len1;
|
||||
|
||||
register int32_t state0 = filtState[0];
|
||||
register int32_t state1 = filtState[1];
|
||||
|
@ -172,26 +172,18 @@ TEST_F(SplTest, BasicArrayOperationsTest) {
|
||||
for (int kk = 0; kk < kVectorSize; ++kk) {
|
||||
EXPECT_EQ(3, b16[kk]);
|
||||
}
|
||||
EXPECT_EQ(kVectorSize, WebRtcSpl_ZerosArrayW16(b16, kVectorSize));
|
||||
WebRtcSpl_ZerosArrayW16(b16, kVectorSize);
|
||||
for (int kk = 0; kk < kVectorSize; ++kk) {
|
||||
EXPECT_EQ(0, b16[kk]);
|
||||
}
|
||||
EXPECT_EQ(kVectorSize, WebRtcSpl_OnesArrayW16(b16, kVectorSize));
|
||||
for (int kk = 0; kk < kVectorSize; ++kk) {
|
||||
EXPECT_EQ(1, b16[kk]);
|
||||
}
|
||||
WebRtcSpl_MemSetW32(b32, 3, kVectorSize);
|
||||
for (int kk = 0; kk < kVectorSize; ++kk) {
|
||||
EXPECT_EQ(3, b32[kk]);
|
||||
}
|
||||
EXPECT_EQ(kVectorSize, WebRtcSpl_ZerosArrayW32(b32, kVectorSize));
|
||||
WebRtcSpl_ZerosArrayW32(b32, kVectorSize);
|
||||
for (int kk = 0; kk < kVectorSize; ++kk) {
|
||||
EXPECT_EQ(0, b32[kk]);
|
||||
}
|
||||
EXPECT_EQ(kVectorSize, WebRtcSpl_OnesArrayW32(b32, kVectorSize));
|
||||
for (int kk = 0; kk < kVectorSize; ++kk) {
|
||||
EXPECT_EQ(1, b32[kk]);
|
||||
}
|
||||
for (int kk = 0; kk < kVectorSize; ++kk) {
|
||||
bTmp16[kk] = (int16_t)kk;
|
||||
bTmp32[kk] = (int32_t)kk;
|
||||
@ -204,7 +196,7 @@ TEST_F(SplTest, BasicArrayOperationsTest) {
|
||||
// for (int kk = 0; kk < kVectorSize; ++kk) {
|
||||
// EXPECT_EQ(b32[kk], bTmp32[kk]);
|
||||
// }
|
||||
EXPECT_EQ(2, WebRtcSpl_CopyFromEndW16(b16, kVectorSize, 2, bTmp16));
|
||||
WebRtcSpl_CopyFromEndW16(b16, kVectorSize, 2, bTmp16);
|
||||
for (int kk = 0; kk < 2; ++kk) {
|
||||
EXPECT_EQ(kk+2, bTmp16[kk]);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ static const uint16_t WebRtcSpl_kAllPassFilter2[3] = {21333, 49062, 63010};
|
||||
// |data_length|
|
||||
//
|
||||
|
||||
void WebRtcSpl_AllPassQMF(int32_t* in_data, int16_t data_length,
|
||||
void WebRtcSpl_AllPassQMF(int32_t* in_data, int data_length,
|
||||
int32_t* out_data, const uint16_t* filter_coefficients,
|
||||
int32_t* filter_state)
|
||||
{
|
||||
@ -65,7 +65,7 @@ void WebRtcSpl_AllPassQMF(int32_t* in_data, int16_t data_length,
|
||||
// filter operation takes the |in_data| (which is the output from the previous cascade
|
||||
// filter) and store the output in |out_data|.
|
||||
// Note that the input vector values are changed during the process.
|
||||
int16_t k;
|
||||
int k;
|
||||
int32_t diff;
|
||||
// First all-pass cascade; filter from in_data to out_data.
|
||||
|
||||
|
@ -75,7 +75,7 @@ void WebRtcSpl_VectorBitShiftW32ToW16(int16_t* out, int length,
|
||||
(*out++) = WebRtcSpl_SatW32ToW16(tmp_w32);
|
||||
}
|
||||
} else {
|
||||
int16_t left_shifts = -right_shifts;
|
||||
int left_shifts = -right_shifts;
|
||||
for (i = length; i > 0; i--) {
|
||||
tmp_w32 = (*in++) << left_shifts;
|
||||
(*out++) = WebRtcSpl_SatW32ToW16(tmp_w32);
|
||||
|
Loading…
Reference in New Issue
Block a user