From ebc142b1d8ca6fbfe90f3f3f450269c1a883a2d2 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 25 Apr 2018 22:41:16 +0300 Subject: [PATCH] Merge pull request #1623 from alalek:android_pack_fix_contrib * android: fix build warnings * build: fix warnings --- modules/bioinspired/src/retina_ocl.cpp | 5 +- .../surface_matching/src/hash_murmur86.hpp | 63 +++++-------------- .../src/selectivesearchsegmentation.cpp | 2 + 3 files changed, 21 insertions(+), 49 deletions(-) diff --git a/modules/bioinspired/src/retina_ocl.cpp b/modules/bioinspired/src/retina_ocl.cpp index 23744587c..b48a412a1 100644 --- a/modules/bioinspired/src/retina_ocl.cpp +++ b/modules/bioinspired/src/retina_ocl.cpp @@ -391,7 +391,6 @@ bool RetinaOCLImpl::convertToColorPlanes(const UMat& input, UMat &output) else { CV_Error(-1, "Retina ocl only support 1, 3, 4 channel input"); - return false; } } void RetinaOCLImpl::convertToInterleaved(const UMat& input, bool colorMode, UMat &output) @@ -449,8 +448,8 @@ void RetinaOCLImpl::getMagnoRAW(OutputArray retinaOutput_magno) // unimplemented interfaces: void RetinaOCLImpl::applyFastToneMapping(InputArray /*inputImage*/, OutputArray /*outputToneMappedImage*/) { NOT_IMPLEMENTED; } -const Mat RetinaOCLImpl::getMagnoRAW() const { NOT_IMPLEMENTED; return Mat(); } -const Mat RetinaOCLImpl::getParvoRAW() const { NOT_IMPLEMENTED; return Mat(); } +const Mat RetinaOCLImpl::getMagnoRAW() const { NOT_IMPLEMENTED; } +const Mat RetinaOCLImpl::getParvoRAW() const { NOT_IMPLEMENTED; } /////////////////////////////////////// ///////// BasicRetinaFilter /////////// diff --git a/modules/surface_matching/src/hash_murmur86.hpp b/modules/surface_matching/src/hash_murmur86.hpp index 7b7d01524..2c6b04601 100644 --- a/modules/surface_matching/src/hash_murmur86.hpp +++ b/modules/surface_matching/src/hash_murmur86.hpp @@ -78,59 +78,30 @@ void hashMurmurx86 ( const void * key, const int len, const uint seed, void * ou * ROTL32(x,r) Rotate x left by r bits */ -/* Convention is to define __BYTE_ORDER == to one of these values */ -#if !defined(__BIG_ENDIAN) -#define __BIG_ENDIAN 4321 -#endif -#if !defined(__LITTLE_ENDIAN) -#define __LITTLE_ENDIAN 1234 -#endif - -/* I386 */ -#if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(i386) -#define __BYTE_ORDER __LITTLE_ENDIAN -#define UNALIGNED_SAFE -#endif - -/* gcc 'may' define __LITTLE_ENDIAN__ or __BIG_ENDIAN__ to 1 (Note the trailing __), -* or even _LITTLE_ENDIAN or _BIG_ENDIAN (Note the single _ prefix) */ -#if !defined(__BYTE_ORDER) -#if defined(__LITTLE_ENDIAN__) && __LITTLE_ENDIAN__==1 || defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN==1 -#define __BYTE_ORDER __LITTLE_ENDIAN -#elif defined(__BIG_ENDIAN__) && __BIG_ENDIAN__==1 || defined(_BIG_ENDIAN) && _BIG_ENDIAN==1 -#define __BYTE_ORDER __BIG_ENDIAN -#endif +#if (defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(i386)) +# define UNALIGNED_SAFE 1 #endif -/* gcc (usually) defines xEL/EB macros for ARM and MIPS endianess */ -#if !defined(__BYTE_ORDER) -#if defined(__ARMEL__) || defined(__MIPSEL__) -#define __BYTE_ORDER __LITTLE_ENDIAN -#endif -#if defined(__ARMEB__) || defined(__MIPSEB__) -#define __BYTE_ORDER __BIG_ENDIAN -#endif +#ifndef UNALIGNED_SAFE +# define UNALIGNED_SAFE 1 +#elif defined(UNALIGNED_SAFE) && !UNALIGNED_SAFE == 0 +# undef UNALIGNED_SAFE #endif /* Now find best way we can to READ_UINT32 */ -#if __BYTE_ORDER==__LITTLE_ENDIAN -/* CPU endian matches murmurhash algorithm, so read 32-bit word directly */ -#define READ_UINT32(ptr) (*((uint32_t*)(ptr))) -#elif __BYTE_ORDER==__BIG_ENDIAN -/* TODO: Add additional cases below where a compiler provided bswap32 is available */ -#if defined(__GNUC__) && (__GNUC__>4 || (__GNUC__==4 && __GNUC_MINOR__>=3)) -#define READ_UINT32(ptr) (__builtin_bswap32(*((uint32_t*)(ptr)))) -#else -/* Without a known fast bswap32 we're just as well off doing this */ -#define READ_UINT32(ptr) (ptr[0]|ptr[1]<<8|ptr[2]<<16|ptr[3]<<24) -#define UNALIGNED_SAFE +#if (defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(i386)) \ + || (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +# define READ_UINT32(ptr) (*((uint32_t*)(ptr))) +#elif (defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + && defined(__GNUC__) && (__GNUC__>4 || (__GNUC__==4 && __GNUC_MINOR__>=3)) +# define READ_UINT32(ptr) (__builtin_bswap32(*((uint32_t*)(ptr)))) #endif -#else -/* Unknown endianess so last resort is to read individual bytes */ -#define READ_UINT32(ptr) (ptr[0]|ptr[1]<<8|ptr[2]<<16|ptr[3]<<24) -/* Since we're not doing word-reads we can skip the messing about with realignment */ -#define UNALIGNED_SAFE +#ifndef READ_UINT32 +/* Unknown endianess so last resort is to read individual bytes */ +# define READ_UINT32(ptr) (ptr[0]|ptr[1]<<8|ptr[2]<<16|ptr[3]<<24) +# undef UNALIGNED_SAFE +# define UNALIGNED_SAFE 1 #endif /*----------------------------------------------------------------------------- diff --git a/modules/ximgproc/src/selectivesearchsegmentation.cpp b/modules/ximgproc/src/selectivesearchsegmentation.cpp index a297280a5..05e80e063 100644 --- a/modules/ximgproc/src/selectivesearchsegmentation.cpp +++ b/modules/ximgproc/src/selectivesearchsegmentation.cpp @@ -58,6 +58,8 @@ namespace cv { double rank; Rect bounding_box; + Region() : id(0), level(0), merged_to(0), rank(0) {} + friend std::ostream& operator<<(std::ostream& os, const Region& n); bool operator <(const Region& n) const {