Skip to content

Commit

Permalink
Merge pull request opencv#9130 from alalek:android_define
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Jul 14, 2017
2 parents e5fbb4f + a4a47b5 commit 5a54ace
Show file tree
Hide file tree
Showing 25 changed files with 73 additions and 73 deletions.
12 changes: 6 additions & 6 deletions 3rdparty/carotene/src/channel_extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void extract2(const Size2D &size,
{
internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON
#ifndef ANDROID
#ifndef __ANDROID__
size_t roiw32 = size.width >= 31 ? size.width - 31 : 0;
#endif
size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
Expand All @@ -60,7 +60,7 @@ void extract2(const Size2D &size,
u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0u, dj = 0u;

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

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

#ifndef ANDROID
#ifndef __ANDROID__
for (; dj < roiw32; sj += 128, dj += 32)
{
internal::prefetch(src + sj);
Expand Down
8 changes: 4 additions & 4 deletions 3rdparty/carotene/src/channels_combine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void combineYUYV(const Size2D &size,
{
internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON
#ifndef ANDROID
#ifndef __ANDROID__
size_t roiw32 = size.width >= 31 ? size.width - 31 : 0;
#endif
size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
Expand All @@ -253,7 +253,7 @@ void combineYUYV(const Size2D &size,
u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
size_t syj = 0u, sj = 0u, dj = 0u;

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

#ifndef ANDROID
#ifndef __ANDROID__
for (; sj < roiw32; sj += 32, syj += 64, dj += 128)
{
internal::prefetch(srcy + syj);
Expand Down
8 changes: 4 additions & 4 deletions 3rdparty/carotene/src/flip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ void flip3(const Size2D & size,
{
using namespace internal;

#ifndef ANDROID
#ifndef __ANDROID__
typedef typename VecTraits<T, 3>::vec128 vec128;
#endif
typedef typename VecTraits<T, 3>::vec64 vec64;

#ifndef ANDROID
#ifndef __ANDROID__
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;
#endif
Expand All @@ -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);
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)
{
prefetch(src + js);
Expand All @@ -139,7 +139,7 @@ void flip3(const Size2D & size,

vst3q(dst + jd - step_base3, v_dst);
}
#endif // ANDROID
#endif // __ANDROID__

for (; j < roiw_tail; j += step_tail, js += step_tail3, jd -= step_tail3)
{
Expand Down
24 changes: 12 additions & 12 deletions 3rdparty/carotene/src/resize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
#ifndef ANDROID
#ifndef __ANDROID__
size_t roiw16 = dsize.width >= 15 ? dsize.width - 15 : 0;
#endif
size_t roiw8 = dsize.width >= 7 ? dsize.width - 7 : 0;
Expand All @@ -373,7 +373,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0, dj = 0;

#ifndef ANDROID
#ifndef __ANDROID__
for ( ; dj < roiw16; dj += 16, sj += 64)
{
internal::prefetch(src0_row + sj);
Expand Down Expand Up @@ -450,7 +450,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
{
if ((wr == 2.0f) && (hr == 2.0f))
{
#ifndef ANDROID
#ifndef __ANDROID__
size_t roiw4 = dsize.width >= 3 ? (dsize.width - 3) << 2 : 0;
#endif
size_t roiw2 = dsize.width >= 1 ? (dsize.width - 1) << 2 : 0;
Expand All @@ -462,7 +462,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0, dj = 0;

#ifndef ANDROID
#ifndef __ANDROID__
for ( ; dj < roiw4; dj += 16, sj += 32)
{
internal::prefetch(src0_row + sj);
Expand Down Expand Up @@ -537,7 +537,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
}
else if ((wr == 0.5f) && (hr == 0.5f))
{
#ifndef ANDROID
#ifndef __ANDROID__
size_t roiw32 = dsize.width >= 31 ? (dsize.width - 31) << 2 : 0;
#endif
size_t roiw16 = dsize.width >= 15 ? (dsize.width - 15) << 2 : 0;
Expand All @@ -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));
size_t sj = 0, dj = 0;

#ifndef ANDROID
#ifndef __ANDROID__
for ( ; dj < roiw32; dj += 128, sj += 64)
{
internal::prefetch(src_row + sj);
Expand Down Expand Up @@ -758,7 +758,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
{
if ((wr == 2.0f) && (wr == 2.0f))
{
#ifndef ANDROID
#ifndef __ANDROID__
size_t roiw16 = dsize.width >= 15 ? (dsize.width - 15) * 3 : 0;
#endif
size_t roiw8 = dsize.width >= 7 ? (dsize.width - 7) * 3 : 0;
Expand All @@ -770,7 +770,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0, dj = 0;

#ifndef ANDROID
#ifndef __ANDROID__
for ( ; dj < roiw16; dj += 48, sj += 96)
{
internal::prefetch(src0_row + sj);
Expand Down Expand Up @@ -856,7 +856,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
}
else if ((wr == 0.5f) && (hr == 0.5f))
{
#ifndef ANDROID
#ifndef __ANDROID__
size_t roiw32 = dsize.width >= 31 ? (dsize.width - 31) * 3 : 0;
#endif
size_t roiw16 = dsize.width >= 15 ? (dsize.width - 15) * 3 : 0;
Expand All @@ -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));
size_t sj = 0, dj = 0;

#ifndef ANDROID
#ifndef __ANDROID__
for ( ; dj < roiw32; dj += 96, sj += 48)
{
internal::prefetch(src_row + sj);
Expand Down Expand Up @@ -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
{
#ifndef ANDROID
#ifndef __ANDROID__
size_t roiw8 = dsize.width >= 7 ? (dsize.width - 7) * 3 : 0;
#endif

Expand All @@ -941,7 +941,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize,
u8 * dst_row = internal::getRowPtr(dstBase, dstStride, i);
size_t sj = 0, dj = 0;

#ifndef ANDROID
#ifndef __ANDROID__
for ( ; dj < roiw8; dj += 24, sj += 96)
{
internal::prefetch(src0_row + sj);
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ void cv::ogl::render(const ogl::Arrays& arr, InputArray indices, int mode, Scala
#endif // HAVE_OPENCL

#if defined(HAVE_OPENGL)
# if defined(ANDROID)
# if defined(__ANDROID__)
# include <EGL/egl.h>
# elif defined(__linux__)
# include <GL/glx.h>
Expand Down Expand Up @@ -1659,7 +1659,7 @@ Context& initializeContextFromGL()
CL_CONTEXT_PLATFORM, (cl_context_properties)platforms[i],
CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(),
CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(),
#elif defined(ANDROID)
#elif defined(__ANDROID__)
CL_CONTEXT_PLATFORM, (cl_context_properties)platforms[i],
CL_GL_CONTEXT_KHR, (cl_context_properties)eglGetCurrentContext(),
CL_EGL_DISPLAY_KHR, (cl_context_properties)eglGetCurrentDisplay(),
Expand Down
6 changes: 3 additions & 3 deletions modules/core/src/parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#if defined ANDROID
#if defined __ANDROID__
#include <sys/sysconf.h>
#elif defined __APPLE__
#include <sys/sysctl.h>
Expand Down Expand Up @@ -590,7 +590,7 @@ int cv::getThreadNum(void)
#endif
}

#ifdef ANDROID
#ifdef __ANDROID__
static inline int getNumberOfCPUsImpl()
{
FILE* cpuPossible = fopen("/sys/devices/system/cpu/possible", "r");
Expand Down Expand Up @@ -641,7 +641,7 @@ int cv::getNumberOfCPUs(void)
#endif

return (int)sysinfo.dwNumberOfProcessors;
#elif defined ANDROID
#elif defined __ANDROID__
static int ncpus = getNumberOfCPUsImpl();
return ncpus;
#elif defined __linux__
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/parallel_pthreads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ void ThreadManager::setNumOfThreads(size_t n)

size_t ThreadManager::defaultNumberOfThreads()
{
#ifdef ANDROID
#ifdef __ANDROID__
// many modern phones/tables have 4-core CPUs. Let's use no more
// than 2 threads by default not to overheat the devices
const unsigned int default_number_of_threads = 2;
Expand Down
6 changes: 3 additions & 3 deletions modules/core/src/stat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ static bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int*
{
const ocl::Device & dev = ocl::Device::getDefault();

#ifdef ANDROID
#ifdef __ANDROID__
if (dev.isNVidia())
return false;
#endif
Expand Down Expand Up @@ -2971,7 +2971,7 @@ static bool ocl_norm( InputArray _src, int normType, InputArray _mask, double &
{
const ocl::Device & d = ocl::Device::getDefault();

#ifdef ANDROID
#ifdef __ANDROID__
if (d.isNVidia())
return false;
#endif
Expand Down Expand Up @@ -3313,7 +3313,7 @@ namespace cv {

static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask, double & result )
{
#ifdef ANDROID
#ifdef __ANDROID__
if (ocl::Device::getDefault().isNVidia())
return false;
#endif
Expand Down
12 changes: 6 additions & 6 deletions modules/core/src/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ Mutex* __initialization_mutex_initializer = &getInitializationMutex();
# endif
#endif

#if defined ANDROID || defined __linux__ || defined __FreeBSD__
#if defined __ANDROID__ || defined __linux__ || defined __FreeBSD__
# include <unistd.h>
# include <fcntl.h>
# include <elf.h>
#if defined ANDROID || defined __linux__
#if defined __ANDROID__ || defined __linux__
# include <linux/auxvec.h>
#endif
#endif

#if defined ANDROID && defined HAVE_CPUFEATURES
#if defined __ANDROID__ && defined HAVE_CPUFEATURES
# include <cpu-features.h>
#endif

Expand Down Expand Up @@ -206,12 +206,12 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix)
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#if defined ANDROID
#if defined __ANDROID__
#include <sys/sysconf.h>
#endif
#endif

#ifdef ANDROID
#ifdef __ANDROID__
# include <android/log.h>
#endif

Expand Down Expand Up @@ -833,7 +833,7 @@ String tempfile( const char* suffix )
fname = temp_file;
#endif
# else
# ifdef ANDROID
# ifdef __ANDROID__
//char defaultTemplate[] = "/mnt/sdcard/__opencv_temp.XXXXXX";
char defaultTemplate[] = "/data/local/tmp/__opencv_temp.XXXXXX";
# else
Expand Down
2 changes: 1 addition & 1 deletion modules/core/test/ocl/test_arithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ OCL_TEST_P(Mul, Mat_Scale)
OCL_OFF(cv::multiply(src1_roi, src2_roi, dst1_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);
#else
Near(udst1_roi.depth() >= CV_32F ? 1e-3 : 1);
Expand Down
6 changes: 3 additions & 3 deletions modules/features2d/test/ocl/test_brute_force_matcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ PARAM_TEST_CASE(BruteForceMatcher, int, int)
}
};

#ifdef ANDROID
#ifdef __ANDROID__
OCL_TEST_P(BruteForceMatcher, DISABLED_Match_Single)
#else
OCL_TEST_P(BruteForceMatcher, Match_Single)
Expand All @@ -135,7 +135,7 @@ OCL_TEST_P(BruteForceMatcher, Match_Single)
ASSERT_EQ(0, badCount);
}

#ifdef ANDROID
#ifdef __ANDROID__
OCL_TEST_P(BruteForceMatcher, DISABLED_KnnMatch_2_Single)
#else
OCL_TEST_P(BruteForceMatcher, KnnMatch_2_Single)
Expand Down Expand Up @@ -171,7 +171,7 @@ OCL_TEST_P(BruteForceMatcher, KnnMatch_2_Single)
ASSERT_EQ(0, badCount);
}

#ifdef ANDROID
#ifdef __ANDROID__
OCL_TEST_P(BruteForceMatcher, DISABLED_RadiusMatch_Single)
#else
OCL_TEST_P(BruteForceMatcher, RadiusMatch_Single)
Expand Down
Loading

0 comments on commit 5a54ace

Please sign in to comment.