Merge pull request #12458 from DEEPIR:3.4
authorcyy <cyyever@outlook.com>
Fri, 7 Sep 2018 15:43:47 +0000 (23:43 +0800)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Fri, 7 Sep 2018 15:43:47 +0000 (18:43 +0300)
* may be an typo fix

* remove identical branch,may be paste error

* add parentheses around macro parameter

* simplify if condition

* check malloc fail

* change the condition of branch removed by commit 3041502861318c85d901e8c08226ff67898c77ed

modules/core/include/opencv2/core/utils/trace.hpp
modules/core/include/opencv2/core/vsx_utils.hpp
modules/core/src/precomp.hpp
modules/imgcodecs/src/grfmt_webp.cpp
modules/photo/src/align.cpp
modules/video/src/bgfg_KNN.cpp
modules/video/src/bgfg_gaussmix2.cpp
modules/videoio/src/cap_ffmpeg_impl.hpp

index 1539fb9..194c8d7 100644 (file)
@@ -142,7 +142,7 @@ CV_EXPORTS void traceArg(const TraceArg& arg, double value);
     static const CV_TRACE_NS::details::Region::LocationStaticStorage \
         CV__TRACE_LOCATION_VARNAME(loc_id) = { &(CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id)), name, CV_TRACE_FILENAME, __LINE__, flags};
 
-#define CV__TRACE_DEFINE_LOCATION_FN(name, flags) CV__TRACE_DEFINE_LOCATION_(fn, name, (flags | CV_TRACE_NS::details::REGION_FLAG_FUNCTION))
+#define CV__TRACE_DEFINE_LOCATION_FN(name, flags) CV__TRACE_DEFINE_LOCATION_(fn, name, ((flags) | CV_TRACE_NS::details::REGION_FLAG_FUNCTION))
 
 
 #define CV__TRACE_OPENCV_FUNCTION() \
index ca55d97..d4dab9e 100644 (file)
@@ -203,7 +203,7 @@ VSX_FINLINE(rt) fnm(const rg& a, const rg& b)  \
 
 #if __GNUG__ < 5
 // vec_xxpermdi in gcc4 missing little-endian supports just like clang
-#   define vec_permi(a, b, c) vec_xxpermdi(b, a, (3 ^ ((c & 1) << 1 | c >> 1)))
+#   define vec_permi(a, b, c) vec_xxpermdi(b, a, (3 ^ (((c) & 1) << 1 | (c) >> 1)))
 #else
 #   define vec_permi vec_xxpermdi
 #endif // __GNUG__ < 5
@@ -320,7 +320,7 @@ VSX_FINLINE(rt) fnm(const rg& a) { return __builtin_convertvector(a, rt); }
 #   define vec_xxsldwi(a, b, c) vec_sld(a, b, (c) * 4)
 #else
 // vec_xxpermdi is missing little-endian supports in clang 4 just like gcc4
-#   define vec_permi(a, b, c) vec_xxpermdi(b, a, (3 ^ ((c & 1) << 1 | c >> 1)))
+#   define vec_permi(a, b, c) vec_xxpermdi(b, a, (3 ^ (((c) & 1) << 1 | (c) >> 1)))
 #endif // __clang_major__ < 5
 
 // shift left double by word immediate
index 54d0a22..6349aa2 100644 (file)
@@ -204,7 +204,7 @@ struct NoVec
     size_t operator()(const void*, const void*, void*, size_t) const { return 0; }
 };
 
-#define CV_SPLIT_MERGE_MAX_BLOCK_SIZE(cn) ((INT_MAX/4)/cn) // HAL implementation accepts 'int' len, so INT_MAX doesn't work here
+#define CV_SPLIT_MERGE_MAX_BLOCK_SIZE(cn) ((INT_MAX/4)/(cn)) // HAL implementation accepts 'int' len, so INT_MAX doesn't work here
 
 enum { BLOCK_SIZE = 1024 };
 
index 58ddec3..6b10112 100644 (file)
@@ -207,9 +207,9 @@ bool WebPDecoder::readData(Mat &img)
         {
             cvtColor(read_img, img, COLOR_BGRA2BGR);
         }
-        else if (img.type() == CV_8UC3 && m_type == CV_8UC4)
+        else if (img.type() == CV_8UC4 && m_type == CV_8UC3)
         {
-            cvtColor(read_img, img, COLOR_BGRA2BGR);
+            cvtColor(read_img, img, COLOR_BGR2BGRA);
         }
         else
         {
index cfb8a5d..d83bf69 100644 (file)
@@ -123,7 +123,7 @@ public:
         Mat img0 = _img0.getMat();
         Mat img1 = _img1.getMat();
         CV_Assert(img0.channels() == 1 && img0.type() == img1.type());
-        CV_Assert(img0.size() == img0.size());
+        CV_Assert(img0.size() == img1.size());
 
         int maxlevel = static_cast<int>(log((double)max(img0.rows, img0.cols)) / log(2.0)) - 1;
         maxlevel = min(maxlevel, max_bits - 1);
index 2866e2d..794b90e 100755 (executable)
@@ -229,7 +229,7 @@ public:
     virtual bool getDetectShadows() const CV_OVERRIDE { return bShadowDetection; }
     virtual void setDetectShadows(bool detectshadows) CV_OVERRIDE
     {
-        if ((bShadowDetection && detectshadows) || (!bShadowDetection && !detectshadows))
+        if (bShadowDetection == detectshadows)
             return;
         bShadowDetection = detectshadows;
 #ifdef HAVE_OPENCL
index 96ae029..ab77fd7 100644 (file)
@@ -266,7 +266,7 @@ public:
     virtual bool getDetectShadows() const CV_OVERRIDE { return bShadowDetection; }
     virtual void setDetectShadows(bool detectshadows) CV_OVERRIDE
     {
-        if ((bShadowDetection && detectshadows) || (!bShadowDetection && !detectshadows))
+        if (bShadowDetection == detectshadows)
             return;
         bShadowDetection = detectshadows;
 #ifdef HAVE_OPENCL
index f4a9f9c..e0198be 100644 (file)
@@ -715,6 +715,8 @@ static int LockCallBack(void **mutex, AVLockOp op)
     {
         case AV_LOCK_CREATE:
             localMutex = reinterpret_cast<ImplMutex*>(malloc(sizeof(ImplMutex)));
+            if (!localMutex)
+                return 1;
             localMutex->init();
             *mutex = localMutex;
             if (!*mutex)