nareshmlx/opencv-pr huggingface dataset:
**File:** modules/core/include/opencv2/core/cvdef.h
**Change Type:** modified
**Context:** PR #3816: cvRound - compilation with O4T
**Review Line:** 508

**Code Changes:**
```diff
 CV_INLINE int cvRound(float value)
 {
-#if CV_VFP && !defined HAVE_TEGRA_OPTIMIZATION
+#if defined ANDROID && (defined CV_ICC || defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION
+    TEGRA_ROUND_FLT(value);
+#elif CV_VFP && !defined HAVE_TEGRA_OPTIMIZATION
     ARM_ROUND_FLT(value)
 #else
     return cvRound((double)value);
```

Review comment:
I can see that. But why?
**File:** modules/python/src2/hdr_parser.py
**Change Type:** modified
**Context:** PR #3406: Mod: Open header files with encoding if Python version is greater than 2... - Fix bug #4003 [http://www.code.opencv.org/issues/4003]

**Code Changes:**
```diff
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 from __future__ import print_function
-import os, sys, re, string
+import os, sys, re, string, io
 
 # the list only for debugging. The real list, used in the real OpenCV build, is specified in CMakeLists.txt
 opencv_hdr_list = [
@@ -734,7 +734,7 @@ def parse(self, hname, wmode=True):
```

Review comment:
You can use ``` python f = io.open(hname, "rt", encoding='utf-8') ``` to avoid version check. It should work in both versions.
**File:** modules/python/src2/hdr_parser.py
**Change Type:** modified
**Context:** PR #3406: Mod: Open header files with encoding if Python version is greater than 2... - Fix bug #4003 [http://www.code.opencv.org/issues/4003]

**Code Changes:**
```diff
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 from __future__ import print_function
-import os, sys, re, string
+import os, sys, re, string, io
 
 # the list only for debugging. The real list, used in the real OpenCV build, is specified in CMakeLists.txt
 opencv_hdr_list = [
@@ -734,7 +734,7 @@ def parse(self, hname, wmode=True):
```

Review comment:
Yes, `io.open` is a good solution. I just try not to import more modules. Which one do you feel more appropriate? If `io.open`, then I can make another PR.
**File:** modules/python/src2/hdr_parser.py
**Change Type:** modified
**Context:** PR #3406: Mod: Open header files with encoding if Python version is greater than 2... - Fix bug #4003 [http://www.code.opencv.org/issues/4003]

**Code Changes:**
```diff
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 from __future__ import print_function
-import os, sys, re, string
+import os, sys, re, string, io
 
 # the list only for debugging. The real list, used in the real OpenCV build, is specified in CMakeLists.txt
 opencv_hdr_list = [
@@ -734,7 +734,7 @@ def parse(self, hname, wmode=True):
```

Review comment:
I think `io.open` looks better. You don't need to create new PR, just amend current commit (`git commit --amend`) and then force push to you current branch (`git push -f`).
**File:** modules/core/src/persistence.cpp
**Change Type:** modified
**Context:** PR #3497: Fix memory leaks appearing when cvOpenFileStorage throws - I'm not sure why a C function throws in the first place, but changing that would ...
**Review Line:** 2845

**Code Changes:**
```diff
                     }
                 }
+                cvFree( &xml_buf );
                 if( last_occurence < 0 )
+                {
+                    cvReleaseFileStorage( &fs );
                     CV_Error( CV_StsError, "Could not find </opencv_storage> in the end of file.\n" );
+                }
                 icvCloseFile( fs );
                 fs->file = fopen( fs->filename, "r+t" );
                 fseek( fs->file, last_occurence, SEEK_SET );
```

Review comment:
Maybe `xml_buf` (line 2825) should also be freed here?
**File:** modules/core/src/persistence.cpp
**Change Type:** modified
**Context:** PR #3497: Fix memory leaks appearing when cvOpenFileStorage throws - I'm not sure why a C function throws in the first place, but changing that would ...
**Review Line:** 2845

**Code Changes:**
```diff
                     }
                 }
+                cvFree( &xml_buf );
                 if( last_occurence < 0 )
+                {
+                    cvReleaseFileStorage( &fs );
                     CV_Error( CV_StsError, "Could not find </opencv_storage> in the end of file.\n" );
+                }
                 icvCloseFile( fs );
                 fs->file = fopen( fs->filename, "r+t" );
                 fseek( fs->file, last_occurence, SEEK_SET );
```

