Chromium Code Reviews

Side by Side Diff: webrtc/common_video/libyuv/scaler_unittest.cc

Issue 1547343002: Remove DISABLED_ON_ macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: MAYBE_ yo Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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 "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "webrtc/common_video/libyuv/include/scaler.h" 15 #include "webrtc/common_video/libyuv/include/scaler.h"
16 #include "webrtc/system_wrappers/include/tick_util.h" 16 #include "webrtc/system_wrappers/include/tick_util.h"
17 #include "webrtc/test/testsupport/fileutils.h" 17 #include "webrtc/test/testsupport/fileutils.h"
18 #include "webrtc/test/testsupport/gtest_disable.h"
19 18
20 namespace webrtc { 19 namespace webrtc {
21 20
22 class TestScaler : public ::testing::Test { 21 class TestScaler : public ::testing::Test {
23 protected: 22 protected:
24 TestScaler(); 23 TestScaler();
25 virtual void SetUp(); 24 virtual void SetUp();
26 virtual void TearDown(); 25 virtual void TearDown();
27 26
28 void ScaleSequence(ScaleMethod method, 27 void ScaleSequence(ScaleMethod method,
(...skipping 79 matching lines...)
108 width_, half_width_, half_width_); 107 width_, half_width_, half_width_);
109 EXPECT_EQ(0, test_scaler_.Scale(test_frame_, &test_frame2)); 108 EXPECT_EQ(0, test_scaler_.Scale(test_frame_, &test_frame2));
110 EXPECT_GT(width_ * height_, test_frame2.allocated_size(kYPlane)); 109 EXPECT_GT(width_ * height_, test_frame2.allocated_size(kYPlane));
111 EXPECT_GT(size_uv_, test_frame2.allocated_size(kUPlane)); 110 EXPECT_GT(size_uv_, test_frame2.allocated_size(kUPlane));
112 EXPECT_GT(size_uv_, test_frame2.allocated_size(kVPlane)); 111 EXPECT_GT(size_uv_, test_frame2.allocated_size(kVPlane));
113 EXPECT_EQ(half_width_, test_frame2.width()); 112 EXPECT_EQ(half_width_, test_frame2.width());
114 EXPECT_EQ(half_height_, test_frame2.height()); 113 EXPECT_EQ(half_height_, test_frame2.height());
115 } 114 }
116 115
117 // TODO(mikhal): Converge the test into one function that accepts the method. 116 // TODO(mikhal): Converge the test into one function that accepts the method.
118 TEST_F(TestScaler, DISABLED_ON_ANDROID(PointScaleTest)) { 117 #if defined(WEBRTC_ANDROID)
118 #define MAYBE_PointScaleTest DISABLED_PointScaleTest
119 #else
120 #define MAYBE_PointScaleTest PointScaleTest
121 #endif
122 TEST_F(TestScaler, MAYBE_PointScaleTest) {
119 double avg_psnr; 123 double avg_psnr;
120 FILE* source_file2; 124 FILE* source_file2;
121 ScaleMethod method = kScalePoint; 125 ScaleMethod method = kScalePoint;
122 std::string out_name = webrtc::test::OutputPath() + 126 std::string out_name = webrtc::test::OutputPath() +
123 "LibYuvTest_PointScale_176_144.yuv"; 127 "LibYuvTest_PointScale_176_144.yuv";
124 ScaleSequence(method, 128 ScaleSequence(method,
125 source_file_, out_name, 129 source_file_, out_name,
126 width_, height_, 130 width_, height_,
127 half_width_, half_height_); 131 half_width_, half_height_);
128 // Upsample back up and check PSNR. 132 // Upsample back up and check PSNR.
(...skipping 46 matching lines...)
175 352, 288); 179 352, 288);
176 avg_psnr = ComputeAvgSequencePSNR(source_file_, out_name, width_, height_); 180 avg_psnr = ComputeAvgSequencePSNR(source_file_, out_name, width_, height_);
177 printf("PSNR for scaling from: %d %d, down/up to: %d %d, and back to " 181 printf("PSNR for scaling from: %d %d, down/up to: %d %d, and back to "
178 "original size: %f \n", width_, height_, 282, 231, avg_psnr); 182 "original size: %f \n", width_, height_, 282, 231, avg_psnr);
179 // Average PSNR for lower bound in assert is ~0.1dB lower than the actual 183 // Average PSNR for lower bound in assert is ~0.1dB lower than the actual
180 // average PSNR under same conditions. 184 // average PSNR under same conditions.
181 ASSERT_GT(avg_psnr, 25.8); 185 ASSERT_GT(avg_psnr, 25.8);
182 ASSERT_EQ(0, fclose(source_file2)); 186 ASSERT_EQ(0, fclose(source_file2));
183 } 187 }
184 188
185 TEST_F(TestScaler, DISABLED_ON_ANDROID(BiLinearScaleTest)) { 189 #if defined(WEBRTC_ANDROID)
190 #define MAYBE_BilinearScaleTest DISABLED_BiLinearScaleTest
191 #else
192 #define MAYBE_BilinearScaleTest BiLinearScaleTest
193 #endif
194 TEST_F(TestScaler, MAYBE_BiLinearScaleTest) {
186 double avg_psnr; 195 double avg_psnr;
187 FILE* source_file2; 196 FILE* source_file2;
188 ScaleMethod method = kScaleBilinear; 197 ScaleMethod method = kScaleBilinear;
189 std::string out_name = webrtc::test::OutputPath() + 198 std::string out_name = webrtc::test::OutputPath() +
190 "LibYuvTest_BilinearScale_176_144.yuv"; 199 "LibYuvTest_BilinearScale_176_144.yuv";
191 ScaleSequence(method, 200 ScaleSequence(method,
192 source_file_, out_name, 201 source_file_, out_name,
193 width_, height_, 202 width_, height_,
194 width_ / 2, height_ / 2); 203 width_ / 2, height_ / 2);
195 // Up-sample back up and check PSNR. 204 // Up-sample back up and check PSNR.
(...skipping 31 matching lines...)
227 width_, height_, 236 width_, height_,
228 300, 200); 237 300, 200);
229 out_name = webrtc::test::OutputPath() + 238 out_name = webrtc::test::OutputPath() +
230 "LibYuvTest_BilinearScale_400_300.yuv"; 239 "LibYuvTest_BilinearScale_400_300.yuv";
231 ScaleSequence(method, 240 ScaleSequence(method,
232 source_file_, out_name, 241 source_file_, out_name,
233 width_, height_, 242 width_, height_,
234 400, 300); 243 400, 300);
235 } 244 }
236 245
237 TEST_F(TestScaler, DISABLED_ON_ANDROID(BoxScaleTest)) { 246 #if defined(WEBRTC_ANDROID)
247 #define MAYBE_BoxScaleTest DISABLED_BoxScaleTest
248 #else
249 #define MAYBE_BoxScaleTest BoxScaleTest
250 #endif
251 TEST_F(TestScaler, MAYBE_BoxScaleTest) {
238 double avg_psnr; 252 double avg_psnr;
239 FILE* source_file2; 253 FILE* source_file2;
240 ScaleMethod method = kScaleBox; 254 ScaleMethod method = kScaleBox;
241 std::string out_name = webrtc::test::OutputPath() + 255 std::string out_name = webrtc::test::OutputPath() +
242 "LibYuvTest_BoxScale_176_144.yuv"; 256 "LibYuvTest_BoxScale_176_144.yuv";
243 ScaleSequence(method, 257 ScaleSequence(method,
244 source_file_, out_name, 258 source_file_, out_name,
245 width_, height_, 259 width_, height_,
246 width_ / 2, height_ / 2); 260 width_ / 2, height_ / 2);
247 // Up-sample back up and check PSNR. 261 // Up-sample back up and check PSNR.
(...skipping 124 matching lines...)
372 if (frame_count) { 386 if (frame_count) {
373 printf("Scaling[%d %d] => [%d %d]: ", 387 printf("Scaling[%d %d] => [%d %d]: ",
374 src_width, src_height, dst_width, dst_height); 388 src_width, src_height, dst_width, dst_height);
375 printf("Average time per frame[ms]: %.2lf\n", 389 printf("Average time per frame[ms]: %.2lf\n",
376 (static_cast<double>(total_clock) / frame_count)); 390 (static_cast<double>(total_clock) / frame_count));
377 } 391 }
378 ASSERT_EQ(0, fclose(output_file)); 392 ASSERT_EQ(0, fclose(output_file));
379 } 393 }
380 394
381 } // namespace webrtc 395 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_audio/signal_processing/real_fft_unittest.cc ('k') | webrtc/libjingle/xmllite/xmlelement_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine