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

Side by Side Diff: media/tools/media_bench/media_bench.cc

Issue 7466003: MD5Update function uses StringPiece instead of raw buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added valid license Created 9 years, 5 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Standalone benchmarking application based on FFmpeg. This tool is used to 5 // Standalone benchmarking application based on FFmpeg. This tool is used to
6 // measure decoding performance between different FFmpeg compile and run-time 6 // measure decoding performance between different FFmpeg compile and run-time
7 // options. We also use this tool to measure performance regressions when 7 // options. We also use this tool to measure performance regressions when
8 // testing newer builds of FFmpeg from trunk. 8 // testing newer builds of FFmpeg from trunk.
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 << std::endl; 419 << std::endl;
420 return 1; 420 return 1;
421 } 421 }
422 } 422 }
423 423
424 const uint8* u8_samples = 424 const uint8* u8_samples =
425 reinterpret_cast<const uint8*>(samples.get()); 425 reinterpret_cast<const uint8*>(samples.get());
426 if (hash_djb2) { 426 if (hash_djb2) {
427 hash_value = DJB2Hash(u8_samples, size_out, hash_value); 427 hash_value = DJB2Hash(u8_samples, size_out, hash_value);
428 } 428 }
429 if (hash_md5) 429 if (hash_md5) {
430 base::MD5Update(&ctx, u8_samples, size_out); 430 base::MD5Update(
431 &ctx,
432 base::StringPiece(reinterpret_cast<const char*>(u8_samples),
433 size_out));
434 }
431 } 435 }
432 } else if (target_codec == AVMEDIA_TYPE_VIDEO) { 436 } else if (target_codec == AVMEDIA_TYPE_VIDEO) {
433 int got_picture = 0; 437 int got_picture = 0;
434 438
435 base::TimeTicks decode_start = base::TimeTicks::HighResNow(); 439 base::TimeTicks decode_start = base::TimeTicks::HighResNow();
436 result = avcodec_decode_video2(codec_context, frame.get(), 440 result = avcodec_decode_video2(codec_context, frame.get(),
437 &got_picture, &packet); 441 &got_picture, &packet);
438 base::TimeDelta delta = base::TimeTicks::HighResNow() - decode_start; 442 base::TimeDelta delta = base::TimeTicks::HighResNow() - decode_start;
439 443
440 if (got_picture) { 444 if (got_picture) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 } 484 }
481 } 485 }
482 if (hash_djb2) { 486 if (hash_djb2) {
483 for (size_t i = 0; i < copy_lines; ++i) { 487 for (size_t i = 0; i < copy_lines; ++i) {
484 hash_value = DJB2Hash(source, bytes_per_line, hash_value); 488 hash_value = DJB2Hash(source, bytes_per_line, hash_value);
485 source += source_stride; 489 source += source_stride;
486 } 490 }
487 } 491 }
488 if (hash_md5) { 492 if (hash_md5) {
489 for (size_t i = 0; i < copy_lines; ++i) { 493 for (size_t i = 0; i < copy_lines; ++i) {
490 base::MD5Update(&ctx, reinterpret_cast<const uint8*>(source), 494 base::MD5Update(
491 bytes_per_line); 495 &ctx,
496 base::StringPiece(reinterpret_cast<const char*>(source),
497 bytes_per_line));
492 source += source_stride; 498 source += source_stride;
493 } 499 }
494 } 500 }
495 } 501 }
496 } 502 }
497 } else { 503 } else {
498 NOTREACHED(); 504 NOTREACHED();
499 } 505 }
500 506
501 // Make sure our decoding went OK. 507 // Make sure our decoding went OK.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 #if defined(ENABLE_WINDOWS_EXCEPTIONS) 587 #if defined(ENABLE_WINDOWS_EXCEPTIONS)
582 } __except(EXCEPTION_EXECUTE_HANDLER) { 588 } __except(EXCEPTION_EXECUTE_HANDLER) {
583 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() 589 *log_out << " Exception:" << std::setw(11) << GetExceptionCode()
584 << " " << in_path.value() << std::endl; 590 << " " << in_path.value() << std::endl;
585 return 1; 591 return 1;
586 } 592 }
587 #endif 593 #endif
588 CommandLine::Reset(); 594 CommandLine::Reset();
589 return 0; 595 return 0;
590 } 596 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698