| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 16 matching lines...) Expand all Loading... |
| 27 #include "base/md5.h" | 27 #include "base/md5.h" |
| 28 #include "base/string_util.h" | 28 #include "base/string_util.h" |
| 29 #include "base/time.h" | 29 #include "base/time.h" |
| 30 #include "media/base/djb2.h" | 30 #include "media/base/djb2.h" |
| 31 #include "media/base/media.h" | 31 #include "media/base/media.h" |
| 32 #include "media/bench/file_protocol.h" | 32 #include "media/bench/file_protocol.h" |
| 33 #include "media/filters/ffmpeg_common.h" | 33 #include "media/filters/ffmpeg_common.h" |
| 34 #include "media/filters/ffmpeg_video_decoder.h" | 34 #include "media/filters/ffmpeg_video_decoder.h" |
| 35 | 35 |
| 36 namespace switches { | 36 namespace switches { |
| 37 const wchar_t kStream[] = L"stream"; | 37 const char kStream[] = "stream"; |
| 38 const wchar_t kVideoThreads[] = L"video-threads"; | 38 const char kVideoThreads[] = "video-threads"; |
| 39 const wchar_t kVerbose[] = L"verbose"; | 39 const char kVerbose[] = "verbose"; |
| 40 const wchar_t kFast2[] = L"fast2"; | 40 const char kFast2[] = "fast2"; |
| 41 const wchar_t kSkip[] = L"skip"; | 41 const char kSkip[] = "skip"; |
| 42 const wchar_t kFlush[] = L"flush"; | 42 const char kFlush[] = "flush"; |
| 43 const wchar_t kDjb2[] = L"djb2"; | 43 const char kDjb2[] = "djb2"; |
| 44 const wchar_t kMd5[] = L"md5"; | 44 const char kMd5[] = "md5"; |
| 45 const wchar_t kFrames[] = L"frames"; | 45 const char kFrames[] = "frames"; |
| 46 const wchar_t kLoop[] = L"loop"; | 46 const char kLoop[] = "loop"; |
| 47 | 47 |
| 48 } // namespace switches | 48 } // namespace switches |
| 49 | 49 |
| 50 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
| 51 // warning: disable warning about exception handler. | 51 // warning: disable warning about exception handler. |
| 52 #pragma warning(disable:4509) | 52 #pragma warning(disable:4509) |
| 53 | 53 |
| 54 // Thread priorities to make benchmark more stable. | 54 // Thread priorities to make benchmark more stable. |
| 55 | 55 |
| 56 void EnterTimingSection() { | 56 void EnterTimingSection() { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 // Retrieve command line options. | 119 // Retrieve command line options. |
| 120 std::string in_path(WideToUTF8(filenames[0])); | 120 std::string in_path(WideToUTF8(filenames[0])); |
| 121 std::string out_path; | 121 std::string out_path; |
| 122 if (filenames.size() > 1) { | 122 if (filenames.size() > 1) { |
| 123 out_path = WideToUTF8(filenames[1]); | 123 out_path = WideToUTF8(filenames[1]); |
| 124 } | 124 } |
| 125 CodecType target_codec = CODEC_TYPE_UNKNOWN; | 125 CodecType target_codec = CODEC_TYPE_UNKNOWN; |
| 126 | 126 |
| 127 // Determine whether to benchmark audio or video decoding. | 127 // Determine whether to benchmark audio or video decoding. |
| 128 std::wstring stream(cmd_line->GetSwitchValue(switches::kStream)); | 128 std::string stream(cmd_line->GetSwitchValueASCII(switches::kStream)); |
| 129 if (!stream.empty()) { | 129 if (!stream.empty()) { |
| 130 if (stream.compare(L"audio") == 0) { | 130 if (stream.compare("audio") == 0) { |
| 131 target_codec = CODEC_TYPE_AUDIO; | 131 target_codec = CODEC_TYPE_AUDIO; |
| 132 } else if (stream.compare(L"video") == 0) { | 132 } else if (stream.compare("video") == 0) { |
| 133 target_codec = CODEC_TYPE_VIDEO; | 133 target_codec = CODEC_TYPE_VIDEO; |
| 134 } else { | 134 } else { |
| 135 std::cerr << "Unknown --stream option " << stream << std::endl; | 135 std::cerr << "Unknown --stream option " << stream << std::endl; |
| 136 return 1; | 136 return 1; |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 // Determine number of threads to use for video decoding (optional). | 140 // Determine number of threads to use for video decoding (optional). |
| 141 int video_threads = 0; | 141 int video_threads = 0; |
| 142 std::wstring threads(cmd_line->GetSwitchValue(switches::kVideoThreads)); | 142 std::wstring threads(cmd_line->GetSwitchValue(switches::kVideoThreads)); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 } | 527 } |
| 528 #if defined(OS_WIN) | 528 #if defined(OS_WIN) |
| 529 } __except(EXCEPTION_EXECUTE_HANDLER) { | 529 } __except(EXCEPTION_EXECUTE_HANDLER) { |
| 530 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() | 530 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() |
| 531 << " " << in_path << std::endl; | 531 << " " << in_path << std::endl; |
| 532 return 1; | 532 return 1; |
| 533 } | 533 } |
| 534 #endif | 534 #endif |
| 535 return 0; | 535 return 0; |
| 536 } | 536 } |
| OLD | NEW |