Update libyuv to r397
Change-Id: I70f5a527de52ae8ae80b189873c9a094035dfa2c
Signed-off-by: Hendrik Dahlkamp <hendrik@google.com>
diff --git a/files/unit_test/unit_test.h b/files/unit_test/unit_test.h
index cac30c7..62521e8 100644
--- a/files/unit_test/unit_test.h
+++ b/files/unit_test/unit_test.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 The LibYuv project authors. All Rights Reserved.
+ * Copyright 2011 The LibYuv Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@@ -8,20 +8,67 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef UINIT_TEST_H_
-#define UINIT_TEST_H_
+#ifndef UNIT_TEST_UNIT_TEST_H_
+#define UNIT_TEST_UNIT_TEST_H_
#include <gtest/gtest.h>
+#define align_buffer_16(var, size) \
+ uint8* var; \
+ uint8* var##_mem; \
+ var##_mem = reinterpret_cast<uint8*>(malloc((size) + 15)); \
+ var = reinterpret_cast<uint8*> \
+ ((reinterpret_cast<intptr_t>(var##_mem) + 15) & ~15);
+
+#define free_aligned_buffer_16(var) \
+ free(var##_mem); \
+ var = 0;
+
+
+#define align_buffer_page_end(var, size) \
+ uint8* var; \
+ uint8* var##_mem; \
+ var##_mem = reinterpret_cast<uint8*>(malloc(((size) + 4095) & ~4095)); \
+ var = var##_mem + (-(size) & 4095);
+
+#define free_aligned_buffer_page_end(var) \
+ free(var##_mem); \
+ var = 0;
+
+#ifdef WIN32
+#include <windows.h>
+static inline double get_time() {
+ LARGE_INTEGER t, f;
+ QueryPerformanceCounter(&t);
+ QueryPerformanceFrequency(&f);
+ return static_cast<double>(t.QuadPart) / static_cast<double>(f.QuadPart);
+}
+
+#define random rand
+#define srandom srand
+#else
+
+#include <sys/time.h>
+#include <sys/resource.h>
+
+static inline double get_time() {
+ struct timeval t;
+ struct timezone tzp;
+ gettimeofday(&t, &tzp);
+ return t.tv_sec + t.tv_usec * 1e-6;
+}
+#endif
+
class libyuvTest : public ::testing::Test {
protected:
libyuvTest();
- virtual void SetUp();
- virtual void TearDown();
- const int _rotate_max_w;
- const int _rotate_max_h;
+ const int rotate_max_w_;
+ const int rotate_max_h_;
+ int benchmark_iterations_;
+ const int benchmark_width_;
+ const int benchmark_height_;
};
-#endif // UNIT_TEST_H_
+#endif // UNIT_TEST_UNIT_TEST_H_