Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Side by Side Diff: webrtc/modules/video_processing/test/deflickering_test.cc

Issue 1901393003: Delete unused methods of the VideoProcessing class. And fix a typo. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added GUARDED_BY annotation. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include <stdio.h>
12 #include <stdlib.h>
13
14 #include <memory>
15
16 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
17 #include "webrtc/modules/video_processing/include/video_processing.h"
18 #include "webrtc/modules/video_processing/test/video_processing_unittest.h"
19 #include "webrtc/system_wrappers/include/tick_util.h"
20 #include "webrtc/test/testsupport/fileutils.h"
21
22 namespace webrtc {
23
24 #if defined(WEBRTC_IOS)
25 TEST_F(VideoProcessingTest, DISABLED_Deflickering) {
26 #else
27 TEST_F(VideoProcessingTest, Deflickering) {
28 #endif
29 enum { NumRuns = 30 };
30 uint32_t frameNum = 0;
31 const uint32_t frame_rate = 15;
32
33 int64_t min_runtime = 0;
34 int64_t avg_runtime = 0;
35
36 // Close automatically opened Foreman.
37 fclose(source_file_);
38 const std::string input_file =
39 webrtc::test::ResourcePath("deflicker_before_cif_short", "yuv");
40 source_file_ = fopen(input_file.c_str(), "rb");
41 ASSERT_TRUE(source_file_ != NULL) << "Cannot read input file: " << input_file
42 << "\n";
43
44 const std::string output_file =
45 webrtc::test::OutputPath() + "deflicker_output_cif_short.yuv";
46 FILE* deflickerFile = fopen(output_file.c_str(), "wb");
47 ASSERT_TRUE(deflickerFile != NULL)
48 << "Could not open output file: " << output_file << "\n";
49
50 printf("\nRun time [us / frame]:\n");
51 std::unique_ptr<uint8_t[]> video_buffer(new uint8_t[frame_length_]);
52 for (uint32_t run_idx = 0; run_idx < NumRuns; run_idx++) {
53 TickTime t0;
54 TickTime t1;
55 TickInterval acc_ticks;
56 uint32_t timeStamp = 1;
57
58 frameNum = 0;
59 while (fread(video_buffer.get(), 1, frame_length_, source_file_) ==
60 frame_length_) {
61 frameNum++;
62 EXPECT_EQ(0, ConvertToI420(kI420, video_buffer.get(), 0, 0, width_,
63 height_, 0, kVideoRotation_0, &video_frame_));
64 video_frame_.set_timestamp(timeStamp);
65
66 t0 = TickTime::Now();
67 VideoProcessing::FrameStats stats;
68 vp_->GetFrameStats(video_frame_, &stats);
69 EXPECT_GT(stats.num_pixels, 0u);
70 ASSERT_EQ(0, vp_->Deflickering(&video_frame_, &stats));
71 t1 = TickTime::Now();
72 acc_ticks += (t1 - t0);
73
74 if (run_idx == 0) {
75 if (PrintVideoFrame(video_frame_, deflickerFile) < 0) {
76 return;
77 }
78 }
79 timeStamp += (90000 / frame_rate);
80 }
81 ASSERT_NE(0, feof(source_file_)) << "Error reading source file";
82
83 printf("%u\n", static_cast<int>(acc_ticks.Microseconds() / frameNum));
84 if (acc_ticks.Microseconds() < min_runtime || run_idx == 0) {
85 min_runtime = acc_ticks.Microseconds();
86 }
87 avg_runtime += acc_ticks.Microseconds();
88
89 rewind(source_file_);
90 }
91 ASSERT_EQ(0, fclose(deflickerFile));
92 // TODO(kjellander): Add verification of deflicker output file.
93
94 printf("\nAverage run time = %d us / frame\n",
95 static_cast<int>(avg_runtime / frameNum / NumRuns));
96 printf("Min run time = %d us / frame\n\n",
97 static_cast<int>(min_runtime / frameNum));
98 }
99
100 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698