diff options
author | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-15 19:03:18 +0000 |
---|---|---|
committer | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-15 19:03:18 +0000 |
commit | 658b4fe27cae13bd99c0d8cb910d3d4ee16fea7c (patch) | |
tree | 6123be4e19cc661d43365d0caf49437052d6a12b /media/bench | |
parent | 12b1230bb1130818c1c297ae3b6aecd0a6c547bc (diff) | |
download | chromium_src-658b4fe27cae13bd99c0d8cb910d3d4ee16fea7c.zip chromium_src-658b4fe27cae13bd99c0d8cb910d3d4ee16fea7c.tar.gz chromium_src-658b4fe27cae13bd99c0d8cb910d3d4ee16fea7c.tar.bz2 |
improvements to media_bench (ffmpeg benchmarking application)
-format output into columns
-add -fast2 and -skip flags
Review URL: http://codereview.chromium.org/69004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/bench')
-rw-r--r-- | media/bench/bench.cc | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/media/bench/bench.cc b/media/bench/bench.cc index 06affca..9e8f032 100644 --- a/media/bench/bench.cc +++ b/media/bench/bench.cc @@ -7,8 +7,9 @@ // options. We also use this tool to measure performance regressions when // testing newer builds of FFmpeg from trunk. -#include <iostream> #include <windows.h> +#include <iomanip> +#include <iostream> #include "base/at_exit.h" #include "base/basictypes.h" @@ -21,6 +22,8 @@ namespace switches { const wchar_t kStream[] = L"stream"; const wchar_t kVideoThreads[] = L"video-threads"; +const wchar_t kFast2[] = L"fast2"; +const wchar_t kSkip[] = L"skip"; } // namespace switches int main(int argc, const char** argv) { @@ -35,7 +38,11 @@ int main(int argc, const char** argv) { << " --stream=[audio|video] " << "Benchmark either the audio or video stream\n" << " --video-threads=N " - << "Decode video using N threads" << std::endl; + << "Decode video using N threads\n" + << " --fast2 " + << "Enable fast2 flag\n" + << " --skip=[1|2|3] " + << "1=loop nonref, 2=loop, 3= frame nonref" << std::endl; return 1; } @@ -63,6 +70,19 @@ int main(int argc, const char** argv) { video_threads = 0; } + bool fast2 = false; + if (cmd_line->HasSwitch(switches::kFast2)) { + fast2 = true; + } + + int skip = 0; + if (cmd_line->HasSwitch(switches::kSkip)) { + std::wstring skip_opt(cmd_line->GetSwitchValue(switches::kSkip)); + if (!StringToInt(skip_opt, &skip)) { + skip = 0; + } + } + // Register FFmpeg and attempt to open file. avcodec_init(); av_register_all(); @@ -107,6 +127,18 @@ int main(int argc, const char** argv) { AVCodecContext* codec_context = format_context->streams[target_stream]->codec; AVCodec* codec = avcodec_find_decoder(codec_context->codec_id); + if (skip == 1) { + codec_context->skip_loop_filter = AVDISCARD_NONREF; + } else if (skip == 2) { + codec_context->skip_loop_filter = AVDISCARD_ALL; + } else if (skip == 3) { + codec_context->skip_loop_filter = AVDISCARD_ALL; + codec_context->skip_frame = AVDISCARD_NONREF; + } + if (fast2) { + codec_context->flags2 |= CODEC_FLAG2_FAST; + } + // Initialize threaded decode. if (target_codec == CODEC_TYPE_VIDEO && video_threads > 0) { if (avcodec_thread_init(codec_context, video_threads) < 0) { @@ -190,12 +222,19 @@ int main(int argc, const char** argv) { // Calculate the standard deviation (jitter). double stddev = sqrt(squared_sum / decode_times.size()); - // Print our results. + // Print our results. + std::cout.setf(std::ios::fixed); + std::cout.precision(3); std::cout << std::endl; - std::cout << " Frames: " << decode_times.size() << std::endl; - std::cout << " Total: " << total.InMillisecondsF() << "ms" << std::endl; - std::cout << " Summation: " << sum << "ms" << std::endl; - std::cout << " Average: " << average << "ms" << std::endl; - std::cout << " StdDev: " << stddev << "ms" << std::endl; + std::cout << " Frames:" << std::setw(10) << decode_times.size() + << std::endl; + std::cout << " Total:" << std::setw(10) << total.InMillisecondsF() + << " ms" << std::endl; + std::cout << " Summation:" << std::setw(10) << sum + << " ms" << std::endl; + std::cout << " Average:" << std::setw(10) << average + << " ms" << std::endl; + std::cout << " StdDev:" << std::setw(10) << stddev + << " ms" << std::endl; return 0; } |