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 (src_width > 32768 || src_height > 32768 || | |
harryjin
2016/05/04 04:33:44
Use a constant?
harryjin
2016/05/04 04:33:44
This whole check can be refactored out to a helper
fbarchard1
2016/05/05 23:37:02
Done.
fbarchard1
2016/05/05 23:37:02
Done.
| |
32 dst_width > 32768 || dst_height > 32768) { | |
33 printf("Warning - size too large to test. Skipping\n"); | |
34 return 0; | |
35 } | |
31 int i, j; | 36 int i, j; |
32 const int b = 0; // 128 to test for padding/stride. | 37 const int b = 0; // 128 to test for padding/stride. |
33 int64 src_argb_plane_size = (Abs(src_width) + b * 2) * | 38 int64 src_argb_plane_size = (Abs(src_width) + b * 2) * |
34 (Abs(src_height) + b * 2) * 4LL; | 39 (Abs(src_height) + b * 2) * 4LL; |
35 int src_stride_argb = (b * 2 + Abs(src_width)) * 4; | 40 int src_stride_argb = (b * 2 + Abs(src_width)) * 4; |
36 | 41 |
37 align_buffer_page_end(src_argb, src_argb_plane_size); | 42 align_buffer_page_end(src_argb, src_argb_plane_size); |
38 if (!src_argb) { | 43 if (!src_argb) { |
39 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); | 44 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); |
40 return 0; | 45 return 0; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 return r; | 141 return r; |
137 } | 142 } |
138 } | 143 } |
139 } | 144 } |
140 return 0; | 145 return 0; |
141 } | 146 } |
142 | 147 |
143 static int ARGBClipTestFilter(int src_width, int src_height, | 148 static int ARGBClipTestFilter(int src_width, int src_height, |
144 int dst_width, int dst_height, | 149 int dst_width, int dst_height, |
145 FilterMode f, int benchmark_iterations) { | 150 FilterMode f, int benchmark_iterations) { |
151 if (src_width > 32768 || src_height > 32768 || | |
152 dst_width > 32768 || dst_height > 32768) { | |
153 printf("Warning - size too large to test. Skipping\n"); | |
154 return 0; | |
155 } | |
146 const int b = 128; | 156 const int b = 128; |
147 int64 src_argb_plane_size = (Abs(src_width) + b * 2) * | 157 int64 src_argb_plane_size = (Abs(src_width) + b * 2) * |
148 (Abs(src_height) + b * 2) * 4; | 158 (Abs(src_height) + b * 2) * 4; |
149 int src_stride_argb = (b * 2 + Abs(src_width)) * 4; | 159 int src_stride_argb = (b * 2 + Abs(src_width)) * 4; |
150 | 160 |
151 align_buffer_64(src_argb, src_argb_plane_size); | 161 align_buffer_64(src_argb, src_argb_plane_size); |
152 if (!src_argb) { | 162 if (!src_argb) { |
153 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); | 163 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); |
154 return 0; | 164 return 0; |
155 } | 165 } |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 benchmark_height_ * 3 / 2, | 457 benchmark_height_ * 3 / 2, |
448 benchmark_width_, benchmark_height_, | 458 benchmark_width_, benchmark_height_, |
449 libyuv::kFilterBilinear, | 459 libyuv::kFilterBilinear, |
450 benchmark_iterations_, | 460 benchmark_iterations_, |
451 disable_cpu_flags_, benchmark_cpu_info_); | 461 disable_cpu_flags_, benchmark_cpu_info_); |
452 EXPECT_LE(diff, 10); | 462 EXPECT_LE(diff, 10); |
453 } | 463 } |
454 | 464 |
455 | 465 |
456 } // namespace libyuv | 466 } // namespace libyuv |
OLD | NEW |