Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: unit_test/planar_test.cc

Issue 2487603002: Remove unused time variables (Closed)
Patch Set: Remove unused time variables and use random content. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 dst_opt[i] = dst_c[i]; 1367 dst_opt[i] = dst_c[i];
1368 } 1368 }
1369 1369
1370 int y_off = b * (yw + b * 2) + b; 1370 int y_off = b * (yw + b * 2) + b;
1371 1371
1372 int y_st = yw + b * 2; 1372 int y_st = yw + b * 2;
1373 int stride = 8; 1373 int stride = 8;
1374 1374
1375 // Disable all optimizations. 1375 // Disable all optimizations.
1376 MaskCpuFlags(disable_cpu_flags_); 1376 MaskCpuFlags(disable_cpu_flags_);
1377 double c_time = get_time();
1378 for (j = 0; j < benchmark_iterations_; j++) { 1377 for (j = 0; j < benchmark_iterations_; j++) {
1379 CopyPlane(orig_y + y_off, y_st, dst_c + y_off, stride, yw, yh); 1378 CopyPlane(orig_y + y_off, y_st, dst_c + y_off, stride, yw, yh);
1380 } 1379 }
1381 c_time = (get_time() - c_time) / benchmark_iterations_;
1382 1380
1383 // Enable optimizations. 1381 // Enable optimizations.
1384 MaskCpuFlags(benchmark_cpu_info_); 1382 MaskCpuFlags(benchmark_cpu_info_);
1385 double opt_time = get_time();
1386 for (j = 0; j < benchmark_iterations_; j++) { 1383 for (j = 0; j < benchmark_iterations_; j++) {
1387 CopyPlane(orig_y + y_off, y_st, dst_opt + y_off, stride, yw, yh); 1384 CopyPlane(orig_y + y_off, y_st, dst_opt + y_off, stride, yw, yh);
1388 } 1385 }
1389 opt_time = (get_time() - opt_time) / benchmark_iterations_;
1390 1386
1391 for (i = 0; i < y_plane_size; ++i) { 1387 for (i = 0; i < y_plane_size; ++i) {
1392 if (dst_c[i] != dst_opt[i]) 1388 if (dst_c[i] != dst_opt[i])
1393 ++err; 1389 ++err;
1394 } 1390 }
1395 1391
1396 free_aligned_buffer_page_end(orig_y); 1392 free_aligned_buffer_page_end(orig_y);
1397 free_aligned_buffer_page_end(dst_c); 1393 free_aligned_buffer_page_end(dst_c);
1398 free_aligned_buffer_page_end(dst_opt); 1394 free_aligned_buffer_page_end(dst_opt);
1399 1395
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 2042
2047 align_buffer_page_end(orig_y, y_plane_size * 3); 2043 align_buffer_page_end(orig_y, y_plane_size * 3);
2048 uint8* dst_opt = orig_y + y_plane_size; 2044 uint8* dst_opt = orig_y + y_plane_size;
2049 uint8* dst_c = orig_y + y_plane_size * 2; 2045 uint8* dst_c = orig_y + y_plane_size * 2;
2050 2046
2051 MemRandomize(orig_y, y_plane_size); 2047 MemRandomize(orig_y, y_plane_size);
2052 memset(dst_c, 0, y_plane_size); 2048 memset(dst_c, 0, y_plane_size);
2053 memset(dst_opt, 1, y_plane_size); 2049 memset(dst_opt, 1, y_plane_size);
2054 2050
2055 for (i = 0; i < y_plane_size / 2; ++i) { 2051 for (i = 0; i < y_plane_size / 2; ++i) {
2056 reinterpret_cast<uint16*>(orig_y)[i] = static_cast<uint16>(i & mask); 2052 reinterpret_cast<uint16*>(orig_y)[i] &= mask;
2057 } 2053 }
2058 2054
2059 // Disable all optimizations. 2055 // Disable all optimizations.
2060 MaskCpuFlags(disable_cpu_flags); 2056 MaskCpuFlags(disable_cpu_flags);
2061 double c_time = get_time();
2062 for (j = 0; j < benchmark_iterations; j++) { 2057 for (j = 0; j < benchmark_iterations; j++) {
2063 HalfFloatPlane(reinterpret_cast<uint16*>(orig_y), benchmark_width * 2, 2058 HalfFloatPlane(reinterpret_cast<uint16*>(orig_y), benchmark_width * 2,
2064 reinterpret_cast<uint16*>(dst_c), benchmark_width * 2, scale, 2059 reinterpret_cast<uint16*>(dst_c), benchmark_width * 2, scale,
2065 benchmark_width, benchmark_height); 2060 benchmark_width, benchmark_height);
2066 } 2061 }
2067 c_time = (get_time() - c_time) / benchmark_iterations;
2068 2062
2069 // Enable optimizations. 2063 // Enable optimizations.
2070 MaskCpuFlags(benchmark_cpu_info); 2064 MaskCpuFlags(benchmark_cpu_info);
2071 double opt_time = get_time();
2072 for (j = 0; j < benchmark_iterations; j++) { 2065 for (j = 0; j < benchmark_iterations; j++) {
2073 HalfFloatPlane(reinterpret_cast<uint16*>(orig_y), benchmark_width * 2, 2066 HalfFloatPlane(reinterpret_cast<uint16*>(orig_y), benchmark_width * 2,
2074 reinterpret_cast<uint16*>(dst_opt), benchmark_width * 2, 2067 reinterpret_cast<uint16*>(dst_opt), benchmark_width * 2,
2075 scale, benchmark_width, benchmark_height); 2068 scale, benchmark_width, benchmark_height);
2076 } 2069 }
2077 opt_time = (get_time() - opt_time) / benchmark_iterations;
2078 2070
2079 int max_diff = 0; 2071 int max_diff = 0;
2080 for (i = 0; i < y_plane_size / 2; ++i) { 2072 for (i = 0; i < y_plane_size / 2; ++i) {
2081 int abs_diff = abs(static_cast<int>(reinterpret_cast<uint16*>(dst_c)[i]) - 2073 int abs_diff = abs(static_cast<int>(reinterpret_cast<uint16*>(dst_c)[i]) -
2082 static_cast<int>(reinterpret_cast<uint16*>(dst_opt)[i])); 2074 static_cast<int>(reinterpret_cast<uint16*>(dst_opt)[i]));
2083 if (abs_diff > max_diff) { 2075 if (abs_diff > max_diff) {
2084 max_diff = abs_diff; 2076 max_diff = abs_diff;
2085 } 2077 }
2086 } 2078 }
2087 2079
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
2519 } 2511 }
2520 2512
2521 free_aligned_buffer_page_end(src_pixels); 2513 free_aligned_buffer_page_end(src_pixels);
2522 free_aligned_buffer_page_end(tmp_pixels_u); 2514 free_aligned_buffer_page_end(tmp_pixels_u);
2523 free_aligned_buffer_page_end(tmp_pixels_v); 2515 free_aligned_buffer_page_end(tmp_pixels_v);
2524 free_aligned_buffer_page_end(dst_pixels_opt); 2516 free_aligned_buffer_page_end(dst_pixels_opt);
2525 free_aligned_buffer_page_end(dst_pixels_c); 2517 free_aligned_buffer_page_end(dst_pixels_c);
2526 } 2518 }
2527 2519
2528 } // namespace libyuv 2520 } // namespace libyuv
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698