[FFmpeg-cvslog] cmdutils: add -cpuflags.

Michael Niedermayer git at videolan.org
Sun Feb 19 22:11:59 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Feb 19 16:51:25 2012 +0100| [1060e9ce5454e7ac009969ab2cf8f7cd83a69ac3] | committer: Michael Niedermayer

cmdutils: add -cpuflags.

This allows globally forcing specific cpuflags (or lack thereof)
Useful for debugging and benchmarking

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1060e9ce5454e7ac009969ab2cf8f7cd83a69ac3
---

 cmdutils.c             |   13 +++++++++++++
 cmdutils.h             |    2 ++
 cmdutils_common_opts.h |    1 +
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index 218c9f0..9248c9c 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -535,6 +535,19 @@ int opt_max_alloc(const char *opt, const char *arg)
     return 0;
 }
 
+int opt_cpuflags(const char *opt, const char *arg)
+{
+    char *tail;
+    long flags = strtol(arg, &tail, 10);
+
+    if (*tail) {
+        av_log(NULL, AV_LOG_FATAL, "Invalid cpuflags \"%s\".\n", arg);
+        exit_program(1);
+    }
+    av_force_cpu_flags(flags);
+    return 0;
+}
+
 int opt_codec_debug(const char *opt, const char *arg)
 {
     av_log_set_level(AV_LOG_DEBUG);
diff --git a/cmdutils.h b/cmdutils.h
index 35bef38..ae7a87a 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -85,6 +85,8 @@ int opt_report(const char *opt);
 
 int opt_max_alloc(const char *opt, const char *arg);
 
+int opt_cpuflags(const char *opt, const char *arg);
+
 int opt_codec_debug(const char *opt, const char *arg);
 
 /**
diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h
index 0aa6d99..044f63b 100644
--- a/cmdutils_common_opts.h
+++ b/cmdutils_common_opts.h
@@ -16,3 +16,4 @@
     { "debug", HAS_ARG, {(void*)opt_codec_debug}, "set debug flags", "flags" },
     { "report", 0, {(void*)opt_report}, "generate a report" },
     { "max_alloc", HAS_ARG, {(void*)opt_max_alloc}, "set maximum size of a single allocated block", "bytes" },
+    { "cpuflags", HAS_ARG, {(void*)opt_cpuflags}, "force specific cpu flags", "flags" },



More information about the ffmpeg-cvslog mailing list