OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 const float kTolerance = 0.02f; | 79 const float kTolerance = 0.02f; |
80 | 80 |
81 size_t frames_read = 0; | 81 size_t frames_read = 0; |
82 | 82 |
83 while (ReadInt16FromFileToFloatBuffer(audio_file.get(), | 83 while (ReadInt16FromFileToFloatBuffer(audio_file.get(), |
84 buffer_length, | 84 buffer_length, |
85 buffer.get()) == buffer_length) { | 85 buffer.get()) == buffer_length) { |
86 ++frames_read; | 86 ++frames_read; |
87 | 87 |
88 float detector_value = | 88 float detector_value = |
89 detector.Detect(buffer.get(), buffer_length, NULL, 0); | 89 detector.Detect(buffer.get(), buffer_length, nullptr, 0); |
90 double file_value; | 90 double file_value; |
91 ASSERT_EQ(1u, ReadDoubleBufferFromFile(detect_file.get(), 1, &file_value)) | 91 ASSERT_EQ(1u, ReadDoubleBufferFromFile(detect_file.get(), 1, &file_value)) |
92 << "Detect test file is malformed.\n"; | 92 << "Detect test file is malformed.\n"; |
93 | 93 |
94 // Compare results with data from the matlab test file. | 94 // Compare results with data from the matlab test file. |
95 EXPECT_NEAR(file_value, detector_value, kTolerance) << "Frame: " | 95 EXPECT_NEAR(file_value, detector_value, kTolerance) << "Frame: " |
96 << frames_read; | 96 << frames_read; |
97 } | 97 } |
98 | 98 |
99 detect_file->CloseFile(); | 99 detect_file->CloseFile(); |
100 audio_file->CloseFile(); | 100 audio_file->CloseFile(); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 } // namespace webrtc | 104 } // namespace webrtc |
OLD | NEW |