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 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2092 align_buffer_page_end(dst_c, y_plane_size); | 2092 align_buffer_page_end(dst_c, y_plane_size); |
2093 align_buffer_page_end(dst_opt, y_plane_size); | 2093 align_buffer_page_end(dst_opt, y_plane_size); |
2094 MemRandomize(orig_y, y_plane_size); | 2094 MemRandomize(orig_y, y_plane_size); |
2095 memset(dst_c, 0, y_plane_size); | 2095 memset(dst_c, 0, y_plane_size); |
2096 memset(dst_opt, 1, y_plane_size); | 2096 memset(dst_opt, 1, y_plane_size); |
2097 | 2097 |
2098 // Disable all optimizations. | 2098 // Disable all optimizations. |
2099 MaskCpuFlags(disable_cpu_flags); | 2099 MaskCpuFlags(disable_cpu_flags); |
2100 double c_time = get_time(); | 2100 double c_time = get_time(); |
2101 for (j = 0; j < benchmark_iterations; j++) { | 2101 for (j = 0; j < benchmark_iterations; j++) { |
2102 HalfFloatPlane((uint16*)orig_y, benchmark_width * 2, | 2102 HalfFloatPlane(reinterpret_cast<uint16*>(orig_y), benchmark_width * 2, |
2103 (uint16*)dst_c, benchmark_width * 2, | 2103 reinterpret_cast<uint16*>(dst_c), benchmark_width * 2, |
2104 scale, benchmark_width, benchmark_height); | 2104 scale, benchmark_width, benchmark_height); |
2105 } | 2105 } |
2106 c_time = (get_time() - c_time) / benchmark_iterations; | 2106 c_time = (get_time() - c_time) / benchmark_iterations; |
2107 | 2107 |
2108 // Enable optimizations. | 2108 // Enable optimizations. |
2109 MaskCpuFlags(benchmark_cpu_info); | 2109 MaskCpuFlags(benchmark_cpu_info); |
2110 double opt_time = get_time(); | 2110 double opt_time = get_time(); |
2111 for (j = 0; j < benchmark_iterations; j++) { | 2111 for (j = 0; j < benchmark_iterations; j++) { |
2112 HalfFloatPlane((uint16*)orig_y, benchmark_width * 2, | 2112 HalfFloatPlane(reinterpret_cast<uint16*>(orig_y), benchmark_width * 2, |
2113 (uint16*)dst_opt, benchmark_width * 2, | 2113 reinterpret_cast<uint16*>(dst_opt), benchmark_width * 2, |
2114 scale, benchmark_width, benchmark_height); | 2114 scale, benchmark_width, benchmark_height); |
2115 } | 2115 } |
2116 opt_time = (get_time() - opt_time) / benchmark_iterations; | 2116 opt_time = (get_time() - opt_time) / benchmark_iterations; |
2117 | 2117 |
2118 int diff = 0; | 2118 int diff = 0; |
2119 for (i = 0; i < y_plane_size; ++i) { | 2119 for (i = 0; i < y_plane_size; ++i) { |
2120 diff = dst_c[i] - dst_opt[i]; | 2120 diff = dst_c[i] - dst_opt[i]; |
2121 if (diff) break; | 2121 if (diff) break; |
2122 } | 2122 } |
2123 | 2123 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2520 } | 2520 } |
2521 | 2521 |
2522 free_aligned_buffer_page_end(src_pixels); | 2522 free_aligned_buffer_page_end(src_pixels); |
2523 free_aligned_buffer_page_end(tmp_pixels_u); | 2523 free_aligned_buffer_page_end(tmp_pixels_u); |
2524 free_aligned_buffer_page_end(tmp_pixels_v); | 2524 free_aligned_buffer_page_end(tmp_pixels_v); |
2525 free_aligned_buffer_page_end(dst_pixels_opt); | 2525 free_aligned_buffer_page_end(dst_pixels_opt); |
2526 free_aligned_buffer_page_end(dst_pixels_c); | 2526 free_aligned_buffer_page_end(dst_pixels_c); |
2527 } | 2527 } |
2528 | 2528 |
2529 } // namespace libyuv | 2529 } // namespace libyuv |
OLD | NEW |