nareshmlx/opencv-pr huggingface dataset:
**File:** modules/highgui/src/cap_msmf.cpp
**Change Type:** modified
**Context:** PR #1040: Windows RT support improvements - Video file reading and writing implemented; TBB support fixed. Works ok with development TBB branch; Media...
**Review Line:** 478

**Code Changes:**
```diff
         return &(out.MF_MT_YUV_MATRIX);
     if(guid == MF_MT_VIDEO_LIGHTING)
         return &(out.MF_MT_VIDEO_LIGHTING);
     if(guid == MF_MT_DEFAULT_STRIDE)
-        return &(out.MF_MT_DEFAULT_STRIDE);
+        return (unsigned int*)&(out.MF_MT_DEFAULT_STRIDE);
     if(guid == MF_MT_VIDEO_CHROMA_SITING)
         return &(out.MF_MT_VIDEO_CHROMA_SITING);
     if(guid == MF_MT_VIDEO_NOMINAL_RANGE)
@@ -462,6 +492,7 @@ unsigned int *GetParametr(GUID guid, MediaType &out)
         return &(out.MF_MT_INTERLACE_MODE);
```

Review comment:
It is trick of Media Foundation. It is passed as unsigned value, but it must be cast as signed. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms698965%28v=vs.85%29.aspx
**File:** 3rdparty/tbb/CMakeLists.txt
**Change Type:** modified
**Context:** PR #1040: Windows RT support improvements - Video file reading and writing implemented; TBB support fixed. Works ok with development TBB branch; Media...

**Code Changes:**
```diff
@@ -1,12 +1,30 @@
 #Cross compile TBB from source
 project(tbb)
 
-# 4.1 update 2 - works fine
-set(tbb_ver "tbb41_20130116oss")
-set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130116oss_src.tgz")
-set(tbb_md5 "3809790e1001a1b32d59c9fee590ee85")
+if (WIN32 AND NOT ARM)
+  message(FATAL_ERROR "BUILD_TBB option supports Windows on ARM only!\nUse regular official TBB build instead of the BUILD_TBB option!")
```

Review comment:
instead _of the_ BUILD_TBB option
**File:** modules/highgui/src/cap_msmf.cpp
**Change Type:** modified
**Context:** PR #1040: Windows RT support improvements - Video file reading and writing implemented; TBB support fixed. Works ok with development TBB branch; Media...
**Review Line:** 478

**Code Changes:**
```diff
         return &(out.MF_MT_YUV_MATRIX);
     if(guid == MF_MT_VIDEO_LIGHTING)
         return &(out.MF_MT_VIDEO_LIGHTING);
     if(guid == MF_MT_DEFAULT_STRIDE)
-        return &(out.MF_MT_DEFAULT_STRIDE);
+        return (unsigned int*)&(out.MF_MT_DEFAULT_STRIDE);
     if(guid == MF_MT_VIDEO_CHROMA_SITING)
         return &(out.MF_MT_VIDEO_CHROMA_SITING);
     if(guid == MF_MT_VIDEO_NOMINAL_RANGE)
@@ -462,6 +492,7 @@ unsigned int *GetParametr(GUID guid, MediaType &out)
         return &(out.MF_MT_INTERLACE_MODE);
```

Review comment:
I see. I would have made the variable unsigned, and cast it to signed only when using it, but I don't insist. But you seem to be reading it from `PROPVARIANT::intVal` in `SpecialCaseAttributeValueNew` below. Shouldn't that be `PROPVARIANT::uintVal`, then?
**File:** modules/java/generator/src/java/android+CameraBridgeViewBase.java
**Change Type:** modified
**Context:** PR #921: Merge 2.4 to master. - Pull requests: #904 from ograycode:2.4 #905 from bitwangyaoyao:2.4_TVL1 #902 from apavlenko:fix_run_py #882 from pengx...
**Review Line:** 86

**Code Changes:**
```diff
         styledAttrs.recycle();
     }
+    
+    /**
+     * Sets the camera index
+     * @param camera index
+     */
+    public void setCameraIndex(int cameraIndex) {
+        this.mCameraIndex = cameraIndex;
+    }
 
```

Review comment:
should be `cameraIndex`
**File:** samples/android/tutorial-3-cameracontrol/src/org/opencv/samples/tutorial3/Tutorial3View.java
**Change Type:** modified
**Context:** PR #846: Fix android tutorial 3 second picture taken bug - Fix bug crash on second picture taken … If the GC is not called, the onPictureTaken is neve...

