mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-02-05 17:29:54 +08:00
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>
This commit is contained in:
parent
d59d3fcd18
commit
2adb84e39e
14
BUILD.gn
14
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" ]
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1649
|
||||
Version: 1650
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -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_
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user