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

Side by Side Diff: unit_test/compare_test.cc

Issue 1407193009: add command line cpu info to allow android neon test (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: Created 5 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 | « unit_test/color_test.cc ('k') | unit_test/convert_test.cc » ('j') | 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 EXPECT_EQ(kMaxWidth * 3 * 3, err); 257 EXPECT_EQ(kMaxWidth * 3 * 3, err);
258 258
259 for (int i = 0; i < kMaxWidth; ++i) { 259 for (int i = 0; i < kMaxWidth; ++i) {
260 src_a[i] = (fastrand() & 0xff); 260 src_a[i] = (fastrand() & 0xff);
261 src_b[i] = (fastrand() & 0xff); 261 src_b[i] = (fastrand() & 0xff);
262 } 262 }
263 263
264 MaskCpuFlags(disable_cpu_flags_); 264 MaskCpuFlags(disable_cpu_flags_);
265 uint64 c_err = ComputeSumSquareError(src_a, src_b, kMaxWidth); 265 uint64 c_err = ComputeSumSquareError(src_a, src_b, kMaxWidth);
266 266
267 MaskCpuFlags(-1); 267 MaskCpuFlags(benchmark_cpu_info_);
268 uint64 opt_err = ComputeSumSquareError(src_a, src_b, kMaxWidth); 268 uint64 opt_err = ComputeSumSquareError(src_a, src_b, kMaxWidth);
269 269
270 EXPECT_EQ(c_err, opt_err); 270 EXPECT_EQ(c_err, opt_err);
271 271
272 free_aligned_buffer_64(src_a); 272 free_aligned_buffer_64(src_a);
273 free_aligned_buffer_64(src_b); 273 free_aligned_buffer_64(src_b);
274 } 274 }
275 275
276 TEST_F(LibYUVBaseTest, BenchmarkPsnr_Opt) { 276 TEST_F(LibYUVBaseTest, BenchmarkPsnr_Opt) {
277 align_buffer_64(src_a, benchmark_width_ * benchmark_height_); 277 align_buffer_64(src_a, benchmark_width_ * benchmark_height_);
278 align_buffer_64(src_b, benchmark_width_ * benchmark_height_); 278 align_buffer_64(src_b, benchmark_width_ * benchmark_height_);
279 for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) { 279 for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) {
280 src_a[i] = i; 280 src_a[i] = i;
281 src_b[i] = i; 281 src_b[i] = i;
282 } 282 }
283 283
284 MaskCpuFlags(-1); 284 MaskCpuFlags(benchmark_cpu_info_);
285 285
286 double opt_time = get_time(); 286 double opt_time = get_time();
287 for (int i = 0; i < benchmark_iterations_; ++i) 287 for (int i = 0; i < benchmark_iterations_; ++i)
288 CalcFramePsnr(src_a, benchmark_width_, 288 CalcFramePsnr(src_a, benchmark_width_,
289 src_b, benchmark_width_, 289 src_b, benchmark_width_,
290 benchmark_width_, benchmark_height_); 290 benchmark_width_, benchmark_height_);
291 291
292 opt_time = (get_time() - opt_time) / benchmark_iterations_; 292 opt_time = (get_time() - opt_time) / benchmark_iterations_;
293 printf("BenchmarkPsnr_Opt - %8.2f us opt\n", opt_time * 1e6); 293 printf("BenchmarkPsnr_Opt - %8.2f us opt\n", opt_time * 1e6);
294 294
295 EXPECT_EQ(0, 0); 295 EXPECT_EQ(0, 0);
296 296
297 free_aligned_buffer_64(src_a); 297 free_aligned_buffer_64(src_a);
298 free_aligned_buffer_64(src_b); 298 free_aligned_buffer_64(src_b);
299 } 299 }
300 300
301 TEST_F(LibYUVBaseTest, BenchmarkPsnr_Unaligned) { 301 TEST_F(LibYUVBaseTest, BenchmarkPsnr_Unaligned) {
302 align_buffer_64(src_a, benchmark_width_ * benchmark_height_ + 1); 302 align_buffer_64(src_a, benchmark_width_ * benchmark_height_ + 1);
303 align_buffer_64(src_b, benchmark_width_ * benchmark_height_); 303 align_buffer_64(src_b, benchmark_width_ * benchmark_height_);
304 for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) { 304 for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) {
305 src_a[i + 1] = i; 305 src_a[i + 1] = i;
306 src_b[i] = i; 306 src_b[i] = i;
307 } 307 }
308 308
309 MaskCpuFlags(-1); 309 MaskCpuFlags(benchmark_cpu_info_);
310 310
311 double opt_time = get_time(); 311 double opt_time = get_time();
312 for (int i = 0; i < benchmark_iterations_; ++i) 312 for (int i = 0; i < benchmark_iterations_; ++i)
313 CalcFramePsnr(src_a + 1, benchmark_width_, 313 CalcFramePsnr(src_a + 1, benchmark_width_,
314 src_b, benchmark_width_, 314 src_b, benchmark_width_,
315 benchmark_width_, benchmark_height_); 315 benchmark_width_, benchmark_height_);
316 316
317 opt_time = (get_time() - opt_time) / benchmark_iterations_; 317 opt_time = (get_time() - opt_time) / benchmark_iterations_;
318 printf("BenchmarkPsnr_Opt - %8.2f us opt\n", opt_time * 1e6); 318 printf("BenchmarkPsnr_Opt - %8.2f us opt\n", opt_time * 1e6);
319 319
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 } 382 }
383 383
384 MaskCpuFlags(disable_cpu_flags_); 384 MaskCpuFlags(disable_cpu_flags_);
385 double c_err, opt_err; 385 double c_err, opt_err;
386 386
387 c_err = CalcFramePsnr(src_a + kSrcStride * b + b, kSrcStride, 387 c_err = CalcFramePsnr(src_a + kSrcStride * b + b, kSrcStride,
388 src_b + kSrcStride * b + b, kSrcStride, 388 src_b + kSrcStride * b + b, kSrcStride,
389 kSrcWidth, kSrcHeight); 389 kSrcWidth, kSrcHeight);
390 390
391 MaskCpuFlags(-1); 391 MaskCpuFlags(benchmark_cpu_info_);
392 392
393 opt_err = CalcFramePsnr(src_a + kSrcStride * b + b, kSrcStride, 393 opt_err = CalcFramePsnr(src_a + kSrcStride * b + b, kSrcStride,
394 src_b + kSrcStride * b + b, kSrcStride, 394 src_b + kSrcStride * b + b, kSrcStride,
395 kSrcWidth, kSrcHeight); 395 kSrcWidth, kSrcHeight);
396 396
397 EXPECT_EQ(opt_err, c_err); 397 EXPECT_EQ(opt_err, c_err);
398 398
399 free_aligned_buffer_64(src_a); 399 free_aligned_buffer_64(src_a);
400 free_aligned_buffer_64(src_b); 400 free_aligned_buffer_64(src_b);
401 } 401 }
402 402
403 TEST_F(LibYUVBaseTest, DISABLED_BenchmarkSsim_Opt) { 403 TEST_F(LibYUVBaseTest, DISABLED_BenchmarkSsim_Opt) {
404 align_buffer_64(src_a, benchmark_width_ * benchmark_height_); 404 align_buffer_64(src_a, benchmark_width_ * benchmark_height_);
405 align_buffer_64(src_b, benchmark_width_ * benchmark_height_); 405 align_buffer_64(src_b, benchmark_width_ * benchmark_height_);
406 for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) { 406 for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) {
407 src_a[i] = i; 407 src_a[i] = i;
408 src_b[i] = i; 408 src_b[i] = i;
409 } 409 }
410 410
411 MaskCpuFlags(-1); 411 MaskCpuFlags(benchmark_cpu_info_);
412 412
413 double opt_time = get_time(); 413 double opt_time = get_time();
414 for (int i = 0; i < benchmark_iterations_; ++i) 414 for (int i = 0; i < benchmark_iterations_; ++i)
415 CalcFrameSsim(src_a, benchmark_width_, 415 CalcFrameSsim(src_a, benchmark_width_,
416 src_b, benchmark_width_, 416 src_b, benchmark_width_,
417 benchmark_width_, benchmark_height_); 417 benchmark_width_, benchmark_height_);
418 418
419 opt_time = (get_time() - opt_time) / benchmark_iterations_; 419 opt_time = (get_time() - opt_time) / benchmark_iterations_;
420 printf("BenchmarkSsim_Opt - %8.2f us opt\n", opt_time * 1e6); 420 printf("BenchmarkSsim_Opt - %8.2f us opt\n", opt_time * 1e6);
421 421
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 490 }
491 } 491 }
492 492
493 MaskCpuFlags(disable_cpu_flags_); 493 MaskCpuFlags(disable_cpu_flags_);
494 double c_err, opt_err; 494 double c_err, opt_err;
495 495
496 c_err = CalcFrameSsim(src_a + kSrcStride * b + b, kSrcStride, 496 c_err = CalcFrameSsim(src_a + kSrcStride * b + b, kSrcStride,
497 src_b + kSrcStride * b + b, kSrcStride, 497 src_b + kSrcStride * b + b, kSrcStride,
498 kSrcWidth, kSrcHeight); 498 kSrcWidth, kSrcHeight);
499 499
500 MaskCpuFlags(-1); 500 MaskCpuFlags(benchmark_cpu_info_);
501 501
502 opt_err = CalcFrameSsim(src_a + kSrcStride * b + b, kSrcStride, 502 opt_err = CalcFrameSsim(src_a + kSrcStride * b + b, kSrcStride,
503 src_b + kSrcStride * b + b, kSrcStride, 503 src_b + kSrcStride * b + b, kSrcStride,
504 kSrcWidth, kSrcHeight); 504 kSrcWidth, kSrcHeight);
505 505
506 if (kSrcWidth > 8 && kSrcHeight > 8) { 506 if (kSrcWidth > 8 && kSrcHeight > 8) {
507 EXPECT_EQ(opt_err, c_err); 507 EXPECT_EQ(opt_err, c_err);
508 } 508 }
509 509
510 free_aligned_buffer_64(src_a); 510 free_aligned_buffer_64(src_a);
511 free_aligned_buffer_64(src_b); 511 free_aligned_buffer_64(src_b);
512 } 512 }
513 513
514 } // namespace libyuv 514 } // namespace libyuv
OLDNEW
« no previous file with comments | « unit_test/color_test.cc ('k') | unit_test/convert_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698