OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 value = WebRtcIsacfix_Encode(ISACFIX_main_inst_, &in_data[pointer], | 73 value = WebRtcIsacfix_Encode(ISACFIX_main_inst_, &in_data[pointer], |
74 bit_stream); | 74 bit_stream); |
75 } | 75 } |
76 clocks = clock() - clocks; | 76 clocks = clock() - clocks; |
77 EXPECT_GT(value, 0); | 77 EXPECT_GT(value, 0); |
78 assert(value <= max_bytes); | 78 assert(value <= max_bytes); |
79 *encoded_bytes = value; | 79 *encoded_bytes = value; |
80 return 1000.0 * clocks / CLOCKS_PER_SEC; | 80 return 1000.0 * clocks / CLOCKS_PER_SEC; |
81 } | 81 } |
82 | 82 |
83 float IsacSpeedTest::DecodeABlock(const uint8_t* bit_stream, int encoded_bytes, | 83 float IsacSpeedTest::DecodeABlock(const uint8_t* bit_stream, |
| 84 int encoded_bytes, |
84 int16_t* out_data) { | 85 int16_t* out_data) { |
85 int value; | 86 int value; |
86 int16_t audio_type; | 87 int16_t audio_type; |
87 clock_t clocks = clock(); | 88 clock_t clocks = clock(); |
88 value = WebRtcIsacfix_Decode(ISACFIX_main_inst_, | 89 value = WebRtcIsacfix_Decode(ISACFIX_main_inst_, bit_stream, encoded_bytes, |
89 bit_stream, | 90 out_data, &audio_type); |
90 encoded_bytes, out_data, &audio_type); | |
91 clocks = clock() - clocks; | 91 clocks = clock() - clocks; |
92 EXPECT_EQ(output_length_sample_, value); | 92 EXPECT_EQ(output_length_sample_, value); |
93 return 1000.0 * clocks / CLOCKS_PER_SEC; | 93 return 1000.0 * clocks / CLOCKS_PER_SEC; |
94 } | 94 } |
95 | 95 |
96 TEST_P(IsacSpeedTest, IsacEncodeDecodeTest) { | 96 TEST_P(IsacSpeedTest, IsacEncodeDecodeTest) { |
97 size_t kDurationSec = 400; // Test audio length in second. | 97 size_t kDurationSec = 400; // Test audio length in second. |
98 EncodeDecode(kDurationSec); | 98 EncodeDecode(kDurationSec); |
99 } | 99 } |
100 | 100 |
101 const coding_param param_set[] = | 101 const coding_param param_set[] = |
102 {::std::tr1::make_tuple(1, 32000, string("audio_coding/speech_mono_16kHz"), | 102 {::std::tr1::make_tuple(1, 32000, string("audio_coding/speech_mono_16kHz"), |
103 string("pcm"), true)}; | 103 string("pcm"), true)}; |
104 | 104 |
105 INSTANTIATE_TEST_CASE_P(AllTest, IsacSpeedTest, | 105 INSTANTIATE_TEST_CASE_P(AllTest, IsacSpeedTest, |
106 ::testing::ValuesIn(param_set)); | 106 ::testing::ValuesIn(param_set)); |
107 | 107 |
108 } // namespace webrtc | 108 } // namespace webrtc |
OLD | NEW |