Review comment:
Good catch. Done.
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #3216: change libraries install layout on linux-mingw - Hello, This patch changes the directories where binaries and libraries are installed when c...

**Code Changes:**
```diff
@@ -254,7 +254,7 @@ else()
   set(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc)
 endif()
 
-if(WIN32)
+if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
   if(DEFINED OpenCV_RUNTIME AND DEFINED OpenCV_ARCH)
     set(OpenCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/")
   else()
@@ -294,7 +294,7 @@ if(ANDROID)
```

Review comment:
Looks like you want here `else` path for MinGW. So proposed condition should work: ``` if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows) ```
**File:** cmake/OpenCVFindIPP.cmake
**Change Type:** modified
**Context:** PR #3794: Several small stabilization fixes - 1) make sure Python 2.7 is detected on Ubuntu (including libs) when it's there. 2) disable IPP on 32-bit...

**Code Changes:**
```diff
@@ -34,6 +34,11 @@ unset(IPP_VERSION_MAJOR)
 unset(IPP_VERSION_MINOR)
 unset(IPP_VERSION_BUILD)
 
+if (X86 AND UNIX AND NOT APPLE AND NOT ANDROID AND BUILD_SHARED_LIBS)
+    message(STATUS "On 32-bit Linux IPP can not currently be used with dynamic libs because of linker errors. Set BUILD_SHARED_LIBS=OFF")
+    return()
+endif()
+
 set(IPP_X64 0)
```

Review comment:
can you maybe add some info on why it can "currently" not be used and/or what needs to be fixed to resolve this?
**File:** cmake/OpenCVFindIPP.cmake
**Change Type:** modified
**Context:** PR #3794: Several small stabilization fixes - 1) make sure Python 2.7 is detected on Ubuntu (including libs) when it's there. 2) disable IPP on 32-bit...

**Code Changes:**
```diff
@@ -34,6 +34,11 @@ unset(IPP_VERSION_MAJOR)
 unset(IPP_VERSION_MINOR)
 unset(IPP_VERSION_BUILD)
 
+if (X86 AND UNIX AND NOT APPLE AND NOT ANDROID AND BUILD_SHARED_LIBS)
+    message(STATUS "On 32-bit Linux IPP can not currently be used with dynamic libs because of linker errors. Set BUILD_SHARED_LIBS=OFF")
+    return()
+endif()
+
 set(IPP_X64 0)
```

