build: detect Android via '__ANDROID__' macro

https://sourceforge.net/p/predef/wiki/OperatingSystems
This commit is contained in:
Alexander Alekhin 2017-07-10 12:43:59 +03:00
parent cddf868572
commit a4a47b538c
25 changed files with 73 additions and 73 deletions

View File

@ -49,7 +49,7 @@ void extract2(const Size2D &size,
{ {
internal::assertSupportedConfiguration(); internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON #ifdef CAROTENE_NEON
#ifndef ANDROID #ifndef __ANDROID__
size_t roiw32 = size.width >= 31 ? size.width - 31 : 0; size_t roiw32 = size.width >= 31 ? size.width - 31 : 0;
#endif #endif
size_t roiw8 = size.width >= 7 ? size.width - 7 : 0; size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
@ -60,7 +60,7 @@ void extract2(const Size2D &size,
u8 * dst = internal::getRowPtr(dstBase, dstStride, i); u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0u, dj = 0u; size_t sj = 0u, dj = 0u;
#ifndef ANDROID #ifndef __ANDROID__
for (; dj < roiw32; sj += 64, dj += 32) for (; dj < roiw32; sj += 64, dj += 32)
{ {
internal::prefetch(src + sj); internal::prefetch(src + sj);
@ -101,7 +101,7 @@ void extract3(const Size2D &size,
{ {
internal::assertSupportedConfiguration(); internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON #ifdef CAROTENE_NEON
#ifndef ANDROID #ifndef __ANDROID__
size_t roiw32 = size.width >= 31 ? size.width - 31 : 0; size_t roiw32 = size.width >= 31 ? size.width - 31 : 0;
#endif #endif
size_t roiw8 = size.width >= 7 ? size.width - 7 : 0; size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
@ -112,7 +112,7 @@ void extract3(const Size2D &size,
u8 * dst = internal::getRowPtr(dstBase, dstStride, i); u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0u, dj = 0u; size_t sj = 0u, dj = 0u;
#ifndef ANDROID #ifndef __ANDROID__
for (; dj < roiw32; sj += 96, dj += 32) for (; dj < roiw32; sj += 96, dj += 32)
{ {
internal::prefetch(src + sj); internal::prefetch(src + sj);
@ -153,7 +153,7 @@ void extract4(const Size2D &size,
{ {
internal::assertSupportedConfiguration(); internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON #ifdef CAROTENE_NEON
#ifndef ANDROID #ifndef __ANDROID__
size_t roiw32 = size.width >= 31 ? size.width - 31 : 0; size_t roiw32 = size.width >= 31 ? size.width - 31 : 0;
#endif #endif
size_t roiw8 = size.width >= 7 ? size.width - 7 : 0; size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
@ -164,7 +164,7 @@ void extract4(const Size2D &size,
u8 * dst = internal::getRowPtr(dstBase, dstStride, i); u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0u, dj = 0u; size_t sj = 0u, dj = 0u;
#ifndef ANDROID #ifndef __ANDROID__
for (; dj < roiw32; sj += 128, dj += 32) for (; dj < roiw32; sj += 128, dj += 32)
{ {
internal::prefetch(src + sj); internal::prefetch(src + sj);

View File

@ -240,7 +240,7 @@ void combineYUYV(const Size2D &size,
{ {
internal::assertSupportedConfiguration(); internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON #ifdef CAROTENE_NEON
#ifndef ANDROID #ifndef __ANDROID__
size_t roiw32 = size.width >= 31 ? size.width - 31 : 0; size_t roiw32 = size.width >= 31 ? size.width - 31 : 0;
#endif #endif
size_t roiw8 = size.width >= 7 ? size.width - 7 : 0; size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
@ -253,7 +253,7 @@ void combineYUYV(const Size2D &size,
u8 * dst = internal::getRowPtr(dstBase, dstStride, i); u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
size_t syj = 0u, sj = 0u, dj = 0u; size_t syj = 0u, sj = 0u, dj = 0u;
#ifndef ANDROID #ifndef __ANDROID__
for (; sj < roiw32; sj += 32, syj += 64, dj += 128) for (; sj < roiw32; sj += 32, syj += 64, dj += 128)
{ {
internal::prefetch(srcy + syj); internal::prefetch(srcy + syj);
@ -317,7 +317,7 @@ void combineUYVY(const Size2D &size,
{ {
internal::assertSupportedConfiguration(); internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON #ifdef CAROTENE_NEON
#ifndef ANDROID #ifndef __ANDROID__
size_t roiw32 = size.width >= 31 ? size.width - 31 : 0; size_t roiw32 = size.width >= 31 ? size.width - 31 : 0;
#endif #endif
size_t roiw8 = size.width >= 7 ? size.width - 7 : 0; size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
@ -330,7 +330,7 @@ void combineUYVY(const Size2D &size,
u8 * dst = internal::getRowPtr(dstBase, dstStride, i); u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
size_t syj = 0u, sj = 0u, dj = 0u; size_t syj = 0u, sj = 0u, dj = 0u;
#ifndef ANDROID #ifndef __ANDROID__
for (; sj < roiw32; sj += 32, syj += 64, dj += 128) for (; sj < roiw32; sj += 32, syj += 64, dj += 128)
{ {
internal::prefetch(srcy + syj); internal::prefetch(srcy + syj);

View File

@ -105,12 +105,12 @@ void flip3(const Size2D & size,
{ {
using namespace internal; using namespace internal;
#ifndef ANDROID #ifndef __ANDROID__
typedef typename VecTraits<T, 3>::vec128 vec128; typedef typename VecTraits<T, 3>::vec128 vec128;
#endif #endif
typedef typename VecTraits<T, 3>::vec64 vec64; typedef typename VecTraits<T, 3>::vec64 vec64;
#ifndef ANDROID #ifndef __ANDROID__
u32 step_base = 16 / sizeof(T), step_base3 = step_base * 3; u32 step_base = 16 / sizeof(T), step_base3 = step_base * 3;
size_t roiw_base = size.width >= (step_base - 1) ? size.width - step_base + 1 : 0; size_t roiw_base = size.width >= (step_base - 1) ? size.width - step_base + 1 : 0;
#endif #endif
@ -123,7 +123,7 @@ void flip3(const Size2D & size,
T * dst = getRowPtr((T *)dstBase, dstStride, (flipMode & FLIP_VERTICAL_MODE) != 0 ? size.height - i - 1 : i); T * dst = getRowPtr((T *)dstBase, dstStride, (flipMode & FLIP_VERTICAL_MODE) != 0 ? size.height - i - 1 : i);
size_t j = 0, js = 0, jd = size.width * 3; size_t j = 0, js = 0, jd = size.width * 3;
#ifndef ANDROID #ifndef __ANDROID__
for (; j < roiw_base; j += step_base, js += step_base3, jd -= step_base3) for (; j < roiw_base; j += step_base, js += step_base3, jd -= step_base3)
{ {
prefetch(src + js); prefetch(src + js);
@ -139,7 +139,7 @@ void flip3(const Size2D & size,
vst3q(dst + jd - step_base3, v_dst); vst3q(dst + jd - step_base3, v_dst);
} }
#endif // ANDROID #endif // __ANDROID__
for (; j < roiw_tail; j += step_tail, js += step_tail3, jd -= step_tail3) for (; j < roiw_tail; j += step_tail, js += step_tail3, jd -= step_tail3)
{ {

View File

@ -359,7 +359,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
} }
else //if ((wr == 4.0f) && (hr == 4.0f)) //the only scale that lasts after isSupported check else //if ((wr == 4.0f) && (hr == 4.0f)) //the only scale that lasts after isSupported check
{ {
#ifndef ANDROID #ifndef __ANDROID__
size_t roiw16 = dsize.width >= 15 ? dsize.width - 15 : 0; size_t roiw16 = dsize.width >= 15 ? dsize.width - 15 : 0;
#endif #endif
size_t roiw8 = dsize.width >= 7 ? dsize.width - 7 : 0; size_t roiw8 = dsize.width >= 7 ? dsize.width - 7 : 0;
@ -373,7 +373,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i); u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0, dj = 0; size_t sj = 0, dj = 0;
#ifndef ANDROID #ifndef __ANDROID__
for ( ; dj < roiw16; dj += 16, sj += 64) for ( ; dj < roiw16; dj += 16, sj += 64)
{ {
internal::prefetch(src0_row + sj); internal::prefetch(src0_row + sj);
@ -450,7 +450,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
{ {
if ((wr == 2.0f) && (hr == 2.0f)) if ((wr == 2.0f) && (hr == 2.0f))
{ {
#ifndef ANDROID #ifndef __ANDROID__
size_t roiw4 = dsize.width >= 3 ? (dsize.width - 3) << 2 : 0; size_t roiw4 = dsize.width >= 3 ? (dsize.width - 3) << 2 : 0;
#endif #endif
size_t roiw2 = dsize.width >= 1 ? (dsize.width - 1) << 2 : 0; size_t roiw2 = dsize.width >= 1 ? (dsize.width - 1) << 2 : 0;
@ -462,7 +462,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i); u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0, dj = 0; size_t sj = 0, dj = 0;
#ifndef ANDROID #ifndef __ANDROID__
for ( ; dj < roiw4; dj += 16, sj += 32) for ( ; dj < roiw4; dj += 16, sj += 32)
{ {
internal::prefetch(src0_row + sj); internal::prefetch(src0_row + sj);
@ -537,7 +537,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
} }
else if ((wr == 0.5f) && (hr == 0.5f)) else if ((wr == 0.5f) && (hr == 0.5f))
{ {
#ifndef ANDROID #ifndef __ANDROID__
size_t roiw32 = dsize.width >= 31 ? (dsize.width - 31) << 2 : 0; size_t roiw32 = dsize.width >= 31 ? (dsize.width - 31) << 2 : 0;
#endif #endif
size_t roiw16 = dsize.width >= 15 ? (dsize.width - 15) << 2 : 0; size_t roiw16 = dsize.width >= 15 ? (dsize.width - 15) << 2 : 0;
@ -549,7 +549,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
u8 * dst1_row = internal::getRowPtr(dstBase, dstStride, std::min(i + 1, dsize.height - 1)); u8 * dst1_row = internal::getRowPtr(dstBase, dstStride, std::min(i + 1, dsize.height - 1));
size_t sj = 0, dj = 0; size_t sj = 0, dj = 0;
#ifndef ANDROID #ifndef __ANDROID__
for ( ; dj < roiw32; dj += 128, sj += 64) for ( ; dj < roiw32; dj += 128, sj += 64)
{ {
internal::prefetch(src_row + sj); internal::prefetch(src_row + sj);
@ -758,7 +758,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
{ {
if ((wr == 2.0f) && (wr == 2.0f)) if ((wr == 2.0f) && (wr == 2.0f))
{ {
#ifndef ANDROID #ifndef __ANDROID__
size_t roiw16 = dsize.width >= 15 ? (dsize.width - 15) * 3 : 0; size_t roiw16 = dsize.width >= 15 ? (dsize.width - 15) * 3 : 0;
#endif #endif
size_t roiw8 = dsize.width >= 7 ? (dsize.width - 7) * 3 : 0; size_t roiw8 = dsize.width >= 7 ? (dsize.width - 7) * 3 : 0;
@ -770,7 +770,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i); u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0, dj = 0; size_t sj = 0, dj = 0;
#ifndef ANDROID #ifndef __ANDROID__
for ( ; dj < roiw16; dj += 48, sj += 96) for ( ; dj < roiw16; dj += 48, sj += 96)
{ {
internal::prefetch(src0_row + sj); internal::prefetch(src0_row + sj);
@ -856,7 +856,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
} }
else if ((wr == 0.5f) && (hr == 0.5f)) else if ((wr == 0.5f) && (hr == 0.5f))
{ {
#ifndef ANDROID #ifndef __ANDROID__
size_t roiw32 = dsize.width >= 31 ? (dsize.width - 31) * 3 : 0; size_t roiw32 = dsize.width >= 31 ? (dsize.width - 31) * 3 : 0;
#endif #endif
size_t roiw16 = dsize.width >= 15 ? (dsize.width - 15) * 3 : 0; size_t roiw16 = dsize.width >= 15 ? (dsize.width - 15) * 3 : 0;
@ -868,7 +868,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
u8 * dst1_row = internal::getRowPtr(dstBase, dstStride, std::min(i + 1, dsize.height - 1)); u8 * dst1_row = internal::getRowPtr(dstBase, dstStride, std::min(i + 1, dsize.height - 1));
size_t sj = 0, dj = 0; size_t sj = 0, dj = 0;
#ifndef ANDROID #ifndef __ANDROID__
for ( ; dj < roiw32; dj += 96, sj += 48) for ( ; dj < roiw32; dj += 96, sj += 48)
{ {
internal::prefetch(src_row + sj); internal::prefetch(src_row + sj);
@ -928,7 +928,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
} }
else //if ((hr == 4.0f) && (wr == 4.0f)) //the only scale that lasts after isSupported check else //if ((hr == 4.0f) && (wr == 4.0f)) //the only scale that lasts after isSupported check
{ {
#ifndef ANDROID #ifndef __ANDROID__
size_t roiw8 = dsize.width >= 7 ? (dsize.width - 7) * 3 : 0; size_t roiw8 = dsize.width >= 7 ? (dsize.width - 7) * 3 : 0;
#endif #endif
@ -941,7 +941,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i); u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0, dj = 0; size_t sj = 0, dj = 0;
#ifndef ANDROID #ifndef __ANDROID__
for ( ; dj < roiw8; dj += 24, sj += 96) for ( ; dj < roiw8; dj += 24, sj += 96)
{ {
internal::prefetch(src0_row + sj); internal::prefetch(src0_row + sj);

View File

@ -1590,7 +1590,7 @@ void cv::ogl::render(const ogl::Arrays& arr, InputArray indices, int mode, Scala
#endif // HAVE_OPENCL #endif // HAVE_OPENCL
#if defined(HAVE_OPENGL) #if defined(HAVE_OPENGL)
# if defined(ANDROID) # if defined(__ANDROID__)
# include <EGL/egl.h> # include <EGL/egl.h>
# elif defined(__linux__) # elif defined(__linux__)
# include <GL/glx.h> # include <GL/glx.h>
@ -1659,7 +1659,7 @@ Context& initializeContextFromGL()
CL_CONTEXT_PLATFORM, (cl_context_properties)platforms[i], CL_CONTEXT_PLATFORM, (cl_context_properties)platforms[i],
CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(), CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(),
CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(), CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(),
#elif defined(ANDROID) #elif defined(__ANDROID__)
CL_CONTEXT_PLATFORM, (cl_context_properties)platforms[i], CL_CONTEXT_PLATFORM, (cl_context_properties)platforms[i],
CL_GL_CONTEXT_KHR, (cl_context_properties)eglGetCurrentContext(), CL_GL_CONTEXT_KHR, (cl_context_properties)eglGetCurrentContext(),
CL_EGL_DISPLAY_KHR, (cl_context_properties)eglGetCurrentDisplay(), CL_EGL_DISPLAY_KHR, (cl_context_properties)eglGetCurrentDisplay(),

View File

@ -56,7 +56,7 @@
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#if defined ANDROID #if defined __ANDROID__
#include <sys/sysconf.h> #include <sys/sysconf.h>
#elif defined __APPLE__ #elif defined __APPLE__
#include <sys/sysctl.h> #include <sys/sysctl.h>
@ -590,7 +590,7 @@ int cv::getThreadNum(void)
#endif #endif
} }
#ifdef ANDROID #ifdef __ANDROID__
static inline int getNumberOfCPUsImpl() static inline int getNumberOfCPUsImpl()
{ {
FILE* cpuPossible = fopen("/sys/devices/system/cpu/possible", "r"); FILE* cpuPossible = fopen("/sys/devices/system/cpu/possible", "r");
@ -641,7 +641,7 @@ int cv::getNumberOfCPUs(void)
#endif #endif
return (int)sysinfo.dwNumberOfProcessors; return (int)sysinfo.dwNumberOfProcessors;
#elif defined ANDROID #elif defined __ANDROID__
static int ncpus = getNumberOfCPUsImpl(); static int ncpus = getNumberOfCPUsImpl();
return ncpus; return ncpus;
#elif defined __linux__ #elif defined __linux__

View File

@ -527,7 +527,7 @@ void ThreadManager::setNumOfThreads(size_t n)
size_t ThreadManager::defaultNumberOfThreads() size_t ThreadManager::defaultNumberOfThreads()
{ {
#ifdef ANDROID #ifdef __ANDROID__
// many modern phones/tables have 4-core CPUs. Let's use no more // many modern phones/tables have 4-core CPUs. Let's use no more
// than 2 threads by default not to overheat the devices // than 2 threads by default not to overheat the devices
const unsigned int default_number_of_threads = 2; const unsigned int default_number_of_threads = 2;

View File

@ -2187,7 +2187,7 @@ static bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int*
{ {
const ocl::Device & dev = ocl::Device::getDefault(); const ocl::Device & dev = ocl::Device::getDefault();
#ifdef ANDROID #ifdef __ANDROID__
if (dev.isNVidia()) if (dev.isNVidia())
return false; return false;
#endif #endif
@ -2975,7 +2975,7 @@ static bool ocl_norm( InputArray _src, int normType, InputArray _mask, double &
{ {
const ocl::Device & d = ocl::Device::getDefault(); const ocl::Device & d = ocl::Device::getDefault();
#ifdef ANDROID #ifdef __ANDROID__
if (d.isNVidia()) if (d.isNVidia())
return false; return false;
#endif #endif
@ -3317,7 +3317,7 @@ namespace cv {
static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask, double & result ) static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask, double & result )
{ {
#ifdef ANDROID #ifdef __ANDROID__
if (ocl::Device::getDefault().isNVidia()) if (ocl::Device::getDefault().isNVidia())
return false; return false;
#endif #endif

View File

@ -66,16 +66,16 @@ Mutex* __initialization_mutex_initializer = &getInitializationMutex();
# endif # endif
#endif #endif
#if defined ANDROID || defined __linux__ || defined __FreeBSD__ #if defined __ANDROID__ || defined __linux__ || defined __FreeBSD__
# include <unistd.h> # include <unistd.h>
# include <fcntl.h> # include <fcntl.h>
# include <elf.h> # include <elf.h>
#if defined ANDROID || defined __linux__ #if defined __ANDROID__ || defined __linux__
# include <linux/auxvec.h> # include <linux/auxvec.h>
#endif #endif
#endif #endif
#if defined ANDROID && defined HAVE_CPUFEATURES #if defined __ANDROID__ && defined HAVE_CPUFEATURES
# include <cpu-features.h> # include <cpu-features.h>
#endif #endif
@ -206,12 +206,12 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix)
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#if defined ANDROID #if defined __ANDROID__
#include <sys/sysconf.h> #include <sys/sysconf.h>
#endif #endif
#endif #endif
#ifdef ANDROID #ifdef __ANDROID__
# include <android/log.h> # include <android/log.h>
#endif #endif
@ -833,7 +833,7 @@ String tempfile( const char* suffix )
fname = temp_file; fname = temp_file;
#endif #endif
# else # else
# ifdef ANDROID # ifdef __ANDROID__
//char defaultTemplate[] = "/mnt/sdcard/__opencv_temp.XXXXXX"; //char defaultTemplate[] = "/mnt/sdcard/__opencv_temp.XXXXXX";
char defaultTemplate[] = "/data/local/tmp/__opencv_temp.XXXXXX"; char defaultTemplate[] = "/data/local/tmp/__opencv_temp.XXXXXX";
# else # else

View File

@ -331,7 +331,7 @@ OCL_TEST_P(Mul, Mat_Scale)
OCL_OFF(cv::multiply(src1_roi, src2_roi, dst1_roi, val[0])); OCL_OFF(cv::multiply(src1_roi, src2_roi, dst1_roi, val[0]));
OCL_ON(cv::multiply(usrc1_roi, usrc2_roi, udst1_roi, val[0])); OCL_ON(cv::multiply(usrc1_roi, usrc2_roi, udst1_roi, val[0]));
#ifdef ANDROID #ifdef __ANDROID__
Near(udst1_roi.depth() >= CV_32F ? 2e-1 : 1); Near(udst1_roi.depth() >= CV_32F ? 2e-1 : 1);
#else #else
Near(udst1_roi.depth() >= CV_32F ? 1e-3 : 1); Near(udst1_roi.depth() >= CV_32F ? 1e-3 : 1);

View File

@ -111,7 +111,7 @@ PARAM_TEST_CASE(BruteForceMatcher, int, int)
} }
}; };
#ifdef ANDROID #ifdef __ANDROID__
OCL_TEST_P(BruteForceMatcher, DISABLED_Match_Single) OCL_TEST_P(BruteForceMatcher, DISABLED_Match_Single)
#else #else
OCL_TEST_P(BruteForceMatcher, Match_Single) OCL_TEST_P(BruteForceMatcher, Match_Single)
@ -135,7 +135,7 @@ OCL_TEST_P(BruteForceMatcher, Match_Single)
ASSERT_EQ(0, badCount); ASSERT_EQ(0, badCount);
} }
#ifdef ANDROID #ifdef __ANDROID__
OCL_TEST_P(BruteForceMatcher, DISABLED_KnnMatch_2_Single) OCL_TEST_P(BruteForceMatcher, DISABLED_KnnMatch_2_Single)
#else #else
OCL_TEST_P(BruteForceMatcher, KnnMatch_2_Single) OCL_TEST_P(BruteForceMatcher, KnnMatch_2_Single)
@ -171,7 +171,7 @@ OCL_TEST_P(BruteForceMatcher, KnnMatch_2_Single)
ASSERT_EQ(0, badCount); ASSERT_EQ(0, badCount);
} }
#ifdef ANDROID #ifdef __ANDROID__
OCL_TEST_P(BruteForceMatcher, DISABLED_RadiusMatch_Single) OCL_TEST_P(BruteForceMatcher, DISABLED_RadiusMatch_Single)
#else #else
OCL_TEST_P(BruteForceMatcher, RadiusMatch_Single) OCL_TEST_P(BruteForceMatcher, RadiusMatch_Single)

View File

@ -11,7 +11,7 @@ using namespace std::tr1;
#define int64 int64_hack_ #define int64 int64_hack_
#include "tiff.h" #include "tiff.h"
#ifdef ANDROID #ifdef __ANDROID__
// Test disabled as it uses a lot of memory. // Test disabled as it uses a lot of memory.
// It is killed with SIGKILL by out of memory killer. // It is killed with SIGKILL by out of memory killer.
TEST(Imgcodecs_Tiff, DISABLED_decode_tile16384x16384) TEST(Imgcodecs_Tiff, DISABLED_decode_tile16384x16384)

View File

@ -27,7 +27,7 @@ PERF_TEST_P(MatInfo_Size_Size, resizeUpLinear,
TEST_CYCLE_MULTIRUN(10) resize(src, dst, to); TEST_CYCLE_MULTIRUN(10) resize(src, dst, to);
#ifdef ANDROID #ifdef __ANDROID__
SANITY_CHECK(dst, 5); SANITY_CHECK(dst, 5);
#else #else
SANITY_CHECK(dst, 1 + 1e-6); SANITY_CHECK(dst, 1 + 1e-6);
@ -54,7 +54,7 @@ PERF_TEST_P(MatInfo_Size_Size, resizeDownLinear,
TEST_CYCLE_MULTIRUN(10) resize(src, dst, to); TEST_CYCLE_MULTIRUN(10) resize(src, dst, to);
#ifdef ANDROID #ifdef __ANDROID__
SANITY_CHECK(dst, 5); SANITY_CHECK(dst, 5);
#else #else
SANITY_CHECK(dst, 1 + 1e-6); SANITY_CHECK(dst, 1 + 1e-6);

View File

@ -43,7 +43,7 @@ PERF_TEST_P( TestWarpAffine, WarpAffine,
TEST_CYCLE() warpAffine( src, dst, warpMat, sz, interType, borderMode, borderColor ); TEST_CYCLE() warpAffine( src, dst, warpMat, sz, interType, borderMode, borderColor );
#ifdef ANDROID #ifdef __ANDROID__
SANITY_CHECK(dst, interType==INTER_LINEAR? 5 : 10); SANITY_CHECK(dst, interType==INTER_LINEAR? 5 : 10);
#else #else
SANITY_CHECK(dst, 1); SANITY_CHECK(dst, 1);
@ -73,7 +73,7 @@ PERF_TEST_P(TestWarpAffine, WarpAffine_ovx,
TEST_CYCLE() warpAffine(src, dst, warpMat, sz, interType, borderMode, borderColor); TEST_CYCLE() warpAffine(src, dst, warpMat, sz, interType, borderMode, borderColor);
#ifdef ANDROID #ifdef __ANDROID__
SANITY_CHECK(dst, interType == INTER_LINEAR ? 5 : 10); SANITY_CHECK(dst, interType == INTER_LINEAR ? 5 : 10);
#else #else
SANITY_CHECK(dst, 1); SANITY_CHECK(dst, 1);
@ -111,7 +111,7 @@ PERF_TEST_P( TestWarpPerspective, WarpPerspective,
TEST_CYCLE() warpPerspective( src, dst, warpMat, sz, interType, borderMode, borderColor ); TEST_CYCLE() warpPerspective( src, dst, warpMat, sz, interType, borderMode, borderColor );
#ifdef ANDROID #ifdef __ANDROID__
SANITY_CHECK(dst, interType==INTER_LINEAR? 5 : 10); SANITY_CHECK(dst, interType==INTER_LINEAR? 5 : 10);
#else #else
SANITY_CHECK(dst, 1); SANITY_CHECK(dst, 1);
@ -149,7 +149,7 @@ PERF_TEST_P(TestWarpPerspective, WarpPerspective_ovx,
TEST_CYCLE() warpPerspective(src, dst, warpMat, sz, interType, borderMode, borderColor); TEST_CYCLE() warpPerspective(src, dst, warpMat, sz, interType, borderMode, borderColor);
#ifdef ANDROID #ifdef __ANDROID__
SANITY_CHECK(dst, interType == INTER_LINEAR ? 5 : 10); SANITY_CHECK(dst, interType == INTER_LINEAR ? 5 : 10);
#else #else
SANITY_CHECK(dst, 1); SANITY_CHECK(dst, 1);
@ -195,7 +195,7 @@ PERF_TEST_P( TestWarpPerspectiveNear_t, WarpPerspectiveNear,
warpPerspective( src, dst, warpMat, size, interType, borderMode, borderColor ); warpPerspective( src, dst, warpMat, size, interType, borderMode, borderColor );
} }
#ifdef ANDROID #ifdef __ANDROID__
SANITY_CHECK(dst, interType==INTER_LINEAR? 5 : 10); SANITY_CHECK(dst, interType==INTER_LINEAR? 5 : 10);
#else #else
SANITY_CHECK(dst, 1); SANITY_CHECK(dst, 1);

View File

@ -4263,7 +4263,7 @@ static bool ocl_sepRowFilter2D(const UMat & src, UMat & buf, const Mat & kernelX
if (!doubleSupport && (sdepth == CV_64F || ddepth == CV_64F)) if (!doubleSupport && (sdepth == CV_64F || ddepth == CV_64F))
return false; return false;
#ifdef ANDROID #ifdef __ANDROID__
size_t localsize[2] = {16, 10}; size_t localsize[2] = {16, 10};
#else #else
size_t localsize[2] = {16, 16}; size_t localsize[2] = {16, 16};
@ -4328,7 +4328,7 @@ static bool ocl_sepColFilter2D(const UMat & buf, UMat & dst, const Mat & kernelY
if (dst.depth() == CV_64F && !doubleSupport) if (dst.depth() == CV_64F && !doubleSupport)
return false; return false;
#ifdef ANDROID #ifdef __ANDROID__
size_t localsize[2] = { 16, 10 }; size_t localsize[2] = { 16, 10 };
#else #else
size_t localsize[2] = { 16, 16 }; size_t localsize[2] = { 16, 16 };

View File

@ -1635,7 +1635,7 @@ static bool ocl_morphOp(InputArray _src, OutputArray _dst, InputArray _kernel,
return true; return true;
} }
#ifdef ANDROID #ifdef __ANDROID__
size_t localThreads[2] = { 16, 8 }; size_t localThreads[2] = { 16, 8 };
#else #else
size_t localThreads[2] = { 16, 16 }; size_t localThreads[2] = { 16, 16 };
@ -1650,7 +1650,7 @@ static bool ocl_morphOp(InputArray _src, OutputArray _dst, InputArray _kernel,
if (localThreads[0]*localThreads[1] * 2 < (localThreads[0] + ksize.width - 1) * (localThreads[1] + ksize.height - 1)) if (localThreads[0]*localThreads[1] * 2 < (localThreads[0] + ksize.width - 1) * (localThreads[1] + ksize.height - 1))
return false; return false;
#ifdef ANDROID #ifdef __ANDROID__
if (dev.isNVidia()) if (dev.isNVidia())
return false; return false;
#endif #endif

View File

@ -3720,7 +3720,7 @@ static bool ocl_bilateralFilter_8u(InputArray _src, OutputArray _dst, int d,
double sigma_color, double sigma_space, double sigma_color, double sigma_space,
int borderType) int borderType)
{ {
#ifdef ANDROID #ifdef __ANDROID__
if (ocl::Device::getDefault().isNVidia()) if (ocl::Device::getDefault().isNVidia())
return false; return false;
#endif #endif

View File

@ -414,7 +414,7 @@ OCL_TEST_P(Remap_INTER_LINEAR, Mat)
random_roi(); random_roi();
double eps = 2.0; double eps = 2.0;
#ifdef ANDROID #ifdef __ANDROID__
// TODO investigate accuracy // TODO investigate accuracy
if (cv::ocl::Device::getDefault().isNVidia()) if (cv::ocl::Device::getDefault().isNVidia())
eps = 8.0; eps = 8.0;

View File

@ -48,7 +48,7 @@
#define USE_STD_THREADS #define USE_STD_THREADS
#endif #endif
#if defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(ANDROID) || defined(USE_STD_THREADS) #if defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(__ANDROID__) || defined(USE_STD_THREADS)
#include "opencv2/core/utility.hpp" #include "opencv2/core/utility.hpp"
@ -69,7 +69,7 @@
#define DEBUGLOGS 0 #define DEBUGLOGS 0
#endif #endif
#ifdef ANDROID #ifdef __ANDROID__
#include <android/log.h> #include <android/log.h>
#define LOG_TAG "OBJECT_DETECTOR" #define LOG_TAG "OBJECT_DETECTOR"
#define LOGD0(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) #define LOGD0(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))

View File

@ -11,7 +11,7 @@
// TODO remove LOG macros, add logging class // TODO remove LOG macros, add logging class
#if ENABLE_LOG #if ENABLE_LOG
#ifdef ANDROID #ifdef __ANDROID__
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <android/log.h> #include <android/log.h>

View File

@ -9,7 +9,7 @@
#include <functional> #include <functional>
#if !(defined(LOGD) || defined(LOGI) || defined(LOGW) || defined(LOGE)) #if !(defined(LOGD) || defined(LOGI) || defined(LOGW) || defined(LOGE))
# if defined(ANDROID) && defined(USE_ANDROID_LOGGING) # if defined(__ANDROID__) && defined(USE_ANDROID_LOGGING)
# include <android/log.h> # include <android/log.h>
# define PERF_TESTS_LOG_TAG "OpenCV_perf" # define PERF_TESTS_LOG_TAG "OpenCV_perf"

View File

@ -237,7 +237,7 @@ namespace perf
# else # else
printf("[----------]\n[ GPU INFO ] \tRun on OS Windows x32.\n[----------]\n"), fflush(stdout); printf("[----------]\n[ GPU INFO ] \tRun on OS Windows x32.\n[----------]\n"), fflush(stdout);
# endif # endif
#elif defined ANDROID #elif defined __ANDROID__
# if defined _LP64 || defined __LP64__ # if defined _LP64 || defined __LP64__
printf("[----------]\n[ GPU INFO ] \tRun on OS Android x64.\n[----------]\n"), fflush(stdout); printf("[----------]\n[ GPU INFO ] \tRun on OS Android x64.\n[----------]\n"), fflush(stdout);
# else # else

View File

@ -15,7 +15,7 @@
#include "opencv2/core/cuda.hpp" #include "opencv2/core/cuda.hpp"
#endif #endif
#ifdef ANDROID #ifdef __ANDROID__
# include <sys/time.h> # include <sys/time.h>
#endif #endif
@ -57,7 +57,7 @@ extern bool test_ipp_check;
static int param_cuda_device; static int param_cuda_device;
#endif #endif
#ifdef ANDROID #ifdef __ANDROID__
static int param_affinity_mask; static int param_affinity_mask;
static bool log_power_checkpoints; static bool log_power_checkpoints;
@ -973,7 +973,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
"{ perf_strategy |default |specifies performance measuring strategy: default, base or simple (weak restrictions)}" "{ perf_strategy |default |specifies performance measuring strategy: default, base or simple (weak restrictions)}"
"{ perf_read_validation_results | |specifies file name with performance results from previous run}" "{ perf_read_validation_results | |specifies file name with performance results from previous run}"
"{ perf_write_validation_results | |specifies file name to write performance validation results}" "{ perf_write_validation_results | |specifies file name to write performance validation results}"
#ifdef ANDROID #ifdef __ANDROID__
"{ perf_time_limit |6.0 |default time limit for a single test (in seconds)}" "{ perf_time_limit |6.0 |default time limit for a single test (in seconds)}"
"{ perf_affinity_mask |0 |set affinity mask for the main thread}" "{ perf_affinity_mask |0 |set affinity mask for the main thread}"
"{ perf_log_power_checkpoints | |additional xml logging for power measurement}" "{ perf_log_power_checkpoints | |additional xml logging for power measurement}"
@ -1044,7 +1044,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
#ifdef ENABLE_INSTRUMENTATION #ifdef ENABLE_INSTRUMENTATION
param_instrument = args.get<int>("perf_instrument"); param_instrument = args.get<int>("perf_instrument");
#endif #endif
#ifdef ANDROID #ifdef __ANDROID__
param_affinity_mask = args.get<int>("perf_affinity_mask"); param_affinity_mask = args.get<int>("perf_affinity_mask");
log_power_checkpoints = args.has("perf_log_power_checkpoints"); log_power_checkpoints = args.has("perf_log_power_checkpoints");
#endif #endif
@ -1461,7 +1461,7 @@ bool TestBase::next()
} }
} }
#ifdef ANDROID #ifdef __ANDROID__
if (log_power_checkpoints) if (log_power_checkpoints)
{ {
timeval tim; timeval tim;
@ -1758,7 +1758,7 @@ void TestBase::reportMetrics(bool toJUnitXML)
const char* type_param = test_info->type_param(); const char* type_param = test_info->type_param();
const char* value_param = test_info->value_param(); const char* value_param = test_info->value_param();
#if defined(ANDROID) && defined(USE_ANDROID_LOGGING) #if defined(__ANDROID__) && defined(USE_ANDROID_LOGGING)
LOGD("[ FAILED ] %s.%s", test_info->test_case_name(), test_info->name()); LOGD("[ FAILED ] %s.%s", test_info->test_case_name(), test_info->name());
#endif #endif
@ -1835,7 +1835,7 @@ void TestBase::SetUp()
if (param_threads >= 0) if (param_threads >= 0)
cv::setNumThreads(param_threads); cv::setNumThreads(param_threads);
#ifdef ANDROID #ifdef __ANDROID__
if (param_affinity_mask) if (param_affinity_mask)
setCurrentThreadAffinityMask(param_affinity_mask); setCurrentThreadAffinityMask(param_affinity_mask);
#endif #endif

View File

@ -43,7 +43,7 @@
#include "precomp.hpp" #include "precomp.hpp"
#include "opencl_kernels_video.hpp" #include "opencl_kernels_video.hpp"
#if defined __APPLE__ || defined ANDROID #if defined __APPLE__ || defined __ANDROID__
#define SMALL_LOCALSIZE #define SMALL_LOCALSIZE
#endif #endif

View File

@ -635,7 +635,7 @@ struct ImplMutex::Impl
int refcount; int refcount;
}; };
#elif defined __linux__ && !defined ANDROID #elif defined __linux__ && !defined __ANDROID__
struct ImplMutex::Impl struct ImplMutex::Impl
{ {