| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
| 11 #include <math.h> | 11 #include <math.h> |
| 12 #include <string.h> | 12 #include <string.h> |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 | 15 |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "webrtc/base/timeutils.h" |
| 17 #include "webrtc/common_video/libyuv/include/scaler.h" | 18 #include "webrtc/common_video/libyuv/include/scaler.h" |
| 18 #include "webrtc/system_wrappers/include/tick_util.h" | |
| 19 #include "webrtc/test/testsupport/fileutils.h" | 19 #include "webrtc/test/testsupport/fileutils.h" |
| 20 | 20 |
| 21 namespace webrtc { | 21 namespace webrtc { |
| 22 | 22 |
| 23 class TestScaler : public ::testing::Test { | 23 class TestScaler : public ::testing::Test { |
| 24 protected: | 24 protected: |
| 25 TestScaler(); | 25 TestScaler(); |
| 26 virtual void SetUp(); | 26 virtual void SetUp(); |
| 27 virtual void TearDown(); | 27 virtual void TearDown(); |
| 28 | 28 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 break; | 371 break; |
| 372 | 372 |
| 373 input_frame.CreateFrame(frame_buffer.get(), | 373 input_frame.CreateFrame(frame_buffer.get(), |
| 374 frame_buffer.get() + size_y, | 374 frame_buffer.get() + size_y, |
| 375 frame_buffer.get() + size_y + size_uv, | 375 frame_buffer.get() + size_y + size_uv, |
| 376 src_width, src_height, | 376 src_width, src_height, |
| 377 src_width, (src_width + 1) / 2, | 377 src_width, (src_width + 1) / 2, |
| 378 (src_width + 1) / 2, | 378 (src_width + 1) / 2, |
| 379 kVideoRotation_0); | 379 kVideoRotation_0); |
| 380 | 380 |
| 381 start_clock = TickTime::MillisecondTimestamp(); | 381 start_clock = rtc::TimeMillis(); |
| 382 EXPECT_EQ(0, test_scaler_.Scale(input_frame, &output_frame)); | 382 EXPECT_EQ(0, test_scaler_.Scale(input_frame, &output_frame)); |
| 383 total_clock += TickTime::MillisecondTimestamp() - start_clock; | 383 total_clock += rtc::TimeMillis() - start_clock; |
| 384 if (PrintVideoFrame(output_frame, output_file) < 0) { | 384 if (PrintVideoFrame(output_frame, output_file) < 0) { |
| 385 return; | 385 return; |
| 386 } | 386 } |
| 387 frame_count++; | 387 frame_count++; |
| 388 } | 388 } |
| 389 | 389 |
| 390 if (frame_count) { | 390 if (frame_count) { |
| 391 printf("Scaling[%d %d] => [%d %d]: ", | 391 printf("Scaling[%d %d] => [%d %d]: ", |
| 392 src_width, src_height, dst_width, dst_height); | 392 src_width, src_height, dst_width, dst_height); |
| 393 printf("Average time per frame[ms]: %.2lf\n", | 393 printf("Average time per frame[ms]: %.2lf\n", |
| 394 (static_cast<double>(total_clock) / frame_count)); | 394 (static_cast<double>(total_clock) / frame_count)); |
| 395 } | 395 } |
| 396 ASSERT_EQ(0, fclose(output_file)); | 396 ASSERT_EQ(0, fclose(output_file)); |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace webrtc | 399 } // namespace webrtc |
| OLD | NEW |