OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 The LibYuv 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 10 matching lines...) Expand all Loading... |
21 namespace libyuv { | 21 namespace libyuv { |
22 | 22 |
23 #define STRINGIZE(line) #line | 23 #define STRINGIZE(line) #line |
24 #define FILELINESTR(file, line) file ":" STRINGIZE(line) | 24 #define FILELINESTR(file, line) file ":" STRINGIZE(line) |
25 | 25 |
26 // Test scaling with C vs Opt and return maximum pixel difference. 0 = exact. | 26 // Test scaling with C vs Opt and return maximum pixel difference. 0 = exact. |
27 static int ARGBTestFilter(int src_width, int src_height, | 27 static int ARGBTestFilter(int src_width, int src_height, |
28 int dst_width, int dst_height, | 28 int dst_width, int dst_height, |
29 FilterMode f, int benchmark_iterations, | 29 FilterMode f, int benchmark_iterations, |
30 int disable_cpu_flags, int benchmark_cpu_info) { | 30 int disable_cpu_flags, int benchmark_cpu_info) { |
| 31 if (!SizeValid(src_width, src_height, dst_width, dst_height)) { |
| 32 return 0; |
| 33 } |
| 34 |
31 int i, j; | 35 int i, j; |
32 const int b = 0; // 128 to test for padding/stride. | 36 const int b = 0; // 128 to test for padding/stride. |
33 int64 src_argb_plane_size = (Abs(src_width) + b * 2) * | 37 int64 src_argb_plane_size = (Abs(src_width) + b * 2) * |
34 (Abs(src_height) + b * 2) * 4LL; | 38 (Abs(src_height) + b * 2) * 4LL; |
35 int src_stride_argb = (b * 2 + Abs(src_width)) * 4; | 39 int src_stride_argb = (b * 2 + Abs(src_width)) * 4; |
36 | 40 |
37 align_buffer_page_end(src_argb, src_argb_plane_size); | 41 align_buffer_page_end(src_argb, src_argb_plane_size); |
38 if (!src_argb) { | 42 if (!src_argb) { |
39 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); | 43 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); |
40 return 0; | 44 return 0; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return r; | 140 return r; |
137 } | 141 } |
138 } | 142 } |
139 } | 143 } |
140 return 0; | 144 return 0; |
141 } | 145 } |
142 | 146 |
143 static int ARGBClipTestFilter(int src_width, int src_height, | 147 static int ARGBClipTestFilter(int src_width, int src_height, |
144 int dst_width, int dst_height, | 148 int dst_width, int dst_height, |
145 FilterMode f, int benchmark_iterations) { | 149 FilterMode f, int benchmark_iterations) { |
| 150 if (!SizeValid(src_width, src_height, dst_width, dst_height)) { |
| 151 return 0; |
| 152 } |
| 153 |
146 const int b = 128; | 154 const int b = 128; |
147 int64 src_argb_plane_size = (Abs(src_width) + b * 2) * | 155 int64 src_argb_plane_size = (Abs(src_width) + b * 2) * |
148 (Abs(src_height) + b * 2) * 4; | 156 (Abs(src_height) + b * 2) * 4; |
149 int src_stride_argb = (b * 2 + Abs(src_width)) * 4; | 157 int src_stride_argb = (b * 2 + Abs(src_width)) * 4; |
150 | 158 |
151 align_buffer_64(src_argb, src_argb_plane_size); | 159 align_buffer_64(src_argb, src_argb_plane_size); |
152 if (!src_argb) { | 160 if (!src_argb) { |
153 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); | 161 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); |
154 return 0; | 162 return 0; |
155 } | 163 } |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 benchmark_height_ * 3 / 2, | 455 benchmark_height_ * 3 / 2, |
448 benchmark_width_, benchmark_height_, | 456 benchmark_width_, benchmark_height_, |
449 libyuv::kFilterBilinear, | 457 libyuv::kFilterBilinear, |
450 benchmark_iterations_, | 458 benchmark_iterations_, |
451 disable_cpu_flags_, benchmark_cpu_info_); | 459 disable_cpu_flags_, benchmark_cpu_info_); |
452 EXPECT_LE(diff, 10); | 460 EXPECT_LE(diff, 10); |
453 } | 461 } |
454 | 462 |
455 | 463 |
456 } // namespace libyuv | 464 } // namespace libyuv |
OLD | NEW |