diff --git a/src/modules/audio_coding/codecs/iSAC/fix/source/lpc_masking_model.h b/src/modules/audio_coding/codecs/iSAC/fix/source/lpc_masking_model.h index 351b41601..189e0e030 100644 --- a/src/modules/audio_coding/codecs/iSAC/fix/source/lpc_masking_model.h +++ b/src/modules/audio_coding/codecs/iSAC/fix/source/lpc_masking_model.h @@ -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_ */ diff --git a/src/modules/audio_coding/codecs/iSAC/fix/source/structs.h b/src/modules/audio_coding/codecs/iSAC/fix/source/structs.h index 54dffa924..bd7adc44b 100644 --- a/src/modules/audio_coding/codecs/iSAC/fix/source/structs.h +++ b/src/modules/audio_coding/codecs/iSAC/fix/source/structs.h @@ -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 { diff --git a/src/modules/audio_coding/codecs/iSAC/fix/test/isacfix_unittest.cc b/src/modules/audio_coding/codecs/iSAC/fix/test/isacfix_unittest.cc new file mode 100644 index 000000000..b6a4b0e05 --- /dev/null +++ b/src/modules/audio_coding/codecs/iSAC/fix/test/isacfix_unittest.cc @@ -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 + +#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); +} diff --git a/src/modules/audio_coding/codecs/iSAC/isacfix_test.gypi b/src/modules/audio_coding/codecs/iSAC/isacfix_test.gypi index e40a67212..a6c59d05a 100644 --- a/src/modules/audio_coding/codecs/iSAC/isacfix_test.gypi +++ b/src/modules/audio_coding/codecs/iSAC/isacfix_test.gypi @@ -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.