| 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 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 width_, height_, | 107 width_, height_, |
| 108 width_, half_width_, half_width_); | 108 width_, half_width_, half_width_); |
| 109 EXPECT_EQ(0, test_scaler_.Scale(test_frame_, &test_frame2)); | 109 EXPECT_EQ(0, test_scaler_.Scale(test_frame_, &test_frame2)); |
| 110 EXPECT_GT(width_ * height_, test_frame2.allocated_size(kYPlane)); | 110 EXPECT_GT(width_ * height_, test_frame2.allocated_size(kYPlane)); |
| 111 EXPECT_GT(size_uv_, test_frame2.allocated_size(kUPlane)); | 111 EXPECT_GT(size_uv_, test_frame2.allocated_size(kUPlane)); |
| 112 EXPECT_GT(size_uv_, test_frame2.allocated_size(kVPlane)); | 112 EXPECT_GT(size_uv_, test_frame2.allocated_size(kVPlane)); |
| 113 EXPECT_EQ(half_width_, test_frame2.width()); | 113 EXPECT_EQ(half_width_, test_frame2.width()); |
| 114 EXPECT_EQ(half_height_, test_frame2.height()); | 114 EXPECT_EQ(half_height_, test_frame2.height()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 //TODO (mikhal): Converge the test into one function that accepts the method. | 117 // TODO(mikhal): Converge the test into one function that accepts the method. |
| 118 TEST_F(TestScaler, DISABLED_ON_ANDROID(PointScaleTest)) { | 118 TEST_F(TestScaler, DISABLED_ON_ANDROID(PointScaleTest)) { |
| 119 double avg_psnr; | 119 double avg_psnr; |
| 120 FILE* source_file2; | 120 FILE* source_file2; |
| 121 ScaleMethod method = kScalePoint; | 121 ScaleMethod method = kScalePoint; |
| 122 std::string out_name = webrtc::test::OutputPath() + | 122 std::string out_name = webrtc::test::OutputPath() + |
| 123 "LibYuvTest_PointScale_176_144.yuv"; | 123 "LibYuvTest_PointScale_176_144.yuv"; |
| 124 ScaleSequence(method, | 124 ScaleSequence(method, |
| 125 source_file_, out_name, | 125 source_file_, out_name, |
| 126 width_, height_, | 126 width_, height_, |
| 127 half_width_, half_height_); | 127 half_width_, half_height_); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 double psnr = I420PSNR(&in_frame, &out_frame); | 315 double psnr = I420PSNR(&in_frame, &out_frame); |
| 316 avg_psnr += psnr; | 316 avg_psnr += psnr; |
| 317 } | 317 } |
| 318 avg_psnr = avg_psnr / frame_count; | 318 avg_psnr = avg_psnr / frame_count; |
| 319 assert(0 == fclose(output_file)); | 319 assert(0 == fclose(output_file)); |
| 320 delete [] input_buffer; | 320 delete [] input_buffer; |
| 321 delete [] output_buffer; | 321 delete [] output_buffer; |
| 322 return avg_psnr; | 322 return avg_psnr; |
| 323 } | 323 } |
| 324 | 324 |
| 325 // TODO (mikhal): Move part to a separate scale test. | 325 // TODO(mikhal): Move part to a separate scale test. |
| 326 void TestScaler::ScaleSequence(ScaleMethod method, | 326 void TestScaler::ScaleSequence(ScaleMethod method, |
| 327 FILE* source_file, std::string out_name, | 327 FILE* source_file, std::string out_name, |
| 328 int src_width, int src_height, | 328 int src_width, int src_height, |
| 329 int dst_width, int dst_height) { | 329 int dst_width, int dst_height) { |
| 330 FILE* output_file; | 330 FILE* output_file; |
| 331 EXPECT_EQ(0, test_scaler_.Set(src_width, src_height, | 331 EXPECT_EQ(0, test_scaler_.Set(src_width, src_height, |
| 332 dst_width, dst_height, | 332 dst_width, dst_height, |
| 333 kI420, kI420, method)); | 333 kI420, kI420, method)); |
| 334 | 334 |
| 335 output_file = fopen(out_name.c_str(), "wb"); | 335 output_file = fopen(out_name.c_str(), "wb"); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 if (frame_count) { | 372 if (frame_count) { |
| 373 printf("Scaling[%d %d] => [%d %d]: ", | 373 printf("Scaling[%d %d] => [%d %d]: ", |
| 374 src_width, src_height, dst_width, dst_height); | 374 src_width, src_height, dst_width, dst_height); |
| 375 printf("Average time per frame[ms]: %.2lf\n", | 375 printf("Average time per frame[ms]: %.2lf\n", |
| 376 (static_cast<double>(total_clock) / frame_count)); | 376 (static_cast<double>(total_clock) / frame_count)); |
| 377 } | 377 } |
| 378 ASSERT_EQ(0, fclose(output_file)); | 378 ASSERT_EQ(0, fclose(output_file)); |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace webrtc | 381 } // namespace webrtc |
| OLD | NEW |