aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2017-03-13 18:06:55 -0700
committerCommit Bot <commit-bot@chromium.org>2017-03-14 01:52:52 +0000
commit2adb84e39e360723d19c68f315d99e3e0f88318c (patch)
treebe861b22c9c9ae35029864d6aa63aa8a5bb2351b
parentd59d3fcd1810e40745db7fb95417c1ba1909e4a5 (diff)
downloadlibyuv-2adb84e39e360723d19c68f315d99e3e0f88318c.tar.gz
make gflags command line parser optional
BUG=libyuv:691 TEST=gn gen out/Release "--args=is_debug=false target_cpu=\"x64\" libyuv_include_tests=true" Change-Id: Ib481189be884c34d9bbc30bfcf71c7969c6f4dae Reviewed-on: https://chromium-review.googlesource.com/452736 Reviewed-by: Frank Barchard <fbarchard@google.com> Commit-Queue: Frank Barchard <fbarchard@google.com>
-rw-r--r--BUILD.gn14
-rw-r--r--README.chromium2
-rw-r--r--include/libyuv/version.h2
-rw-r--r--source/rotate_win.cc11
-rw-r--r--unit_test/unit_test.cc13
5 files changed, 32 insertions, 10 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 4f56cdc2..bcb66b6d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -9,6 +9,11 @@
import("libyuv.gni")
import("//testing/test.gni")
+declare_args() {
+ # Set to false to disable building with gflags.
+ libyuv_use_gflags = true
+}
+
config("libyuv_config") {
include_dirs = [ "include" ]
if (is_android && current_cpu == "arm64") {
@@ -231,9 +236,14 @@ if (libyuv_include_tests) {
deps = [
":libyuv",
"//testing/gtest",
- "//third_party/gflags",
]
+ defines = []
+ if (libyuv_use_gflags) {
+ defines += [ "LIBYUV_USE_GFLAGS" ]
+ deps += [ "//third_party/gflags" ]
+ }
+
configs += [ ":libyuv_unittest_warnings_config" ]
public_deps = [
@@ -241,8 +251,6 @@ if (libyuv_include_tests) {
]
public_configs = [ ":libyuv_unittest_config" ]
- defines = []
-
if (is_linux) {
cflags = [ "-fexceptions" ]
}
diff --git a/README.chromium b/README.chromium
index 2512b38d..110884d2 100644
--- a/README.chromium
+++ b/README.chromium
@@ -1,6 +1,6 @@
Name: libyuv
URL: http://code.google.com/p/libyuv/
-Version: 1649
+Version: 1650
License: BSD
License File: LICENSE
diff --git a/include/libyuv/version.h b/include/libyuv/version.h
index 5d56cf06..324ed07d 100644
--- a/include/libyuv/version.h
+++ b/include/libyuv/version.h
@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_
-#define LIBYUV_VERSION 1649
+#define LIBYUV_VERSION 1650
#endif // INCLUDE_LIBYUV_VERSION_H_
diff --git a/source/rotate_win.cc b/source/rotate_win.cc
index 044048d3..93a5c28a 100644
--- a/source/rotate_win.cc
+++ b/source/rotate_win.cc
@@ -137,9 +137,9 @@ __declspec(naked) void TransposeUVWx8_SSE2(const uint8* src,
mov ecx, [ecx + 16 + 28] // w
align 4
- convertloop:
- // Read in the data from the source pointer.
- // First round of bit swap.
+ // Read in the data from the source pointer.
+ // First round of bit swap.
+ convertloop:
movdqu xmm0, [eax]
movdqu xmm1, [eax + edi]
lea eax, [eax + 2 * edi]
@@ -166,7 +166,7 @@ __declspec(naked) void TransposeUVWx8_SSE2(const uint8* src,
lea eax, [eax + 2 * edi]
movdqu [esp], xmm5 // backup xmm5
neg edi
- movdqa xmm5, xmm6 // use xmm5 as temp register.
+ movdqa xmm5, xmm6 // use xmm5 as temp register.
punpcklbw xmm6, xmm7
punpckhbw xmm5, xmm7
movdqa xmm7, xmm5
@@ -187,10 +187,11 @@ __declspec(naked) void TransposeUVWx8_SSE2(const uint8* src,
movdqa xmm6, xmm5
movdqu xmm5, [esp] // restore xmm5
movdqu [esp], xmm6 // backup xmm6
- movdqa xmm6, xmm5 // use xmm6 as temp register.
+ movdqa xmm6, xmm5 // use xmm6 as temp register.
punpcklwd xmm5, xmm7
punpckhwd xmm6, xmm7
movdqa xmm7, xmm6
+
// Third round of bit swap.
// Write to the destination pointer.
movdqa xmm6, xmm0
diff --git a/unit_test/unit_test.cc b/unit_test/unit_test.cc
index 7f8bcf8f..55297e36 100644
--- a/unit_test/unit_test.cc
+++ b/unit_test/unit_test.cc
@@ -14,7 +14,9 @@
#include <cstring>
+#ifdef LIBYUV_USE_GFLAGS
#include "gflags/gflags.h"
+#endif
// Change this to 1000 for benchmarking.
// TODO(fbarchard): Add command line parsing to pass this as option.
@@ -22,6 +24,7 @@
unsigned int fastrand_seed = 0xfb;
+#ifdef LIBYUV_USE_GFLAGS
DEFINE_int32(libyuv_width, 0, "width of test image.");
DEFINE_int32(libyuv_height, 0, "height of test image.");
DEFINE_int32(libyuv_repeat, 0, "number of times to repeat test.");
@@ -29,6 +32,14 @@ DEFINE_int32(libyuv_flags, 0, "cpu flags for reference code. 1 = C, -1 = SIMD");
DEFINE_int32(libyuv_cpu_info,
0,
"cpu flags for benchmark code. 1 = C, -1 = SIMD");
+#else
+// Disable command line parameters if gflags disabled.
+static const int32 FLAGS_libyuv_width = 0;
+static const int32 FLAGS_libyuv_height = 0;
+static const int32 FLAGS_libyuv_repeat = 0;
+static const int32 FLAGS_libyuv_flags = 0;
+static const int32 FLAGS_libyuv_cpu_info = 0;
+#endif
// For quicker unittests, default is 128 x 72. But when benchmarking,
// default to 720p. Allow size to specify.
@@ -390,9 +401,11 @@ LibYUVBaseTest::LibYUVBaseTest()
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
+#ifdef LIBYUV_USE_GFLAGS
// AllowCommandLineParsing allows us to ignore flags passed on to us by
// Chromium build bots without having to explicitly disable them.
google::AllowCommandLineReparsing();
google::ParseCommandLineFlags(&argc, &argv, true);
+#endif
return RUN_ALL_TESTS();
}