**Code Changes:**
```diff
@@ -6,17 +6,16 @@
 import org.opencv.android.JavaCameraView;
 
 import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
 import android.hardware.Camera;
 import android.hardware.Camera.PictureCallback;
 import android.hardware.Camera.Size;
 import android.util.AttributeSet;
```

Review comment:
Please add issue description and remove link to ticket.
**File:** modules/highgui/src/cap.cpp
**Change Type:** modified
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...

**Code Changes:**
```diff
@@ -114,7 +114,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
 {
     int  domains[] =
     {
-#ifdef HAVE_VIDEOINPUT
+#ifdef HAVE_DSHOW
         CV_CAP_DSHOW,
 #endif
 #if 1
@@ -168,7 +168,8 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
```

Review comment:
It seems that this return breaks old logic of the function.
**File:** modules/core/include/opencv2/core/types_c.h
**Change Type:** modified
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...

**Code Changes:**
```diff
@@ -322,8 +322,12 @@ CV_INLINE  int  cvRound( double value )
     return (int)lrint(value);
 #  endif
 #else
-    // while this is not IEEE754-compliant rounding, it's usually a good enough approximation
-    return (int)(value + (value >= 0 ? 0.5 : -0.5));
+    double intpart, fractpart;
+    fractpart = modf(value, &intpart);
+    if ((abs(fractpart) != 0.5) || ((((int)intpart) % 2) != 0))
+        return (int)(value + (value >= 0 ? 0.5 : -0.5));
```

Review comment:
Comment is out of date.
**File:** modules/highgui/src/cap_ffmpeg.cpp
**Change Type:** modified
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...

**Code Changes:**
```diff
@@ -209,7 +209,7 @@ CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char * filename)
     if( result->open( filename ))
         return result;
     delete result;
-#if defined WIN32 || defined _WIN32
+#ifdef HAVE_VFW
     return cvCreateFileCapture_VFW(filename);
 #else
     return 0;
@@ -263,9 +263,9 @@ CvVideoWriter* cvCreateVideoWriter_FFMPEG_proxy( const char* filename, int fourc
```

Review comment:
Why not use `#if HAVE_VFW` instead?
**File:** modules/highgui/src/cap_ffmpeg.cpp
**Change Type:** modified
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...

**Code Changes:**
```diff
@@ -209,7 +209,7 @@ CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char * filename)
     if( result->open( filename ))
         return result;
     delete result;
-#if defined WIN32 || defined _WIN32
+#ifdef HAVE_VFW
     return cvCreateFileCapture_VFW(filename);
 #else
     return 0;
@@ -263,9 +263,9 @@ CvVideoWriter* cvCreateVideoWriter_FFMPEG_proxy( const char* filename, int fourc
```

Review comment:
`HAVE_VFW`?
**File:** platforms/winrt/arm.winrt.toolchain.cmake
**Change Type:** added
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...

**Code Changes:**
```diff
@@ -0,0 +1,6 @@
+set(CMAKE_SYSTEM_NAME Windows)
+set(CMAKE_SYSTEM_PROCESSOR "arm-v7a")
+
+set(CMAKE_FIND_ROOT_PATH "${CMAKE_SOURCE_DIR}/platforms/winrt")
+set(CMAKE_REQUIRED_DEFINITIONS -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
+add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
\ No newline at end of file
```

Review comment:
Comment is irrelevant. CMake simply do not know platform named "WindowsRT". System name is not a simple string literal in CMake. It is used internally by CMake to load base configuration.
**File:** platforms/winrt/arm.winrt.toolchain.cmake
**Change Type:** added
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...

**Code Changes:**
```diff
@@ -0,0 +1,6 @@
+set(CMAKE_SYSTEM_NAME Windows)
+set(CMAKE_SYSTEM_PROCESSOR "arm-v7a")
+
+set(CMAKE_FIND_ROOT_PATH "${CMAKE_SOURCE_DIR}/platforms/winrt")
+set(CMAKE_REQUIRED_DEFINITIONS -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
+add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
\ No newline at end of file
```

Review comment:
`armv7-a` will be more correct
**File:** platforms/winrt/arm.winrt.toolchain.cmake
**Change Type:** added
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...
**Review Line:** 6

**Code Changes:**
```diff
+set(CMAKE_SYSTEM_NAME Windows)
+set(CMAKE_SYSTEM_PROCESSOR "arm-v7a")
+
+set(CMAKE_FIND_ROOT_PATH "${CMAKE_SOURCE_DIR}/platforms/winrt")
+set(CMAKE_REQUIRED_DEFINITIONS -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
+add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
\ No newline at end of file
```

Review comment:
`CMAKE_FIND_ROOT_PATH` also need to be set
**File:** modules/core/include/opencv2/core/types_c.h
**Change Type:** modified
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...
**Review Line:** 326

**Code Changes:**
```diff
 #  endif
 #else
-    // while this is not IEEE754-compliant rounding, it's usually a good enough approximation
-    return (int)(value + (value >= 0 ? 0.5 : -0.5));
+    double intpart, fractpart;
+    fractpart = modf(value, &intpart);
+    if ((abs(fractpart) != 0.5) || ((((int)intpart) % 2) != 0))
+        return (int)(value + (value >= 0 ? 0.5 : -0.5));
+    else
+        return (int)intpart;
 #endif
```

Review comment:
May be use std::modf ? Same with abs.
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...

**Code Changes:**
```diff
@@ -118,6 +118,7 @@ OCV_OPTION(WITH_CUFFT          "Include NVidia Cuda Fast Fourier Transform (FFT)
 OCV_OPTION(WITH_CUBLAS         "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) )
 OCV_OPTION(WITH_NVCUVID        "Include NVidia Video Decoding library support"                               OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS AND NOT APPLE) )
 OCV_OPTION(WITH_EIGEN          "Include Eigen2/Eigen3 support"               ON)
+OCV_OPTION(WITH_VFW            "Include Video for Windows support"           ON   IF (WIN32))
 OCV_OPTION(WITH_FFMPEG         "Include FFMPEG support"                      ON   IF (NOT ANDROID AND NOT IOS))
 OCV_OPTION(WITH_GSTREAMER      "Include Gstreamer support"                   ON   IF (UNIX AND NOT APPLE AND NOT ANDROID) )
 OCV_OPTION(WITH_GTK            "Include GTK support"                         ON   IF (UNIX AND NOT APPLE AND NOT ANDROID) )
@@ -132,13 +133,15 @@ OCV_OPTION(WITH_PNG            "Include PNG support"                         ON
 OCV_OPTION(WITH_PVAPI          "Include Prosilica GigE support"              ON   IF (NOT ANDROID AND NOT IOS) )
```

Review comment:
add `IF WIN32`
**File:** platforms/winrt/arm.winrt.toolchain.cmake
**Change Type:** added
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...
**Review Line:** 6

**Code Changes:**
```diff
+set(CMAKE_SYSTEM_NAME Windows)
+set(CMAKE_SYSTEM_PROCESSOR "arm-v7a")
+
+set(CMAKE_FIND_ROOT_PATH "${CMAKE_SOURCE_DIR}/platforms/winrt")
+set(CMAKE_REQUIRED_DEFINITIONS -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
+add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
\ No newline at end of file
```

Review comment:
same comment on toolchain file as was before
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...
**Review Line:** 141

**Code Changes:**
```diff
+OCV_OPTION(WITH_WIN32UI        "Build with Win32 UI Backend support"         ON   IF (WIN32) )
 OCV_OPTION(WITH_QUICKTIME      "Use QuickTime for Video I/O insted of QTKit" OFF  IF APPLE )
 OCV_OPTION(WITH_TBB            "Include Intel TBB support"                   OFF  IF (NOT IOS) )
 OCV_OPTION(WITH_CSTRIPES       "Include C= support"                          OFF  IF WIN32 )
 OCV_OPTION(WITH_TIFF           "Include TIFF support"                        ON   IF (NOT IOS) )
 OCV_OPTION(WITH_UNICAP         "Include Unicap support (GPL)"                OFF  IF (UNIX AND NOT APPLE AND NOT ANDROID) )
 OCV_OPTION(WITH_V4L            "Include Video 4 Linux support"               ON   IF (UNIX AND NOT ANDROID) )
-OCV_OPTION(WITH_VIDEOINPUT     "Build HighGUI with DirectShow support"       ON   IF WIN32 )
+OCV_OPTION(WITH_DSHOW          "Build HighGUI with DirectShow support"       ON   IF (WIN32 AND NOT ARM) )
+OCV_OPTION(WITH_MSMF           "Build HighGUI with Media Foundation support" OFF  IF WIN32 )
 OCV_OPTION(WITH_XIMEA          "Include XIMEA cameras support"               OFF  IF (NOT ANDROID AND NOT APPLE) )
```

