[x265] [PATCH 4/5] testbench: fix logic on option --cpuid

Min Chen chenm003 at 163.com
Thu Jun 20 18:53:14 CEST 2013


>From f9d61a351283fda0234f06afded193182fe96f18 Mon Sep 17 00:00:00 2001
From: Min Chen <chenm003 at 163.com>
Date: Thu, 20 Jun 2013 19:16:33 +0800
Subject: [PATCH 4/5] testbench: fix logic on option --cpuid

---
 source/test/TestBench.cpp |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/source/test/TestBench.cpp b/source/test/TestBench.cpp
index aaefc7b..b43fb88 100644
--- a/source/test/TestBench.cpp
+++ b/source/test/TestBench.cpp
@@ -84,12 +84,13 @@ int main(int argc, char *argv[])
 {
     int cpuid = instrset_detect(); // Detect supported instruction set
     const char *testname = 0;
+    int cpuid_user = -1;
 
     for (int i = 1; i < argc - 1; i += 2)
     {
         if (!strcmp(argv[i], "--cpuid"))
         {
-            cpuid = atoi(argv[i + 1]);
+            cpuid_user = atoi(argv[i + 1]);
         }
         if (!strcmp(argv[i], "--test"))
         {
@@ -121,7 +122,14 @@ int main(int argc, char *argv[])
     memset(&cprim, 0, sizeof(EncoderPrimitives));
     Setup_C_Primitives(cprim);
 
-    for (int i = 2; i <= cpuid; i++)
+    int cpuid_low = 2;
+    int cpuid_high = cpuid;
+
+    if (cpuid_user >= 0)
+    {
+        cpuid_low = cpuid_high = cpuid_user;
+    }
+    for (int i = cpuid_low; i <= cpuid_high; i++)
     {
 #if ENABLE_VECTOR_PRIMITIVES
         EncoderPrimitives vecprim;
-- 
1.7.9.msysgit.0




More information about the x265-devel mailing list