Solves buffer overrun crash on Windows [issue 258].

Removed function calls not tested. Added a TODO on activating them when refactoring signal_processing.
Review URL: https://webrtc-codereview.appspot.com/379012

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1620 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org 2012-02-07 08:10:46 +00:00
parent 14979ed4e6
commit 530963925e

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source * that can be found in the LICENSE file in the root of the source
@ -394,8 +394,8 @@ TEST_F(SplTest, RandTest) {
TEST_F(SplTest, SignalProcessingTest) { TEST_F(SplTest, SignalProcessingTest) {
const int kVectorSize = 4; const int kVectorSize = 4;
int A[] = {1, 2, 33, 100}; int A[] = {1, 2, 33, 100};
const WebRtc_Word16 kHanning[4] = { 2399, 8192, 13985, 16384 };
WebRtc_Word16 b16[kVectorSize]; WebRtc_Word16 b16[kVectorSize];
WebRtc_Word32 b32[kVectorSize];
WebRtc_Word16 bTmp16[kVectorSize]; WebRtc_Word16 bTmp16[kVectorSize];
WebRtc_Word32 bTmp32[kVectorSize]; WebRtc_Word32 bTmp32[kVectorSize];
@ -404,26 +404,27 @@ TEST_F(SplTest, SignalProcessingTest) {
for (int kk = 0; kk < kVectorSize; ++kk) { for (int kk = 0; kk < kVectorSize; ++kk) {
b16[kk] = A[kk]; b16[kk] = A[kk];
b32[kk] = A[kk];
} }
EXPECT_EQ(2, WebRtcSpl_AutoCorrelation(b16, kVectorSize, 1, bTmp32, &bScale)); EXPECT_EQ(2, WebRtcSpl_AutoCorrelation(b16, kVectorSize, 1, bTmp32, &bScale));
WebRtcSpl_ReflCoefToLpc(b16, kVectorSize, bTmp16); // TODO(bjornv): Activate the Reflection Coefficient tests when refactoring.
// for (int kk = 0; kk < kVectorSize; ++kk) { // WebRtcSpl_ReflCoefToLpc(b16, kVectorSize, bTmp16);
// EXPECT_EQ(aTmp16[kk], bTmp16[kk]); //// for (int kk = 0; kk < kVectorSize; ++kk) {
// } //// EXPECT_EQ(aTmp16[kk], bTmp16[kk]);
WebRtcSpl_LpcToReflCoef(bTmp16, kVectorSize, b16); //// }
// for (int kk = 0; kk < kVectorSize; ++kk) { // WebRtcSpl_LpcToReflCoef(bTmp16, kVectorSize, b16);
// EXPECT_EQ(a16[kk], b16[kk]); //// for (int kk = 0; kk < kVectorSize; ++kk) {
// } //// EXPECT_EQ(a16[kk], b16[kk]);
WebRtcSpl_AutoCorrToReflCoef(b32, kVectorSize, bTmp16); //// }
// for (int kk = 0; kk < kVectorSize; ++kk) { // WebRtcSpl_AutoCorrToReflCoef(b32, kVectorSize, bTmp16);
// EXPECT_EQ(aTmp16[kk], bTmp16[kk]); //// for (int kk = 0; kk < kVectorSize; ++kk) {
// } //// EXPECT_EQ(aTmp16[kk], bTmp16[kk]);
//// }
WebRtcSpl_GetHanningWindow(bTmp16, kVectorSize); WebRtcSpl_GetHanningWindow(bTmp16, kVectorSize);
// for (int kk = 0; kk < kVectorSize; ++kk) { for (int kk = 0; kk < kVectorSize; ++kk) {
// EXPECT_EQ(aTmp16[kk], bTmp16[kk]); EXPECT_EQ(kHanning[kk], bTmp16[kk]);
// } }
for (int kk = 0; kk < kVectorSize; ++kk) { for (int kk = 0; kk < kVectorSize; ++kk) {
b16[kk] = A[kk]; b16[kk] = A[kk];