Review comment:
Please put a compatibility code for this option to `cmake/OpenCVLegacyOptions.cmake`
**File:** modules/core/include/opencv2/core/types_c.h
**Change Type:** modified
**Context:** PR #716: WinRT support - Build for ARM WInRT enabled with cmake and ninja; Video I/O and UI parts of Highgui module disabled for WinRT; Experimental M...
**Review Line:** 326

**Code Changes:**
```diff
 #  endif
 #else
-    // while this is not IEEE754-compliant rounding, it's usually a good enough approximation
-    return (int)(value + (value >= 0 ? 0.5 : -0.5));
+    double intpart, fractpart;
+    fractpart = modf(value, &intpart);
+    if ((abs(fractpart) != 0.5) || ((((int)intpart) % 2) != 0))
+        return (int)(value + (value >= 0 ? 0.5 : -0.5));
+    else
+        return (int)intpart;
 #endif
```

Review comment:
The fractional part of x with the same sign as x. The integral part is put into the value pointed to by iptr.
**File:** modules/video/include/opencv2/video/background_segm.hpp
**Change Type:** modified
**Context:** PR #680: converted "video" module to C++ - converted "video" module to C++. Background/foreground subtraction algorithms have been converted to the ne...

**Code Changes:**
```diff
@@ -12,6 +12,7 @@
 //
 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
 // Third party copyrights are property of their respective owners.
 //
 // Redistribution and use in source and binary forms, with or without modification,
@@ -57,14 +58,11 @@ namespace cv
 class CV_EXPORTS_W BackgroundSubtractor : public Algorithm
```

Review comment:
I think that `CV_EXPORTS` is still required. I'm afraid that dynamic cast in user code will not work for classes created inside the library because of different vtables.
**File:** modules/video/src/lkpyramid.cpp
**Change Type:** modified
**Context:** PR #680: converted "video" module to C++ - converted "video" module to C++. Background/foreground subtraction algorithms have been converted to the ne...
**Review Line:** 160

**Code Changes:**
```diff
 // This software is provided by the copyright holders and contributors "as is" and
@@ -156,6 +157,14 @@ cv::detail::LKTrackerInvoker::LKTrackerInvoker(
     minEigThreshold = _minEigThreshold;
 }
 
+#if defined __arm__ && !CV_NEON
+typedef int64 acctype;
+typedef int itemtype;
+#else
+typedef float acctype;
+typedef float itemtype;
```

Review comment:
Is this block with typedefs included intentionally?
**File:** modules/gpu/include/opencv2/gpu/gpu.hpp
**Change Type:** modified
**Context:** PR #644: implemented Malvar, He, and Cutler Bayer Demosaicing on gpu

**Code Changes:**
```diff
@@ -627,6 +627,26 @@ CV_EXPORTS void reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat&
 //! converts image from one color space to another
 CV_EXPORTS void cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn = 0, Stream& stream = Stream::Null());
 
+enum
+{
+    // Bayer Demosaicing (Malvar, He, and Cutler)
+    COLOR_BayerBG2BGR_MHT = 256,
+    COLOR_BayerGB2BGR_MHT = 257,
+    COLOR_BayerRG2BGR_MHT = 258,
```

Review comment:
To use COLOR_COLORCVT_MAX constant is not a good idea. I can be changed for future in imgproc module and we'll get problems with compatibility.
**File:** samples/android/native-activity/jni/native.cpp
**Change Type:** added
**Context:** PR #662: Android native activity sample added

**Code Changes:**
```diff
@@ -0,0 +1,221 @@
+#include <android_native_app_glue.h>
+
+#include <errno.h>
+#include <jni.h>
+#include <sys/time.h>
+#include <time.h>
+#include <android/log.h>
+
+#include <stdio.h>
```

Review comment:
I suggest you replace `1.f*` with `(float)` (i.e. type casting)
**File:** samples/android/native-activity/jni/native.cpp
**Change Type:** added
**Context:** PR #662: Android native activity sample added

**Code Changes:**
```diff
@@ -0,0 +1,221 @@
+#include <android_native_app_glue.h>
+
+#include <errno.h>
+#include <jni.h>
+#include <sys/time.h>
+#include <time.h>
+#include <android/log.h>
+
+#include <stdio.h>
```

Review comment:
`fps = time_queue.size() * (float)cv::getTickFrequency() / (now-then);`
**File:** modules/calib3d/src/circlesgrid.cpp
**Change Type:** modified
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...
**Review Line:** 411

**Code Changes:**
```diff
+      const int knn = 1;
+      int indicesbuf[knn] = {0};
+      float distsbuf[knn] = {0.f};
+      Mat indices(1, knn, CV_32S, &indicesbuf);
+      Mat dists(1, knn, CV_32F, &distsbuf);
       flannIndex.knnSearch(query, indices, dists, knn, flann::SearchParams());
-      centers.push_back(patternPoints.at(indices[0]));
+      centers.push_back(patternPoints.at(indicesbuf[0]));
 
-      if(dists[0] > maxRectifiedDistance)
+      if(distsbuf[0] > maxRectifiedDistance)
```

Review comment:
I think that current implementation is dangerous so lets hardcode 1 everywhere `knn` used or change the above lines to ``` const int knn = 1; int indicesbuf[knn] = {0,}; float distsbuf[knn] = {0.f,}; Mat indices(1, knn, CV_32S, indicesbuf); Mat dists(1, knn, CV_32F, distsbuf); ``` Another option is to use `Matx` and don't wrap local variables with Mats
**File:** modules/calib3d/src/ptsetreg.cpp
**Change Type:** added
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...

**Code Changes:**
```diff
@@ -0,0 +1,540 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
This line can be omitted, isn't it?
**File:** modules/calib3d/src/ptsetreg.cpp
**Change Type:** added
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...

**Code Changes:**
```diff
@@ -0,0 +1,540 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
What about using long form of create here instead of writing custom logic? ``` _mask.create(count, 1, CV_8U, -1, true); ```
**File:** modules/calib3d/src/ptsetreg.cpp
**Change Type:** added
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...

**Code Changes:**
```diff
@@ -0,0 +1,540 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
This looks very close to what `cv::RANSACUpdateNumIters` does. Shouldn't it be used here?
**File:** modules/calib3d/src/ptsetreg.cpp
**Change Type:** added
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...
**Review Line:** 427

**Code Changes:**
```diff
+
+        const int N = 12;
+        double buf[N*N + N + N];
+        Mat A(N, N, CV_64F, &buf[0]);
+        Mat B(N, 1, CV_64F, &buf[0] + N*N);
+        Mat X(N, 1, CV_64F, &buf[0] + N*N + N);
+        double* Adata = A.ptr<double>();
+        double* Bdata = B.ptr<double>();
+        A = Scalar::all(0);
+
+        for( int i = 0; i < (N/3); i++ )
```

Review comment:
Here algorithm uses several small matrices having type ad size known at compile time (as well as in several other functions from this PR). Should not they be replaced with `Matx`?
**File:** modules/calib3d/src/precomp.hpp
**Change Type:** modified
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...

**Code Changes:**
```diff
@@ -59,4 +59,51 @@
 #define GET_OPTIMIZED(func) (func)
 #endif
 
+
+namespace cv
+{
+
+int RANSACUpdateNumIters( double p, double ep, int modelPoints, int maxIters );
+
```

Review comment:
`CV_EXPORTS` is missed
**File:** modules/calib3d/src/levmarq.cpp
**Change Type:** added
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...

**Code Changes:**
```diff
@@ -0,0 +1,226 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
`CV_EXPORTS` is not needed here
**File:** modules/calib3d/src/fundam.cpp
**Change Type:** modified
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...

**Code Changes:**
```diff
@@ -7,10 +7,11 @@
 //  copy or use the software.
 //
 //
-//                        Intel License Agreement
+//                          License Agreement
 //                For Open Source Computer Vision Library
 //
 // Copyright (C) 2000, Intel Corporation, all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
```

Review comment:
The really portable way to get pointer to data of 2d array is using `LtL[0]` instead of simple option to convert `LtL` to a `void*`. But I would suggest to use `Matx` for these matrices.