Review comment:
There is a linker issue: [http://code.opencv.org/issues/4070](http://code.opencv.org/issues/4070) Also some other mentions: - https://software.intel.com/en-us/forums/topic/335961 - http://answers.opencv.org/question/37115/opencv-249-make-error/ It can be related with the following note from [IPP 8.1 Release Notes](https://software.intel.com/en-us/articles/intel-ipp-81-library-release-notes): > Known Intel® IPP 8.1 Issues and Limitations: > - On Linux\* OS, Intel IPP shared libraries for IA-32 contain non-PIC symbols. Each process that uses Intel IPP shared libraries uses a separate copy of the library instead of using one common library.
**File:** cmake/OpenCVDetectPython.cmake
**Change Type:** modified
**Context:** PR #3794: Several small stabilization fixes - 1) make sure Python 2.7 is detected on Ubuntu (including libs) when it's there. 2) disable IPP on 32-bit...

**Code Changes:**
```diff
@@ -75,10 +75,10 @@ function(find_python preferred_version min_version library_env include_dir_env
 
     if(NOT ANDROID AND NOT IOS)
       ocv_check_environment_variables(${library_env} ${include_dir_env})
-      if(${library})
+      if(${${library_env}})
           set(PYTHON_LIBRARY "${${library_env}}")
       endif()
-      if(${include_dir})
+      if(${${include_dir_env}})
```

Review comment:
Interesting, it fixes PYTHON3 detection but breaks PYTHON2 detection for me. I think problem is several lines upper, the environment detection works wrong, it should be: ``` .cmake ocv_check_environment_variables(${library_env} ${include_dir_env}) if(${${library_env}}) set(PYTHON_LIBRARY "${${library_env}}") endif() if(${${include_dir_env}}) set(PYTHON_INCLUDE_DIR "${${include_dir_env}}") endif() ```
**File:** cmake/OpenCVDetectPython.cmake
**Change Type:** modified
**Context:** PR #3794: Several small stabilization fixes - 1) make sure Python 2.7 is detected on Ubuntu (including libs) when it's there. 2) disable IPP on 32-bit...

**Code Changes:**
```diff
@@ -75,10 +75,10 @@ function(find_python preferred_version min_version library_env include_dir_env
 
     if(NOT ANDROID AND NOT IOS)
       ocv_check_environment_variables(${library_env} ${include_dir_env})
-      if(${library})
+      if(${${library_env}})
           set(PYTHON_LIBRARY "${${library_env}}")
       endif()
-      if(${include_dir})
+      if(${${include_dir_env}})
```

Review comment:
the proposed fix does not help :( and how come my solution break python2 if it calls find_host_package another time only if pythonlibs are not found? BTW, buildbot also finds Python successfully with the patch.
**File:** modules/core/src/stat.cpp
**Change Type:** modified
**Context:** PR #4135: IPP code refactored - IPP code path implemented as separate static functions to simplify future work with IPP code and make it more readable...
**Review Line:** 2258

**Code Changes:**
```diff
+        {
+            typedef IppStatus (CV_STDCALL* ippiMinMaxIndxFuncC1)(const void *, int, IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *);
 
-                if( ippFuncC1 )
+            CV_SUPPRESS_DEPRECATED_START
+            ippiMinMaxIndxFuncC1 ippFuncC1 =
+                depth == CV_8U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1R :
+                depth == CV_8S ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8s_C1R :
+                depth == CV_16U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1R :
+#if !((defined _MSC_VER && defined _M_IX86) || defined __i386__)
+                depth == CV_32F ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R :
```

Review comment:
This condition should be restored. http://pullrequest.opencv.org/buildbot/builders/precommit_windows32/builds/196/steps/test_imgproc_1/logs/stdio (this buildslave's CPU is AMD A10-6800K, so something went wrong in this case)
**File:** modules/core/test/test_utils.cpp
**Change Type:** added
**Context:** PR #5372: add some CommandLineParser tests
**Review Line:** 136

**Code Changes:**
```diff
+    cv::CommandLineParser parser(argc, argv, keys2);
+    //EXPECT_FALSE(parser.has("arg1"));
+    //EXPECT_FALSE(parser.has("arg2"));
+    //EXPECT_EQ("default1", parser.get<String>("arg1"));
+    EXPECT_EQ("default1", parser.get<String>(0));
+    //??? EXPECT_ANY_THROW(parser.get<String>("arg2"));
+    //??? EXPECT_ANY_THROW(parser.get<String>(1));
+}
+
+TEST(CommandLineParser, testPositional_default)
+{
```

Review comment:
it does not throw, but rather sets the error flag for `CommandLineParser::check`
**File:** modules/core/test/test_utils.cpp
**Change Type:** added
**Context:** PR #5372: add some CommandLineParser tests
**Review Line:** 76

**Code Changes:**
```diff
+TEST(CommandLineParser, testBoolOption_noArgs)
+{
+    const char* argv[] = {"<bin>"};
+    const int argc = 1;
+    cv::CommandLineParser parser(argc, argv, keys);
+    EXPECT_FALSE(parser.get<bool>("help"));
+    EXPECT_FALSE(parser.get<bool>("h"));
+    EXPECT_FALSE(parser.get<bool>("info"));
+    EXPECT_FALSE(parser.get<bool>("i"));
+    EXPECT_TRUE(parser.get<bool>("true")); // default is true
+    EXPECT_TRUE(parser.get<bool>("t"));
```

Review comment:
this one sets the error flag. maybe add `EXPECT_TRUE(parser.check())`
**File:** modules/core/test/test_utils.cpp
**Change Type:** added
**Context:** PR #5372: add some CommandLineParser tests
**Review Line:** 42

**Code Changes:**
```diff
+    EXPECT_TRUE(parser.has("h"));
+    EXPECT_TRUE(parser.has("info"));
+    EXPECT_TRUE(parser.has("i"));
+    EXPECT_FALSE(parser.has("n"));
+    EXPECT_FALSE(parser.has("unused"));
+    EXPECT_FALSE(parser.has("q")); // TODO Throw ???
+}
+TEST(CommandLineParser, testHas_TrueValues1)
+{
+    const char* argv[] = {"<bin>", "-h=1", "--info=1"};
+    const int argc = 3;
```

Review comment:
good idea. asking for a undeclared key is likely a programming error. (e.g. typo in key name)
**File:** modules/calib3d/src/triangulate.cpp
**Change Type:** modified
**Context:** PR #3938: clean up cvTriangulatePoints by using C++ primitives directly. - also fixes the Calib3d_StereoCalibrate_C testcase.

**Code Changes:**
```diff
@@ -63,8 +63,7 @@ cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvMa
       !CV_IS_MAT(points4D) )
       CV_Error( CV_StsUnsupportedFormat, "Input parameters must be matrices" );
 
-    int numPoints;
-    numPoints = projPoints1->cols;
+    int numPoints = projPoints1->cols;
 
     if( numPoints < 1 )
         CV_Error( CV_StsOutOfRange, "Number of points must be more than zero" );
```

Review comment:
when you use cv::SVD class, it allocates w, u and vt internally in the heap, which may or may not be an expensive operation. Probably, cv::SVD::compute should be used instead, and w, u and vt should be cv::Matx's as well.
**File:** modules/calib3d/src/fundam.cpp
**Change Type:** modified
**Context:** PR #4183: simplify 8point algorithm using Matx classes - easier to read and should also be faster as the matrix multiplications can be inlined using e...

**Code Changes:**
```diff
@@ -547,45 +547,32 @@ static int run7Point( const Mat& _m1, const Mat& _m2, Mat& _fmatrix )
 
 static int run8Point( const Mat& _m1, const Mat& _m2, Mat& _fmatrix )
 {
-    double a[9*9], w[9], v[9*9];
-    Mat W( 9, 1, CV_64F, w );
-    Mat V( 9, 9, CV_64F, v );
-    Mat A( 9, 9, CV_64F, a );
-    Mat U, F0, TF;
-
```

Review comment:
run7Point, run8Point return the number of solutions, not a boolean flag; please, revert the change
**File:** modules/calib3d/src/fundam.cpp
**Change Type:** modified
**Context:** PR #4183: simplify 8point algorithm using Matx classes - easier to read and should also be faster as the matrix multiplications can be inlined using e...

**Code Changes:**
```diff
@@ -547,45 +547,32 @@ static int run7Point( const Mat& _m1, const Mat& _m2, Mat& _fmatrix )
 
 static int run8Point( const Mat& _m1, const Mat& _m2, Mat& _fmatrix )
 {
-    double a[9*9], w[9], v[9*9];
-    Mat W( 9, 1, CV_64F, w );
-    Mat V( 9, 9, CV_64F, v );
-    Mat A( 9, 9, CV_64F, a );
-    Mat U, F0, TF;
-
```

Review comment:
use Mat(F0).copyTo(_fmatrix) instead, because the caller may pre-allocate _fmatrix and expect that it's stored at some particular location
**File:** samples/cpp/stereo_match.cpp
**Change Type:** modified
**Context:** PR #3357: add input paramter checking that verifies the existance of the input files to stero_match example - Hi, I'm just learning the git process. I...

**Code Changes:**
```diff
@@ -159,7 +159,18 @@ int main(int argc, char** argv)
     Mat img1 = imread(img1_filename, color_mode);
     Mat img2 = imread(img2_filename, color_mode);
 
-    if( scale != 1.f )
+    if (img1.empty())
+    {
+        printf("Command-line parameter error: could not load the first input image file\n");
+        return -1;
+    }
```

Review comment:
I believe it's better to check `img1.empty()` and `img2.empty()` (see lines below), because I can pass `file1.txt` and `file2.txt` as command line parameters, but the images will be empty
**File:** samples/cpp/stereo_match.cpp
**Change Type:** modified
**Context:** PR #3357: add input paramter checking that verifies the existance of the input files to stero_match example - Hi, I'm just learning the git process. I...

**Code Changes:**
```diff
@@ -159,7 +159,18 @@ int main(int argc, char** argv)
     Mat img1 = imread(img1_filename, color_mode);
     Mat img2 = imread(img2_filename, color_mode);
 
-    if( scale != 1.f )
+    if (img1.empty())
+    {
+        printf("Command-line parameter error: could not load the first input image file\n");
+        return -1;
+    }
```

Review comment:
why did you add this?
**File:** modules/core/src/ocl.cpp
**Change Type:** modified
**Context:** PR #5242: UMat fixes (getUMat & 'map_unmap_counting') - fixes for the following failing UMat tests: `Core_UMat.getUMat` (#5010), `UMat.map_unmap_count...

**Code Changes:**
```diff
@@ -4571,17 +4571,13 @@ class OpenCLAllocator : public MatAllocator
                     }
                     else
                     {
-                        // CL_MEM_USE_HOST_PTR (nothing is required) and OTHER cases
-                        if (u->flags & UMatData::USER_ALLOCATED)
-                        {
-                            cl_int retval = 0;
-                            void* data = clEnqueueMapBuffer(q, (cl_mem)u->handle, CL_TRUE,
-                                (CL_MAP_READ | CL_MAP_WRITE),
```

Review comment:
This comment is not actual, please remove it.
**File:** modules/core/src/arithm.cpp
**Change Type:** modified
**Context:** PR #3557: SSE2 optimization of addWeighted - ``` addWeighted::Size_MatType::(640x480, 8SC1) 2.257 ms 0.166 ms 13.58 addWeighted::Size_MatType::(640x48...

**Code Changes:**
```diff
@@ -2772,7 +2772,144 @@ struct AddWeighted_SIMD
     }
 };
 
-#if CV_NEON
+#if CV_SSE2
+
+template <>
+struct AddWeighted_SIMD<schar, float>
+{
```

Review comment:
there should probably be check for SSE 4.1 in runtime as well
**File:** modules/core/src/matrix.cpp
**Change Type:** modified
**Context:** PR #4212: Extended Mat::reshape method to accept n-dimensional shapes.

**Code Changes:**
```diff
@@ -4257,7 +4257,45 @@ Mat Mat::reshape(int _cn, int _newndims, const int* _newsz) const
             return reshape(_cn, _newsz[0]);
     }
 
-    CV_Error(CV_StsNotImplemented, "");
+    if (isContinuous())
+    {
+        CV_Assert(_cn >= 0 && _newndims > 0 && _newndims <= CV_MAX_DIM && _newsz);
+
+        if (_cn == 0)
```

Review comment:
Use same parameter behaviour: `1` --> `this->channels()` https://github.com/Itseez/opencv/blob/47e7a7a7ce11884ddaf46b0f7aa7774ee7708915/modules/core/src/matrix.cpp#L970-L971 +fix/add test for this case
**File:** modules/core/src/matrix.cpp
**Change Type:** modified
**Context:** PR #4212: Extended Mat::reshape method to accept n-dimensional shapes.

**Code Changes:**
```diff
@@ -4257,7 +4257,45 @@ Mat Mat::reshape(int _cn, int _newndims, const int* _newsz) const
             return reshape(_cn, _newsz[0]);
     }
 
-    CV_Error(CV_StsNotImplemented, "");
+    if (isContinuous())
+    {
+        CV_Assert(_cn >= 0 && _newndims > 0 && _newndims <= CV_MAX_DIM && _newsz);
+
+        if (_cn == 0)
```

Review comment:
typo in `different` `has` or `matrices`?
**File:** modules/features2d/src/opencl/brute_force_match.cl
**Change Type:** modified
**Context:** PR #3256: OCL: Optimize OpenCL version of BFMatcher - Using vectors instead scalars, if data was aligned. Report: http://ocl.itseez.com/intel/export/p...
**Review Line:** 463

**Code Changes:**
```diff
+        const int trainIdx = mad24(BLOCK_SIZE, t, lidx);
 
-        if (queryIdx < query_rows && trainIdx < train_rows /*&& mask(queryIdx, trainIdx)*/)
+        if (queryIdx < query_rows && trainIdx < train_rows)
         {
             if (result < myBestDistance1)
             {
@@ -678,12 +478,11 @@ __kernel void BruteForceMatch_knnMatch(
     barrier(CLK_LOCAL_MEM_FENCE);
 
     __local float *s_distance = (__local float *)sharebuffer;
```

Review comment:
Please remove this "dead" code from all kernels.
**File:** modules/features2d/src/opencl/brute_force_match.cl
**Change Type:** modified
**Context:** PR #3256: OCL: Optimize OpenCL version of BFMatcher - Using vectors instead scalars, if data was aligned. Report: http://ocl.itseez.com/intel/export/p...

**Code Changes:**
```diff
@@ -59,39 +59,71 @@
 #define MAX_DESC_LEN 64
 #endif
 
+#define BLOCK_SIZE_ODD          (BLOCK_SIZE + 1)
+#ifndef SHARED_MEM_SZ
+#  if (BLOCK_SIZE < MAX_DESC_LEN)
+#    define SHARED_MEM_SZ      (kercn * (BLOCK_SIZE * MAX_DESC_LEN + BLOCK_SIZE * BLOCK_SIZE))
+#  else
+#    define SHARED_MEM_SZ      (kercn * 2 * BLOCK_SIZE_ODD * BLOCK_SIZE)
```

Review comment:
Is BLOCK_SIZE = 16 (as local_size_0)? In such case this local mem pattern is not good. There is recommendation to use pitch = 16+1 instead of 16 (s_train[j \* 17 + lidx]). Is it possible to try this pattern?
**File:** modules/features2d/src/opencl/brute_force_match.cl
**Change Type:** modified
**Context:** PR #3256: OCL: Optimize OpenCL version of BFMatcher - Using vectors instead scalars, if data was aligned. Report: http://ocl.itseez.com/intel/export/p...

**Code Changes:**
```diff
@@ -59,39 +59,71 @@
 #define MAX_DESC_LEN 64
 #endif
 
+#define BLOCK_SIZE_ODD          (BLOCK_SIZE + 1)
+#ifndef SHARED_MEM_SZ
+#  if (BLOCK_SIZE < MAX_DESC_LEN)
+#    define SHARED_MEM_SZ      (kercn * (BLOCK_SIZE * MAX_DESC_LEN + BLOCK_SIZE * BLOCK_SIZE))
+#  else
+#    define SHARED_MEM_SZ      (kercn * 2 * BLOCK_SIZE_ODD * BLOCK_SIZE)
```

Review comment:
Yes. I changed a code of this PR, and last [perfomance report](http://ocl.itseez.com/intel/export/perf/pr/3256/report/detail/20141017-144957-22ff1e8-3787388_SHARK-BAY-HD4600_master_win64-vc11_regression-vs-nightly_iGPU-HD4600.html?t0r3=0) show perf improvment.
**File:** modules/features2d/src/opencl/brute_force_match.cl
**Change Type:** modified
**Context:** PR #3256: OCL: Optimize OpenCL version of BFMatcher - Using vectors instead scalars, if data was aligned. Report: http://ocl.itseez.com/intel/export/p...
**Review Line:** 258

**Code Changes:**
```diff
             }
 
             barrier(CLK_LOCAL_MEM_FENCE);
@@ -294,10 +257,10 @@ __kernel void BruteForceMatch_Match(
 
             barrier(CLK_LOCAL_MEM_FENCE);
         }
-
+#endif
         result = DIST_RES(result);
 
```

Review comment:
does this barrier really need here? Does reduce_block_match(s_query, s_train, lidx, lidy) make write into local mem?
**File:** modules/features2d/src/opencl/brute_force_match.cl
**Change Type:** modified
**Context:** PR #3256: OCL: Optimize OpenCL version of BFMatcher - Using vectors instead scalars, if data was aligned. Report: http://ocl.itseez.com/intel/export/p...
**Review Line:** 258

**Code Changes:**
```diff
             }
 
             barrier(CLK_LOCAL_MEM_FENCE);
@@ -294,10 +257,10 @@ __kernel void BruteForceMatch_Match(
 
             barrier(CLK_LOCAL_MEM_FENCE);
         }
-
+#endif
         result = DIST_RES(result);
 
```

Review comment:
I think it needs. We fill `s_query` and `s_train`, wait for all threads, calculate `result`, wait all threads calculated `results` and then refill `s_query` and `s_train` again. If we remove this barrier, then some threads can write in `s_query` and `s_train`, before another threads ends calculation. Am I wrong?
**File:** modules/features2d/src/opencl/brute_force_match.cl
**Change Type:** modified
**Context:** PR #3256: OCL: Optimize OpenCL version of BFMatcher - Using vectors instead scalars, if data was aligned. Report: http://ocl.itseez.com/intel/export/p...
**Review Line:** 258

**Code Changes:**
```diff
             }
 
             barrier(CLK_LOCAL_MEM_FENCE);
@@ -294,10 +257,10 @@ __kernel void BruteForceMatch_Match(
 
             barrier(CLK_LOCAL_MEM_FENCE);
         }
-
+#endif
         result = DIST_RES(result);
 
```

Review comment:
you are right. it is needed.
**File:** cmake/templates/cvconfig.h.in
**Change Type:** modified
**Context:** PR #2003: Add support Creative Senz3D camera by Intel Perceptual Computing SDK

**Code Changes:**
```diff
@@ -85,6 +85,9 @@
 /* Apple ImageIO Framework */
 #cmakedefine HAVE_IMAGEIO
 
+/* Intel Perceptual Computing SDK library */
+#cmakedefine HAVE_INTELPERC
+
 /* Intel Integrated Performance Primitives */
 #cmakedefine HAVE_IPP
 
```

Review comment:
The macros in this file are sorted alphabetically. Please maintain that order.