Commit 1b06484b authored by mikhal@webrtc.org's avatar mikhal@webrtc.org

libyuv: clean up:

1. Removing libyuv:: when not needed
2. Test clean-up 
Review URL: http://webrtc-codereview.appspot.com/279002

git-svn-id: http://libyuv.googlecode.com/svn/trunk@74 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent f7a5048f
......@@ -111,7 +111,7 @@ int ARGBToBayerRGB(const uint8* src_rgb, int src_stride_rgb,
void (*ARGBToBayerRow)(const uint8* src_argb,
uint8* dst_bayer, uint32 selector, int pix);
#if defined(HAS_ARGBTOBAYERROW_SSSE3)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSSE3) &&
if (TestCpuFlag(kCpuHasSSSE3) &&
(width % 4 == 0) &&
IS_ALIGNED(src_rgb, 16) && (src_stride_rgb % 16 == 0) &&
IS_ALIGNED(dst_bayer, 4) && (dst_stride_bayer % 4 == 0)) {
......@@ -365,7 +365,7 @@ int BayerRGBToI420(const uint8* src_bayer, int src_stride_bayer,
SIMD_ALIGNED(uint8 row[kMaxStride * 2]);
#if defined(HAS_ARGBTOYROW_SSSE3)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSSE3) &&
if (TestCpuFlag(kCpuHasSSSE3) &&
(width % 16 == 0) &&
IS_ALIGNED(row, 16) && (kMaxStride % 16 == 0) &&
IS_ALIGNED(dst_y, 16) && (dst_stride_y % 16 == 0)) {
......@@ -376,7 +376,7 @@ int BayerRGBToI420(const uint8* src_bayer, int src_stride_bayer,
ARGBToYRow = ARGBToYRow_C;
}
#if defined(HAS_ARGBTOUVROW_SSSE3)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSSE3) &&
if (TestCpuFlag(kCpuHasSSSE3) &&
(width % 16 == 0) &&
IS_ALIGNED(row, 16) && (kMaxStride % 16 == 0) &&
IS_ALIGNED(dst_u, 8) && (dst_stride_u % 8 == 0) &&
......
......@@ -782,13 +782,13 @@ void TransposePlane(const uint8* src, int src_stride,
rotate_wxh_func TransposeWxH;
#if defined(HAS_TRANSPOSE_WX8_NEON)
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON)) {
if (TestCpuFlag(kCpuHasNEON)) {
TransposeWx8 = TransposeWx8_NEON;
TransposeWxH = TransposeWxH_C;
} else
#endif
#if defined(HAS_TRANSPOSE_WX8_FAST_SSSE3)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSSE3) &&
if (TestCpuFlag(kCpuHasSSSE3) &&
(width % 16 == 0) &&
IS_ALIGNED(src, 16) && (src_stride % 16 == 0) &&
IS_ALIGNED(dst, 8) && (dst_stride % 8 == 0)) {
......@@ -797,7 +797,7 @@ void TransposePlane(const uint8* src, int src_stride,
} else
#endif
#if defined(HAS_TRANSPOSE_WX8_SSSE3)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSSE3) &&
if (TestCpuFlag(kCpuHasSSSE3) &&
(width % 8 == 0) &&
IS_ALIGNED(src, 8) && (src_stride % 8 == 0) &&
IS_ALIGNED(dst, 8) && (dst_stride % 8 == 0)) {
......@@ -912,12 +912,12 @@ void RotatePlane180(const uint8* src, int src_stride,
reverse_func ReverseLine;
#if defined(HAS_REVERSE_LINE_NEON)
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON)) {
if (TestCpuFlag(kCpuHasNEON)) {
ReverseLine = ReverseLine_NEON;
} else
#endif
#if defined(HAS_REVERSE_LINE_SSSE3)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSSE3) &&
if (TestCpuFlag(kCpuHasSSSE3) &&
(width % 16 == 0) &&
IS_ALIGNED(src, 16) && (src_stride % 16 == 0) &&
IS_ALIGNED(dst, 16) && (dst_stride % 16 == 0)) {
......@@ -986,13 +986,13 @@ void TransposeUV(const uint8* src, int src_stride,
rotate_uv_wxh_func TransposeWxH;
#if defined(HAS_TRANSPOSE_UVWX8_NEON)
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON)) {
if (TestCpuFlag(kCpuHasNEON)) {
TransposeWx8 = TransposeUVWx8_NEON;
TransposeWxH = TransposeUVWxH_C;
} else
#endif
#if defined(HAS_TRANSPOSE_UVWX8_SSE2)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSE2) &&
if (TestCpuFlag(kCpuHasSSE2) &&
(width % 8 == 0) &&
IS_ALIGNED(src, 16) && (src_stride % 16 == 0) &&
IS_ALIGNED(dst_a, 8) && (dst_stride_a % 8 == 0) &&
......@@ -1137,12 +1137,12 @@ void RotateUV180(const uint8* src, int src_stride,
reverse_uv_func ReverseLine;
#if defined(HAS_REVERSE_LINE_UV_NEON)
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON)) {
if (TestCpuFlag(kCpuHasNEON)) {
ReverseLine = ReverseLineUV_NEON;
} else
#endif
#if defined(HAS_REVERSE_LINE_UV_SSSE3)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSSE3) &&
if (TestCpuFlag(kCpuHasSSSE3) &&
(width % 16 == 0) &&
IS_ALIGNED(src, 16) && (src_stride % 16 == 0) &&
IS_ALIGNED(dst_a, 8) && (dst_stride_a % 8 == 0) &&
......
......@@ -3060,13 +3060,13 @@ static void ScalePlaneDown2(int src_width, int src_height,
uint8* dst_ptr, int dst_width);
#if defined(HAS_SCALEROWDOWN2_NEON)
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON) &&
if (TestCpuFlag(kCpuHasNEON) &&
(dst_width % 16 == 0)) {
ScaleRowDown2 = filtering ? ScaleRowDown2Int_NEON : ScaleRowDown2_NEON;
} else
#endif
#if defined(HAS_SCALEROWDOWN2_SSE2)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSE2) &&
if (TestCpuFlag(kCpuHasSSE2) &&
(dst_width % 16 == 0) && IS_ALIGNED(src_ptr, 16) &&
IS_ALIGNED(dst_ptr, 16)) {
ScaleRowDown2 = filtering ? ScaleRowDown2Int_SSE2 : ScaleRowDown2_SSE2;
......@@ -3100,13 +3100,13 @@ static void ScalePlaneDown4(int src_width, int src_height,
uint8* dst_ptr, int dst_width);
#if defined(HAS_SCALEROWDOWN4_NEON)
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON) &&
if (TestCpuFlag(kCpuHasNEON) &&
(dst_width % 4 == 0)) {
ScaleRowDown4 = filtering ? ScaleRowDown4Int_NEON : ScaleRowDown4_NEON;
} else
#endif
#if defined(HAS_SCALEROWDOWN4_SSE2)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSE2) &&
if (TestCpuFlag(kCpuHasSSE2) &&
(dst_width % 8 == 0) && (src_stride % 16 == 0) &&
(dst_stride % 8 == 0) &&
IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(dst_ptr, 8)) {
......@@ -3141,7 +3141,7 @@ static void ScalePlaneDown8(int src_width, int src_height,
void (*ScaleRowDown8)(const uint8* src_ptr, int src_stride,
uint8* dst_ptr, int dst_width);
#if defined(HAS_SCALEROWDOWN8_SSE2)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSE2) &&
if (TestCpuFlag(kCpuHasSSE2) &&
(dst_width % 16 == 0) && dst_width <= kMaxOutputWidth &&
(src_stride % 16 == 0) && (dst_stride % 16 == 0) &&
IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(dst_ptr, 16)) {
......@@ -3176,7 +3176,7 @@ static void ScalePlaneDown34(int src_width, int src_height,
void (*ScaleRowDown34_1)(const uint8* src_ptr, int src_stride,
uint8* dst_ptr, int dst_width);
#if defined(HAS_SCALEROWDOWN34_NEON)
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON) &&
if (TestCpuFlag(kCpuHasNEON) &&
(dst_width % 24 == 0)) {
if (!filtering) {
ScaleRowDown34_0 = ScaleRowDown34_NEON;
......@@ -3188,7 +3188,7 @@ static void ScalePlaneDown34(int src_width, int src_height,
} else
#endif
#if defined(HAS_SCALEROWDOWN34_SSSE3)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSSE3) &&
if (TestCpuFlag(kCpuHasSSSE3) &&
(dst_width % 24 == 0) && (src_stride % 16 == 0) &&
(dst_stride % 8 == 0) &&
IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(dst_ptr, 8)) {
......@@ -3202,7 +3202,7 @@ static void ScalePlaneDown34(int src_width, int src_height,
} else
#endif
#if defined(HAS_SCALEROWDOWN34_SSE2)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSE2) &&
if (TestCpuFlag(kCpuHasSSE2) &&
(dst_width % 24 == 0) && (src_stride % 16 == 0) &&
(dst_stride % 8 == 0) &&
IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(dst_ptr, 8) &&
......@@ -3265,7 +3265,7 @@ static void ScalePlaneDown38(int src_width, int src_height,
void (*ScaleRowDown38_2)(const uint8* src_ptr, int src_stride,
uint8* dst_ptr, int dst_width);
#if defined(HAS_SCALEROWDOWN38_NEON)
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON) &&
if (TestCpuFlag(kCpuHasNEON) &&
(dst_width % 12 == 0)) {
if (!filtering) {
ScaleRowDown38_3 = ScaleRowDown38_NEON;
......@@ -3277,7 +3277,7 @@ static void ScalePlaneDown38(int src_width, int src_height,
} else
#endif
#if defined(HAS_SCALEROWDOWN38_SSSE3)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSSE3) &&
if (TestCpuFlag(kCpuHasSSSE3) &&
(dst_width % 24 == 0) && (src_stride % 16 == 0) &&
(dst_stride % 8 == 0) &&
IS_ALIGNED(src_ptr, 16) && IS_ALIGNED(dst_ptr, 8)) {
......@@ -3426,7 +3426,7 @@ static void ScalePlaneBox(int src_width, int src_height,
void (*ScaleAddCols)(int dst_width, int boxheight, int dx,
const uint16* src_ptr, uint8* dst_ptr);
#if defined(HAS_SCALEADDROWS_SSE2)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSE2) &&
if (TestCpuFlag(kCpuHasSSE2) &&
(src_stride % 16 == 0) && IS_ALIGNED(src_ptr, 16) &&
(src_width % 16) == 0) {
ScaleAddRows = ScaleAddRows_SSE2;
......@@ -3521,14 +3521,14 @@ static void ScalePlaneBilinear(int src_width, int src_height,
void (*ScaleFilterCols)(uint8* dst_ptr, const uint8* src_ptr,
int dst_width, int dx);
#if defined(HAS_SCALEFILTERROWS_SSSE3)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSSE3) &&
if (TestCpuFlag(kCpuHasSSSE3) &&
(src_stride % 16 == 0) && IS_ALIGNED(src_ptr, 16) &&
(src_width % 16) == 0) {
ScaleFilterRows = ScaleFilterRows_SSSE3;
} else
#endif
#if defined(HAS_SCALEFILTERROWS_SSE2)
if (libyuv::TestCpuFlag(libyuv::kCpuHasSSE2) &&
if (TestCpuFlag(kCpuHasSSE2) &&
(src_stride % 16 == 0) && IS_ALIGNED(src_ptr, 16) &&
(src_width % 16) == 0) {
ScaleFilterRows = ScaleFilterRows_SSE2;
......
......@@ -16,7 +16,7 @@
#include <string.h>
#include <time.h>
using namespace libyuv;
namespace libyuv {
TEST_F(libyuvTest, BenchmarkSumSquareError_C) {
const int max_width = 4096*3;
......@@ -328,3 +328,5 @@ TEST_F(libyuvTest, Ssim) {
free_aligned_buffer_16(src_a)
free_aligned_buffer_16(src_b)
}
}
......@@ -14,7 +14,7 @@
#include <stdlib.h>
#include <time.h>
using namespace libyuv;
namespace libyuv {
void print_array(uint8 *array, int w, int h) {
int i, j;
......@@ -1445,3 +1445,5 @@ TEST_F(libyuvTest, NV12ToI420RotateNegHeight180) {
EXPECT_EQ(0, y_err + uv_err);
}
} // namespace
......@@ -14,7 +14,7 @@
#include <stdlib.h>
#include <time.h>
using namespace libyuv;
namespace libyuv {
static int TestFilter(int src_width, int src_height,
int dst_width, int dst_height,
......@@ -68,7 +68,7 @@ static int TestFilter(int src_width, int src_height,
align_buffer_16(dst_u_opt, dst_uv_plane_size)
align_buffer_16(dst_v_opt, dst_uv_plane_size)
libyuv::MaskCpuFlags(kCpuInitialized);
MaskCpuFlags(kCpuInitialized);
double c_time = get_time();
for (i = 0; i < runs; ++i)
......@@ -83,7 +83,7 @@ static int TestFilter(int src_width, int src_height,
c_time = (get_time() - c_time) / runs;
libyuv::MaskCpuFlags(-1);
MaskCpuFlags(-1);
double opt_time = get_time();
for (i = 0; i < runs; ++i)
......@@ -210,3 +210,5 @@ TEST_F(libyuvTest, ScaleDownBy38) {
EXPECT_EQ(0, err);
}
} // namespace
......@@ -11,15 +11,6 @@
#include <cstring>
#include "unit_test.h"
class libyuvEnvironment : public ::testing::Environment {
public:
virtual void SetUp() {
}
virtual void TearDown() {
}
};
libyuvTest::libyuvTest() :
_rotate_max_w(128),
_rotate_max_h(128),
......@@ -28,16 +19,7 @@ libyuvTest::libyuvTest() :
_benchmark_height(720) {
}
void libyuvTest::SetUp() {
}
void libyuvTest::TearDown() {
}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
libyuvEnvironment* env = new libyuvEnvironment;
::testing::AddGlobalTestEnvironment(env);
return RUN_ALL_TESTS();
}
......@@ -40,8 +40,7 @@ static double get_time()
#include <sys/time.h>
#include <sys/resource.h>
static double get_time()
{
static double get_time() {
struct timeval t;
struct timezone tzp;
gettimeofday(&t, &tzp);
......@@ -53,8 +52,6 @@ static double get_time()
class libyuvTest : public ::testing::Test {
protected:
libyuvTest();
virtual void SetUp();
virtual void TearDown();
const int _rotate_max_w;
const int _rotate_max_h;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment