Added unittest for iSAC-Fix.

Only one function in this version.
Review URL: https://webrtc-codereview.appspot.com/713006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2575 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kma@webrtc.org 2012-08-08 18:26:19 +00:00
parent c2fde804fa
commit ccb7cc6175
4 changed files with 56 additions and 9 deletions

View File

@ -18,6 +18,10 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_LPC_MASKING_MODEL_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_LPC_MASKING_MODEL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "structs.h"
int32_t WebRtcIsacfix_CalculateResidualEnergy(int lpc_order,
@ -41,4 +45,8 @@ void WebRtcIsacfix_GetLpcCoef(WebRtc_Word16 *inLoQ0,
WebRtc_Word16 *lo_coeffQ15,
WebRtc_Word16 *hi_coeffQ15);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_LPC_MASKING_MODEL_H_ */

View File

@ -19,9 +19,9 @@
#define WEBRTC_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/fix/source/settings.h"
#include "typedefs.h"
#include "signal_processing_library.h"
#include "settings.h"
/* Bitstream struct for decoder */
typedef struct Bitstreamstruct_dec {

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* 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
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <typedefs.h>
#include "gtest/gtest.h"
#include "modules/audio_coding/codecs/iSAC/fix/source/lpc_masking_model.h"
class IsacUnitTest : public testing::Test {
};
TEST_F(IsacUnitTest, CalculateResidualEnergyTest) {
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};
int q_shift_residual = 0;
int32_t residual_energy = 0;
residual_energy = WebRtcIsacfix_CalculateResidualEnergy(kIntOrder,
kInt32QDomain, kIntShift, a, corr, &q_shift_residual);
EXPECT_EQ(1789023310, residual_energy);
EXPECT_EQ(2, q_shift_residual);
}

View File

@ -1,4 +1,4 @@
# 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
# that can be found in the LICENSE file in the root of the source
@ -23,13 +23,19 @@
'./fix/test/kenny.c',
],
},
{
'target_name': 'isacfix_unittests',
'type': 'executable',
'dependencies': [
'iSACFix',
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(webrtc_root)/test/test.gyp:test_support_main',
],
'sources': [
'fix/test/isacfix_unittest.cc',
],
},
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
# TODO(kma): Add bit-exact test for iSAC-fix.