Commit f7e74a1a authored by frkoenig@google.com's avatar frkoenig@google.com

Move neon rotate code from straight assembly to inline.

Allow assemblers with a slightly different syntax to use
the optimized neon routines.

Removed extra constraints on the calling of the optimized
routines.  All neon routines can load unaligned and handle
odd widths.

Align allocated buffers in rotate_test.cc

Add neon rotate file to gyp file for arm targets.
Review URL: http://webrtc-codereview.appspot.com/253007

git-svn-id: http://libyuv.googlecode.com/svn/trunk@59 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 7aa6f06e
......@@ -28,7 +28,6 @@
'include/libyuv/general.h',
'include/libyuv/scale.h',
'include/libyuv/planar_functions.h',
# headers
'source/conversion_tables.h',
......@@ -59,6 +58,15 @@
'source/row_posix.cc',
],
}],
['target_arch=="arm"',{
'conditions': [
['arm_neon==1', {
'sources' : [
'source/rotate_neon.cc',
],
}],
],
}],
]
},
], # targets
......
......@@ -43,7 +43,6 @@ typedef void (*rotate_wx8_func)(const uint8*, int, uint8*, int, int);
typedef void (*rotate_wxh_func)(const uint8*, int, uint8*, int, int, int);
#ifdef __ARM_NEON__
extern "C" {
#define HAS_REVERSE_LINE_NEON
void ReverseLine_NEON(const uint8* src, uint8* dst, int width);
#define HAS_REVERSE_LINE_UV_NEON
......@@ -58,7 +57,6 @@ void TransposeUVWx8_NEON(const uint8* src, int src_stride,
uint8* dst_a, int dst_stride_a,
uint8* dst_b, int dst_stride_b,
int width);
} // extern "C"
#endif
#if defined(WIN32) && !defined(COVERAGE_ENABLED)
......@@ -784,10 +782,7 @@ void TransposePlane(const uint8* src, int src_stride,
rotate_wxh_func TransposeWxH;
#if defined(HAS_TRANSPOSE_WX8_NEON)
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON) &&
(width % 8 == 0) &&
IS_ALIGNED(src, 8) && (src_stride % 8 == 0) &&
IS_ALIGNED(dst, 8) && (dst_stride % 8 == 0)) {
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON)) {
TransposeWx8 = TransposeWx8_NEON;
TransposeWxH = TransposeWxH_C;
} else
......@@ -917,10 +912,7 @@ void RotatePlane180(const uint8* src, int src_stride,
reverse_func ReverseLine;
#if defined(HAS_REVERSE_LINE_NEON)
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON) &&
(width % 16 == 0) &&
IS_ALIGNED(src, 16) && (src_stride % 16 == 0) &&
IS_ALIGNED(dst, 16) && (dst_stride % 16 == 0)) {
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON)) {
ReverseLine = ReverseLine_NEON;
} else
#endif
......@@ -1145,11 +1137,7 @@ void RotateUV180(const uint8* src, int src_stride,
reverse_uv_func ReverseLine;
#if defined(HAS_REVERSE_LINE_UV_NEON)
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON) &&
(width % 16 == 0) &&
IS_ALIGNED(src, 16) && (src_stride % 16 == 0) &&
IS_ALIGNED(dst_a, 8) && (dst_stride_a % 8 == 0) &&
IS_ALIGNED(dst_b, 8) && (dst_stride_b % 8 == 0) ) {
if (libyuv::TestCpuFlag(libyuv::kCpuHasNEON)) {
ReverseLine = ReverseLineUV_NEON;
} else
#endif
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -16,43 +16,6 @@
using namespace libyuv;
#define align_buffer_16(var, size) \
uint8 *var; \
uint8 *var##_mem; \
var##_mem = reinterpret_cast<uint8*>(calloc(size+15, sizeof(uint8))); \
var = reinterpret_cast<uint8*> \
((reinterpret_cast<intptr_t>(var##_mem) + 15) & (~0x0f));
#define free_aligned_buffer_16(var) \
free(var##_mem); \
var = 0;
#ifdef WIN32
#include <windows.h>
static double get_time()
{
LARGE_INTEGER t, f;
QueryPerformanceCounter(&t);
QueryPerformanceFrequency(&f);
return double(t.QuadPart)/double(f.QuadPart);
}
#else
#include <sys/time.h>
#include <sys/resource.h>
static double get_time()
{
struct timeval t;
struct timezone tzp;
gettimeofday(&t, &tzp);
return t.tv_sec + t.tv_usec*1e-6;
}
#endif
static int TestFilter(int src_width, int src_height,
int dst_width, int dst_height,
FilterMode f) {
......
......@@ -13,6 +13,43 @@
#include <gtest/gtest.h>
#define align_buffer_16(var, size) \
uint8 *var; \
uint8 *var##_mem; \
var##_mem = reinterpret_cast<uint8*>(calloc(size+15, sizeof(uint8))); \
var = reinterpret_cast<uint8*> \
((reinterpret_cast<intptr_t>(var##_mem) + 15) & (~0x0f));
#define free_aligned_buffer_16(var) \
free(var##_mem); \
var = 0;
#ifdef WIN32
#include <windows.h>
static double get_time()
{
LARGE_INTEGER t, f;
QueryPerformanceCounter(&t);
QueryPerformanceFrequency(&f);
return double(t.QuadPart)/double(f.QuadPart);
}
#else
#include <sys/time.h>
#include <sys/resource.h>
static 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();
......
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