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 <stdio.h> | 11 #include <stdio.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 | 13 |
| 14 #include <memory> |
| 15 |
14 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 16 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
15 #include "webrtc/modules/video_processing/include/video_processing.h" | 17 #include "webrtc/modules/video_processing/include/video_processing.h" |
16 #include "webrtc/modules/video_processing/test/video_processing_unittest.h" | 18 #include "webrtc/modules/video_processing/test/video_processing_unittest.h" |
17 #include "webrtc/system_wrappers/include/tick_util.h" | 19 #include "webrtc/system_wrappers/include/tick_util.h" |
18 #include "webrtc/test/testsupport/fileutils.h" | 20 #include "webrtc/test/testsupport/fileutils.h" |
19 | 21 |
20 namespace webrtc { | 22 namespace webrtc { |
21 | 23 |
22 #if defined(WEBRTC_IOS) | 24 #if defined(WEBRTC_IOS) |
23 TEST_F(VideoProcessingTest, DISABLED_Deflickering) { | 25 TEST_F(VideoProcessingTest, DISABLED_Deflickering) { |
(...skipping 15 matching lines...) Expand all Loading... |
39 ASSERT_TRUE(source_file_ != NULL) << "Cannot read input file: " << input_file | 41 ASSERT_TRUE(source_file_ != NULL) << "Cannot read input file: " << input_file |
40 << "\n"; | 42 << "\n"; |
41 | 43 |
42 const std::string output_file = | 44 const std::string output_file = |
43 webrtc::test::OutputPath() + "deflicker_output_cif_short.yuv"; | 45 webrtc::test::OutputPath() + "deflicker_output_cif_short.yuv"; |
44 FILE* deflickerFile = fopen(output_file.c_str(), "wb"); | 46 FILE* deflickerFile = fopen(output_file.c_str(), "wb"); |
45 ASSERT_TRUE(deflickerFile != NULL) | 47 ASSERT_TRUE(deflickerFile != NULL) |
46 << "Could not open output file: " << output_file << "\n"; | 48 << "Could not open output file: " << output_file << "\n"; |
47 | 49 |
48 printf("\nRun time [us / frame]:\n"); | 50 printf("\nRun time [us / frame]:\n"); |
49 rtc::scoped_ptr<uint8_t[]> video_buffer(new uint8_t[frame_length_]); | 51 std::unique_ptr<uint8_t[]> video_buffer(new uint8_t[frame_length_]); |
50 for (uint32_t run_idx = 0; run_idx < NumRuns; run_idx++) { | 52 for (uint32_t run_idx = 0; run_idx < NumRuns; run_idx++) { |
51 TickTime t0; | 53 TickTime t0; |
52 TickTime t1; | 54 TickTime t1; |
53 TickInterval acc_ticks; | 55 TickInterval acc_ticks; |
54 uint32_t timeStamp = 1; | 56 uint32_t timeStamp = 1; |
55 | 57 |
56 frameNum = 0; | 58 frameNum = 0; |
57 while (fread(video_buffer.get(), 1, frame_length_, source_file_) == | 59 while (fread(video_buffer.get(), 1, frame_length_, source_file_) == |
58 frame_length_) { | 60 frame_length_) { |
59 frameNum++; | 61 frameNum++; |
(...skipping 29 matching lines...) Expand all Loading... |
89 ASSERT_EQ(0, fclose(deflickerFile)); | 91 ASSERT_EQ(0, fclose(deflickerFile)); |
90 // TODO(kjellander): Add verification of deflicker output file. | 92 // TODO(kjellander): Add verification of deflicker output file. |
91 | 93 |
92 printf("\nAverage run time = %d us / frame\n", | 94 printf("\nAverage run time = %d us / frame\n", |
93 static_cast<int>(avg_runtime / frameNum / NumRuns)); | 95 static_cast<int>(avg_runtime / frameNum / NumRuns)); |
94 printf("Min run time = %d us / frame\n\n", | 96 printf("Min run time = %d us / frame\n\n", |
95 static_cast<int>(min_runtime / frameNum)); | 97 static_cast<int>(min_runtime / frameNum)); |
96 } | 98 } |
97 | 99 |
98 } // namespace webrtc | 100 } // namespace webrtc |
OLD | NEW |