merged the trunk r8735:8766, r8769, r8777:8780, r8790 and r8800:8811
authorMarina Kolpakova <no@email>
Thu, 28 Jun 2012 17:07:17 +0000 (17:07 +0000)
committerMarina Kolpakova <no@email>
Thu, 28 Jun 2012 17:07:17 +0000 (17:07 +0000)
61 files changed:
3rdparty/zlib/CMakeLists.txt
CMakeLists.txt
android/service/engine/CMakeLists.txt
cmake/OpenCVDetectAndroidSDK.cmake
cmake/OpenCVDetectPython.cmake
cmake/OpenCVFindLibsGrfmt.cmake
cmake/OpenCVFindXimea.cmake
doc/tutorials/introduction/android_binary_package/images/eclipse_opencv_dependency0.png [new file with mode: 0644]
doc/tutorials/introduction/android_binary_package/images/eclipse_opencv_dependency1.png [new file with mode: 0644]
modules/calib3d/src/calibration.cpp
modules/calib3d/test/test_cornerssubpix.cpp
modules/contrib/CMakeLists.txt
modules/contrib/src/chamfermatching.cpp
modules/contrib/src/rgbdodometry.cpp
modules/core/doc/dynamic_structures.rst
modules/core/doc/xml_yaml_persistence.rst
modules/core/src/matop.cpp
modules/core/src/system.cpp
modules/core/test/test_arithm.cpp
modules/core/test/test_io.cpp
modules/core/test/test_operations.cpp
modules/features2d/doc/feature_detection_and_description.rst
modules/features2d/include/opencv2/features2d/features2d.hpp
modules/features2d/test/test_fast.cpp
modules/features2d/test/test_mser.cpp
modules/features2d/test/test_nearestneighbors.cpp
modules/gpu/perf/perf_video.cpp
modules/gpu/src/hog.cpp
modules/highgui/CMakeLists.txt
modules/highgui/src/cap_ximea.cpp
modules/highgui/test/test_ffmpeg.cpp
modules/highgui/test/test_grfmt.cpp
modules/highgui/test/test_video_io.cpp
modules/highgui/test/test_video_pos.cpp
modules/imgproc/test/test_grabcut.cpp
modules/imgproc/test/test_watershed.cpp
modules/java/android_lib/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
modules/java/generator/gen_java.py
modules/legacy/CMakeLists.txt
modules/legacy/src/features2d.cpp
modules/legacy/src/image.cpp
modules/legacy/src/oneway.cpp
modules/legacy/test/test_em.cpp
modules/legacy/test/test_stereomatching.cpp
modules/ml/test/test_emknearestkmeans.cpp
modules/ml/test/test_precomp.hpp
modules/ml/test/test_save_load.cpp
modules/objdetect/CMakeLists.txt
modules/objdetect/test/test_latentsvmdetector.cpp
modules/photo/test/test_inpaint.cpp
modules/python/src2/gen.py
modules/ts/include/opencv2/ts/ts_gtest.h
modules/ts/misc/run.py
modules/ts/src/ts_gtest.cpp
modules/videostab/CMakeLists.txt
modules/videostab/src/frame_source.cpp
modules/videostab/src/precomp.hpp
samples/android/color-blob-detection/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
samples/python2/contours.py
samples/python2/edge.py
samples/python2/letter_recog.py

index 25df533..f4315e7 100644 (file)
@@ -8,6 +8,7 @@ project(${ZLIB_LIBRARY} C)
 include(CheckFunctionExists)
 include(CheckIncludeFile)
 include(CheckCSourceCompiles)
+include(CheckTypeSize)
 
 #
 # Check for fseeko
@@ -27,6 +28,14 @@ if(MSVC)
   add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
 endif()
 
+#
+# Check to see if we have large file support
+#
+check_type_size(off64_t OFF64_T)
+if(HAVE_OFF64_T)
+  add_definitions(-D_LARGEFILE64_SOURCE=1)
+endif()
+
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein"
                "${CMAKE_CURRENT_BINARY_DIR}/zconf.h" @ONLY)
 ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")
index 4e8daa2..37e29ad 100644 (file)
@@ -116,14 +116,14 @@ OCV_OPTION(WITH_CUDA           "Include NVidia Cuda Runtime support"         ON
 OCV_OPTION(WITH_CUFFT          "Include NVidia Cuda Fast Fourier Transform (FFT) library support"            ON  IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) )
 OCV_OPTION(WITH_EIGEN          "Include Eigen2/Eigen3 support"               ON)
 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 AND NOT IOS) )
-OCV_OPTION(WITH_GTK            "Include GTK support"                         ON   IF (UNIX AND NOT APPLE AND 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) )
 OCV_OPTION(WITH_IMAGEIO        "ImageIO support for OS X"                    OFF  IF APPLE)
 OCV_OPTION(WITH_IPP            "Include Intel IPP support"                   OFF  IF (MSVC OR X86 OR X86_64) )
 OCV_OPTION(WITH_JASPER         "Include JPEG2K support"                      ON   IF (NOT IOS) )
 OCV_OPTION(WITH_JPEG           "Include JPEG support"                        ON   IF (NOT IOS) )
 OCV_OPTION(WITH_OPENEXR        "Include ILM support via OpenEXR"             ON   IF (NOT IOS) )
-OCV_OPTION(WITH_OPENGL         "Include OpenGL support"                      OFF  IF (NOT ANDROID AND NOT IOS AND NOT APPLE) )
+OCV_OPTION(WITH_OPENGL         "Include OpenGL support"                      OFF  IF (NOT ANDROID AND NOT APPLE) )
 OCV_OPTION(WITH_OPENNI         "Include OpenNI support"                      OFF  IF (NOT ANDROID AND NOT IOS) )
 OCV_OPTION(WITH_PNG            "Include PNG support"                         ON   IF (NOT IOS) )
 OCV_OPTION(WITH_PVAPI          "Include Prosilica GigE support"              ON   IF (NOT ANDROID AND NOT IOS) )
@@ -131,10 +131,10 @@ OCV_OPTION(WITH_QT             "Build with Qt Backend support"               OFF
 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_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 AND NOT IOS) )
-OCV_OPTION(WITH_V4L            "Include Video 4 Linux support"               ON   IF (UNIX AND NOT APPLE AND NOT ANDROID AND 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 APPLE AND NOT ANDROID) )
 OCV_OPTION(WITH_VIDEOINPUT     "Build HighGUI with DirectShow support"       ON   IF WIN32 )
-OCV_OPTION(WITH_XIMEA          "Include XIMEA cameras support"               OFF  IF WIN32 )
+OCV_OPTION(WITH_XIMEA          "Include XIMEA cameras support"               OFF  IF (NOT ANDROID AND NOT APPLE) )
 OCV_OPTION(WITH_XINE           "Include Xine support (GPL)"                  OFF  IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
 
 # OpenCV build components
@@ -149,8 +149,14 @@ OCV_OPTION(BUILD_TESTS              "Build accuracy & regression tests"
 OCV_OPTION(BUILD_WITH_DEBUG_INFO    "Include debug info into debug libs (not MSCV only)" ON )
 OCV_OPTION(BUILD_WITH_STATIC_CRT    "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
 OCV_OPTION(BUILD_FAT_JAVA_LIB       "Create fat java wrapper containing the whole OpenCV library" ON IF ANDROID AND NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
-OCV_OPTION(BUILD_ANDROID_SERVICE    "TBD" OFF IF ANDROID )
-OCV_OPTION(BUILD_ANDROID_PACKAGE    "TBD" OFF IF ANDROID )
+OCV_OPTION(BUILD_ANDROID_SERVICE    "TBD" OFF IF ANDROID AND ANDROID_USE_STLPORT AND ANDROID_SOURCE_TREE )
+
+if(DEFINED BUILD_opencv_nonfree AND NOT BUILD_opencv_nonfree)
+  OCV_OPTION(BUILD_ANDROID_PACKAGE  "TBD" OFF IF ANDROID )
+else()
+  unset(BUILD_ANDROID_PACKAGE CACHE)
+endif()
+
 
 # 3rd party libs
 OCV_OPTION(BUILD_ZLIB               "Build zlib from source"         WIN32 OR IOS OR APPLE )
@@ -332,15 +338,6 @@ if(UNIX)
   endif()
 endif()
 
-#
-# Check to see if we have large file support (needed by zlib)
-#
-include(CheckTypeSize)
-check_type_size(off64_t OFF64_T)
-if(HAVE_OFF64_T)
-  add_definitions(-D_LARGEFILE64_SOURCE=1)
-endif()
-
 include(cmake/OpenCVPCHSupport.cmake REQUIRED)
 include(cmake/OpenCVModule.cmake REQUIRED)
 
@@ -530,7 +527,7 @@ if(ANDROID)
   endif()
   status("    android tool:"  ANDROID_EXECUTABLE  THEN "${ANDROID_EXECUTABLE} (${ANDROID_TOOLS_Pkg_Desc})" ELSE NO)
   status("    ant:"           ANT_EXECUTABLE      THEN "${ANT_EXECUTABLE} (ver ${ANT_VERSION})"            ELSE NO)
-  status("    Build service:" BUILD_ANDROID_SERVICE THEN YES ELSE NO)
+  status("    Google Play package:" BUILD_ANDROID_PACKAGE THEN YES ELSE NO)
 endif()
 
 # ========================== GUI ==========================
index f98621b..87c8635 100644 (file)
@@ -2,14 +2,13 @@ set(engine OpenCVEngine)
 set(JNI_LIB_NAME ${engine} ${engine}_jni)
 add_android_project(opencv_engine "${CMAKE_CURRENT_SOURCE_DIR}" SDK_TARGET 8 ${ANDROID_SDK_TARGET} IGNORE_JAVA ON)
 
-link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib" "${ANDROID_SOURCE_TREE}/bin_${ANDROID_ARCH_NAME}/system/lib")
-SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
-
-
+link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib" "${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib" "${ANDROID_SOURCE_TREE}/bin_${ANDROID_ARCH_NAME}/system/lib")
 
+SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
 file(GLOB engine_files "jni/BinderComponent/*.cpp" "jni/BinderComponent/*.h" "jni/include/*.h")
 
-include_directories(jni/BinderComponent jni/include "${ANDROID_SOURCE_TREE}/frameworks/base/include" "${ANDROID_SOURCE_TREE}/system/core/include")
+include_directories(jni/BinderComponent jni/include)
+include_directories(SYSTEM "${ANDROID_SOURCE_TREE}/frameworks/base/include" "${ANDROID_SOURCE_TREE}/system/core/include")
 add_library(${engine} SHARED ${engine_files})
 target_link_libraries(${engine} z binder log utils)
 
index b77d002..b1b7c76 100644 (file)
@@ -215,7 +215,7 @@ macro(add_android_project target path)
 
     project(${target})
     set(android_proj_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/.build")
-   
+
     # get project sources
     file(GLOB_RECURSE android_proj_files RELATIVE "${path}" "${path}/res/*" "${path}/src/*")
     ocv_list_filterout(android_proj_files ".svn")
@@ -278,8 +278,6 @@ macro(add_android_project target path)
         get_target_property(android_proj_jni_location "${JNI_LIB_NAME}" LOCATION)
         add_custom_command(TARGET ${JNI_LIB_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "${android_proj_jni_location}")
       endif()
-    else()
-      unset(JNI_LIB_NAME)
     endif()
 
     # build java part
@@ -302,6 +300,8 @@ macro(add_android_project target path)
        DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME})
     endif()
 
+    unset(JNI_LIB_NAME)
+
     add_custom_target(${target} ALL SOURCES "${android_proj_bin_dir}/bin/${target}-debug.apk" )
     if(NOT android_proj_IGNORE_JAVA)
       add_dependencies(${target} opencv_java)
index e66410d..8be94ca 100644 (file)
@@ -30,7 +30,11 @@ if(PYTHON_EXECUTABLE)
   endif()
   
   if(NOT ANDROID AND NOT IOS)
-    find_host_package(PythonLibs ${PYTHON_VERSION_FULL})
+    if(CMAKE_VERSION VERSION_GREATER 2.8.8)
+      find_host_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT)
+    else()
+      find_host_package(PythonLibs ${PYTHON_VERSION_FULL})
+    endif()
     # cmake 2.4 (at least on Ubuntu 8.04 (hardy)) don't define PYTHONLIBS_FOUND
     if(NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH)
       set(PYTHONLIBS_FOUND ON)
index d5bfa1f..54a1bde 100644 (file)
@@ -7,11 +7,11 @@ if(BUILD_ZLIB)
   ocv_clear_vars(ZLIB_FOUND)
 else()
   include(FindZLIB)
+  if(ZLIB_VERSION_STRING)
+    #cmake 2.8.2 bug - it fails to determine zlib version
+    unset(ZLIB_VERSION_STRING CACHE)
+  endif()
   if(ZLIB_FOUND)
-    if(ZLIB_VERSION_STRING)
-      #cmake 2.8.2 bug - it fails to determine zlib version
-      unset(ZLIB_VERSION_STRING CACHE)
-    endif()
     ocv_parse_header2(ZLIB "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_VERSION "")
   endif()
   if(ZLIB_FOUND AND ANDROID)
index 7528956..5600275 100755 (executable)
@@ -8,6 +8,7 @@
 #  XIMEA_LIBRARY_DIR    - XIMEA libraries folder
 #
 # Created: 5 Aug 2011 by Marian Zajko (marian.zajko@ximea.com)
+# Updated: 25 June 2012 by Igor Kuzmin (parafin@ximea.com)
 #
 
 set(XIMEA_FOUND)
@@ -20,10 +21,16 @@ if(WIN32)
 
   if(EXISTS XIMEA_PATH)
     set(XIMEA_FOUND 1)
-
     # set LIB folders
-    set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}\\x86")
-
+    set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x86")
+  else()
+    set(XIMEA_FOUND 0)
+  endif()
+else()
+  if(EXISTS /opt/XIMEA)
+    set(XIMEA_FOUND 1)
+    # set folders
+    set(XIMEA_PATH /opt/XIMEA/include)
   else()
     set(XIMEA_FOUND 0)
   endif()
diff --git a/doc/tutorials/introduction/android_binary_package/images/eclipse_opencv_dependency0.png b/doc/tutorials/introduction/android_binary_package/images/eclipse_opencv_dependency0.png
new file mode 100644 (file)
index 0000000..33c1ce3
Binary files /dev/null and b/doc/tutorials/introduction/android_binary_package/images/eclipse_opencv_dependency0.png differ
diff --git a/doc/tutorials/introduction/android_binary_package/images/eclipse_opencv_dependency1.png b/doc/tutorials/introduction/android_binary_package/images/eclipse_opencv_dependency1.png
new file mode 100644 (file)
index 0000000..c016dfb
Binary files /dev/null and b/doc/tutorials/introduction/android_binary_package/images/eclipse_opencv_dependency1.png differ
index f211c5d..ffe1c58 100644 (file)
@@ -2366,7 +2366,8 @@ void cvStereoRectify( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2,
     // calculate global Z rotation
     cvCrossProduct(&t,&uu,&ww);
     double nw = cvNorm(&ww, 0, CV_L2);
-    cvConvertScale(&ww, &ww, acos(fabs(c)/nt)/nw);
+    if (nw > 0.0)
+        cvConvertScale(&ww, &ww, acos(fabs(c)/nt)/nw);
     cvRodrigues2(&ww, &wR);
 
     // apply to both views
index 6afcfc6..70f0be8 100644 (file)
@@ -54,7 +54,7 @@ protected:
     Mat intrinsic_matrix_;
     Mat distortion_coeffs_;
     Size image_size_;
-    
+
     void run(int);
     void generateIntrinsicParams();
 };
@@ -66,14 +66,14 @@ int calcDistance(const vector<Point2f>& set1, const vector<Point2f>& set2, doubl
     {
         return 0;
     }
-    
+
     std::vector<int> indices;
     double sum_dist = 0.0;
     for(size_t i = 0; i < set1.size(); i++)
     {
         double min_dist = std::numeric_limits<double>::max();
         int min_idx = -1;
-        
+
         for(int j = 0; j < (int)set2.size(); j++)
         {
             double dist = norm(set1[i] - set2[j]);
@@ -83,33 +83,33 @@ int calcDistance(const vector<Point2f>& set1, const vector<Point2f>& set2, doubl
                 min_dist = dist;
             }
         }
-        
+
         // check validity of min_idx
         if(min_idx == -1)
         {
             return 0;
         }
         std::vector<int>::iterator it = std::find(indices.begin(), indices.end(), min_idx);
-        if(it != indices.end()) 
+        if(it != indices.end())
         {
             // there are two points in set1 corresponding to the same point in set2
             return 0;
         }
         indices.push_back(min_idx);
-        
+
 //        printf("dist %d = %f\n", (int)i, min_dist);
-        
+
         sum_dist += min_dist*min_dist;
     }
-    
+
     mean_dist = sqrt(sum_dist/set1.size());
 //    printf("sum_dist = %f, set1.size() = %d, mean_dist = %f\n", sum_dist, (int)set1.size(), mean_dist);
-    
+
     return 1;
 }
 
 CV_ChessboardSubpixelTest::CV_ChessboardSubpixelTest() :
-    intrinsic_matrix_(Size(3, 3), CV_64FC1), distortion_coeffs_(Size(1, 4), CV_64FC1), 
+    intrinsic_matrix_(Size(3, 3), CV_64FC1), distortion_coeffs_(Size(1, 4), CV_64FC1),
     image_size_(640, 480)
 {
 }
@@ -121,13 +121,13 @@ void CV_ChessboardSubpixelTest::run( int )
     int  progress = 0;
 
     RNG& rng = ts->get_rng();
-    
+
     const int runs_count = 20;
     const int max_pattern_size = 8;
     const int min_pattern_size = 5;
     Mat bg(image_size_, CV_8UC1);
     bg = Scalar(0);
-    
+
     double sum_dist = 0.0;
     int count = 0;
     for(int i = 0; i < runs_count; i++)
@@ -144,13 +144,13 @@ void CV_ChessboardSubpixelTest::run( int )
             pattern_size = Size(pattern_width, pattern_height);
         }
         ChessBoardGenerator gen_chessboard(Size(pattern_size.width + 1, pattern_size.height + 1));
-        
+
         // generates intrinsic camera and distortion matrices
         generateIntrinsicParams();
-        
+
         vector<Point2f> corners;
-        Mat chessboard_image = gen_chessboard(bg, intrinsic_matrix_, distortion_coeffs_, corners); 
-        
+        Mat chessboard_image = gen_chessboard(bg, intrinsic_matrix_, distortion_coeffs_, corners);
+
         vector<Point2f> test_corners;
         bool result = findChessboardCorners(chessboard_image, pattern_size, test_corners, 15);
         if(!result)
@@ -158,47 +158,47 @@ void CV_ChessboardSubpixelTest::run( int )
 #if 0
             ts->printf(cvtest::TS::LOG, "Warning: chessboard was not detected! Writing image to test.jpg\n");
             ts->printf(cvtest::TS::LOG, "Size = %d, %d\n", pattern_size.width, pattern_size.height);
-            ts->printf(cvtest::TS::LOG, "Intrinsic params: fx = %f, fy = %f, cx = %f, cy = %f\n", 
-                       intrinsic_matrix_.at<double>(0, 0), intrinsic_matrix_.at<double>(1, 1), 
+            ts->printf(cvtest::TS::LOG, "Intrinsic params: fx = %f, fy = %f, cx = %f, cy = %f\n",
+                       intrinsic_matrix_.at<double>(0, 0), intrinsic_matrix_.at<double>(1, 1),
                        intrinsic_matrix_.at<double>(0, 2), intrinsic_matrix_.at<double>(1, 2));
-            ts->printf(cvtest::TS::LOG, "Distortion matrix: %f, %f, %f, %f, %f\n", 
+            ts->printf(cvtest::TS::LOG, "Distortion matrix: %f, %f, %f, %f, %f\n",
                        distortion_coeffs_.at<double>(0, 0), distortion_coeffs_.at<double>(0, 1),
-                       distortion_coeffs_.at<double>(0, 2), distortion_coeffs_.at<double>(0, 3), 
+                       distortion_coeffs_.at<double>(0, 2), distortion_coeffs_.at<double>(0, 3),
                        distortion_coeffs_.at<double>(0, 4));
-            
+
             imwrite("test.jpg", chessboard_image);
 #endif
             continue;
         }
-        
+
         double dist1 = 0.0;
         int ret = calcDistance(corners, test_corners, dist1);
         if(ret == 0)
         {
             ts->printf(cvtest::TS::LOG, "findChessboardCorners returns invalid corner coordinates!\n");
             code = cvtest::TS::FAIL_INVALID_OUTPUT;
-            break;            
+            break;
         }
-        
+
         IplImage chessboard_image_header = chessboard_image;
-        cvFindCornerSubPix(&chessboard_image_header, (CvPoint2D32f*)&test_corners[0], 
+        cvFindCornerSubPix(&chessboard_image_header, (CvPoint2D32f*)&test_corners[0],
             (int)test_corners.size(), cvSize(3, 3), cvSize(1, 1), cvTermCriteria(CV_TERMCRIT_EPS|CV_TERMCRIT_ITER,300,0.1));
         find4QuadCornerSubpix(chessboard_image, test_corners, Size(5, 5));
-        
+
         double dist2 = 0.0;
         ret = calcDistance(corners, test_corners, dist2);
         if(ret == 0)
         {
             ts->printf(cvtest::TS::LOG, "findCornerSubpix returns invalid corner coordinates!\n");
             code = cvtest::TS::FAIL_INVALID_OUTPUT;
-            break;            
+            break;
         }
-        
-        ts->printf(cvtest::TS::LOG, "Error after findChessboardCorners: %f, after findCornerSubPix: %f\n", 
+
+        ts->printf(cvtest::TS::LOG, "Error after findChessboardCorners: %f, after findCornerSubPix: %f\n",
                    dist1, dist2);
         sum_dist += dist2;
         count++;
-        
+
         const double max_reduce_factor = 0.8;
         if(dist1 < dist2*max_reduce_factor)
         {
@@ -206,33 +206,33 @@ void CV_ChessboardSubpixelTest::run( int )
             code = cvtest::TS::FAIL_INVALID_OUTPUT;
             break;
         }
-        
+
         progress = update_progress( progress, i-1, runs_count, 0 );
     }
     sum_dist /= count;
-    ts->printf(cvtest::TS::LOG, "Average error after findCornerSubpix: %f\n", sum_dist); 
-        
+    ts->printf(cvtest::TS::LOG, "Average error after findCornerSubpix: %f\n", sum_dist);
+
     if( code < 0 )
         ts->set_failed_test_info( code );
 }
-                                        
+
 void CV_ChessboardSubpixelTest::generateIntrinsicParams()
 {
     RNG& rng = ts->get_rng();
     const double max_focus_length = 1000.0;
     const double max_focus_diff = 5.0;
-    
+
     double fx = cvtest::randReal(rng)*max_focus_length;
     double fy = fx + cvtest::randReal(rng)*max_focus_diff;
     double cx = image_size_.width/2;
     double cy = image_size_.height/2;
-    
+
     double k1 = 0.5*cvtest::randReal(rng);
     double k2 = 0.05*cvtest::randReal(rng);
     double p1 = 0.05*cvtest::randReal(rng);
     double p2 = 0.05*cvtest::randReal(rng);
     double k3 = 0.0;
-    
+
     intrinsic_matrix_ = (Mat_<double>(3, 3) << fx, 0.0, cx, 0.0, fy, cy, 0.0, 0.0, 1.0);
     distortion_coeffs_ = (Mat_<double>(1, 5) << k1, k2, p1, p2, k3);
 }
index 2c338b8..81c9ea4 100644 (file)
@@ -1 +1 @@
-ocv_define_module(contrib opencv_imgproc opencv_calib3d opencv_features2d opencv_highgui opencv_ml opencv_video opencv_objdetect)
+ocv_define_module(contrib opencv_imgproc opencv_calib3d opencv_features2d opencv_ml opencv_video opencv_objdetect OPTIONAL opencv_highgui)
index 42fcd29..09d589e 100644 (file)
 //
 
 #include "precomp.hpp"
-#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv_modules.hpp"
+#ifdef HAVE_OPENCV_HIGHGUI
+#  include "opencv2/highgui/highgui.hpp"
+#endif
 #include <iostream>
 #include <queue>
 
@@ -907,13 +910,16 @@ void ChamferMatcher::Template::show() const
         }
     }
 
-
     circle(templ_color,Point(center.x + pad, center.y + pad),1,CV_RGB(0,255,0));
 
+#ifdef HAVE_OPENCV_HIGHGUI
     namedWindow("templ",1);
     imshow("templ",templ_color);
 
     cvWaitKey(0);
+#else
+    CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without GUI support");
+#endif
 
     templ_color.release();
 }
index 59f3254..0ea8d18 100644 (file)
 // the use of this software, even if advised of the possibility of such damage.
 //
 //M*/
+
+#define SHOW_DEBUG_IMAGES 0
+
 #include "opencv2/core/core.hpp"
 #include "opencv2/calib3d/calib3d.hpp"
 
-#include "opencv2/highgui/highgui.hpp"
+#if SHOW_DEBUG_IMAGES
+#  include "opencv2/highgui/highgui.hpp"
+#endif
+
 #include "precomp.hpp"
 
 #include <iostream>
@@ -58,7 +64,6 @@
 
 #include <limits>
 
-#define SHOW_DEBUG_IMAGES 0
 using namespace cv;
 
 inline static
index 1a8a691..df20690 100644 (file)
@@ -588,11 +588,11 @@ GetSetElem
 ----------
 Finds a set element by its index.
 
-.. ocv:cfunction:: CvSetElem* cvGetSetElem( const CvSet* set_header, int index )
+.. ocv:cfunction:: CvSetElem* cvGetSetElem( const CvSet* set_header, int idx )
 
     :param set_header: Set
 
-    :param index: Index of the set element within a sequence
+    :param idx: Index of the set element within a sequence
 
 The function finds a set element by its index. The function returns the pointer to it or 0 if the index is invalid or the corresponding node is free. The function supports negative indices as it uses
 :ocv:cfunc:`GetSeqElem`
index 4907e29..c7d55d0 100644 (file)
@@ -167,7 +167,7 @@ The constructors.
         * **FileStorage::WRITE** Open the file for writing.
 
         * **FileStorage::APPEND** Open the file for appending.
-        
+
         * **FileStorage::MEMORY** Read data from ``source`` or write data to the internal buffer (which is returned by ``FileStorage::release``)
 
     :param encoding: Encoding of the file. Note that UTF-16 XML encoding is not supported currently and you should use 8-bit encoding instead of it.
index c7fb841..736984e 100644 (file)
@@ -1491,7 +1491,9 @@ void MatOp_GEMM::multiply(const MatExpr& e, double s, MatExpr& res) const
 void MatOp_GEMM::transpose(const MatExpr& e, MatExpr& res) const
 {
     res = e;
-    res.flags ^= CV_GEMM_A_T | CV_GEMM_B_T | CV_GEMM_C_T;
+    res.flags = (!(e.flags & CV_GEMM_A_T) ? CV_GEMM_B_T : 0) |
+                (!(e.flags & CV_GEMM_B_T) ? CV_GEMM_A_T : 0) |
+                (!(e.flags & CV_GEMM_C_T) ? CV_GEMM_C_T : 0);
     swap(res.a, res.b);
 }
 
index 0c75202..8a78faf 100644 (file)
@@ -473,20 +473,59 @@ string format( const char* fmt, ... )
 
 string tempfile( const char* suffix )
 {
-    char buf[L_tmpnam];
-    char* name = 0;
-#ifdef ANDROID
-    strcpy(buf, "/sdcard/__opencv_temp_XXXXXX");
-    name = mktemp(buf);
-#else
-    name = tmpnam(buf);
-#endif
-    if (*name == '\\')
-        ++name;
-    string n(name);
-    if (suffix != 0)
-        n += (n[n.size()-1] == '.' && suffix[0] == '.' ? suffix + 1 : suffix);
-    return n;
+#if defined WIN32 || defined _WIN32
+    char temp_dir[MAX_PATH + 1] = { 0 };
+    char temp_file[MAX_PATH + 1] = { 0 };
+
+    ::GetTempPathA(sizeof(temp_dir), temp_dir);
+    if(0 == ::GetTempFileNameA(temp_dir, "__opencv_temp.", 0, temp_file))
+        return string();
+
+    string name = temp_file;
+    if(suffix)
+    {
+        if (suffix[0] != '.')
+            return name + "." + suffix;
+        else
+            return name + suffix;
+    }
+    else
+        return name;
+# else
+#  ifdef ANDROID
+    //char defaultTemplate[] = "/mnt/sdcard/__opencv_temp.XXXXXX";
+    char defaultTemplate[] = "/data/local/tmp/__opencv_temp.XXXXXX";
+#  else
+    char defaultTemplate[] = "/tmp/__opencv_temp.XXXXXX";
+#  endif
+
+    string fname;
+    const char *temp_dir = getenv("OPENCV_TEMP_PATH");
+    if(temp_dir == 0 || temp_dir[0] == 0)
+        fname = defaultTemplate;
+    else
+    {
+        fname = temp_dir;
+        char ech = fname[fname.size() - 1];
+        if(ech != '/' && ech != '\\')
+            fname += "/";
+        fname += "__opencv_temp.XXXXXX";
+    }
+
+    const int fd = mkstemp((char*)fname.c_str());
+    if(fd == -1) return "";
+    close(fd);
+    remove(fname.c_str());
+
+    if(suffix)
+    {
+        if (suffix[0] != '.')
+            fname = fname + "." + suffix;
+        else
+            fname += suffix;
+    }
+    return fname;
+# endif
 }
 
 static CvErrorCallback customErrorCallback = 0;
index fc07bd8..875b849 100644 (file)
@@ -27,23 +27,23 @@ struct BaseElemWiseOp
         minval = depth < CV_32S ? cvtest::getMinVal(depth) : depth == CV_32S ? -1000000 : -1000.;
         maxval = depth < CV_32S ? cvtest::getMaxVal(depth) : depth == CV_32S ? 1000000 : 1000.;
     }
-    
+
     virtual void getRandomSize(RNG& rng, vector<int>& size)
     {
         cvtest::randomSize(rng, 2, ARITHM_MAX_NDIMS, cvtest::ARITHM_MAX_SIZE_LOG, size);
     }
-    
+
     virtual int getRandomType(RNG& rng)
     {
         return cvtest::randomType(rng, DEPTH_MASK_ALL_BUT_8S, 1,
                                   ninputs > 1 ? ARITHM_MAX_CHANNELS : 4);
     }
-        
-    virtual double getMaxErr(int depth) { return depth < CV_32F ? 1 : depth == CV_32F ? 1e-5 : 1e-12; }    
+
+    virtual double getMaxErr(int depth) { return depth < CV_32F ? 1 : depth == CV_32F ? 1e-5 : 1e-12; }
     virtual void generateScalars(int depth, RNG& rng)
     {
         const double m = 3.;
-        
+
         if( !(flags & FIX_ALPHA) )
         {
             alpha = exp(rng.uniform(-0.5, 0.1)*m*2*CV_LOG2);
@@ -54,7 +54,7 @@ struct BaseElemWiseOp
             beta = exp(rng.uniform(-0.5, 0.1)*m*2*CV_LOG2);
             beta *= rng.uniform(0, 2) ? 1 : -1;
         }
-        
+
         if( !(flags & FIX_GAMMA) )
         {
             for( int i = 0; i < 4; i++ )
@@ -65,25 +65,25 @@ struct BaseElemWiseOp
             if( flags & REAL_GAMMA )
                 gamma = Scalar::all(gamma[0]);
         }
-        
+
         if( depth == CV_32F )
         {
             Mat fl, db;
-            
+
             db = Mat(1, 1, CV_64F, &alpha);
             db.convertTo(fl, CV_32F);
             fl.convertTo(db, CV_64F);
-            
+
             db = Mat(1, 1, CV_64F, &beta);
             db.convertTo(fl, CV_32F);
             fl.convertTo(db, CV_64F);
-            
+
             db = Mat(1, 4, CV_64F, &gamma[0]);
             db.convertTo(fl, CV_32F);
             fl.convertTo(db, CV_64F);
         }
     }
-    
+
     int ninputs;
     int flags;
     double alpha;
@@ -98,7 +98,7 @@ struct BaseAddOp : public BaseElemWiseOp
 {
     BaseAddOp(int _ninputs, int _flags, double _alpha, double _beta, Scalar _gamma=Scalar::all(0))
     : BaseElemWiseOp(_ninputs, _flags, _alpha, _beta, _gamma) {}
-    
+
     void refop(const vector<Mat>& src, Mat& dst, const Mat& mask)
     {
         Mat temp;
@@ -214,7 +214,7 @@ struct MulOp : public BaseElemWiseOp
     {
         return depth <= CV_32S ? 2 : depth < CV_64F ? 1e-5 : 1e-12;
     }
-};    
+};
 
 struct DivOp : public BaseElemWiseOp
 {
@@ -231,7 +231,7 @@ struct DivOp : public BaseElemWiseOp
     {
         return depth <= CV_32S ? 2 : depth < CV_64F ? 1e-5 : 1e-12;
     }
-};    
+};
 
 struct RecipOp : public BaseElemWiseOp
 {
@@ -248,8 +248,8 @@ struct RecipOp : public BaseElemWiseOp
     {
         return depth <= CV_32S ? 2 : depth < CV_64F ? 1e-5 : 1e-12;
     }
-};        
-    
+};
+
 struct AbsDiffOp : public BaseAddOp
 {
     AbsDiffOp() : BaseAddOp(2, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, -1, Scalar::all(0)) {};
@@ -354,7 +354,7 @@ struct MinOp : public BaseElemWiseOp
     {
         return 0;
     }
-};    
+};
 
 struct MaxOp : public BaseElemWiseOp
 {
@@ -371,7 +371,7 @@ struct MaxOp : public BaseElemWiseOp
     {
         return 0;
     }
-};    
+};
 
 struct MinSOp : public BaseElemWiseOp
 {
@@ -388,7 +388,7 @@ struct MinSOp : public BaseElemWiseOp
     {
         return 0;
     }
-};    
+};
 
 struct MaxSOp : public BaseElemWiseOp
 {
@@ -406,7 +406,7 @@ struct MaxSOp : public BaseElemWiseOp
         return 0;
     }
 };
-    
+
 struct CmpOp : public BaseElemWiseOp
 {
     CmpOp() : BaseElemWiseOp(2, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {};
@@ -427,7 +427,7 @@ struct CmpOp : public BaseElemWiseOp
     {
         return cvtest::randomType(rng, DEPTH_MASK_ALL_BUT_8S, 1, 1);
     }
-        
+
     double getMaxErr(int)
     {
         return 0;
@@ -462,9 +462,9 @@ struct CmpSOp : public BaseElemWiseOp
         return 0;
     }
     int cmpop;
-};    
+};
+
 
-    
 struct CopyOp : public BaseElemWiseOp
 {
     CopyOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA+SUPPORT_MASK, 1, 1, Scalar::all(0)) {};
@@ -487,7 +487,7 @@ struct CopyOp : public BaseElemWiseOp
     int cmpop;
 };
 
-    
+
 struct SetOp : public BaseElemWiseOp
 {
     SetOp() : BaseElemWiseOp(0, FIX_ALPHA+FIX_BETA+SUPPORT_MASK, 1, 1, Scalar::all(0)) {};
@@ -507,7 +507,7 @@ struct SetOp : public BaseElemWiseOp
     {
         return 0;
     }
-};    
+};
 
 template<typename _Tp, typename _WTp> static void
 inRangeS_(const _Tp* src, const _WTp* a, const _WTp* b, uchar* dst, size_t total, int cn)
@@ -547,7 +547,7 @@ template<typename _Tp> static void inRange_(const _Tp* src, const _Tp* a, const
         }
     }
 }
-    
+
 
 static void inRange(const Mat& src, const Mat& lb, const Mat& rb, Mat& dst)
 {
@@ -556,19 +556,19 @@ static void inRange(const Mat& src, const Mat& lb, const Mat& rb, Mat& dst)
     dst.create( src.dims, &src.size[0], CV_8U );
     const Mat *arrays[]={&src, &lb, &rb, &dst, 0};
     Mat planes[4];
-    
+
     NAryMatIterator it(arrays, planes);
     size_t total = planes[0].total();
     size_t i, nplanes = it.nplanes;
-       int depth = src.depth(), cn = src.channels();
-    
+    int depth = src.depth(), cn = src.channels();
+
     for( i = 0; i < nplanes; i++, ++it )
     {
         const uchar* sptr = planes[0].data;
         const uchar* aptr = planes[1].data;
         const uchar* bptr = planes[2].data;
         uchar* dptr = planes[3].data;
-        
+
         switch( depth )
         {
         case CV_8U:
@@ -604,21 +604,21 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds
     dst.create( src.dims, &src.size[0], CV_8U );
     const Mat *arrays[]={&src, &dst, 0};
     Mat planes[2];
-    
+
     NAryMatIterator it(arrays, planes);
     size_t total = planes[0].total();
     size_t i, nplanes = it.nplanes;
-       int depth = src.depth(), cn = src.channels();
+    int depth = src.depth(), cn = src.channels();
     union { double d[4]; float f[4]; int i[4];} lbuf, rbuf;
     int wtype = CV_MAKETYPE(depth <= CV_32S ? CV_32S : depth, cn);
     scalarToRawData(lb, lbuf.d, wtype, cn);
     scalarToRawData(rb, rbuf.d, wtype, cn);
-    
+
     for( i = 0; i < nplanes; i++, ++it )
     {
         const uchar* sptr = planes[0].data;
         uchar* dptr = planes[1].data;
-        
+
         switch( depth )
         {
         case CV_8U:
@@ -647,8 +647,8 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds
         }
     }
 }
-    
-    
+
+
 struct InRangeSOp : public BaseElemWiseOp
 {
     InRangeSOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA, 1, 1, Scalar::all(0)) {};
@@ -676,9 +676,9 @@ struct InRangeSOp : public BaseElemWiseOp
         }
     }
     Scalar gamma1;
-};    
+};
+
 
-    
 struct InRangeOp : public BaseElemWiseOp
 {
     InRangeOp() : BaseElemWiseOp(3, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {};
@@ -687,7 +687,7 @@ struct InRangeOp : public BaseElemWiseOp
         Mat lb, rb;
         cvtest::min(src[1], src[2], lb);
         cvtest::max(src[1], src[2], rb);
-        
+
         cv::inRange(src[0], lb, rb, dst);
     }
     void refop(const vector<Mat>& src, Mat& dst, const Mat&)
@@ -695,16 +695,16 @@ struct InRangeOp : public BaseElemWiseOp
         Mat lb, rb;
         cvtest::min(src[1], src[2], lb);
         cvtest::max(src[1], src[2], rb);
-        
+
         cvtest::inRange(src[0], lb, rb, dst);
     }
     double getMaxErr(int)
     {
         return 0;
     }
-};    
-    
-    
+};
+
+
 struct ConvertScaleOp : public BaseElemWiseOp
 {
     ConvertScaleOp() : BaseElemWiseOp(1, FIX_BETA+REAL_GAMMA, 1, 1, Scalar::all(0)), ddepth(0) { };
@@ -739,7 +739,7 @@ struct ConvertScaleOp : public BaseElemWiseOp
     int ddepth;
 };
 
-    
+
 struct ConvertScaleAbsOp : public BaseElemWiseOp
 {
     ConvertScaleAbsOp() : BaseElemWiseOp(1, FIX_BETA+REAL_GAMMA, 1, 1, Scalar::all(0)) {};
@@ -767,13 +767,13 @@ struct ConvertScaleAbsOp : public BaseElemWiseOp
     }
 };
 
-    
+
 static void flip(const Mat& src, Mat& dst, int flipcode)
 {
     CV_Assert(src.dims == 2);
     dst.create(src.size(), src.type());
     int i, j, k, esz = (int)src.elemSize(), width = src.cols*esz;
-    
+
     for( i = 0; i < dst.rows; i++ )
     {
         const uchar* sptr = src.ptr(flipcode == 1 ? i : dst.rows - i - 1);
@@ -796,7 +796,7 @@ static void setIdentity(Mat& dst, const Scalar& s)
     double buf[4];
     scalarToRawData(s, buf, dst.type(), 0);
     int i, k, esz = (int)dst.elemSize(), width = dst.cols*esz;
-    
+
     for( i = 0; i < dst.rows; i++ )
     {
         uchar* dptr = dst.ptr(i);
@@ -807,7 +807,7 @@ static void setIdentity(Mat& dst, const Scalar& s)
     }
 }
 
-    
+
 struct FlipOp : public BaseElemWiseOp
 {
     FlipOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {};
@@ -853,8 +853,8 @@ struct TransposeOp : public BaseElemWiseOp
     {
         return 0;
     }
-};    
-    
+};
+
 struct SetIdentityOp : public BaseElemWiseOp
 {
     SetIdentityOp() : BaseElemWiseOp(0, FIX_ALPHA+FIX_BETA, 1, 1, Scalar::all(0)) {};
@@ -874,7 +874,7 @@ struct SetIdentityOp : public BaseElemWiseOp
     {
         return 0;
     }
-};    
+};
 
 struct SetZeroOp : public BaseElemWiseOp
 {
@@ -893,23 +893,23 @@ struct SetZeroOp : public BaseElemWiseOp
     }
 };
 
-    
+
 static void exp(const Mat& src, Mat& dst)
 {
     dst.create( src.dims, &src.size[0], src.type() );
     const Mat *arrays[]={&src, &dst, 0};
     Mat planes[2];
-    
+
     NAryMatIterator it(arrays, planes);
     size_t j, total = planes[0].total()*src.channels();
     size_t i, nplanes = it.nplanes;
-       int depth = src.depth();
-    
+    int depth = src.depth();
+
     for( i = 0; i < nplanes; i++, ++it )
     {
         const uchar* sptr = planes[0].data;
         uchar* dptr = planes[1].data;
-        
+
         if( depth == CV_32F )
         {
             for( j = 0; j < total; j++ )
@@ -920,7 +920,7 @@ static void exp(const Mat& src, Mat& dst)
             for( j = 0; j < total; j++ )
                 ((double*)dptr)[j] = std::exp(((const double*)sptr)[j]);
         }
-    }    
+    }
 }
 
 static void log(const Mat& src, Mat& dst)
@@ -928,17 +928,17 @@ static void log(const Mat& src, Mat& dst)
     dst.create( src.dims, &src.size[0], src.type() );
     const Mat *arrays[]={&src, &dst, 0};
     Mat planes[2];
-    
+
     NAryMatIterator it(arrays, planes);
     size_t j, total = planes[0].total()*src.channels();
     size_t i, nplanes = it.nplanes;
-       int depth = src.depth();
-    
+    int depth = src.depth();
+
     for( i = 0; i < nplanes; i++, ++it )
     {
         const uchar* sptr = planes[0].data;
         uchar* dptr = planes[1].data;
-        
+
         if( depth == CV_32F )
         {
             for( j = 0; j < total; j++ )
@@ -949,9 +949,9 @@ static void log(const Mat& src, Mat& dst)
             for( j = 0; j < total; j++ )
                 ((double*)dptr)[j] = std::log(fabs(((const double*)sptr)[j]));
         }
-    }    
-}    
-    
+    }
+}
+
 struct ExpOp : public BaseElemWiseOp
 {
     ExpOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {};
@@ -976,7 +976,7 @@ struct ExpOp : public BaseElemWiseOp
     {
         return depth == CV_32F ? 1e-5 : 1e-12;
     }
-};        
+};
 
 
 struct LogOp : public BaseElemWiseOp
@@ -1018,13 +1018,13 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
     mangle.create( mx.dims, &mx.size[0], mx.type() );
     const Mat *arrays[]={&mx, &my, &mmag, &mangle, 0};
     Mat planes[4];
-    
+
     NAryMatIterator it(arrays, planes);
     size_t j, total = planes[0].total();
     size_t i, nplanes = it.nplanes;
-       int depth = mx.depth();
+    int depth = mx.depth();
     double scale = angleInDegrees ? 180/CV_PI : 1;
-    
+
     for( i = 0; i < nplanes; i++, ++it )
     {
         if( depth == CV_32F )
@@ -1033,7 +1033,7 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
             const float* yptr = (const float*)planes[1].data;
             float* mptr = (float*)planes[2].data;
             float* aptr = (float*)planes[3].data;
-            
+
             for( j = 0; j < total; j++ )
             {
                 mptr[j] = std::sqrt(xptr[j]*xptr[j] + yptr[j]*yptr[j]);
@@ -1048,7 +1048,7 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
             const double* yptr = (const double*)planes[1].data;
             double* mptr = (double*)planes[2].data;
             double* aptr = (double*)planes[3].data;
-            
+
             for( j = 0; j < total; j++ )
             {
                 mptr[j] = std::sqrt(xptr[j]*xptr[j] + yptr[j]*yptr[j]);
@@ -1059,8 +1059,8 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
         }
     }
 }
-    
-    
+
+
 struct CartToPolarToCartOp : public BaseElemWiseOp
 {
     CartToPolarToCartOp() : BaseElemWiseOp(2, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0))
@@ -1075,10 +1075,10 @@ struct CartToPolarToCartOp : public BaseElemWiseOp
     void op(const vector<Mat>& src, Mat& dst, const Mat&)
     {
         Mat mag, angle, x, y;
-        
+
         cv::cartToPolar(src[0], src[1], mag, angle, angleInDegrees);
         cv::polarToCart(mag, angle, x, y, angleInDegrees);
-        
+
         Mat msrc[] = {mag, angle, x, y};
         int pairs[] = {0, 0, 1, 1, 2, 2, 3, 3};
         dst.create(src[0].dims, src[0].size, CV_MAKETYPE(src[0].depth(), 4));
@@ -1103,8 +1103,8 @@ struct CartToPolarToCartOp : public BaseElemWiseOp
     }
     bool angleInDegrees;
 };
-    
-    
+
+
 struct MeanOp : public BaseElemWiseOp
 {
     MeanOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA+SUPPORT_MASK+SCALAR_OUTPUT, 1, 1, Scalar::all(0))
@@ -1125,7 +1125,7 @@ struct MeanOp : public BaseElemWiseOp
     {
         return 1e-6;
     }
-};    
+};
 
 
 struct SumOp : public BaseElemWiseOp
@@ -1148,9 +1148,9 @@ struct SumOp : public BaseElemWiseOp
     {
         return 1e-5;
     }
-};    
+};
+
 
-    
 struct CountNonZeroOp : public BaseElemWiseOp
 {
     CountNonZeroOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA+SCALAR_OUTPUT+SUPPORT_MASK, 1, 1, Scalar::all(0))
@@ -1181,9 +1181,9 @@ struct CountNonZeroOp : public BaseElemWiseOp
     {
         return 0;
     }
-};    
+};
+
 
-    
 struct MeanStdDevOp : public BaseElemWiseOp
 {
     Scalar sqmeanRef;
@@ -1206,13 +1206,13 @@ struct MeanStdDevOp : public BaseElemWiseOp
         cvtest::multiply(temp, temp, temp);
         Scalar mean = cvtest::mean(src[0], mask);
         Scalar sqmean = cvtest::mean(temp, mask);
-        
+
         sqmeanRef = sqmean;
         cn = temp.channels();
 
         for( int c = 0; c < 4; c++ )
-            sqmean[c] = std::sqrt(std::max(sqmean[c] - mean[c]*mean[c], 0.)); 
-        
+            sqmean[c] = std::sqrt(std::max(sqmean[c] - mean[c]*mean[c], 0.));
+
         dst.create(1, 2, CV_64FC4);
         dst.at<Scalar>(0,0) = mean;
         dst.at<Scalar>(0,1) = sqmean;
@@ -1225,9 +1225,9 @@ struct MeanStdDevOp : public BaseElemWiseOp
             err = std::max(err, sqmeanRef[i]);
         return 3e-7 * err;
     }
-};    
+};
+
 
-    
 struct NormOp : public BaseElemWiseOp
 {
     NormOp() : BaseElemWiseOp(2, FIX_ALPHA+FIX_BETA+FIX_GAMMA+SUPPORT_MASK+SCALAR_OUTPUT, 1, 1, Scalar::all(0))
@@ -1272,7 +1272,7 @@ struct NormOp : public BaseElemWiseOp
         return 1e-6;
     }
     int normType;
-};        
+};
 
 
 struct MinMaxLocOp : public BaseElemWiseOp
@@ -1290,7 +1290,7 @@ struct MinMaxLocOp : public BaseElemWiseOp
     {
         int i, ndims = (int)minidx.size();
         dst.create(1, ndims*2 + 2, CV_64FC1);
-        
+
         for( i = 0; i < ndims; i++ )
         {
             dst.at<double>(0,i) = minidx[i];
@@ -1319,9 +1319,9 @@ struct MinMaxLocOp : public BaseElemWiseOp
     {
         return 0;
     }
-};            
-    
-    
+};
+
+
 }
 
 typedef Ptr<cvtest::BaseElemWiseOp> ElemWiseOpPtr;
@@ -1330,7 +1330,7 @@ class ElemWiseTest : public ::testing::TestWithParam<ElemWiseOpPtr> {};
 TEST_P(ElemWiseTest, accuracy)
 {
     ElemWiseOpPtr op = GetParam();
-    
+
     int testIdx = 0;
     RNG rng((uint64)cvtest::ARITHM_RNG_SEED);
     for( testIdx = 0; testIdx < cvtest::ARITHM_NTESTS; testIdx++ )
@@ -1340,7 +1340,7 @@ TEST_P(ElemWiseTest, accuracy)
         int type = op->getRandomType(rng);
         int depth = CV_MAT_DEPTH(type);
         bool haveMask = (op->flags & cvtest::BaseElemWiseOp::SUPPORT_MASK) != 0 && rng.uniform(0, 4) == 0;
-        
+
         double minval=0, maxval=0;
         op->getValueRange(depth, minval, maxval);
         int i, ninputs = op->ninputs;
@@ -1350,7 +1350,7 @@ TEST_P(ElemWiseTest, accuracy)
         Mat dst0, dst, mask;
         if( haveMask )
             mask = cvtest::randomMat(rng, size, CV_8U, 0, 2, true);
-        
+
         if( (haveMask || ninputs == 0) && !(op->flags & cvtest::BaseElemWiseOp::SCALAR_OUTPUT))
         {
             dst0 = cvtest::randomMat(rng, size, type, minval, maxval, false);
@@ -1358,17 +1358,17 @@ TEST_P(ElemWiseTest, accuracy)
             cvtest::copy(dst, dst0);
         }
         op->generateScalars(depth, rng);
-        
+
         op->refop(src, dst0, mask);
         op->op(src, dst, mask);
-        
+
         double maxErr = op->getMaxErr(depth);
         vector<int> pos;
-               ASSERT_PRED_FORMAT2(cvtest::MatComparator(maxErr, op->context), dst0, dst) << "\nsrc[0] ~ " << cvtest::MatInfo(!src.empty() ? src[0] : Mat()) << "\ntestCase #" << testIdx << "\n";
+        ASSERT_PRED_FORMAT2(cvtest::MatComparator(maxErr, op->context), dst0, dst) << "\nsrc[0] ~ " << cvtest::MatInfo(!src.empty() ? src[0] : Mat()) << "\ntestCase #" << testIdx << "\n";
     }
 }
 
+
 INSTANTIATE_TEST_CASE_P(Core_Copy, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::CopyOp)));
 INSTANTIATE_TEST_CASE_P(Core_Set, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::SetOp)));
 INSTANTIATE_TEST_CASE_P(Core_SetZero, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::SetZeroOp)));
@@ -1429,7 +1429,7 @@ class CV_ArithmMaskTest : public cvtest::BaseTest
 {
 public:
     CV_ArithmMaskTest() {}
-    ~CV_ArithmMaskTest() {}   
+    ~CV_ArithmMaskTest() {}
 protected:
     void run(int)
     {
@@ -1441,7 +1441,7 @@ protected:
             for( int iter = 0; iter < 100; iter++ )
             {
                 //ts->printf(cvtest::TS::LOG, ".");
-                
+
                 ts->update_context(this, iter, true);
                 int k, dims = rng.uniform(1, MAX_DIM+1), p = 1;
                 int depth = rng.uniform(CV_8U, CV_64F+1);
@@ -1459,15 +1459,15 @@ protected:
                 Mat mask(dims, sizes, CV_8U);
                 Mat mask1;
                 Mat c, d;
-                
+
                 rng.fill(a, RNG::UNIFORM, 0, 100);
                 rng.fill(b, RNG::UNIFORM, 0, 100);
-                
+
                 // [-2,2) range means that the each generated random number
                 // will be one of -2, -1, 0, 1. Saturated to [0,255], it will become
                 // 0, 0, 0, 1 => the mask will be filled by ~25%.
                 rng.fill(mask, RNG::UNIFORM, -2, 2);
-                
+
                 a.convertTo(a1, depth1);
                 b.convertTo(b1, depth1);
                 // invert the mask
@@ -1504,7 +1504,7 @@ protected:
                 d.convertTo(d1, depth);
                 CV_Assert( norm(c, d1, CV_C) <= DBL_EPSILON );
             }
-            
+
             Mat_<uchar> tmpSrc(100,100);
             tmpSrc = 124;
             Mat_<uchar> tmpMask(100,100);
index f290bab..6b55eb2 100644 (file)
@@ -31,7 +31,7 @@ static SparseMat cvTsGetRandomSparseMat(int dims, const int* sz, int type,
         else
             *(double*)ptr = saturate_cast<double>(val);
     }
-    
+
     return m;
 }
 
@@ -40,11 +40,11 @@ static bool cvTsCheckSparse(const CvSparseMat* m1, const CvSparseMat* m2, double
     CvSparseMatIterator it1;
     CvSparseNode* node1;
     int depth = CV_MAT_DEPTH(m1->type);
-    
+
     if( m1->heap->active_count != m2->heap->active_count ||
        m1->dims != m2->dims || CV_MAT_TYPE(m1->type) != CV_MAT_TYPE(m2->type) )
         return false;
-    
+
     for( node1 = cvInitSparseMatIterator( m1, &it1 );
         node1 != 0; node1 = cvGetNextSparseNode( &it1 ))
     {
@@ -75,7 +75,7 @@ static bool cvTsCheckSparse(const CvSparseMat* m1, const CvSparseMat* m2, double
         else if( fabs(*(double*)v1 - *(double*)v2) > eps*(fabs(*(double*)v2) + 1) )
             return false;
     }
-    
+
     return true;
 }
 
@@ -94,27 +94,27 @@ protected:
         test_case_count = 4;
         int progress = 0;
         MemStorage storage(cvCreateMemStorage(0));
-        
+
         for( int idx = 0; idx < test_case_count; idx++ )
         {
             ts->update_context( this, idx, false );
             progress = update_progress( progress, idx, test_case_count, 0 );
-            
+
             cvClearMemStorage(storage);
-            
+
             bool mem = (idx % 4) >= 2;
             string filename = tempfile(idx % 2 ? ".yml" : ".xml");
-            
+
             FileStorage fs(filename, FileStorage::WRITE + (mem ? FileStorage::MEMORY : 0));
-            
+
             int test_int = (int)cvtest::randInt(rng);
             double test_real = (cvtest::randInt(rng)%2?1:-1)*exp(cvtest::randReal(rng)*18-9);
             string test_string = "vw wv23424rt\"&amp;&lt;&gt;&amp;&apos;@#$@$%$%&%IJUKYILFD@#$@%$&*&() ";
-            
+
             int depth = cvtest::randInt(rng) % (CV_64F+1);
             int cn = cvtest::randInt(rng) % 4 + 1;
             Mat test_mat(cvtest::randInt(rng)%30+1, cvtest::randInt(rng)%30+1, CV_MAKETYPE(depth, cn));
-            
+
             rng0.fill(test_mat, CV_RAND_UNI, Scalar::all(ranges[depth][0]), Scalar::all(ranges[depth][1]));
             if( depth >= CV_32F )
             {
@@ -123,11 +123,11 @@ protected:
                 rng0.fill(test_mat_scale, CV_RAND_UNI, Scalar::all(-1), Scalar::all(1));
                 multiply(test_mat, test_mat_scale, test_mat);
             }
-            
+
             CvSeq* seq = cvCreateSeq(test_mat.type(), (int)sizeof(CvSeq),
                                      (int)test_mat.elemSize(), storage);
-            cvSeqPushMulti(seq, test_mat.data, test_mat.cols*test_mat.rows); 
-            
+            cvSeqPushMulti(seq, test_mat.data, test_mat.cols*test_mat.rows);
+
             CvGraph* graph = cvCreateGraph( CV_ORIENTED_GRAPH,
                                            sizeof(CvGraph), sizeof(CvGraphVtx),
                                            sizeof(CvGraphEdge), storage );
@@ -141,12 +141,12 @@ protected:
                 cvGraphAddEdge(graph, edges[i][0], edges[i][1], 0, &edge);
                 edge->weight = (float)(i+1);
             }
-            
+
             depth = cvtest::randInt(rng) % (CV_64F+1);
             cn = cvtest::randInt(rng) % 4 + 1;
             int sz[] = {cvtest::randInt(rng)%10+1, cvtest::randInt(rng)%10+1, cvtest::randInt(rng)%10+1};
             MatND test_mat_nd(3, sz, CV_MAKETYPE(depth, cn));
-            
+
             rng0.fill(test_mat_nd, CV_RAND_UNI, Scalar::all(ranges[depth][0]), Scalar::all(ranges[depth][1]));
             if( depth >= CV_32F )
             {
@@ -155,44 +155,44 @@ protected:
                 rng0.fill(test_mat_scale, CV_RAND_UNI, Scalar::all(-1), Scalar::all(1));
                 multiply(test_mat_nd, test_mat_scale, test_mat_nd);
             }
-            
+
             int ssz[] = {cvtest::randInt(rng)%10+1, cvtest::randInt(rng)%10+1,
                 cvtest::randInt(rng)%10+1,cvtest::randInt(rng)%10+1};
             SparseMat test_sparse_mat = cvTsGetRandomSparseMat(4, ssz, cvtest::randInt(rng)%(CV_64F+1),
                                                                cvtest::randInt(rng) % 10000, 0, 100, rng);
-            
+
             fs << "test_int" << test_int << "test_real" << test_real << "test_string" << test_string;
             fs << "test_mat" << test_mat;
             fs << "test_mat_nd" << test_mat_nd;
             fs << "test_sparse_mat" << test_sparse_mat;
-            
+
             fs << "test_list" << "[" << 0.0000000000001 << 2 << CV_PI << -3435345 << "2-502 2-029 3egegeg" <<
             "{:" << "month" << 12 << "day" << 31 << "year" << 1969 << "}" << "]";
             fs << "test_map" << "{" << "x" << 1 << "y" << 2 << "width" << 100 << "height" << 200 << "lbp" << "[:";
-            
+
             const uchar arr[] = {0, 1, 1, 0, 1, 1, 0, 1};
             fs.writeRaw("u", arr, (int)(sizeof(arr)/sizeof(arr[0])));
-            
+
             fs << "]" << "}";
             cvWriteComment(*fs, "test comment", 0);
-            
+
             fs.writeObj("test_seq", seq);
             fs.writeObj("test_graph",graph);
             CvGraph* graph2 = (CvGraph*)cvClone(graph);
-            
+
             string content = fs.releaseAndGetString();
-            
+
             if(!fs.open(mem ? content : filename, FileStorage::READ + (mem ? FileStorage::MEMORY : 0)))
             {
                 ts->printf( cvtest::TS::LOG, "filename %s can not be read\n", !mem ? filename.c_str() : content.c_str());
                 ts->set_failed_test_info( cvtest::TS::FAIL_MISSING_TEST_DATA );
                 return;
             }
-            
+
             int real_int = (int)fs["test_int"];
             double real_real = (double)fs["test_real"];
             string real_string = (string)fs["test_string"];
-            
+
             if( real_int != test_int ||
                fabs(real_real - test_real) > DBL_EPSILON*(fabs(test_real)+1) ||
                real_string != test_string )
@@ -201,7 +201,7 @@ protected:
                 ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
                 return;
             }
-            
+
             CvMat* m = (CvMat*)fs["test_mat"].readObj();
             CvMat _test_mat = test_mat;
             double max_diff = 0;
@@ -209,7 +209,7 @@ protected:
             cvReshape(m, &stub1, 1, 0);
             cvReshape(&_test_mat, &_test_stub1, 1, 0);
             vector<int> pt;
-            
+
             if( !m || !CV_IS_MAT(m) || m->rows != test_mat.rows || m->cols != test_mat.cols ||
                cvtest::cmpEps( Mat(&stub1), Mat(&_test_stub1), &max_diff, 0, &pt, true) < 0 )
             {
@@ -221,26 +221,26 @@ protected:
             }
             if( m && CV_IS_MAT(m))
                 cvReleaseMat(&m);
-            
+
             CvMatND* m_nd = (CvMatND*)fs["test_mat_nd"].readObj();
             CvMatND _test_mat_nd = test_mat_nd;
-            
+
             if( !m_nd || !CV_IS_MATND(m_nd) )
             {
                 ts->printf( cvtest::TS::LOG, "the read nd-matrix is not correct\n" );
                 ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
                 return;
             }
-            
+
             CvMat stub, _test_stub;
             cvGetMat(m_nd, &stub, 0, 1);
             cvGetMat(&_test_mat_nd, &_test_stub, 0, 1);
             cvReshape(&stub, &stub1, 1, 0);
             cvReshape(&_test_stub, &_test_stub1, 1, 0);
-            
+
             if( !CV_ARE_TYPES_EQ(&stub, &_test_stub) ||
                !CV_ARE_SIZES_EQ(&stub, &_test_stub) ||
-               //cvNorm(&stub, &_test_stub, CV_L2) != 0 ) 
+               //cvNorm(&stub, &_test_stub, CV_L2) != 0 )
                cvtest::cmpEps( Mat(&stub1), Mat(&_test_stub1), &max_diff, 0, &pt, true) < 0 )
             {
                 ts->printf( cvtest::TS::LOG, "readObj method: the read nd matrix is not correct: (%.20g vs %.20g) vs at (%d,%d)\n",
@@ -249,16 +249,16 @@ protected:
                 ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
                 return;
             }
-            
+
             MatND mat_nd2;
             fs["test_mat_nd"] >> mat_nd2;
             CvMatND m_nd2 = mat_nd2;
             cvGetMat(&m_nd2, &stub, 0, 1);
             cvReshape(&stub, &stub1, 1, 0);
-            
+
             if( !CV_ARE_TYPES_EQ(&stub, &_test_stub) ||
                !CV_ARE_SIZES_EQ(&stub, &_test_stub) ||
-               //cvNorm(&stub, &_test_stub, CV_L2) != 0 ) 
+               //cvNorm(&stub, &_test_stub, CV_L2) != 0 )
                cvtest::cmpEps( Mat(&stub1), Mat(&_test_stub1), &max_diff, 0, &pt, true) < 0 )
             {
                 ts->printf( cvtest::TS::LOG, "C++ method: the read nd matrix is not correct: (%.20g vs %.20g) vs at (%d,%d)\n",
@@ -267,16 +267,16 @@ protected:
                 ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
                 return;
             }
-            
+
             cvRelease((void**)&m_nd);
-            
+
             Ptr<CvSparseMat> m_s = (CvSparseMat*)fs["test_sparse_mat"].readObj();
             Ptr<CvSparseMat> _test_sparse_ = (CvSparseMat*)test_sparse_mat;
             Ptr<CvSparseMat> _test_sparse = (CvSparseMat*)cvClone(_test_sparse_);
             SparseMat m_s2;
             fs["test_sparse_mat"] >> m_s2;
             Ptr<CvSparseMat> _m_s2 = (CvSparseMat*)m_s2;
-            
+
             if( !m_s || !CV_IS_SPARSE_MAT(m_s) ||
                !cvTsCheckSparse(m_s, _test_sparse,0) ||
                !cvTsCheckSparse(_m_s2, _test_sparse,0))
@@ -285,7 +285,7 @@ protected:
                 ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
                 return;
             }
-            
+
             FileNode tl = fs["test_list"];
             if( tl.type() != FileNode::SEQ || tl.size() != 6 ||
                fabs((double)tl[0] - 0.0000000000001) >= DBL_EPSILON ||
@@ -302,15 +302,15 @@ protected:
                 ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
                 return;
             }
-            
+
             FileNode tm = fs["test_map"];
             FileNode tm_lbp = tm["lbp"];
-            
+
             int real_x = (int)tm["x"];
             int real_y = (int)tm["y"];
             int real_width = (int)tm["width"];
             int real_height = (int)tm["height"];
-            
+
             int real_lbp_val = 0;
             FileNodeIterator it;
             it = tm_lbp.begin();
@@ -332,7 +332,7 @@ protected:
             real_lbp_val |= (int)*it2 << 4;
             it2 += -1;
             CV_Assert( it == it2 );
-            
+
             if( tm.type() != FileNode::MAP || tm.size() != 5 ||
                real_x != 1 ||
                real_y != 2 ||
@@ -346,7 +346,7 @@ protected:
                 ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
                 return;
             }
-            
+
             CvGraph* graph3 = (CvGraph*)fs["test_graph"].readObj();
             if(graph2->active_count != vcount || graph3->active_count != vcount ||
                graph2->edges->active_count != ecount || graph3->edges->active_count != ecount)
@@ -355,7 +355,7 @@ protected:
                 ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
                 return;
             }
-            
+
             for( i = 0; i < ecount; i++ )
             {
                 CvGraphEdge* edge2 = cvFindGraphEdge(graph2, edges[i][0], edges[i][1]);
@@ -368,7 +368,7 @@ protected:
                     return;
                 }
             }
-            
+
             fs.release();
             if( !mem )
                 remove(filename.c_str());
@@ -383,13 +383,14 @@ class CV_MiscIOTest : public cvtest::BaseTest
 {
 public:
     CV_MiscIOTest() {}
-    ~CV_MiscIOTest() {}   
+    ~CV_MiscIOTest() {}
 protected:
     void run(int)
     {
         try
         {
-            FileStorage fs("test.xml", FileStorage::WRITE);
+            string fname = cv::tempfile(".xml");
+            FileStorage fs(fname, FileStorage::WRITE);
             vector<int> mi, mi2, mi3, mi4;
             vector<Mat> mv, mv2, mv3, mv4;
             Mat m(10, 9, CV_32F);
@@ -403,7 +404,7 @@ protected:
             fs << "mv3" << mv3;
             fs << "empty" << empty;
             fs.release();
-            fs.open("test.xml", FileStorage::READ);
+            fs.open(fname, FileStorage::READ);
             fs["mi"] >> mi2;
             fs["mv"] >> mv2;
             fs["mi3"] >> mi4;
@@ -429,7 +430,7 @@ TEST(Core_InputOutput, misc) { CV_MiscIOTest test; test.safe_run(); }
 {
 public:
     CV_BigMatrixIOTest() {}
-    ~CV_BigMatrixIOTest() {}   
+    ~CV_BigMatrixIOTest() {}
 protected:
     void run(int)
     {
@@ -439,7 +440,7 @@ protected:
             int N = 1000, M = 1200000;
             Mat mat(M, N, CV_32F);
             rng.fill(mat, RNG::UNIFORM, 0, 1);
-            FileStorage fs("test.xml", FileStorage::WRITE);
+            FileStorage fs(cv::tempfile(".xml"), FileStorage::WRITE);
             fs << "mat" << mat;
             fs.release();
         }
index 1069c8d..5297f95 100644 (file)
@@ -749,7 +749,22 @@ bool CV_OperationsTest::TestTemplateMat()
         if (Mat3i(1, 1).channels() != 3) throw test_excep();
         if (Mat3w(1, 1).channels() != 3) throw test_excep();
         if (Mat3s(1, 1).channels() != 3) throw test_excep();
-
+        
+        vector<Mat_<float> > mvf, mvf2;
+        Mat_<Vec2f> mf2;
+        mvf.push_back(Mat_<float>::ones(4, 3));
+        mvf.push_back(Mat_<float>::zeros(4, 3));
+        merge(mvf, mf2);
+        split(mf2, mvf2);
+        CV_Assert( norm(mvf2[0], mvf[0], CV_C) == 0 &&
+                  norm(mvf2[1], mvf[1], CV_C) == 0 );
+        
+        {
+        Mat a(2,2,CV_32F,1.f);
+        Mat b(1,2,CV_32F,1.f);
+        Mat c = (a*b.t()).t();
+        CV_Assert( norm(c, CV_L1) == 4. );
+        }
     }
     catch (const test_excep& e)
     {
index 5aeafb2..0fcaf02 100644 (file)
@@ -94,9 +94,9 @@ Finds keypoints in an image and computes their descriptors
 
     :param useProvidedKeypoints: If it is true, then the method will use the provided vector of keypoints instead of detecting them.
 
-    FREAK
+FREAK
 -----
-.. ocv:class:: FREAK
+.. ocv:class:: FREAK : public DescriptorExtractor
 
 Class implementing the FREAK (*Fast Retina Keypoint*) keypoint descriptor, described in [AOV12]_. The algorithm propose a novel keypoint descriptor inspired by the human visual system and more precisely the retina, coined Fast Retina Key- point (FREAK). A cascade of binary strings is computed by efficiently comparing image intensities over a retinal sampling pattern. FREAKs are in general faster to compute with lower memory load and also more robust than SIFT, SURF or BRISK. They are competitive alternatives to existing keypoints in particular for embedded applications.
 
@@ -106,12 +106,12 @@ FREAK::FREAK
 ------------
 The FREAK constructor
 
-.. ocv:function:: FREAK::FREAK(bool orientationNormalized = true, bool scaleNormalized = true, float patternScale = 22.0f, int nbOctave = 4, const vector<int>& selectedPairs = vector<int>())
+.. ocv:function:: FREAK::FREAK( bool orientationNormalized=true, bool scaleNormalized=true, float patternScale=22.0f, int nOctaves=4, const vector<int>& selectedPairs=vector<int>() )
 
     :param orientationNormalized: Enable orientation normalization.
     :param scaleNormalized: Enable scale normalization.
     :param patternScale: Scaling of the description pattern.
-    :param nbOctave: Number of octaves covered by the detected keypoints.
+    :param nOctaves: Number of octaves covered by the detected keypoints.
     :param selectedPairs: (Optional) user defined selected pairs indexes,
 
 FREAK::selectPairs
@@ -126,4 +126,3 @@ We notice that for keypoint matching applications, image content has little effe
     :param keypoints: Set of detected keypoints
     :param corrThresh: Correlation threshold.
     :param verbose: Prints pair selection informations.
-        
\ No newline at end of file
index c324863..888c2da 100644 (file)
@@ -328,7 +328,7 @@ public:
            float patternScale = 22.0f,
            int nOctaves = 4,
            const vector<int>& selectedPairs = vector<int>());
-       FREAK( const FREAK& rhs );
+    FREAK( const FREAK& rhs );
     FREAK& operator=( const FREAK& );
 
     virtual ~FREAK();
@@ -349,51 +349,51 @@ public:
     vector<int> selectPairs( const vector<Mat>& images, vector<vector<KeyPoint> >& keypoints,
                       const double corrThresh = 0.7, bool verbose = true );
 
-       AlgorithmInfo* info() const;
+    AlgorithmInfo* info() const;
 
-       enum
-       {
-               NB_SCALES = 64, NB_PAIRS = 512, NB_ORIENPAIRS = 45
-       };
+    enum
+    {
+        NB_SCALES = 64, NB_PAIRS = 512, NB_ORIENPAIRS = 45
+    };
 
 protected:
     virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
-       void buildPattern();
-       uchar meanIntensity( const Mat& image, const Mat& integral, const float kp_x, const float kp_y,
+    void buildPattern();
+    uchar meanIntensity( const Mat& image, const Mat& integral, const float kp_x, const float kp_y,
                          const unsigned int scale, const unsigned int rot, const unsigned int point ) const;
 
-       bool orientationNormalized; //true if the orientation is normalized, false otherwise
+    bool orientationNormalized; //true if the orientation is normalized, false otherwise
     bool scaleNormalized; //true if the scale is normalized, false otherwise
     double patternScale; //scaling of the pattern
     int nOctaves; //number of octaves
     bool extAll; // true if all pairs need to be extracted for pairs selection
-    
+
     double patternScale0;
     int nOctaves0;
     vector<int> selectedPairs0;
 
-       struct PatternPoint
-       {
-           float x; // x coordinate relative to center
-           float y; // x coordinate relative to center
-           float sigma; // Gaussian smoothing sigma
-       };
-
-       struct DescriptionPair
-       {
-           uchar i; // index of the first point
-           uchar j; // index of the second point
-       };
-
-       struct OrientationPair
-       {
-           uchar i; // index of the first point
-           uchar j; // index of the second point
-           int weight_dx; // dx/(norm_sq))*4096
-           int weight_dy; // dy/(norm_sq))*4096
-       };
-       
-       vector<PatternPoint> patternLookup; // look-up table for the pattern points (position+sigma of all points at all scales and orientation)
+    struct PatternPoint
+    {
+        float x; // x coordinate relative to center
+        float y; // x coordinate relative to center
+        float sigma; // Gaussian smoothing sigma
+    };
+
+    struct DescriptionPair
+    {
+        uchar i; // index of the first point
+        uchar j; // index of the second point
+    };
+
+    struct OrientationPair
+    {
+        uchar i; // index of the first point
+        uchar j; // index of the second point
+        int weight_dx; // dx/(norm_sq))*4096
+        int weight_dy; // dy/(norm_sq))*4096
+    };
+
+    vector<PatternPoint> patternLookup; // look-up table for the pattern points (position+sigma of all points at all scales and orientation)
     int patternSizes[NB_SCALES]; // size of the pattern at a specific scale (used to check if a point is within image boundaries)
     DescriptionPair descriptionPairs[NB_PAIRS];
     OrientationPair orientationPairs[NB_ORIENPAIRS];
@@ -603,7 +603,7 @@ public:
 
     // TODO implement read/write
     virtual bool empty() const;
-    
+
     AlgorithmInfo* info() const;
 
 protected:
@@ -641,8 +641,8 @@ protected:
 class CV_EXPORTS AdjusterAdapter: public FeatureDetector
 {
 public:
-       /** pure virtual interface
-        */
+    /** pure virtual interface
+     */
     virtual ~AdjusterAdapter() {}
     /** too few features were detected so, adjust the detector params accordingly
      * \param min the minimum number of desired features
@@ -682,7 +682,7 @@ public:
     /** \param adjuster an AdjusterAdapter that will do the detection and parameter adjustment
      *  \param max_features the maximum desired number of features
      *  \param max_iters the maximum number of times to try to adjust the feature detector params
-     *                         for the FastAdjuster this can be high, but with Star or Surf this can get time consuming
+     *          for the FastAdjuster this can be high, but with Star or Surf this can get time consuming
      *  \param min_features the minimum desired features
      */
     DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjuster, int min_features=400, int max_features=500, int max_iters=5 );
@@ -693,8 +693,8 @@ protected:
     virtual void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
 
 private:
-       DynamicAdaptedFeatureDetector& operator=(const DynamicAdaptedFeatureDetector&);
-       DynamicAdaptedFeatureDetector(const DynamicAdaptedFeatureDetector&);
+    DynamicAdaptedFeatureDetector& operator=(const DynamicAdaptedFeatureDetector&);
+    DynamicAdaptedFeatureDetector(const DynamicAdaptedFeatureDetector&);
 
     int escape_iters_;
     int min_features_, max_features_;
@@ -792,7 +792,7 @@ public:
     virtual bool empty() const;
 
 protected:
-       virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
+    virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
 
     Ptr<DescriptorExtractor> descriptorExtractor;
 };
@@ -962,7 +962,7 @@ class CV_EXPORTS_W DescriptorMatcher : public Algorithm
 public:
     virtual ~DescriptorMatcher();
 
-       /*
+    /*
      * Add descriptors to train descriptor collection.
      * descriptors      Descriptors to add. Each descriptors[i] is a descriptors set from one image.
      */
@@ -1078,7 +1078,7 @@ protected:
     static bool isMaskedOut( const vector<Mat>& masks, int queryIdx );
 
     static Mat clone_op( Mat m ) { return m.clone(); }
-       void checkMasks( const vector<Mat>& masks, int queryDescriptorsCount ) const;
+    void checkMasks( const vector<Mat>& masks, int queryDescriptorsCount ) const;
 
     // Collection of descriptors from train images.
     vector<Mat> trainDescCollection;
index 416fe14..d991a29 100644 (file)
@@ -48,8 +48,8 @@ class CV_FastTest : public cvtest::BaseTest
 {
 public:
     CV_FastTest();
-    ~CV_FastTest();    
-protected:    
+    ~CV_FastTest();
+protected:
     void run(int);
 };
 
@@ -58,13 +58,13 @@ CV_FastTest::~CV_FastTest() {}
 
 void CV_FastTest::run( int )
 {
-    Mat image1 = imread(string(ts->get_data_path()) + "inpaint/orig.jpg");   
-    Mat image2 = imread(string(ts->get_data_path()) + "cameracalibration/chess9.jpg");   
+    Mat image1 = imread(string(ts->get_data_path()) + "inpaint/orig.jpg");
+    Mat image2 = imread(string(ts->get_data_path()) + "cameracalibration/chess9.jpg");
     string xml = string(ts->get_data_path()) + "fast/result.xml";
-        
+
     if (image1.empty() || image2.empty())
     {
-        ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );  
+        ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
         return;
     }
 
@@ -73,20 +73,20 @@ void CV_FastTest::run( int )
     cvtColor(image2, gray2, CV_BGR2GRAY);
 
     vector<KeyPoint> keypoints1;
-    vector<KeyPoint> keypoints2;    
+    vector<KeyPoint> keypoints2;
     FAST(gray1, keypoints1, 30);
     FAST(gray2, keypoints2, 30);
 
     for(size_t i = 0; i < keypoints1.size(); ++i)
     {
         const KeyPoint& kp = keypoints1[i];
-        cv::circle(image1, kp.pt, cvRound(kp.size/2), CV_RGB(255, 0, 0));        
+        cv::circle(image1, kp.pt, cvRound(kp.size/2), CV_RGB(255, 0, 0));
     }
 
     for(size_t i = 0; i < keypoints2.size(); ++i)
     {
         const KeyPoint& kp = keypoints2[i];
-        cv::circle(image2, kp.pt, cvRound(kp.size/2), CV_RGB(255, 0, 0));        
+        cv::circle(image2, kp.pt, cvRound(kp.size/2), CV_RGB(255, 0, 0));
     }
 
     Mat kps1(1, (int)(keypoints1.size() * sizeof(KeyPoint)), CV_8U, &keypoints1[0]);
@@ -99,14 +99,14 @@ void CV_FastTest::run( int )
         fs << "exp_kps1" << kps1;
         fs << "exp_kps2" << kps2;
         fs.release();
-    }              
+    }
 
     if (!fs.isOpened())
         fs.open(xml, FileStorage::READ);
-    Mat exp_kps1, exp_kps2;        
+
+    Mat exp_kps1, exp_kps2;
     read( fs["exp_kps1"], exp_kps1, Mat() );
-    read( fs["exp_kps2"], exp_kps2, Mat() );                
+    read( fs["exp_kps2"], exp_kps2, Mat() );
     fs.release();
 
     if ( 0 != norm(exp_kps1, kps1, NORM_L2) || 0 != norm(exp_kps2, kps2, NORM_L2))
@@ -114,7 +114,7 @@ void CV_FastTest::run( int )
         ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
         return;
     }
-    
+
  /*   cv::namedWindow("Img1"); cv::imshow("Img1", image1);
     cv::namedWindow("Img2"); cv::imshow("Img2", image2);
     cv::waitKey(0);*/
index 89e51c1..316bc0f 100644 (file)
@@ -50,8 +50,8 @@ using namespace cv;
 class CV_MserTest : public cvtest::BaseTest
 {
 public:
-    CV_MserTest();  
-protected:    
+    CV_MserTest();
+protected:
     void run(int);
     int LoadBoxes(const char* path, vector<CvBox2D>& boxes);
     int SaveBoxes(const char* path, const vector<CvBox2D>& boxes);
@@ -71,7 +71,7 @@ int CV_MserTest::LoadBoxes(const char* path, vector<CvBox2D>& boxes)
     {
         return 0;
     }
-    
+
     while (!feof(f))
     {
         CvBox2D box;
@@ -175,12 +175,12 @@ void CV_MserTest::run(int)
     {
         RotatedRect box = fitEllipse(msers[i]);
         box.angle=(float)CV_PI/2-box.angle;
-        boxes.push_back(box);           
+        boxes.push_back(box);
     }
 
     string boxes_path = string(ts->get_data_path()) + "mser/boxes.txt";
     string calc_boxes_path = string(ts->get_data_path()) + "mser/boxes.calc.txt";
-    
+
     if (!LoadBoxes(boxes_path.c_str(),boxes_orig))
     {
         SaveBoxes(boxes_path.c_str(),boxes);
index bdeb8fc..8a04822 100644 (file)
@@ -128,7 +128,7 @@ void NearestNeighborTest::run( int /*start_from*/ ) {
     randu( desc, Scalar(minValue), Scalar(maxValue) );
 
     createModel( desc );
-    
+
     tempCode = checkGetPoins( desc );
     if( tempCode != cvtest::TS::OK )
     {
@@ -149,9 +149,9 @@ void NearestNeighborTest::run( int /*start_from*/ ) {
         ts->printf( cvtest::TS::LOG, "bad accuracy of Find \n" );
         code = tempCode;
     }
-    
+
     releaseModel();
-    
+
     ts->set_failed_test_info( code );
 }
 
@@ -398,7 +398,7 @@ void CV_FlannSavedIndexTest::createModel(const cv::Mat &data)
     }
     string filename = tempfile();
     index->save( filename );
-    
+
     createIndex( data, SavedIndexParams(filename.c_str()));
     remove( filename.c_str() );
 }
index e82f440..6a4ff14 100644 (file)
@@ -21,10 +21,10 @@ GPU_PERF_TEST_1(BroxOpticalFlow, cv::gpu::DeviceInfo)
 \r
     cv::gpu::GpuMat frame0(frame0_host);\r
     cv::gpu::GpuMat frame1(frame1_host);\r
-    cv::gpu::GpuMat u; \r
+    cv::gpu::GpuMat u;\r
     cv::gpu::GpuMat v;\r
 \r
-    cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/, \r
+    cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,\r
                                     10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);\r
 \r
     d_flow(frame0, frame1, u, v);\r
@@ -58,12 +58,12 @@ GPU_PERF_TEST_1(InterpolateFrames, cv::gpu::DeviceInfo)
 \r
     cv::gpu::GpuMat frame0(frame0_host);\r
     cv::gpu::GpuMat frame1(frame1_host);\r
-    cv::gpu::GpuMat fu, fv; \r
+    cv::gpu::GpuMat fu, fv;\r
     cv::gpu::GpuMat bu, bv;\r
 \r
-    cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/, \r
+    cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,\r
                                     10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);\r
-    \r
+\r
     d_flow(frame0, frame1, fu, fv);\r
     d_flow(frame1, frame0, bu, bv);\r
 \r
@@ -101,9 +101,9 @@ GPU_PERF_TEST_1(CreateOpticalFlowNeedleMap, cv::gpu::DeviceInfo)
     cv::gpu::GpuMat frame1(frame1_host);\r
     cv::gpu::GpuMat u, v;\r
 \r
-    cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/, \r
+    cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,\r
                                     10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);\r
-    \r
+\r
     d_flow(frame0, frame1, u, v);\r
 \r
     cv::gpu::GpuMat vertex, colors;\r
@@ -127,7 +127,7 @@ GPU_PERF_TEST(GoodFeaturesToTrack, cv::gpu::DeviceInfo, MinDistance)
 {\r
     cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
     cv::gpu::setDevice(devInfo.deviceID());\r
-    \r
+\r
     double minDistance = GET_PARAM(1);\r
 \r
     cv::Mat image_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);\r
@@ -233,7 +233,7 @@ GPU_PERF_TEST(PyrLKOpticalFlowDense, cv::gpu::DeviceInfo, WinSize, Levels, Iters
 \r
     cv::gpu::GpuMat frame0(frame0_host);\r
     cv::gpu::GpuMat frame1(frame1_host);\r
-    cv::gpu::GpuMat u; \r
+    cv::gpu::GpuMat u;\r
     cv::gpu::GpuMat v;\r
 \r
     cv::gpu::PyrLKOpticalFlow pyrLK;\r
index 3e5317a..3d0b7e9 100644 (file)
@@ -43,7 +43,7 @@
 #include "precomp.hpp"\r
 \r
 #if !defined (HAVE_CUDA)\r
-    \r
+\r
 cv::gpu::HOGDescriptor::HOGDescriptor(Size, Size, Size, Size, int, double, double, bool, int) { throw_nogpu(); }\r
 size_t cv::gpu::HOGDescriptor::getDescriptorSize() const { throw_nogpu(); return 0; }\r
 size_t cv::gpu::HOGDescriptor::getBlockHistogramSize() const { throw_nogpu(); return 0; }\r
@@ -60,35 +60,35 @@ std::vector<float> cv::gpu::HOGDescriptor::getPeopleDetector64x128() { throw_nog
 \r
 #else\r
 \r
-namespace cv { namespace gpu { namespace device \r
+namespace cv { namespace gpu { namespace device\r
 {\r
-    namespace hog \r
+    namespace hog\r
     {\r
-        void set_up_constants(int nbins, int block_stride_x, int block_stride_y, \r
+        void set_up_constants(int nbins, int block_stride_x, int block_stride_y,\r
                               int nblocks_win_x, int nblocks_win_y);\r
 \r
         void compute_hists(int nbins, int block_stride_x, int blovck_stride_y,\r
-                           int height, int width, const cv::gpu::DevMem2Df& grad, \r
+                           int height, int width, const cv::gpu::DevMem2Df& grad,\r
                            const cv::gpu::DevMem2Db& qangle, float sigma, float* block_hists);\r
 \r
-        void normalize_hists(int nbins, int block_stride_x, int block_stride_y, \r
+        void normalize_hists(int nbins, int block_stride_x, int block_stride_y,\r
                              int height, int width, float* block_hists, float threshold);\r
 \r
-        void classify_hists(int win_height, int win_width, int block_stride_y, \r
-                            int block_stride_x, int win_stride_y, int win_stride_x, int height, \r
-                            int width, float* block_hists, float* coefs, float free_coef, \r
+        void classify_hists(int win_height, int win_width, int block_stride_y,\r
+                            int block_stride_x, int win_stride_y, int win_stride_x, int height,\r
+                            int width, float* block_hists, float* coefs, float free_coef,\r
                             float threshold, unsigned char* labels);\r
 \r
-        void extract_descrs_by_rows(int win_height, int win_width, int block_stride_y, int block_stride_x, \r
-                                    int win_stride_y, int win_stride_x, int height, int width, float* block_hists, \r
+        void extract_descrs_by_rows(int win_height, int win_width, int block_stride_y, int block_stride_x,\r
+                                    int win_stride_y, int win_stride_x, int height, int width, float* block_hists,\r
                                     cv::gpu::DevMem2Df descriptors);\r
-        void extract_descrs_by_cols(int win_height, int win_width, int block_stride_y, int block_stride_x, \r
-                                    int win_stride_y, int win_stride_x, int height, int width, float* block_hists, \r
+        void extract_descrs_by_cols(int win_height, int win_width, int block_stride_y, int block_stride_x,\r
+                                    int win_stride_y, int win_stride_x, int height, int width, float* block_hists,\r
                                     cv::gpu::DevMem2Df descriptors);\r
 \r
-        void compute_gradients_8UC1(int nbins, int height, int width, const cv::gpu::DevMem2Db& img, \r
+        void compute_gradients_8UC1(int nbins, int height, int width, const cv::gpu::DevMem2Db& img,\r
                                     float angle_scale, cv::gpu::DevMem2Df grad, cv::gpu::DevMem2Db qangle, bool correct_gamma);\r
-        void compute_gradients_8UC4(int nbins, int height, int width, const cv::gpu::DevMem2Db& img, \r
+        void compute_gradients_8UC4(int nbins, int height, int width, const cv::gpu::DevMem2Db& img,\r
                                     float angle_scale, cv::gpu::DevMem2Df grad, cv::gpu::DevMem2Db qangle, bool correct_gamma);\r
 \r
         void resize_8UC1(const cv::gpu::DevMem2Db& src, cv::gpu::DevMem2Db dst);\r
@@ -97,7 +97,7 @@ namespace cv { namespace gpu { namespace device
 }}}\r
 \r
 using namespace ::cv::gpu::device;\r
-    \r
+\r
 cv::gpu::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size block_stride_, Size cell_size_,\r
                                       int nbins_, double win_sigma_, double threshold_L2hys_, bool gamma_correction_, int nlevels_)\r
         : win_size(win_size_),\r
@@ -110,7 +110,7 @@ cv::gpu::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size blo
           gamma_correction(gamma_correction_),\r
           nlevels(nlevels_)\r
 {\r
-    CV_Assert((win_size.width  - block_size.width ) % block_stride.width  == 0 && \r
+    CV_Assert((win_size.width  - block_size.width ) % block_stride.width  == 0 &&\r
               (win_size.height - block_size.height) % block_stride.height == 0);\r
 \r
     CV_Assert(block_size.width % cell_size.width == 0 && block_size.height % cell_size.height == 0);\r
@@ -124,14 +124,14 @@ cv::gpu::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size blo
 \r
     cv::Size blocks_per_win = numPartsWithin(win_size, block_size, block_stride);\r
     hog::set_up_constants(nbins, block_stride.width, block_stride.height, blocks_per_win.width, blocks_per_win.height);\r
-}       \r
+}\r
 \r
 size_t cv::gpu::HOGDescriptor::getDescriptorSize() const\r
 {\r
     return numPartsWithin(win_size, block_size, block_stride).area() * getBlockHistogramSize();\r
 }\r
 \r
-size_t cv::gpu::HOGDescriptor::getBlockHistogramSize() const \r
+size_t cv::gpu::HOGDescriptor::getBlockHistogramSize() const\r
 {\r
     Size cells_per_block = Size(block_size.width / cell_size.width, block_size.height / cell_size.height);\r
     return (size_t)(nbins * cells_per_block.area());\r
@@ -167,7 +167,7 @@ void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& _detector)
 \r
     this->detector.upload(Mat(detector_reordered).reshape(1, 1));\r
 \r
-    size_t descriptor_size = getDescriptorSize();  \r
+    size_t descriptor_size = getDescriptorSize();\r
     free_coef = _detector.size() > descriptor_size ? _detector[descriptor_size] : 0;\r
 \r
     CV_Assert(checkDetectorSize());\r
@@ -175,25 +175,25 @@ void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& _detector)
 \r
 cv::gpu::GpuMat cv::gpu::HOGDescriptor::getBuffer(const Size& sz, int type, GpuMat& buf)\r
 {\r
-       if (buf.empty() || buf.type() != type)\r
-               buf.create(sz, type);\r
-       else\r
-               if (buf.cols < sz.width || buf.rows < sz.height)\r
-                       buf.create(std::max(buf.rows, sz.height), std::max(buf.cols, sz.width), type);  \r
+    if (buf.empty() || buf.type() != type)\r
+        buf.create(sz, type);\r
+    else\r
+        if (buf.cols < sz.width || buf.rows < sz.height)\r
+            buf.create(std::max(buf.rows, sz.height), std::max(buf.cols, sz.width), type);\r
 \r
-       return buf(Rect(Point(0,0), sz));\r
+    return buf(Rect(Point(0,0), sz));\r
 }\r
 \r
 cv::gpu::GpuMat cv::gpu::HOGDescriptor::getBuffer(int rows, int cols, int type, GpuMat& buf)\r
-{ \r
-       return getBuffer(Size(cols, rows), type, buf); \r
+{\r
+    return getBuffer(Size(cols, rows), type, buf);\r
 }\r
 \r
 \r
 void cv::gpu::HOGDescriptor::computeGradient(const GpuMat& img, GpuMat& _grad, GpuMat& _qangle)\r
 {\r
     CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4);\r
-       \r
+\r
     //   grad.create(img.size(), CV_32FC2);\r
     _grad = getBuffer(img.size(), CV_32FC2, grad_buf);\r
 \r
@@ -201,8 +201,8 @@ void cv::gpu::HOGDescriptor::computeGradient(const GpuMat& img, GpuMat& _grad, G
     _qangle = getBuffer(img.size(), CV_8UC2, qangle_buf);\r
 \r
     float angleScale = (float)(nbins / CV_PI);\r
-    switch (img.type()) \r
-       {\r
+    switch (img.type())\r
+    {\r
         case CV_8UC1:\r
             hog::compute_gradients_8UC1(nbins, img.rows, img.cols, img, angleScale, _grad, _qangle, gamma_correction);\r
             break;\r
@@ -220,13 +220,13 @@ void cv::gpu::HOGDescriptor::computeBlockHistograms(const GpuMat& img)
     size_t block_hist_size = getBlockHistogramSize();\r
     Size blocks_per_img = numPartsWithin(img.size(), block_size, block_stride);\r
 \r
-       //   block_hists.create(1, block_hist_size * blocks_per_img.area(), CV_32F);\r
-       block_hists = getBuffer(1, static_cast<int>(block_hist_size * blocks_per_img.area()), CV_32F, block_hists_buf);\r
-    \r
-    hog::compute_hists(nbins, block_stride.width, block_stride.height, img.rows, img.cols, \r
-                                               grad, qangle, (float)getWinSigma(), block_hists.ptr<float>());\r
+    //   block_hists.create(1, block_hist_size * blocks_per_img.area(), CV_32F);\r
+    block_hists = getBuffer(1, static_cast<int>(block_hist_size * blocks_per_img.area()), CV_32F, block_hists_buf);\r
+\r
+    hog::compute_hists(nbins, block_stride.width, block_stride.height, img.rows, img.cols,\r
+                        grad, qangle, (float)getWinSigma(), block_hists.ptr<float>());\r
 \r
-    hog::normalize_hists(nbins, block_stride.width, block_stride.height, img.rows, img.cols, \r
+    hog::normalize_hists(nbins, block_stride.width, block_stride.height, img.rows, img.cols,\r
                          block_hists.ptr<float>(), (float)threshold_L2hys);\r
 }\r
 \r
@@ -246,11 +246,11 @@ void cv::gpu::HOGDescriptor::getDescriptors(const GpuMat& img, Size win_stride,
     switch (descr_format)\r
     {\r
     case DESCR_FORMAT_ROW_BY_ROW:\r
-        hog::extract_descrs_by_rows(win_size.height, win_size.width, block_stride.height, block_stride.width, \r
+        hog::extract_descrs_by_rows(win_size.height, win_size.width, block_stride.height, block_stride.width,\r
                                     win_stride.height, win_stride.width, img.rows, img.cols, block_hists.ptr<float>(), descriptors);\r
         break;\r
     case DESCR_FORMAT_COL_BY_COL:\r
-        hog::extract_descrs_by_cols(win_size.height, win_size.width, block_stride.height, block_stride.width, \r
+        hog::extract_descrs_by_cols(win_size.height, win_size.width, block_stride.height, block_stride.width,\r
                                     win_stride.height, win_stride.width, img.rows, img.cols, block_hists.ptr<float>(), descriptors);\r
         break;\r
     default:\r
@@ -277,10 +277,10 @@ void cv::gpu::HOGDescriptor::detect(const GpuMat& img, vector<Point>& hits, doub
 \r
     Size wins_per_img = numPartsWithin(img.size(), win_size, win_stride);\r
     //   labels.create(1, wins_per_img.area(), CV_8U);\r
-       labels = getBuffer(1, wins_per_img.area(), CV_8U, labels_buf);\r
+    labels = getBuffer(1, wins_per_img.area(), CV_8U, labels_buf);\r
 \r
-    hog::classify_hists(win_size.height, win_size.width, block_stride.height, block_stride.width, \r
-                        win_stride.height, win_stride.width, img.rows, img.cols, block_hists.ptr<float>(), \r
+    hog::classify_hists(win_size.height, win_size.width, block_stride.height, block_stride.width,\r
+                        win_stride.height, win_stride.width, img.rows, img.cols, block_hists.ptr<float>(),\r
                         detector.ptr<float>(), (float)free_coef, (float)hit_threshold, labels.ptr());\r
 \r
     labels.download(labels_host);\r
@@ -289,18 +289,18 @@ void cv::gpu::HOGDescriptor::detect(const GpuMat& img, vector<Point>& hits, doub
     {\r
         int y = i / wins_per_img.width;\r
         int x = i - wins_per_img.width * y;\r
-        if (vec[i]) \r
+        if (vec[i])\r
             hits.push_back(Point(x * win_stride.width, y * win_stride.height));\r
     }\r
 }\r
 \r
 \r
 \r
-void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& found_locations, double hit_threshold, \r
-                                                                                         Size win_stride, Size padding, double scale0, int group_threshold)\r
+void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& found_locations, double hit_threshold,\r
+                                              Size win_stride, Size padding, double scale0, int group_threshold)\r
 {\r
 \r
-       CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4);\r
+    CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4);\r
 \r
     vector<double> level_scale;\r
     double scale = 1.;\r
@@ -309,35 +309,35 @@ void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& f
     for (levels = 0; levels < nlevels; levels++)\r
     {\r
         level_scale.push_back(scale);\r
-        if (cvRound(img.cols/scale) < win_size.width || \r
+        if (cvRound(img.cols/scale) < win_size.width ||\r
             cvRound(img.rows/scale) < win_size.height || scale0 <= 1)\r
             break;\r
         scale *= scale0;\r
     }\r
     levels = std::max(levels, 1);\r
     level_scale.resize(levels);\r
-       image_scales.resize(levels);\r
+    image_scales.resize(levels);\r
 \r
-    std::vector<Rect> all_candidates;   \r
+    std::vector<Rect> all_candidates;\r
     vector<Point> locations;\r
 \r
     for (size_t i = 0; i < level_scale.size(); i++)\r
     {\r
-        double _scale = level_scale[i];\r
-        Size sz(cvRound(img.cols / _scale), cvRound(img.rows / _scale));\r
+        scale = level_scale[i];\r
+        Size sz(cvRound(img.cols / scale), cvRound(img.rows / scale));\r
         GpuMat smaller_img;\r
 \r
         if (sz == img.size())\r
             smaller_img = img;\r
         else\r
-        {                      \r
+        {\r
             image_scales[i].create(sz, img.type());\r
-            switch (img.type()) \r
-                       {\r
+            switch (img.type())\r
+            {\r
                 case CV_8UC1: hog::resize_8UC1(img, image_scales[i]); break;\r
                 case CV_8UC4: hog::resize_8UC4(img, image_scales[i]); break;\r
             }\r
-                       smaller_img = image_scales[i];\r
+            smaller_img = image_scales[i];\r
         }\r
 \r
         detect(smaller_img, locations, hit_threshold, win_stride, padding);\r
@@ -346,16 +346,16 @@ void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& f
             all_candidates.push_back(Rect(Point2d((CvPoint)locations[j]) * scale, scaled_win_size));\r
     }\r
 \r
-    found_locations.assign(all_candidates.begin(), all_candidates.end());    \r
+    found_locations.assign(all_candidates.begin(), all_candidates.end());\r
     groupRectangles(found_locations, group_threshold, 0.2/*magic number copied from CPU version*/);\r
 }\r
 \r
-int cv::gpu::HOGDescriptor::numPartsWithin(int size, int part_size, int stride) \r
+int cv::gpu::HOGDescriptor::numPartsWithin(int size, int part_size, int stride)\r
 {\r
     return (size - part_size + stride) / stride;\r
 }\r
 \r
-cv::Size cv::gpu::HOGDescriptor::numPartsWithin(cv::Size size, cv::Size part_size, cv::Size stride) \r
+cv::Size cv::gpu::HOGDescriptor::numPartsWithin(cv::Size size, cv::Size part_size, cv::Size stride)\r
 {\r
     return Size(numPartsWithin(size.width, part_size.width, stride.width), numPartsWithin(size.height, part_size.height, stride.height));\r
 }\r
@@ -368,336 +368,336 @@ std::vector<float> cv::gpu::HOGDescriptor::getDefaultPeopleDetector()
 std::vector<float> cv::gpu::HOGDescriptor::getPeopleDetector48x96()\r
 {\r
     static const float detector[] = {\r
-        0.294350f, -0.098796f, -0.129522f, 0.078753f, 0.387527f, 0.261529f, \r
-        0.145939f, 0.061520f, 0.328699f, 0.227148f, -0.066467f, -0.086723f, \r
-        0.047559f, 0.106714f, 0.037897f, 0.111461f, -0.024406f, 0.304769f, \r
-        0.254676f, -0.069235f, 0.082566f, 0.147260f, 0.326969f, 0.148888f, \r
-        0.055270f, -0.087985f, 0.261720f, 0.143442f, 0.026812f, 0.238212f, \r
-        0.194020f, 0.056341f, -0.025854f, -0.034444f, -0.156631f, 0.205174f, \r
-        0.089008f, -0.139811f, -0.100147f, -0.037830f, -0.029230f, -0.055641f, \r
-        0.033248f, -0.016512f, 0.155244f, 0.247315f, -0.124694f, -0.048414f, \r
-        -0.062219f, 0.193683f, 0.004574f, 0.055089f, 0.093565f, 0.167712f, \r
-        0.167581f, 0.018895f, 0.215258f, 0.122609f, 0.090520f, -0.067219f, \r
-        -0.049029f, -0.099615f, 0.241804f, -0.094893f, -0.176248f, 0.001727f, \r
-        -0.134473f, 0.104442f, 0.050942f, 0.081165f, 0.072156f, 0.121646f, \r
-        0.002656f, -0.297974f, -0.133587f, -0.060121f, -0.092515f, -0.048974f, \r
-        -0.084754f, -0.180111f, -0.038590f, 0.086283f, -0.134636f, -0.107249f, \r
-        0.132890f, 0.141556f, 0.249425f, 0.130273f, -0.030031f, 0.073212f, \r
-        -0.008155f, 0.019931f, 0.071688f, 0.000300f, -0.019525f, -0.021725f, \r
-        -0.040993f, -0.086841f, 0.070124f, 0.240033f, 0.265350f, 0.043208f, \r
-        0.166754f, 0.091453f, 0.060916f, -0.036972f, -0.091043f, 0.079873f, \r
-        0.219781f, 0.158102f, -0.140618f, -0.043016f, 0.124802f, 0.093668f, \r
-        0.103208f, 0.094872f, 0.080541f, 0.137711f, 0.160566f, -0.169231f, \r
-        0.013983f, 0.309508f, -0.004217f, -0.057200f, -0.064489f, 0.014066f, \r
-        0.361009f, 0.251328f, -0.080983f, -0.044183f, 0.061436f, -0.037381f, \r
-        -0.078786f, 0.030993f, 0.066314f, 0.037683f, 0.152325f, -0.091683f, \r
-        0.070203f, 0.217856f, 0.036435f, -0.076462f, 0.006254f, -0.094431f, \r
-        0.154829f, -0.023038f, -0.196961f, -0.024594f, 0.178465f, -0.050139f, \r
-        -0.045932f, -0.000965f, 0.109112f, 0.046165f, -0.159373f, -0.008713f, \r
-        0.041307f, 0.097129f, -0.057211f, -0.064599f, 0.077165f, 0.176167f, \r
-        0.138322f, 0.065753f, -0.104950f, 0.017933f, 0.136255f, -0.011598f, \r
-        0.047007f, 0.080550f, 0.068619f, 0.084661f, -0.035493f, -0.091314f, \r
-        -0.041411f, 0.060971f, -0.101912f, -0.079870f, -0.085977f, -0.022686f, \r
-        0.079788f, -0.098064f, -0.054603f, 0.040383f, 0.300794f, 0.128603f, \r
-        0.094844f, 0.047407f, 0.101825f, 0.061832f, -0.162160f, -0.204553f, \r
-        -0.035165f, 0.101450f, -0.016641f, -0.027140f, -0.134392f, -0.008743f, \r
-        0.102331f, 0.114853f, 0.009644f, 0.062823f, 0.237339f, 0.167843f, \r
-        0.053066f, -0.012592f, 0.043158f, 0.002305f, 0.065001f, -0.038929f, \r
-        -0.020356f, 0.152343f, 0.043469f, -0.029967f, -0.042948f, 0.032481f, \r
-        0.068488f, -0.110840f, -0.111083f, 0.111980f, -0.002072f, -0.005562f, \r
-        0.082926f, 0.006635f, -0.108153f, 0.024242f, -0.086464f, -0.189884f, \r
-        -0.017492f, 0.191456f, -0.007683f, -0.128769f, -0.038017f, -0.132380f, \r
-        0.091926f, 0.079696f, -0.106728f, -0.007656f, 0.172744f, 0.011576f, \r
-        0.009883f, 0.083258f, -0.026516f, 0.145534f, 0.153924f, -0.130290f, \r
-        -0.108945f, 0.124490f, -0.003186f, -0.100485f, 0.015024f, -0.060512f, \r
-        0.026288f, -0.086713f, -0.169012f, 0.076517f, 0.215778f, 0.043701f, \r
-        -0.131642f, -0.012585f, -0.045181f, -0.118183f, -0.241544f, -0.167293f, \r
-        -0.020107f, -0.019917f, -0.101827f, -0.107096f, -0.010503f, 0.044938f, \r
-        0.189680f, 0.217119f, -0.046086f, 0.044508f, 0.199716f, -0.036004f, \r
-        -0.148927f, 0.013355f, -0.078279f, 0.030451f, 0.056301f, -0.024609f, \r
-        0.083224f, 0.099533f, -0.039432f, -0.138880f, 0.005482f, -0.024120f, \r
-        -0.140468f, -0.066381f, -0.017057f, 0.009260f, -0.058004f, -0.028486f, \r
-        -0.061610f, 0.007483f, -0.158309f, -0.150687f, -0.044595f, -0.105121f, \r
-        -0.045763f, -0.006618f, -0.024419f, -0.117713f, -0.119366f, -0.175941f, \r
-        -0.071542f, 0.119027f, 0.111362f, 0.043080f, 0.034889f, 0.093003f, \r
-        0.007842f, 0.057368f, -0.108834f, -0.079968f, 0.230959f, 0.020205f, \r
-        0.011470f, 0.098877f, 0.101310f, -0.030215f, -0.018018f, -0.059552f, \r
-        -0.106157f, 0.021866f, -0.036471f, 0.080051f, 0.041165f, -0.082101f, \r
-        0.117726f, 0.030961f, -0.054763f, -0.084102f, -0.185778f, -0.061305f, \r
-        -0.038089f, -0.110728f, -0.264010f, 0.076675f, -0.077111f, -0.137644f, \r
-        0.036232f, 0.277995f, 0.019116f, 0.107738f, 0.144003f, 0.080304f, \r
-        0.215036f, 0.228897f, 0.072713f, 0.077773f, 0.120168f, 0.075324f, \r
-        0.062730f, 0.122478f, -0.049008f, 0.164912f, 0.162450f, 0.041246f, \r
-        0.009891f, -0.097827f, -0.038700f, -0.023027f, -0.120020f, 0.203364f, \r
-        0.248474f, 0.149810f, -0.036276f, -0.082814f, -0.090343f, -0.027143f, \r
-        -0.075689f, -0.320310f, -0.000500f, -0.143334f, -0.065077f, -0.186936f, \r
-        0.129372f, 0.116431f, 0.181699f, 0.170436f, 0.418854f, 0.460045f, \r
-        0.333719f, 0.230515f, 0.047822f, -0.044954f, -0.068086f, 0.140179f, \r
-        -0.044821f, 0.085550f, 0.092483f, -0.107296f, -0.130670f, -0.206629f, \r
-        0.114601f, -0.317869f, -0.076663f, 0.038680f, 0.212753f, -0.016059f, \r
-        -0.126526f, -0.163602f, 0.210154f, 0.099887f, -0.126366f, 0.118453f, \r
-        0.019309f, -0.021611f, -0.096499f, -0.111809f, -0.200489f, 0.142854f, \r
-        0.228840f, -0.353346f, -0.179151f, 0.116834f, 0.252389f, -0.031728f, \r
-        -0.188135f, -0.158998f, 0.386523f, 0.122315f, 0.209944f, 0.394023f, \r
-        0.359030f, 0.260717f, 0.170335f, 0.013683f, -0.142596f, -0.026138f, \r
-        -0.011878f, -0.150519f, 0.047159f, -0.107062f, -0.147347f, -0.187689f, \r
-        -0.186027f, -0.208048f, 0.058468f, -0.073026f, -0.236556f, -0.079788f, \r
-        -0.146216f, -0.058563f, -0.101361f, -0.071294f, -0.071093f, 0.116919f, \r
-        0.234304f, 0.306781f, 0.321866f, 0.240000f, 0.073261f, -0.012173f, \r
-        0.026479f, 0.050173f, 0.166127f, 0.228955f, 0.061905f, 0.156460f, \r
-        0.205990f, 0.120672f, 0.037350f, 0.167884f, 0.290099f, 0.420900f, \r
-        -0.012601f, 0.189839f, 0.306378f, 0.118383f, -0.095598f, -0.072360f, \r
-        -0.132496f, -0.224259f, -0.126021f, 0.022714f, 0.284039f, 0.051369f, \r
-        -0.000927f, -0.058735f, -0.083354f, -0.141254f, -0.187578f, -0.202669f, \r
-        0.048902f, 0.246597f, 0.441863f, 0.342519f, 0.066979f, 0.215286f, \r
-        0.188191f, -0.072240f, -0.208142f, -0.030196f, 0.178141f, 0.136985f, \r
-        -0.043374f, -0.181098f, 0.091815f, 0.116177f, -0.126690f, -0.386625f, \r
-        0.368165f, 0.269149f, -0.088042f, -0.028823f, 0.092961f, 0.024099f, \r
-        0.046112f, 0.176756f, 0.135849f, 0.124955f, 0.195467f, -0.037218f, \r
-        0.167217f, 0.188938f, 0.053528f, -0.066561f, 0.133721f, -0.070565f, \r
-        0.115898f, 0.152435f, -0.116993f, -0.110592f, -0.179005f, 0.026668f, \r
-        0.080530f, 0.075084f, -0.070401f, 0.012497f, 0.021849f, -0.139764f, \r
-        -0.022020f, -0.096301f, -0.064954f, -0.127446f, -0.013806f, -0.108315f, \r
-        0.156285f, 0.149867f, -0.011382f, 0.064532f, 0.029168f, 0.027393f, \r
-        0.069716f, 0.153735f, 0.038459f, 0.230714f, 0.253840f, 0.059522f, \r
-        -0.045053f, 0.014083f, 0.071103f, 0.068747f, 0.095887f, 0.005832f, \r
-        0.144887f, 0.026357f, -0.067359f, -0.044151f, -0.123283f, -0.019911f, \r
-        0.005318f, 0.109208f, -0.003201f, -0.021734f, 0.142025f, -0.066907f, \r
-        -0.120070f, -0.188639f, 0.012472f, -0.048704f, -0.012366f, -0.184828f, \r
-        0.168591f, 0.267166f, 0.058208f, -0.044101f, 0.033500f, 0.178558f, \r
-        0.104550f, 0.122418f, 0.080177f, 0.173246f, 0.298537f, 0.064173f, \r
-        0.053397f, 0.174341f, 0.230984f, 0.117025f, 0.166242f, 0.227781f, \r
-        0.120623f, 0.176952f, -0.011393f, -0.086483f, -0.008270f, 0.051700f, \r
-        -0.153369f, -0.058837f, -0.057639f, -0.060115f, 0.026349f, -0.160745f, \r
-        -0.037894f, -0.048575f, 0.041052f, -0.022112f, 0.060365f, 0.051906f, \r
-        0.162657f, 0.138519f, -0.050185f, -0.005938f, 0.071301f, 0.127686f, \r
-        0.062342f, 0.144400f, 0.072600f, 0.198436f, 0.246219f, -0.078185f, \r
-        -0.036169f, 0.075934f, 0.047328f, -0.013601f, 0.087205f, 0.019900f, \r
-        0.022606f, -0.015365f, -0.092506f, 0.075275f, -0.116375f, 0.050500f, \r
-        0.045118f, 0.166567f, 0.072073f, 0.060371f, 0.131747f, -0.169863f, \r
-        -0.039352f, -0.047486f, -0.039797f, -0.204312f, 0.021710f, 0.129443f, \r
-        -0.021173f, 0.173416f, -0.070794f, -0.063986f, 0.069689f, -0.064099f, \r
-        -0.123201f, -0.017372f, -0.206870f, 0.065863f, 0.113226f, 0.024707f, \r
-        -0.071341f, -0.066964f, -0.098278f, -0.062927f, 0.075840f, 0.014716f, \r
-        0.019378f, 0.132699f, -0.074191f, -0.089557f, -0.078446f, -0.197488f, \r
-        -0.173665f, 0.052583f, 0.044361f, 0.113549f, 0.098492f, 0.077379f, \r
-        -0.011146f, -0.192593f, -0.164435f, 0.045568f, 0.205699f, 0.049187f, \r
-        -0.082281f, 0.134874f, 0.185499f, 0.034968f, -0.119561f, -0.112372f, \r
-        -0.115091f, -0.054042f, -0.183816f, -0.078100f, 0.190695f, 0.091617f, \r
-        0.004257f, -0.041135f, -0.061453f, -0.141592f, -0.194809f, -0.120638f, \r
-        0.020168f, 0.109672f, 0.067398f, -0.015238f, -0.239145f, -0.264671f, \r
-        -0.185176f, 0.050472f, 0.020793f, 0.035678f, 0.022839f, -0.052055f, \r
-        -0.127968f, -0.113049f, -0.228416f, -0.258281f, -0.053437f, 0.076424f, \r
-        0.061450f, 0.237478f, 0.003618f, -0.055865f, -0.108087f, -0.028937f, \r
-        0.045585f, 0.052829f, -0.001471f, 0.022826f, 0.059565f, -0.104430f, \r
-        -0.077266f, -0.211882f, -0.212078f, 0.028074f, 0.075846f, 0.016265f, \r
-        0.161879f, 0.134477f, 0.008935f, -0.048041f, 0.074692f, 0.004928f, \r
-        -0.025156f, 0.192874f, 0.074410f, 0.308732f, 0.267400f, 0.094208f, \r
-        -0.005251f, 0.042041f, -0.032148f, 0.015588f, 0.252869f, 0.175302f, \r
-        0.022892f, 0.081673f, 0.063208f, 0.162626f, 0.194426f, 0.233890f, \r
-        0.262292f, 0.186930f, 0.084079f, -0.286388f, -0.213034f, -0.048867f, \r
-        -0.207669f, -0.170050f, 0.011673f, -0.092958f, -0.192786f, -0.273536f, \r
-        0.230904f, 0.266732f, 0.320519f, 0.297155f, 0.548169f, 0.304922f, \r
-        0.132687f, 0.247333f, 0.212488f, -0.271472f, -0.142105f, -0.002627f, \r
-        -0.119215f, 0.128383f, 0.100079f, -0.057490f, -0.121902f, -0.228892f, \r
-        0.202292f, -0.399795f, -0.371326f, -0.095836f, -0.063626f, -0.161375f, \r
-        -0.311180f, -0.294797f, 0.242122f, 0.011788f, 0.095573f, 0.322523f, \r
-        0.511840f, 0.322880f, 0.313259f, 0.173331f, 0.002542f, -0.029802f, \r
-        0.324766f, -0.326170f, -0.340547f, -0.138288f, -0.002963f, -0.114060f, \r
-        -0.377312f, -0.442570f, 0.212446f, -0.007759f, -0.011576f, 0.169711f, \r
-        0.308689f, 0.317348f, 0.539390f, 0.332845f, 0.057331f, -0.068180f, \r
-        0.101994f, 0.266995f, 0.209570f, 0.355730f, 0.091635f, 0.170238f, \r
-        0.125215f, 0.274154f, 0.070223f, 0.025515f, 0.049946f, -0.000550f, \r
-        0.043715f, -0.141843f, 0.020844f, 0.129871f, 0.256588f, 0.105015f, \r
-        0.148339f, 0.170682f, 0.028792f, 0.074037f, 0.160042f, 0.405137f, \r
-        0.246187f, 0.352160f, 0.168951f, 0.222263f, 0.264439f, 0.065945f, \r
-        0.021963f, -0.075084f, 0.093105f, 0.027318f, 0.098864f, 0.057566f, \r
-        -0.080282f, 0.185032f, 0.314419f, 0.333727f, 0.125798f, 0.294919f, \r
-        0.386002f, 0.217619f, -0.183517f, -0.278622f, -0.002342f, -0.027821f, \r
-        -0.134266f, -0.331843f, -0.008296f, 0.124564f, 0.053712f, -0.369016f, \r
-        -0.095036f, 0.209381f, 0.423760f, 0.371760f, 0.106397f, 0.369408f, \r
-        0.485608f, 0.231201f, -0.138685f, -0.349208f, -0.070083f, 0.028991f, \r
-        -0.081630f, -0.395992f, -0.146791f, -0.027354f, 0.063396f, -0.272484f, \r
-        0.058299f, 0.338207f, 0.110767f, -0.052642f, -0.233848f, -0.027448f, \r
-        0.030328f, 0.155572f, -0.093826f, 0.019331f, 0.120638f, 0.006292f, \r
-        -0.106083f, -0.236290f, -0.140933f, -0.088067f, -0.025138f, -0.208395f, \r
-        -0.025502f, 0.144192f, -0.048353f, -0.106144f, -0.305121f, -0.114147f, \r
-        0.090963f, 0.327727f, 0.035606f, -0.093779f, 0.002651f, -0.171081f, \r
-        -0.188131f, -0.216571f, -0.209101f, -0.054402f, 0.157147f, -0.057127f, \r
-        0.066584f, 0.008988f, 0.041191f, 0.034456f, -0.078255f, 0.052099f, \r
-        -0.022239f, 0.066981f, -0.117520f, -0.072637f, 0.062512f, 0.037570f, \r
-        -0.057544f, -0.312359f, 0.034357f, -0.031549f, 0.002566f, -0.207375f, \r
-        -0.070654f, -0.018786f, -0.044815f, -0.012814f, -0.076320f, 0.078183f, \r
-        0.023877f, 0.117078f, 0.022292f, -0.205424f, -0.060430f, -0.017296f, \r
-        -0.004827f, -0.321036f, -0.092155f, 0.038837f, 0.073190f, -0.067513f, \r
-        0.026521f, 0.171945f, 0.087318f, 0.034495f, -0.034089f, 0.154410f, \r
-        -0.061431f, 0.007435f, -0.111094f, -0.095976f, 0.014741f, -0.132324f, \r
-        -0.029517f, -0.192160f, 0.098667f, 0.020762f, 0.177050f, -0.064510f, \r
-        -0.054437f, -0.058678f, -0.001858f, 0.167602f, 0.015735f, 0.054338f, \r
-        0.016477f, 0.186381f, -0.010667f, 0.054692f, 0.126742f, 0.013140f, \r
-        0.090353f, -0.133608f, -0.018017f, -0.152619f, 0.027600f, -0.138700f, \r
-        -0.050274f, 0.045141f, -0.118731f, 0.094797f, -0.167605f, 0.097461f, \r
-        -0.009131f, 0.199920f, -0.052976f, 0.158194f, 0.178568f, -0.107600f, \r
-        0.009671f, -0.084072f, -0.040258f, -0.205673f, 0.102891f, 0.223511f, \r
-        0.042699f, 0.118548f, -0.021274f, 0.110997f, -0.155121f, 0.027696f, \r
-        -0.149968f, 0.051552f, -0.129219f, 0.173524f, 0.073972f, -0.189045f, \r
-        -0.034523f, -0.106655f, -0.011843f, -0.197381f, 0.219413f, 0.183197f, \r
-        -0.054920f, 0.144955f, 0.036517f, -0.085412f, -0.229070f, -0.143710f, \r
-        -0.049486f, 0.156634f, -0.008673f, -0.064778f, 0.082344f, 0.145673f, \r
-        0.002912f, -0.210121f, -0.116564f, 0.078425f, 0.220908f, -0.067594f, \r
-        0.048610f, 0.084912f, -0.066202f, -0.112515f, -0.217767f, -0.082640f, \r
-        -0.017414f, 0.230265f, -0.070735f, 0.066073f, 0.215256f, 0.071157f, \r
-        -0.087220f, -0.202235f, -0.011918f, 0.099562f, 0.174716f, -0.063845f, \r
-        -0.121055f, 0.014367f, 0.132709f, -0.005060f, -0.244606f, -0.179693f, \r
-        -0.134690f, 0.023239f, -0.193116f, -0.076975f, -0.021164f, -0.001938f, \r
-        -0.163799f, -0.111437f, -0.210362f, -0.166376f, 0.034754f, 0.010036f, \r
-        -0.021917f, 0.068014f, -0.086893f, -0.251746f, -0.267171f, 0.037383f, \r
-        0.003966f, 0.033571f, -0.151506f, 0.025437f, -0.020626f, -0.308454f, \r
-        -0.343143f, -0.092263f, -0.026261f, -0.028345f, 0.036036f, 0.035169f, \r
-        0.129470f, 0.122205f, 0.015661f, -0.070612f, -0.094333f, -0.066055f, \r
-        -0.041083f, 0.159146f, 0.073184f, 0.110044f, 0.174471f, 0.078069f, \r
-        -0.014881f, 0.008116f, 0.013209f, 0.075857f, 0.195605f, 0.062714f, \r
-        0.067955f, 0.056544f, -0.153908f, -0.141749f, -0.072550f, 0.033523f, \r
-        -0.024665f, 0.134487f, 0.079076f, 0.133562f, 0.227130f, 0.018054f, \r
-        0.004928f, 0.169162f, 0.065152f, 0.072160f, 0.131631f, 0.096303f, \r
-        0.054288f, 0.106256f, 0.114632f, 0.119038f, 0.515200f, 0.247429f, \r
-        0.199134f, 0.211957f, 0.127558f, -0.294684f, -0.194890f, -0.049988f, \r
-        -0.112247f, -0.008122f, -0.006176f, 0.037035f, -0.110881f, -0.249989f, \r
-        0.152434f, 0.234621f, 0.153340f, 0.349283f, 0.683049f, 0.157174f, \r
-        0.124844f, 0.099136f, 0.064407f, -0.248400f, -0.155323f, -0.026498f, \r
-        -0.023450f, 0.049051f, -0.114187f, 0.007195f, -0.176825f, -0.376926f, \r
-        0.366159f, -0.179938f, -0.148508f, 0.006043f, 0.170048f, 0.097866f, \r
-        -0.102658f, -0.260430f, 0.248868f, 0.037019f, -0.118111f, 0.078176f, \r
-        0.194171f, 0.211328f, 0.368612f, 0.361213f, 0.130013f, 0.094650f, \r
-        0.227396f, -0.178058f, -0.114782f, -0.008093f, 0.231080f, -0.011843f, \r
-        -0.097917f, -0.325788f, 0.141879f, 0.119738f, -0.230427f, -0.117419f, \r
-        -0.114153f, 0.037903f, 0.116383f, 0.218773f, -0.101884f, 0.059466f, \r
-        0.119255f, 0.010874f, -0.031449f, 0.045996f, 0.119931f, 0.273760f, \r
-        0.311700f, 0.261794f, 0.194809f, 0.339829f, 0.239449f, 0.064140f, \r
-        0.077597f, 0.098996f, 0.143534f, 0.184602f, 0.037507f, 0.225494f, \r
-        0.096142f, -0.147370f, -0.207833f, -0.174742f, -0.086391f, -0.038942f, \r
-        0.159577f, -0.088492f, -0.000989f, 0.108154f, -0.025890f, -0.072713f, \r
-        0.025997f, -0.006803f, -0.086879f, -0.011290f, -0.269200f, -0.103450f, \r
-        -0.124910f, -0.116340f, 0.141459f, 0.208800f, 0.042268f, 0.265034f, \r
-        0.516474f, 0.217591f, -0.018843f, -0.313328f, -0.168363f, 0.047129f, \r
-        0.090480f, -0.109852f, -0.018761f, 0.210669f, 0.281269f, -0.043591f, \r
-        -0.034147f, -0.237772f, -0.134843f, -0.072481f, -0.103831f, 0.038355f, \r
-        0.308619f, 0.148023f, -0.045867f, -0.123950f, -0.210860f, -0.064973f, \r
-        -0.036308f, -0.046731f, -0.022099f, 0.095776f, 0.409423f, 0.060635f, \r
-        -0.065196f, 0.051828f, 0.027981f, -0.009609f, -0.137681f, -0.095011f, \r
-        -0.019045f, 0.177278f, 0.009759f, -0.092119f, -0.016958f, -0.133860f, \r
-        -0.118421f, -0.032039f, -0.006214f, -0.084541f, 0.063971f, -0.073642f, \r
-        0.165676f, 0.110443f, 0.044131f, 0.046568f, 0.053292f, -0.055466f, \r
-        0.015512f, 0.371947f, 0.232102f, -0.016923f, 0.103979f, -0.091758f, \r
-        0.005907f, 0.209100f, 0.157433f, 0.030518f, 0.250366f, 0.062322f, \r
-        0.036720f, 0.094676f, 0.017306f, -0.010328f, -0.079012f, 0.016781f, \r
-        -0.112435f, 0.061795f, 0.042543f, -0.126799f, -0.009975f, -0.056760f, \r
-        0.046424f, -0.194712f, -0.139399f, -0.037731f, 0.157989f, -0.016261f, \r
-        0.123345f, 0.230563f, 0.083300f, -0.016392f, 0.059567f, -0.016035f, \r
-        -0.064767f, 0.231945f, 0.156629f, 0.034602f, 0.145628f, 0.041315f, \r
-        0.034535f, 0.019967f, -0.089188f, -0.012091f, 0.307857f, 0.211405f, \r
-        -0.025091f, -0.148249f, -0.129384f, 0.063536f, -0.068603f, -0.067941f, \r
-        -0.035104f, 0.210832f, 0.063810f, 0.062764f, -0.089889f, -0.030554f, \r
-        0.014791f, -0.053362f, -0.037818f, -0.196640f, 0.008388f, -0.082654f, \r
-        0.143056f, 0.064221f, 0.069795f, 0.191040f, 0.097321f, -0.028679f, \r
-        0.075794f, 0.313154f, 0.086240f, 0.207643f, 0.017809f, 0.122867f, \r
-        0.224586f, 0.167403f, -0.023884f, 0.047434f, 0.344091f, 0.187745f, \r
-        0.136177f, 0.141738f, 0.063799f, 0.045233f, -0.077342f, -0.003525f, \r
-        -0.165041f, -0.025616f, -0.073745f, 0.164439f, 0.011200f, -0.145896f, \r
-        -0.027954f, -0.061987f, -0.039874f, -0.142775f, 0.151042f, -0.038238f, \r
-        0.053152f, 0.078615f, 0.086061f, 0.100593f, 0.128046f, -0.071006f, \r
-        -0.116558f, 0.208445f, 0.051086f, 0.076843f, 0.023191f, -0.084781f, \r
-        -0.011790f, 0.147807f, -0.048554f, -0.113932f, 0.283322f, 0.190934f, \r
-        0.092789f, 0.033018f, -0.142428f, -0.142480f, -0.099023f, -0.041020f, \r
-        -0.042760f, 0.203295f, -0.053475f, 0.042424f, 0.222839f, -0.019167f, \r
-        -0.133176f, -0.276216f, -0.031998f, 0.117290f, 0.177827f, -0.059973f, \r
-        -0.064744f, -0.117040f, -0.155482f, -0.099531f, 0.164121f, -0.026682f, \r
-        -0.093810f, 0.238993f, -0.006506f, 0.007830f, 0.065819f, -0.203643f, \r
-        -0.100925f, -0.053652f, -0.130770f, 0.026277f, 0.131796f, 0.032742f, \r
-        0.127186f, 0.116694f, -0.161122f, -0.279773f, -0.252515f, -0.002638f, \r
-        0.042812f, 0.096776f, -0.123280f, 0.064858f, -0.010455f, -0.219760f, \r
-        -0.239331f, -0.104363f, -0.058022f, -0.053584f, 0.025611f, 0.005129f, \r
-        -0.100418f, -0.045712f, -0.194418f, -0.126366f, -0.030530f, 0.051168f, \r
-        0.215959f, 0.172402f, -0.054700f, -0.185995f, -0.278360f, -0.193693f, \r
-        -0.040309f, 0.003735f, -0.007770f, 0.123556f, 0.190179f, -0.077315f, \r
-        0.117403f, 0.212942f, 0.012160f, 0.000113f, 0.027331f, 0.040202f, \r
-        0.033293f, 0.219438f, 0.184174f, 0.259349f, 0.311206f, 0.082547f, \r
-        -0.047875f, -0.078417f, 0.010746f, 0.082620f, 0.311931f, 0.307605f, \r
-        0.003863f, 0.021405f, -0.026388f, -0.019572f, 0.020582f, -0.059353f, \r
-        0.025199f, 0.261319f, 0.086316f, 0.143614f, 0.107780f, 0.003900f, \r
-        -0.188397f, -0.038563f, -0.106045f, -0.125154f, -0.010509f, 0.054021f, \r
-        0.242130f, 0.279152f, 0.215546f, 0.346995f, 0.440856f, 0.237452f, \r
-        0.234154f, 0.301646f, 0.168929f, -0.208358f, -0.126848f, 0.010260f, \r
-        0.121018f, -0.062975f, -0.052848f, 0.050341f, -0.061103f, -0.266482f, \r
-        0.107186f, 0.140221f, 0.280065f, 0.287889f, 0.373198f, 0.151596f, \r
-        0.013593f, 0.115616f, 0.014616f, -0.281710f, -0.237597f, -0.117305f, \r
-        -0.000034f, -0.136739f, -0.196275f, -0.095225f, -0.125310f, -0.250514f, \r
-        0.236804f, -0.071805f, -0.037421f, 0.048230f, 0.321596f, 0.063632f, \r
-        0.024039f, -0.029133f, 0.230983f, 0.160593f, -0.154355f, -0.013086f, \r
-        -0.079929f, 0.094692f, 0.160391f, 0.180239f, 0.053895f, 0.100759f, \r
-        0.288631f, 0.038191f, 0.181692f, 0.229682f, 0.440166f, 0.063401f, \r
-        0.006273f, 0.020865f, 0.338695f, 0.256244f, -0.043927f, 0.115617f, \r
-        0.003296f, 0.173965f, 0.021318f, -0.040936f, -0.118932f, 0.182380f, \r
-        0.235922f, -0.053233f, -0.015053f, -0.101057f, 0.095341f, 0.051111f, \r
-        0.161831f, 0.032614f, 0.159496f, 0.072375f, 0.025089f, 0.023748f, \r
-        0.029151f, 0.161284f, -0.117717f, -0.036191f, -0.176822f, -0.162006f, \r
-        0.226542f, -0.078329f, 0.043079f, -0.119172f, 0.054614f, -0.101365f, \r
-        -0.064541f, -0.115304f, 0.135170f, 0.298872f, 0.098060f, 0.089428f, \r
-        -0.007497f, 0.110391f, -0.028824f, 0.020835f, -0.036804f, 0.125411f, \r
-        0.192105f, -0.048931f, 0.003086f, -0.010681f, 0.074698f, -0.016263f, \r
-        0.096063f, 0.060267f, -0.007277f, 0.139139f, -0.080635f, 0.036628f, \r
-        0.086058f, 0.131979f, 0.085707f, 0.025301f, 0.226094f, 0.194759f, \r
-        0.042193f, -0.157846f, -0.068402f, -0.141450f, -0.112659f, -0.076305f, \r
-        -0.069085f, -0.114332f, -0.102005f, 0.132193f, -0.067042f, 0.106643f, \r
-        0.198964f, 0.171616f, 0.167237f, -0.033730f, -0.026755f, 0.083621f, \r
-        0.149459f, -0.002799f, -0.000318f, 0.011753f, 0.065889f, -0.089375f, \r
-        -0.049610f, 0.224579f, 0.216548f, -0.034908f, -0.017851f, -0.088144f, \r
-        0.007530f, 0.240268f, 0.073270f, 0.013263f, 0.175323f, 0.012082f, \r
-        0.093993f, 0.015282f, 0.105854f, 0.107990f, 0.077798f, -0.096166f, \r
-        -0.079607f, 0.177820f, 0.142392f, 0.033337f, -0.078100f, -0.081616f, \r
-        -0.046993f, 0.139459f, 0.020272f, -0.123161f, 0.175269f, 0.105217f, \r
-        0.057328f, 0.080909f, -0.012612f, -0.097081f, 0.082060f, -0.096716f, \r
-        -0.063921f, 0.201884f, 0.128166f, -0.035051f, -0.032227f, -0.068139f, \r
-        -0.115915f, 0.095080f, -0.086007f, -0.067543f, 0.030776f, 0.032712f, \r
-        0.088937f, 0.054336f, -0.039329f, -0.114022f, 0.171672f, -0.112321f, \r
-        -0.217646f, 0.065186f, 0.060223f, 0.192174f, 0.055580f, -0.131107f, \r
-        -0.144338f, 0.056730f, -0.034707f, -0.081616f, -0.135298f, -0.000614f, \r
-        0.087189f, 0.014614f, 0.067709f, 0.107689f, 0.225780f, 0.084361f, \r
-        -0.008544f, 0.051649f, -0.048369f, -0.037739f, -0.060710f, 0.002654f, \r
-        0.016935f, 0.085563f, -0.015961f, -0.019265f, 0.111788f, 0.062376f, \r
-        0.202019f, 0.047713f, 0.042261f, 0.069716f, 0.242913f, 0.021052f, \r
-        -0.072812f, -0.155920f, -0.026436f, 0.035621f, -0.079300f, -0.028787f, \r
-        -0.048329f, 0.084718f, -0.060565f, -0.083750f, -0.164075f, -0.040742f, \r
-        -0.086219f, 0.015271f, -0.005204f, -0.016038f, 0.045816f, -0.050433f, \r
-        -0.077652f, 0.117109f, 0.009611f, -0.009045f, -0.008634f, -0.055373f, \r
-        -0.085968f, 0.028527f, -0.054736f, -0.168089f, 0.175839f, 0.071205f, \r
-        -0.023603f, 0.037907f, -0.004561f, -0.022634f, 0.123831f, 0.094469f, \r
-        -0.072920f, -0.133642f, -0.014032f, -0.142754f, -0.026999f, -0.199409f, \r
-        0.013268f, 0.226989f, 0.048650f, -0.170988f, -0.050141f, 0.007880f, \r
-        0.061880f, 0.019078f, -0.043578f, -0.038139f, 0.134814f, 0.054097f, \r
-        -0.081670f, 0.176838f, 0.047920f, -0.038176f, 0.050406f, -0.107181f, \r
-        -0.036279f, 0.027060f, 0.081594f, -0.002820f, 0.090507f, -0.033338f, \r
-        -0.059571f, 0.013404f, -0.099860f, 0.073371f, 0.342805f, 0.098305f, \r
-        -0.150910f, -0.020822f, -0.056960f, 0.046262f, -0.043413f, -0.149405f, \r
-        -0.129105f, -0.010899f, -0.014229f, -0.179949f, -0.113044f, -0.049468f, \r
-        -0.065513f, 0.090269f, -0.011919f, 0.087846f, 0.095796f, 0.146127f, \r
-        0.101599f, 0.078066f, -0.084348f, -0.100002f, -0.020134f, -0.050169f, \r
-        0.062122f, 0.014640f, 0.019143f, 0.036543f, 0.180924f, -0.013976f, \r
-        -0.066768f, -0.001090f, -0.070419f, -0.004839f, -0.001504f, 0.034483f, \r
-        -0.044954f, -0.050336f, -0.088638f, -0.174782f, -0.116082f, -0.205507f, \r
-        0.015587f, -0.042839f, -0.096879f, -0.144097f, -0.050268f, -0.196796f, \r
-        0.109639f, 0.271411f, 0.173732f, 0.108070f, 0.156437f, 0.124255f, \r
-        0.097242f, 0.238693f, 0.083941f, 0.109105f, 0.223940f, 0.267188f, \r
-        0.027385f, 0.025819f, 0.125070f, 0.093738f, 0.040353f, 0.038645f, \r
-        -0.012730f, 0.144063f, 0.052931f, -0.009138f, 0.084193f, 0.160272f, \r
-        -0.041366f, 0.011951f, -0.121446f, -0.106713f, -0.047566f, 0.047984f, \r
-        -0.255224f, -0.076116f, 0.098685f, -0.150845f, -0.171513f, -0.156590f, \r
-        0.058331f, 0.187493f, 0.413018f, 0.554265f, 0.372242f, 0.237943f, \r
-        0.124571f, 0.110829f, 0.010322f, -0.174477f, -0.067627f, -0.001979f, \r
-        0.142913f, 0.040597f, 0.019907f, 0.025963f, -0.043585f, -0.120732f, \r
-        0.099937f, 0.091059f, 0.247307f, 0.204226f, -0.042753f, -0.068580f, \r
-        -0.119002f, 0.026722f, 0.034853f, -0.060934f, -0.025054f, -0.093026f, \r
-        -0.035372f, -0.233209f, -0.049869f, -0.039151f, -0.022279f, -0.065380f, \r
+        0.294350f, -0.098796f, -0.129522f, 0.078753f, 0.387527f, 0.261529f,\r
+        0.145939f, 0.061520f, 0.328699f, 0.227148f, -0.066467f, -0.086723f,\r
+        0.047559f, 0.106714f, 0.037897f, 0.111461f, -0.024406f, 0.304769f,\r
+        0.254676f, -0.069235f, 0.082566f, 0.147260f, 0.326969f, 0.148888f,\r
+        0.055270f, -0.087985f, 0.261720f, 0.143442f, 0.026812f, 0.238212f,\r
+        0.194020f, 0.056341f, -0.025854f, -0.034444f, -0.156631f, 0.205174f,\r
+        0.089008f, -0.139811f, -0.100147f, -0.037830f, -0.029230f, -0.055641f,\r
+        0.033248f, -0.016512f, 0.155244f, 0.247315f, -0.124694f, -0.048414f,\r
+        -0.062219f, 0.193683f, 0.004574f, 0.055089f, 0.093565f, 0.167712f,\r
+        0.167581f, 0.018895f, 0.215258f, 0.122609f, 0.090520f, -0.067219f,\r
+        -0.049029f, -0.099615f, 0.241804f, -0.094893f, -0.176248f, 0.001727f,\r
+        -0.134473f, 0.104442f, 0.050942f, 0.081165f, 0.072156f, 0.121646f,\r
+        0.002656f, -0.297974f, -0.133587f, -0.060121f, -0.092515f, -0.048974f,\r
+        -0.084754f, -0.180111f, -0.038590f, 0.086283f, -0.134636f, -0.107249f,\r
+        0.132890f, 0.141556f, 0.249425f, 0.130273f, -0.030031f, 0.073212f,\r
+        -0.008155f, 0.019931f, 0.071688f, 0.000300f, -0.019525f, -0.021725f,\r
+        -0.040993f, -0.086841f, 0.070124f, 0.240033f, 0.265350f, 0.043208f,\r
+        0.166754f, 0.091453f, 0.060916f, -0.036972f, -0.091043f, 0.079873f,\r
+        0.219781f, 0.158102f, -0.140618f, -0.043016f, 0.124802f, 0.093668f,\r
+        0.103208f, 0.094872f, 0.080541f, 0.137711f, 0.160566f, -0.169231f,\r
+        0.013983f, 0.309508f, -0.004217f, -0.057200f, -0.064489f, 0.014066f,\r
+        0.361009f, 0.251328f, -0.080983f, -0.044183f, 0.061436f, -0.037381f,\r
+        -0.078786f, 0.030993f, 0.066314f, 0.037683f, 0.152325f, -0.091683f,\r
+        0.070203f, 0.217856f, 0.036435f, -0.076462f, 0.006254f, -0.094431f,\r
+        0.154829f, -0.023038f, -0.196961f, -0.024594f, 0.178465f, -0.050139f,\r
+        -0.045932f, -0.000965f, 0.109112f, 0.046165f, -0.159373f, -0.008713f,\r
+        0.041307f, 0.097129f, -0.057211f, -0.064599f, 0.077165f, 0.176167f,\r
+        0.138322f, 0.065753f, -0.104950f, 0.017933f, 0.136255f, -0.011598f,\r
+        0.047007f, 0.080550f, 0.068619f, 0.084661f, -0.035493f, -0.091314f,\r
+        -0.041411f, 0.060971f, -0.101912f, -0.079870f, -0.085977f, -0.022686f,\r
+        0.079788f, -0.098064f, -0.054603f, 0.040383f, 0.300794f, 0.128603f,\r
+        0.094844f, 0.047407f, 0.101825f, 0.061832f, -0.162160f, -0.204553f,\r
+        -0.035165f, 0.101450f, -0.016641f, -0.027140f, -0.134392f, -0.008743f,\r
+        0.102331f, 0.114853f, 0.009644f, 0.062823f, 0.237339f, 0.167843f,\r
+        0.053066f, -0.012592f, 0.043158f, 0.002305f, 0.065001f, -0.038929f,\r
+        -0.020356f, 0.152343f, 0.043469f, -0.029967f, -0.042948f, 0.032481f,\r
+        0.068488f, -0.110840f, -0.111083f, 0.111980f, -0.002072f, -0.005562f,\r
+        0.082926f, 0.006635f, -0.108153f, 0.024242f, -0.086464f, -0.189884f,\r
+        -0.017492f, 0.191456f, -0.007683f, -0.128769f, -0.038017f, -0.132380f,\r
+        0.091926f, 0.079696f, -0.106728f, -0.007656f, 0.172744f, 0.011576f,\r
+        0.009883f, 0.083258f, -0.026516f, 0.145534f, 0.153924f, -0.130290f,\r
+        -0.108945f, 0.124490f, -0.003186f, -0.100485f, 0.015024f, -0.060512f,\r
+        0.026288f, -0.086713f, -0.169012f, 0.076517f, 0.215778f, 0.043701f,\r
+        -0.131642f, -0.012585f, -0.045181f, -0.118183f, -0.241544f, -0.167293f,\r
+        -0.020107f, -0.019917f, -0.101827f, -0.107096f, -0.010503f, 0.044938f,\r
+        0.189680f, 0.217119f, -0.046086f, 0.044508f, 0.199716f, -0.036004f,\r
+        -0.148927f, 0.013355f, -0.078279f, 0.030451f, 0.056301f, -0.024609f,\r
+        0.083224f, 0.099533f, -0.039432f, -0.138880f, 0.005482f, -0.024120f,\r
+        -0.140468f, -0.066381f, -0.017057f, 0.009260f, -0.058004f, -0.028486f,\r
+        -0.061610f, 0.007483f, -0.158309f, -0.150687f, -0.044595f, -0.105121f,\r
+        -0.045763f, -0.006618f, -0.024419f, -0.117713f, -0.119366f, -0.175941f,\r
+        -0.071542f, 0.119027f, 0.111362f, 0.043080f, 0.034889f, 0.093003f,\r
+        0.007842f, 0.057368f, -0.108834f, -0.079968f, 0.230959f, 0.020205f,\r
+        0.011470f, 0.098877f, 0.101310f, -0.030215f, -0.018018f, -0.059552f,\r
+        -0.106157f, 0.021866f, -0.036471f, 0.080051f, 0.041165f, -0.082101f,\r
+        0.117726f, 0.030961f, -0.054763f, -0.084102f, -0.185778f, -0.061305f,\r
+        -0.038089f, -0.110728f, -0.264010f, 0.076675f, -0.077111f, -0.137644f,\r
+        0.036232f, 0.277995f, 0.019116f, 0.107738f, 0.144003f, 0.080304f,\r
+        0.215036f, 0.228897f, 0.072713f, 0.077773f, 0.120168f, 0.075324f,\r
+        0.062730f, 0.122478f, -0.049008f, 0.164912f, 0.162450f, 0.041246f,\r
+        0.009891f, -0.097827f, -0.038700f, -0.023027f, -0.120020f, 0.203364f,\r
+        0.248474f, 0.149810f, -0.036276f, -0.082814f, -0.090343f, -0.027143f,\r
+        -0.075689f, -0.320310f, -0.000500f, -0.143334f, -0.065077f, -0.186936f,\r
+        0.129372f, 0.116431f, 0.181699f, 0.170436f, 0.418854f, 0.460045f,\r
+        0.333719f, 0.230515f, 0.047822f, -0.044954f, -0.068086f, 0.140179f,\r
+        -0.044821f, 0.085550f, 0.092483f, -0.107296f, -0.130670f, -0.206629f,\r
+        0.114601f, -0.317869f, -0.076663f, 0.038680f, 0.212753f, -0.016059f,\r
+        -0.126526f, -0.163602f, 0.210154f, 0.099887f, -0.126366f, 0.118453f,\r
+        0.019309f, -0.021611f, -0.096499f, -0.111809f, -0.200489f, 0.142854f,\r
+        0.228840f, -0.353346f, -0.179151f, 0.116834f, 0.252389f, -0.031728f,\r
+        -0.188135f, -0.158998f, 0.386523f, 0.122315f, 0.209944f, 0.394023f,\r
+        0.359030f, 0.260717f, 0.170335f, 0.013683f, -0.142596f, -0.026138f,\r
+        -0.011878f, -0.150519f, 0.047159f, -0.107062f, -0.147347f, -0.187689f,\r
+        -0.186027f, -0.208048f, 0.058468f, -0.073026f, -0.236556f, -0.079788f,\r
+        -0.146216f, -0.058563f, -0.101361f, -0.071294f, -0.071093f, 0.116919f,\r
+        0.234304f, 0.306781f, 0.321866f, 0.240000f, 0.073261f, -0.012173f,\r
+        0.026479f, 0.050173f, 0.166127f, 0.228955f, 0.061905f, 0.156460f,\r
+        0.205990f, 0.120672f, 0.037350f, 0.167884f, 0.290099f, 0.420900f,\r
+        -0.012601f, 0.189839f, 0.306378f, 0.118383f, -0.095598f, -0.072360f,\r
+        -0.132496f, -0.224259f, -0.126021f, 0.022714f, 0.284039f, 0.051369f,\r
+        -0.000927f, -0.058735f, -0.083354f, -0.141254f, -0.187578f, -0.202669f,\r
+        0.048902f, 0.246597f, 0.441863f, 0.342519f, 0.066979f, 0.215286f,\r
+        0.188191f, -0.072240f, -0.208142f, -0.030196f, 0.178141f, 0.136985f,\r
+        -0.043374f, -0.181098f, 0.091815f, 0.116177f, -0.126690f, -0.386625f,\r
+        0.368165f, 0.269149f, -0.088042f, -0.028823f, 0.092961f, 0.024099f,\r
+        0.046112f, 0.176756f, 0.135849f, 0.124955f, 0.195467f, -0.037218f,\r
+        0.167217f, 0.188938f, 0.053528f, -0.066561f, 0.133721f, -0.070565f,\r
+        0.115898f, 0.152435f, -0.116993f, -0.110592f, -0.179005f, 0.026668f,\r
+        0.080530f, 0.075084f, -0.070401f, 0.012497f, 0.021849f, -0.139764f,\r
+        -0.022020f, -0.096301f, -0.064954f, -0.127446f, -0.013806f, -0.108315f,\r
+        0.156285f, 0.149867f, -0.011382f, 0.064532f, 0.029168f, 0.027393f,\r
+        0.069716f, 0.153735f, 0.038459f, 0.230714f, 0.253840f, 0.059522f,\r
+        -0.045053f, 0.014083f, 0.071103f, 0.068747f, 0.095887f, 0.005832f,\r
+        0.144887f, 0.026357f, -0.067359f, -0.044151f, -0.123283f, -0.019911f,\r
+        0.005318f, 0.109208f, -0.003201f, -0.021734f, 0.142025f, -0.066907f,\r
+        -0.120070f, -0.188639f, 0.012472f, -0.048704f, -0.012366f, -0.184828f,\r
+        0.168591f, 0.267166f, 0.058208f, -0.044101f, 0.033500f, 0.178558f,\r
+        0.104550f, 0.122418f, 0.080177f, 0.173246f, 0.298537f, 0.064173f,\r
+        0.053397f, 0.174341f, 0.230984f, 0.117025f, 0.166242f, 0.227781f,\r
+        0.120623f, 0.176952f, -0.011393f, -0.086483f, -0.008270f, 0.051700f,\r
+        -0.153369f, -0.058837f, -0.057639f, -0.060115f, 0.026349f, -0.160745f,\r
+        -0.037894f, -0.048575f, 0.041052f, -0.022112f, 0.060365f, 0.051906f,\r
+        0.162657f, 0.138519f, -0.050185f, -0.005938f, 0.071301f, 0.127686f,\r
+        0.062342f, 0.144400f, 0.072600f, 0.198436f, 0.246219f, -0.078185f,\r
+        -0.036169f, 0.075934f, 0.047328f, -0.013601f, 0.087205f, 0.019900f,\r
+        0.022606f, -0.015365f, -0.092506f, 0.075275f, -0.116375f, 0.050500f,\r
+        0.045118f, 0.166567f, 0.072073f, 0.060371f, 0.131747f, -0.169863f,\r
+        -0.039352f, -0.047486f, -0.039797f, -0.204312f, 0.021710f, 0.129443f,\r
+        -0.021173f, 0.173416f, -0.070794f, -0.063986f, 0.069689f, -0.064099f,\r
+        -0.123201f, -0.017372f, -0.206870f, 0.065863f, 0.113226f, 0.024707f,\r
+        -0.071341f, -0.066964f, -0.098278f, -0.062927f, 0.075840f, 0.014716f,\r
+        0.019378f, 0.132699f, -0.074191f, -0.089557f, -0.078446f, -0.197488f,\r
+        -0.173665f, 0.052583f, 0.044361f, 0.113549f, 0.098492f, 0.077379f,\r
+        -0.011146f, -0.192593f, -0.164435f, 0.045568f, 0.205699f, 0.049187f,\r
+        -0.082281f, 0.134874f, 0.185499f, 0.034968f, -0.119561f, -0.112372f,\r
+        -0.115091f, -0.054042f, -0.183816f, -0.078100f, 0.190695f, 0.091617f,\r
+        0.004257f, -0.041135f, -0.061453f, -0.141592f, -0.194809f, -0.120638f,\r
+        0.020168f, 0.109672f, 0.067398f, -0.015238f, -0.239145f, -0.264671f,\r
+        -0.185176f, 0.050472f, 0.020793f, 0.035678f, 0.022839f, -0.052055f,\r
+        -0.127968f, -0.113049f, -0.228416f, -0.258281f, -0.053437f, 0.076424f,\r
+        0.061450f, 0.237478f, 0.003618f, -0.055865f, -0.108087f, -0.028937f,\r
+        0.045585f, 0.052829f, -0.001471f, 0.022826f, 0.059565f, -0.104430f,\r
+        -0.077266f, -0.211882f, -0.212078f, 0.028074f, 0.075846f, 0.016265f,\r
+        0.161879f, 0.134477f, 0.008935f, -0.048041f, 0.074692f, 0.004928f,\r
+        -0.025156f, 0.192874f, 0.074410f, 0.308732f, 0.267400f, 0.094208f,\r
+        -0.005251f, 0.042041f, -0.032148f, 0.015588f, 0.252869f, 0.175302f,\r
+        0.022892f, 0.081673f, 0.063208f, 0.162626f, 0.194426f, 0.233890f,\r
+        0.262292f, 0.186930f, 0.084079f, -0.286388f, -0.213034f, -0.048867f,\r
+        -0.207669f, -0.170050f, 0.011673f, -0.092958f, -0.192786f, -0.273536f,\r
+        0.230904f, 0.266732f, 0.320519f, 0.297155f, 0.548169f, 0.304922f,\r
+        0.132687f, 0.247333f, 0.212488f, -0.271472f, -0.142105f, -0.002627f,\r
+        -0.119215f, 0.128383f, 0.100079f, -0.057490f, -0.121902f, -0.228892f,\r
+        0.202292f, -0.399795f, -0.371326f, -0.095836f, -0.063626f, -0.161375f,\r
+        -0.311180f, -0.294797f, 0.242122f, 0.011788f, 0.095573f, 0.322523f,\r
+        0.511840f, 0.322880f, 0.313259f, 0.173331f, 0.002542f, -0.029802f,\r
+        0.324766f, -0.326170f, -0.340547f, -0.138288f, -0.002963f, -0.114060f,\r
+        -0.377312f, -0.442570f, 0.212446f, -0.007759f, -0.011576f, 0.169711f,\r
+        0.308689f, 0.317348f, 0.539390f, 0.332845f, 0.057331f, -0.068180f,\r
+        0.101994f, 0.266995f, 0.209570f, 0.355730f, 0.091635f, 0.170238f,\r
+        0.125215f, 0.274154f, 0.070223f, 0.025515f, 0.049946f, -0.000550f,\r
+        0.043715f, -0.141843f, 0.020844f, 0.129871f, 0.256588f, 0.105015f,\r
+        0.148339f, 0.170682f, 0.028792f, 0.074037f, 0.160042f, 0.405137f,\r
+        0.246187f, 0.352160f, 0.168951f, 0.222263f, 0.264439f, 0.065945f,\r
+        0.021963f, -0.075084f, 0.093105f, 0.027318f, 0.098864f, 0.057566f,\r
+        -0.080282f, 0.185032f, 0.314419f, 0.333727f, 0.125798f, 0.294919f,\r
+        0.386002f, 0.217619f, -0.183517f, -0.278622f, -0.002342f, -0.027821f,\r
+        -0.134266f, -0.331843f, -0.008296f, 0.124564f, 0.053712f, -0.369016f,\r
+        -0.095036f, 0.209381f, 0.423760f, 0.371760f, 0.106397f, 0.369408f,\r
+        0.485608f, 0.231201f, -0.138685f, -0.349208f, -0.070083f, 0.028991f,\r
+        -0.081630f, -0.395992f, -0.146791f, -0.027354f, 0.063396f, -0.272484f,\r
+        0.058299f, 0.338207f, 0.110767f, -0.052642f, -0.233848f, -0.027448f,\r
+        0.030328f, 0.155572f, -0.093826f, 0.019331f, 0.120638f, 0.006292f,\r
+        -0.106083f, -0.236290f, -0.140933f, -0.088067f, -0.025138f, -0.208395f,\r
+        -0.025502f, 0.144192f, -0.048353f, -0.106144f, -0.305121f, -0.114147f,\r
+        0.090963f, 0.327727f, 0.035606f, -0.093779f, 0.002651f, -0.171081f,\r
+        -0.188131f, -0.216571f, -0.209101f, -0.054402f, 0.157147f, -0.057127f,\r
+        0.066584f, 0.008988f, 0.041191f, 0.034456f, -0.078255f, 0.052099f,\r
+        -0.022239f, 0.066981f, -0.117520f, -0.072637f, 0.062512f, 0.037570f,\r
+        -0.057544f, -0.312359f, 0.034357f, -0.031549f, 0.002566f, -0.207375f,\r
+        -0.070654f, -0.018786f, -0.044815f, -0.012814f, -0.076320f, 0.078183f,\r
+        0.023877f, 0.117078f, 0.022292f, -0.205424f, -0.060430f, -0.017296f,\r
+        -0.004827f, -0.321036f, -0.092155f, 0.038837f, 0.073190f, -0.067513f,\r
+        0.026521f, 0.171945f, 0.087318f, 0.034495f, -0.034089f, 0.154410f,\r
+        -0.061431f, 0.007435f, -0.111094f, -0.095976f, 0.014741f, -0.132324f,\r
+        -0.029517f, -0.192160f, 0.098667f, 0.020762f, 0.177050f, -0.064510f,\r
+        -0.054437f, -0.058678f, -0.001858f, 0.167602f, 0.015735f, 0.054338f,\r
+        0.016477f, 0.186381f, -0.010667f, 0.054692f, 0.126742f, 0.013140f,\r
+        0.090353f, -0.133608f, -0.018017f, -0.152619f, 0.027600f, -0.138700f,\r
+        -0.050274f, 0.045141f, -0.118731f, 0.094797f, -0.167605f, 0.097461f,\r
+        -0.009131f, 0.199920f, -0.052976f, 0.158194f, 0.178568f, -0.107600f,\r
+        0.009671f, -0.084072f, -0.040258f, -0.205673f, 0.102891f, 0.223511f,\r
+        0.042699f, 0.118548f, -0.021274f, 0.110997f, -0.155121f, 0.027696f,\r
+        -0.149968f, 0.051552f, -0.129219f, 0.173524f, 0.073972f, -0.189045f,\r
+        -0.034523f, -0.106655f, -0.011843f, -0.197381f, 0.219413f, 0.183197f,\r
+        -0.054920f, 0.144955f, 0.036517f, -0.085412f, -0.229070f, -0.143710f,\r
+        -0.049486f, 0.156634f, -0.008673f, -0.064778f, 0.082344f, 0.145673f,\r
+        0.002912f, -0.210121f, -0.116564f, 0.078425f, 0.220908f, -0.067594f,\r
+        0.048610f, 0.084912f, -0.066202f, -0.112515f, -0.217767f, -0.082640f,\r
+        -0.017414f, 0.230265f, -0.070735f, 0.066073f, 0.215256f, 0.071157f,\r
+        -0.087220f, -0.202235f, -0.011918f, 0.099562f, 0.174716f, -0.063845f,\r
+        -0.121055f, 0.014367f, 0.132709f, -0.005060f, -0.244606f, -0.179693f,\r
+        -0.134690f, 0.023239f, -0.193116f, -0.076975f, -0.021164f, -0.001938f,\r
+        -0.163799f, -0.111437f, -0.210362f, -0.166376f, 0.034754f, 0.010036f,\r
+        -0.021917f, 0.068014f, -0.086893f, -0.251746f, -0.267171f, 0.037383f,\r
+        0.003966f, 0.033571f, -0.151506f, 0.025437f, -0.020626f, -0.308454f,\r
+        -0.343143f, -0.092263f, -0.026261f, -0.028345f, 0.036036f, 0.035169f,\r
+        0.129470f, 0.122205f, 0.015661f, -0.070612f, -0.094333f, -0.066055f,\r
+        -0.041083f, 0.159146f, 0.073184f, 0.110044f, 0.174471f, 0.078069f,\r
+        -0.014881f, 0.008116f, 0.013209f, 0.075857f, 0.195605f, 0.062714f,\r
+        0.067955f, 0.056544f, -0.153908f, -0.141749f, -0.072550f, 0.033523f,\r
+        -0.024665f, 0.134487f, 0.079076f, 0.133562f, 0.227130f, 0.018054f,\r
+        0.004928f, 0.169162f, 0.065152f, 0.072160f, 0.131631f, 0.096303f,\r
+        0.054288f, 0.106256f, 0.114632f, 0.119038f, 0.515200f, 0.247429f,\r
+        0.199134f, 0.211957f, 0.127558f, -0.294684f, -0.194890f, -0.049988f,\r
+        -0.112247f, -0.008122f, -0.006176f, 0.037035f, -0.110881f, -0.249989f,\r
+        0.152434f, 0.234621f, 0.153340f, 0.349283f, 0.683049f, 0.157174f,\r
+        0.124844f, 0.099136f, 0.064407f, -0.248400f, -0.155323f, -0.026498f,\r
+        -0.023450f, 0.049051f, -0.114187f, 0.007195f, -0.176825f, -0.376926f,\r
+        0.366159f, -0.179938f, -0.148508f, 0.006043f, 0.170048f, 0.097866f,\r
+        -0.102658f, -0.260430f, 0.248868f, 0.037019f, -0.118111f, 0.078176f,\r
+        0.194171f, 0.211328f, 0.368612f, 0.361213f, 0.130013f, 0.094650f,\r
+        0.227396f, -0.178058f, -0.114782f, -0.008093f, 0.231080f, -0.011843f,\r
+        -0.097917f, -0.325788f, 0.141879f, 0.119738f, -0.230427f, -0.117419f,\r
+        -0.114153f, 0.037903f, 0.116383f, 0.218773f, -0.101884f, 0.059466f,\r
+        0.119255f, 0.010874f, -0.031449f, 0.045996f, 0.119931f, 0.273760f,\r
+        0.311700f, 0.261794f, 0.194809f, 0.339829f, 0.239449f, 0.064140f,\r
+        0.077597f, 0.098996f, 0.143534f, 0.184602f, 0.037507f, 0.225494f,\r
+        0.096142f, -0.147370f, -0.207833f, -0.174742f, -0.086391f, -0.038942f,\r
+        0.159577f, -0.088492f, -0.000989f, 0.108154f, -0.025890f, -0.072713f,\r
+        0.025997f, -0.006803f, -0.086879f, -0.011290f, -0.269200f, -0.103450f,\r
+        -0.124910f, -0.116340f, 0.141459f, 0.208800f, 0.042268f, 0.265034f,\r
+        0.516474f, 0.217591f, -0.018843f, -0.313328f, -0.168363f, 0.047129f,\r
+        0.090480f, -0.109852f, -0.018761f, 0.210669f, 0.281269f, -0.043591f,\r
+        -0.034147f, -0.237772f, -0.134843f, -0.072481f, -0.103831f, 0.038355f,\r
+        0.308619f, 0.148023f, -0.045867f, -0.123950f, -0.210860f, -0.064973f,\r
+        -0.036308f, -0.046731f, -0.022099f, 0.095776f, 0.409423f, 0.060635f,\r
+        -0.065196f, 0.051828f, 0.027981f, -0.009609f, -0.137681f, -0.095011f,\r
+        -0.019045f, 0.177278f, 0.009759f, -0.092119f, -0.016958f, -0.133860f,\r
+        -0.118421f, -0.032039f, -0.006214f, -0.084541f, 0.063971f, -0.073642f,\r
+        0.165676f, 0.110443f, 0.044131f, 0.046568f, 0.053292f, -0.055466f,\r
+        0.015512f, 0.371947f, 0.232102f, -0.016923f, 0.103979f, -0.091758f,\r
+        0.005907f, 0.209100f, 0.157433f, 0.030518f, 0.250366f, 0.062322f,\r
+        0.036720f, 0.094676f, 0.017306f, -0.010328f, -0.079012f, 0.016781f,\r
+        -0.112435f, 0.061795f, 0.042543f, -0.126799f, -0.009975f, -0.056760f,\r
+        0.046424f, -0.194712f, -0.139399f, -0.037731f, 0.157989f, -0.016261f,\r
+        0.123345f, 0.230563f, 0.083300f, -0.016392f, 0.059567f, -0.016035f,\r
+        -0.064767f, 0.231945f, 0.156629f, 0.034602f, 0.145628f, 0.041315f,\r
+        0.034535f, 0.019967f, -0.089188f, -0.012091f, 0.307857f, 0.211405f,\r
+        -0.025091f, -0.148249f, -0.129384f, 0.063536f, -0.068603f, -0.067941f,\r
+        -0.035104f, 0.210832f, 0.063810f, 0.062764f, -0.089889f, -0.030554f,\r
+        0.014791f, -0.053362f, -0.037818f, -0.196640f, 0.008388f, -0.082654f,\r
+        0.143056f, 0.064221f, 0.069795f, 0.191040f, 0.097321f, -0.028679f,\r
+        0.075794f, 0.313154f, 0.086240f, 0.207643f, 0.017809f, 0.122867f,\r
+        0.224586f, 0.167403f, -0.023884f, 0.047434f, 0.344091f, 0.187745f,\r
+        0.136177f, 0.141738f, 0.063799f, 0.045233f, -0.077342f, -0.003525f,\r
+        -0.165041f, -0.025616f, -0.073745f, 0.164439f, 0.011200f, -0.145896f,\r
+        -0.027954f, -0.061987f, -0.039874f, -0.142775f, 0.151042f, -0.038238f,\r
+        0.053152f, 0.078615f, 0.086061f, 0.100593f, 0.128046f, -0.071006f,\r
+        -0.116558f, 0.208445f, 0.051086f, 0.076843f, 0.023191f, -0.084781f,\r
+        -0.011790f, 0.147807f, -0.048554f, -0.113932f, 0.283322f, 0.190934f,\r
+        0.092789f, 0.033018f, -0.142428f, -0.142480f, -0.099023f, -0.041020f,\r
+        -0.042760f, 0.203295f, -0.053475f, 0.042424f, 0.222839f, -0.019167f,\r
+        -0.133176f, -0.276216f, -0.031998f, 0.117290f, 0.177827f, -0.059973f,\r
+        -0.064744f, -0.117040f, -0.155482f, -0.099531f, 0.164121f, -0.026682f,\r
+        -0.093810f, 0.238993f, -0.006506f, 0.007830f, 0.065819f, -0.203643f,\r
+        -0.100925f, -0.053652f, -0.130770f, 0.026277f, 0.131796f, 0.032742f,\r
+        0.127186f, 0.116694f, -0.161122f, -0.279773f, -0.252515f, -0.002638f,\r
+        0.042812f, 0.096776f, -0.123280f, 0.064858f, -0.010455f, -0.219760f,\r
+        -0.239331f, -0.104363f, -0.058022f, -0.053584f, 0.025611f, 0.005129f,\r
+        -0.100418f, -0.045712f, -0.194418f, -0.126366f, -0.030530f, 0.051168f,\r
+        0.215959f, 0.172402f, -0.054700f, -0.185995f, -0.278360f, -0.193693f,\r
+        -0.040309f, 0.003735f, -0.007770f, 0.123556f, 0.190179f, -0.077315f,\r
+        0.117403f, 0.212942f, 0.012160f, 0.000113f, 0.027331f, 0.040202f,\r
+        0.033293f, 0.219438f, 0.184174f, 0.259349f, 0.311206f, 0.082547f,\r
+        -0.047875f, -0.078417f, 0.010746f, 0.082620f, 0.311931f, 0.307605f,\r
+        0.003863f, 0.021405f, -0.026388f, -0.019572f, 0.020582f, -0.059353f,\r
+        0.025199f, 0.261319f, 0.086316f, 0.143614f, 0.107780f, 0.003900f,\r
+        -0.188397f, -0.038563f, -0.106045f, -0.125154f, -0.010509f, 0.054021f,\r
+        0.242130f, 0.279152f, 0.215546f, 0.346995f, 0.440856f, 0.237452f,\r
+        0.234154f, 0.301646f, 0.168929f, -0.208358f, -0.126848f, 0.010260f,\r
+        0.121018f, -0.062975f, -0.052848f, 0.050341f, -0.061103f, -0.266482f,\r
+        0.107186f, 0.140221f, 0.280065f, 0.287889f, 0.373198f, 0.151596f,\r
+        0.013593f, 0.115616f, 0.014616f, -0.281710f, -0.237597f, -0.117305f,\r
+        -0.000034f, -0.136739f, -0.196275f, -0.095225f, -0.125310f, -0.250514f,\r
+        0.236804f, -0.071805f, -0.037421f, 0.048230f, 0.321596f, 0.063632f,\r
+        0.024039f, -0.029133f, 0.230983f, 0.160593f, -0.154355f, -0.013086f,\r
+        -0.079929f, 0.094692f, 0.160391f, 0.180239f, 0.053895f, 0.100759f,\r
+        0.288631f, 0.038191f, 0.181692f, 0.229682f, 0.440166f, 0.063401f,\r
+        0.006273f, 0.020865f, 0.338695f, 0.256244f, -0.043927f, 0.115617f,\r
+        0.003296f, 0.173965f, 0.021318f, -0.040936f, -0.118932f, 0.182380f,\r
+        0.235922f, -0.053233f, -0.015053f, -0.101057f, 0.095341f, 0.051111f,\r
+        0.161831f, 0.032614f, 0.159496f, 0.072375f, 0.025089f, 0.023748f,\r
+        0.029151f, 0.161284f, -0.117717f, -0.036191f, -0.176822f, -0.162006f,\r
+        0.226542f, -0.078329f, 0.043079f, -0.119172f, 0.054614f, -0.101365f,\r
+        -0.064541f, -0.115304f, 0.135170f, 0.298872f, 0.098060f, 0.089428f,\r
+        -0.007497f, 0.110391f, -0.028824f, 0.020835f, -0.036804f, 0.125411f,\r
+        0.192105f, -0.048931f, 0.003086f, -0.010681f, 0.074698f, -0.016263f,\r
+        0.096063f, 0.060267f, -0.007277f, 0.139139f, -0.080635f, 0.036628f,\r
+        0.086058f, 0.131979f, 0.085707f, 0.025301f, 0.226094f, 0.194759f,\r
+        0.042193f, -0.157846f, -0.068402f, -0.141450f, -0.112659f, -0.076305f,\r
+        -0.069085f, -0.114332f, -0.102005f, 0.132193f, -0.067042f, 0.106643f,\r
+        0.198964f, 0.171616f, 0.167237f, -0.033730f, -0.026755f, 0.083621f,\r
+        0.149459f, -0.002799f, -0.000318f, 0.011753f, 0.065889f, -0.089375f,\r
+        -0.049610f, 0.224579f, 0.216548f, -0.034908f, -0.017851f, -0.088144f,\r
+        0.007530f, 0.240268f, 0.073270f, 0.013263f, 0.175323f, 0.012082f,\r
+        0.093993f, 0.015282f, 0.105854f, 0.107990f, 0.077798f, -0.096166f,\r
+        -0.079607f, 0.177820f, 0.142392f, 0.033337f, -0.078100f, -0.081616f,\r
+        -0.046993f, 0.139459f, 0.020272f, -0.123161f, 0.175269f, 0.105217f,\r
+        0.057328f, 0.080909f, -0.012612f, -0.097081f, 0.082060f, -0.096716f,\r
+        -0.063921f, 0.201884f, 0.128166f, -0.035051f, -0.032227f, -0.068139f,\r
+        -0.115915f, 0.095080f, -0.086007f, -0.067543f, 0.030776f, 0.032712f,\r
+        0.088937f, 0.054336f, -0.039329f, -0.114022f, 0.171672f, -0.112321f,\r
+        -0.217646f, 0.065186f, 0.060223f, 0.192174f, 0.055580f, -0.131107f,\r
+        -0.144338f, 0.056730f, -0.034707f, -0.081616f, -0.135298f, -0.000614f,\r
+        0.087189f, 0.014614f, 0.067709f, 0.107689f, 0.225780f, 0.084361f,\r
+        -0.008544f, 0.051649f, -0.048369f, -0.037739f, -0.060710f, 0.002654f,\r
+        0.016935f, 0.085563f, -0.015961f, -0.019265f, 0.111788f, 0.062376f,\r
+        0.202019f, 0.047713f, 0.042261f, 0.069716f, 0.242913f, 0.021052f,\r
+        -0.072812f, -0.155920f, -0.026436f, 0.035621f, -0.079300f, -0.028787f,\r
+        -0.048329f, 0.084718f, -0.060565f, -0.083750f, -0.164075f, -0.040742f,\r
+        -0.086219f, 0.015271f, -0.005204f, -0.016038f, 0.045816f, -0.050433f,\r
+        -0.077652f, 0.117109f, 0.009611f, -0.009045f, -0.008634f, -0.055373f,\r
+        -0.085968f, 0.028527f, -0.054736f, -0.168089f, 0.175839f, 0.071205f,\r
+        -0.023603f, 0.037907f, -0.004561f, -0.022634f, 0.123831f, 0.094469f,\r
+        -0.072920f, -0.133642f, -0.014032f, -0.142754f, -0.026999f, -0.199409f,\r
+        0.013268f, 0.226989f, 0.048650f, -0.170988f, -0.050141f, 0.007880f,\r
+        0.061880f, 0.019078f, -0.043578f, -0.038139f, 0.134814f, 0.054097f,\r
+        -0.081670f, 0.176838f, 0.047920f, -0.038176f, 0.050406f, -0.107181f,\r
+        -0.036279f, 0.027060f, 0.081594f, -0.002820f, 0.090507f, -0.033338f,\r
+        -0.059571f, 0.013404f, -0.099860f, 0.073371f, 0.342805f, 0.098305f,\r
+        -0.150910f, -0.020822f, -0.056960f, 0.046262f, -0.043413f, -0.149405f,\r
+        -0.129105f, -0.010899f, -0.014229f, -0.179949f, -0.113044f, -0.049468f,\r
+        -0.065513f, 0.090269f, -0.011919f, 0.087846f, 0.095796f, 0.146127f,\r
+        0.101599f, 0.078066f, -0.084348f, -0.100002f, -0.020134f, -0.050169f,\r
+        0.062122f, 0.014640f, 0.019143f, 0.036543f, 0.180924f, -0.013976f,\r
+        -0.066768f, -0.001090f, -0.070419f, -0.004839f, -0.001504f, 0.034483f,\r
+        -0.044954f, -0.050336f, -0.088638f, -0.174782f, -0.116082f, -0.205507f,\r
+        0.015587f, -0.042839f, -0.096879f, -0.144097f, -0.050268f, -0.196796f,\r
+        0.109639f, 0.271411f, 0.173732f, 0.108070f, 0.156437f, 0.124255f,\r
+        0.097242f, 0.238693f, 0.083941f, 0.109105f, 0.223940f, 0.267188f,\r
+        0.027385f, 0.025819f, 0.125070f, 0.093738f, 0.040353f, 0.038645f,\r
+        -0.012730f, 0.144063f, 0.052931f, -0.009138f, 0.084193f, 0.160272f,\r
+        -0.041366f, 0.011951f, -0.121446f, -0.106713f, -0.047566f, 0.047984f,\r
+        -0.255224f, -0.076116f, 0.098685f, -0.150845f, -0.171513f, -0.156590f,\r
+        0.058331f, 0.187493f, 0.413018f, 0.554265f, 0.372242f, 0.237943f,\r
+        0.124571f, 0.110829f, 0.010322f, -0.174477f, -0.067627f, -0.001979f,\r
+        0.142913f, 0.040597f, 0.019907f, 0.025963f, -0.043585f, -0.120732f,\r
+        0.099937f, 0.091059f, 0.247307f, 0.204226f, -0.042753f, -0.068580f,\r
+        -0.119002f, 0.026722f, 0.034853f, -0.060934f, -0.025054f, -0.093026f,\r
+        -0.035372f, -0.233209f, -0.049869f, -0.039151f, -0.022279f, -0.065380f,\r
         -9.063785f };\r
     return vector<float>(detector, detector + sizeof(detector)/sizeof(detector[0]));\r
 }\r
index 4e21421..947d76d 100644 (file)
@@ -84,10 +84,9 @@ if(HAVE_QT)
   QT4_WRAP_CPP(_MOC_OUTFILES src/window_QT.h)
 
   list(APPEND HIGHGUI_LIBRARIES ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY})
-  list(APPEND highgui_srcs src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES} )
-
-  ocv_check_flag_support(CXX -Wno-missing-declarations HAVE_CXX_WNO_MISSING_DECLARATIONS)
-  if(HAVE_CXX_WNO_MISSING_DECLARATIONS)
+  list(APPEND highgui_srcs src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES})
+  ocv_check_flag_support(CXX -Wno-missing-declarations _have_flag)
+  if(${_have_flag})
     set_source_files_properties(${_RCC_OUTFILES} PROPERTIES COMPILE_FLAGS -Wno-missing-declarations)
   endif()
 elseif(WIN32)
@@ -150,7 +149,9 @@ endif(HAVE_opencv_androidcamera)
 if(HAVE_XIMEA)
   list(APPEND highgui_srcs src/cap_ximea.cpp)
   ocv_include_directories(${XIMEA_PATH})
-  link_directories(${XIMEA_LIBRARY_DIR})
+  if(XIMEA_LIBRARY_DIR)
+    link_directories(${XIMEA_LIBRARY_DIR})
+  endif()
   list(APPEND HIGHGUI_LIBRARIES m3api)
 endif(HAVE_XIMEA)
 
index a803414..cb94aff 100755 (executable)
@@ -1,8 +1,8 @@
-
 #include "precomp.hpp"
 
 #include "xiApi.h"
 #include "xiExt.h"
+#include "m3Api.h"
 
 /**********************************************************************************/
 
@@ -18,20 +18,20 @@ public:
     virtual bool setProperty(int, double);
     virtual bool grabFrame();
     virtual IplImage* retrieveFrame(int);
-       virtual int getCaptureDomain() { return CV_CAP_XIAPI; } // Return the type of the capture object: CV_CAP_VFW, etc...
+    virtual int getCaptureDomain() { return CV_CAP_XIAPI; } // Return the type of the capture object: CV_CAP_VFW, etc...
 
 protected:
-       void init();
-       void errMsg(char* msg, int errNum);
+    void init();
+    void errMsg(const char* msg, int errNum);
     IplImage* frame;
 
-       HANDLE    hmv;
-       DWORD     numDevices;
-       XI_IMG    image;
-       int       width;
-       int       height;
-       int       format;
-       int       timeout;
+    HANDLE    hmv;
+    DWORD     numDevices;
+    XI_IMG    image;
+    int       width;
+    int       height;
+    int       format;
+    int       timeout;
 };
 
 /**********************************************************************************/
@@ -43,7 +43,7 @@ CvCapture* cvCreateCameraCapture_XIMEA( int index )
     if( capture->open( index ))
         return capture;
 
-       delete capture;
+    delete capture;
     return 0;
 }
 
@@ -51,8 +51,9 @@ CvCapture* cvCreateCameraCapture_XIMEA( int index )
 // Enumerate connected devices
 void CvCaptureCAM_XIMEA::init()
 {
-       xiGetNumberDevices( &numDevices);
-       hmv = NULL;
+    xiGetNumberDevices( &numDevices);
+    hmv = NULL;
+    memset(&image, 0, sizeof(XI_IMG));
 }
 
 
@@ -60,57 +61,85 @@ void CvCaptureCAM_XIMEA::init()
 // Initialize camera input
 bool CvCaptureCAM_XIMEA::open( int wIndex )
 {
-       int mvret = XI_OK;
-
-       if(numDevices == 0)
-               return false;
-       
-       if((mvret = xiOpenDevice( wIndex, &hmv)) != XI_OK)
-  {
-               errMsg("Open XI_DEVICE failed", mvret);
-               return false;
-       }
-
-       // always use auto exposure/gain
-       xiSetParamInt( hmv, XI_PRM_AEAG, 1);
-
-       // always use auto white ballance
-       xiSetParamInt( hmv, XI_PRM_AUTO_WB, 1);
-
-       xiGetParamInt( hmv, XI_PRM_WIDTH, &width);
-       xiGetParamInt( hmv, XI_PRM_HEIGHT, &height);
-       
-       // default image format RGB24
-       xiSetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, XI_RGB24);
-       format = XI_RGB24;
-       // allocate frame buffer for RGB24 image
-       frame = cvCreateImage(cvSize( width, height), IPL_DEPTH_8U, 3); 
-
-       //default capture timeout 10s
-       timeout = 10000;
-
-       return true;
+    int mvret = XI_OK;
+
+    if(numDevices == 0)
+        return false;
+
+    if((mvret = xiOpenDevice( wIndex, &hmv)) != XI_OK)
+    {
+        errMsg("Open XI_DEVICE failed", mvret);
+        return false;
+    }
+
+    // always use auto exposure/gain
+    mvret = xiSetParamInt( hmv, XI_PRM_AEAG, 1);
+    if(mvret != XI_OK) goto error;
+
+    // always use auto white ballance
+    mvret = xiSetParamInt( hmv, XI_PRM_AUTO_WB, 1);
+    if(mvret != XI_OK) goto error;
+
+    mvret = xiGetParamInt( hmv, XI_PRM_WIDTH, &width);
+    if(mvret != XI_OK) goto error;
+
+    mvret = xiGetParamInt( hmv, XI_PRM_HEIGHT, &height);
+    if(mvret != XI_OK) goto error;
+
+    // default image format RGB24
+    format = XI_RGB24;
+    mvret = xiSetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, format);
+    if(mvret != XI_OK) goto error;
+
+    // allocate frame buffer for RGB24 image
+    frame = cvCreateImage(cvSize( width, height), IPL_DEPTH_8U, 3);
+
+    //default capture timeout 10s
+    timeout = 10000;
+
+    mvret = xiStartAcquisition(hmv);
+    if(mvret != XI_OK)
+    {
+        errMsg("StartAcquisition XI_DEVICE failed", mvret);
+        goto error;
+    }
+
+    return true;
+
+error:
+    xiCloseDevice(hmv);
+    hmv = NULL;
+    return false;
 }
 
 /**********************************************************************************/
 
 void CvCaptureCAM_XIMEA::close()
 {
-       xiCloseDevice(hmv);
-       hmv = NULL;
+    xiStopAcquisition(hmv);
+    xiCloseDevice(hmv);
+    hmv = NULL;
 }
 
 /**********************************************************************************/
 
 bool CvCaptureCAM_XIMEA::grabFrame()
 {
-       int mvret = XI_OK;
-       image.size = sizeof(XI_IMG);
-       if((mvret = xiGetImage( hmv, timeout, &image)) != XI_OK)
-  {
-               errMsg("Error during GetImage", mvret);
-               return false;
-       }
+    image.size = sizeof(XI_IMG);
+    int mvret = xiGetImage( hmv, timeout, &image);
+
+    if(mvret == MM40_ACQUISITION_STOPED)
+    {
+        xiStartAcquisition(hmv);
+        mvret = xiGetImage(hmv, timeout, &image);
+    }
+
+    if(mvret != XI_OK)
+    {
+        errMsg("Error during GetImage", mvret);
+        return false;
+    }
+
     return true;
 }
 
@@ -118,136 +147,150 @@ bool CvCaptureCAM_XIMEA::grabFrame()
 
 IplImage* CvCaptureCAM_XIMEA::retrieveFrame(int)
 {
-       // update cvImage after format has changed
-       if( image.width != width || image.height != height || image.frm != format)
-       {
-               cvReleaseImage(&frame);
-               switch( image.frm)
-               {
-               case XI_MONO8  : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 1); break;
-               case XI_MONO16 : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_16U, 1); break; 
-               case XI_RGB24  : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 3); break;
-               case XI_RGB32  : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 4); break;
-               }
-               // update global image format
-               format = image.frm;     
-               width = image.width;
-               height = image.height;
-       }
-
-       // copy pixel data
-       switch( image.frm)
-       {
-       case XI_MONO8  : memcpy( frame->imageData, image.bp, image.width*image.height); break;
-       case XI_MONO16 : memcpy( frame->imageData, image.bp, image.width*image.height*sizeof(WORD)); break;
-       case XI_RGB24  : memcpy( frame->imageData, image.bp, image.width*image.height*3); break;
-       case XI_RGB32  : memcpy( frame->imageData, image.bp, image.width*image.height*sizeof(DWORD)); break;
-       }
-       return frame;
+    // update cvImage after format has changed
+    if( (int)image.width != width || (int)image.height != height || image.frm != (XI_IMG_FORMAT)format)
+    {
+        cvReleaseImage(&frame);
+        switch( image.frm)
+        {
+        case XI_MONO8  : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 1); break;
+        case XI_MONO16 : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_16U, 1); break;
+        case XI_RGB24  : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 3); break;
+        case XI_RGB32  : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 4); break;
+        default :
+            return frame;
+        }
+        // update global image format
+        format = image.frm;
+        width = image.width;
+        height = image.height;
+    }
+
+    // copy pixel data
+    switch( image.frm)
+    {
+    case XI_MONO8  : memcpy( frame->imageData, image.bp, image.width*image.height); break;
+    case XI_MONO16 : memcpy( frame->imageData, image.bp, image.width*image.height*sizeof(WORD)); break;
+    case XI_RGB24  : memcpy( frame->imageData, image.bp, image.width*image.height*3); break;
+    case XI_RGB32  : memcpy( frame->imageData, image.bp, image.width*image.height*sizeof(DWORD)); break;
+    default: break;
+    }
+    return frame;
 }
 
 /**********************************************************************************/
 
 double CvCaptureCAM_XIMEA::getProperty( int property_id )
 {
-       if(hmv == NULL)
-               return 0;
-
-       int ival = 0;
-       float fval = 0;
-
-       switch( property_id )
-  {
-       // OCV parameters
-  case CV_CAP_PROP_POS_FRAMES   : return (double) image.nframe;
-  case CV_CAP_PROP_FRAME_WIDTH  : xiGetParamInt( hmv, XI_PRM_WIDTH, &ival); return ival;
-  case CV_CAP_PROP_FRAME_HEIGHT : xiGetParamInt( hmv, XI_PRM_HEIGHT, &ival); return ival;
-  case CV_CAP_PROP_FPS          : xiGetParamFloat( hmv, XI_PRM_FRAMERATE, &fval); return fval;
-  case CV_CAP_PROP_GAIN         : xiGetParamFloat( hmv, XI_PRM_GAIN, &fval); return fval;
-  case CV_CAP_PROP_EXPOSURE     : xiGetParamInt( hmv, XI_PRM_EXPOSURE, &ival); return ival;
-
-       // XIMEA camera properties
-       case CV_CAP_PROP_XI_DOWNSAMPLING  : xiGetParamInt( hmv, XI_PRM_DOWNSAMPLING, &ival); return ival;
-       case CV_CAP_PROP_XI_DATA_FORMAT   : xiGetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, &ival); return ival;
-       case CV_CAP_PROP_XI_OFFSET_X      : xiGetParamInt( hmv, XI_PRM_OFFSET_X, &ival); return ival;
-       case CV_CAP_PROP_XI_OFFSET_Y      : xiGetParamInt( hmv, XI_PRM_OFFSET_Y, &ival); return ival;
-       case CV_CAP_PROP_XI_TRG_SOURCE    : xiGetParamInt( hmv, XI_PRM_TRG_SOURCE, &ival); return ival;
-       case CV_CAP_PROP_XI_GPI_SELECTOR  : xiGetParamInt( hmv, XI_PRM_GPI_SELECTOR, &ival); return ival;
-       case CV_CAP_PROP_XI_GPI_MODE      : xiGetParamInt( hmv, XI_PRM_GPI_MODE, &ival); return ival;
-       case CV_CAP_PROP_XI_GPI_LEVEL     : xiGetParamInt( hmv, XI_PRM_GPI_LEVEL, &ival); return ival;
-       case CV_CAP_PROP_XI_GPO_SELECTOR  : xiGetParamInt( hmv, XI_PRM_GPO_SELECTOR, &ival); return ival;
-       case CV_CAP_PROP_XI_GPO_MODE      : xiGetParamInt( hmv, XI_PRM_GPO_MODE, &ival); return ival;
-       case CV_CAP_PROP_XI_LED_SELECTOR  : xiGetParamInt( hmv, XI_PRM_LED_SELECTOR, &ival); return ival;
-       case CV_CAP_PROP_XI_LED_MODE      : xiGetParamInt( hmv, XI_PRM_LED_MODE, &ival); return ival;
-       case CV_CAP_PROP_XI_AUTO_WB       : xiGetParamInt( hmv, XI_PRM_AUTO_WB, &ival); return ival;
-       case CV_CAP_PROP_XI_AEAG          : xiGetParamInt( hmv, XI_PRM_AEAG, &ival); return ival;
-       case CV_CAP_PROP_XI_EXP_PRIORITY  : xiGetParamFloat( hmv, XI_PRM_EXP_PRIORITY, &fval); return fval;
-       case CV_CAP_PROP_XI_AE_MAX_LIMIT  : xiGetParamInt( hmv, XI_PRM_EXP_PRIORITY, &ival); return ival;
-       case CV_CAP_PROP_XI_AG_MAX_LIMIT  : xiGetParamFloat( hmv, XI_PRM_AG_MAX_LIMIT, &fval); return fval;
-       case CV_CAP_PROP_XI_AEAG_LEVEL    : xiGetParamInt( hmv, XI_PRM_AEAG_LEVEL, &ival); return ival;
-       case CV_CAP_PROP_XI_TIMEOUT       : return timeout;
-  }
-       return 0;
+    if(hmv == NULL)
+        return 0;
+
+    int ival = 0;
+    float fval = 0;
+
+    switch( property_id )
+    {
+    // OCV parameters
+    case CV_CAP_PROP_POS_FRAMES   : return (double) image.nframe;
+    case CV_CAP_PROP_FRAME_WIDTH  : xiGetParamInt( hmv, XI_PRM_WIDTH, &ival); return ival;
+    case CV_CAP_PROP_FRAME_HEIGHT : xiGetParamInt( hmv, XI_PRM_HEIGHT, &ival); return ival;
+    case CV_CAP_PROP_FPS          : xiGetParamFloat( hmv, XI_PRM_FRAMERATE, &fval); return fval;
+    case CV_CAP_PROP_GAIN         : xiGetParamFloat( hmv, XI_PRM_GAIN, &fval); return fval;
+    case CV_CAP_PROP_EXPOSURE     : xiGetParamInt( hmv, XI_PRM_EXPOSURE, &ival); return ival;
+
+    // XIMEA camera properties
+    case CV_CAP_PROP_XI_DOWNSAMPLING  : xiGetParamInt( hmv, XI_PRM_DOWNSAMPLING, &ival); return ival;
+    case CV_CAP_PROP_XI_DATA_FORMAT   : xiGetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, &ival); return ival;
+    case CV_CAP_PROP_XI_OFFSET_X      : xiGetParamInt( hmv, XI_PRM_OFFSET_X, &ival); return ival;
+    case CV_CAP_PROP_XI_OFFSET_Y      : xiGetParamInt( hmv, XI_PRM_OFFSET_Y, &ival); return ival;
+    case CV_CAP_PROP_XI_TRG_SOURCE    : xiGetParamInt( hmv, XI_PRM_TRG_SOURCE, &ival); return ival;
+    case CV_CAP_PROP_XI_GPI_SELECTOR  : xiGetParamInt( hmv, XI_PRM_GPI_SELECTOR, &ival); return ival;
+    case CV_CAP_PROP_XI_GPI_MODE      : xiGetParamInt( hmv, XI_PRM_GPI_MODE, &ival); return ival;
+    case CV_CAP_PROP_XI_GPI_LEVEL     : xiGetParamInt( hmv, XI_PRM_GPI_LEVEL, &ival); return ival;
+    case CV_CAP_PROP_XI_GPO_SELECTOR  : xiGetParamInt( hmv, XI_PRM_GPO_SELECTOR, &ival); return ival;
+    case CV_CAP_PROP_XI_GPO_MODE      : xiGetParamInt( hmv, XI_PRM_GPO_MODE, &ival); return ival;
+    case CV_CAP_PROP_XI_LED_SELECTOR  : xiGetParamInt( hmv, XI_PRM_LED_SELECTOR, &ival); return ival;
+    case CV_CAP_PROP_XI_LED_MODE      : xiGetParamInt( hmv, XI_PRM_LED_MODE, &ival); return ival;
+    case CV_CAP_PROP_XI_AUTO_WB       : xiGetParamInt( hmv, XI_PRM_AUTO_WB, &ival); return ival;
+    case CV_CAP_PROP_XI_AEAG          : xiGetParamInt( hmv, XI_PRM_AEAG, &ival); return ival;
+    case CV_CAP_PROP_XI_EXP_PRIORITY  : xiGetParamFloat( hmv, XI_PRM_EXP_PRIORITY, &fval); return fval;
+    case CV_CAP_PROP_XI_AE_MAX_LIMIT  : xiGetParamInt( hmv, XI_PRM_EXP_PRIORITY, &ival); return ival;
+    case CV_CAP_PROP_XI_AG_MAX_LIMIT  : xiGetParamFloat( hmv, XI_PRM_AG_MAX_LIMIT, &fval); return fval;
+    case CV_CAP_PROP_XI_AEAG_LEVEL    : xiGetParamInt( hmv, XI_PRM_AEAG_LEVEL, &ival); return ival;
+    case CV_CAP_PROP_XI_TIMEOUT       : return timeout;
+
+    }
+    return 0;
 }
 
 /**********************************************************************************/
 
 bool CvCaptureCAM_XIMEA::setProperty( int property_id, double value )
-{ 
-       int ival = (int) value; 
-       float fval = (float) value;
-       
-       int mvret = XI_OK;
-       
-       switch(property_id)
-       {
-       // OCV parameters
-    case CV_CAP_PROP_FRAME_WIDTH  : mvret = xiSetParamInt( hmv, XI_PRM_WIDTH, ival); break;
-    case CV_CAP_PROP_FRAME_HEIGHT : mvret = xiSetParamInt( hmv, XI_PRM_HEIGHT, ival); break;
+{
+    int ival = (int) value;
+    float fval = (float) value;
+
+    int mvret = XI_OK;
+
+    switch(property_id)
+    {
+    // OCV parameters
+    case CV_CAP_PROP_FRAME_WIDTH  : mvret = xiSetParamInt( hmv, XI_PRM_WIDTH, ival);
+        if(mvret == XI_OK) width = ival;
+        break;
+    case CV_CAP_PROP_FRAME_HEIGHT : mvret = xiSetParamInt( hmv, XI_PRM_HEIGHT, ival);
+        if(mvret == XI_OK) height = ival;
+        break;
     case CV_CAP_PROP_FPS          : mvret = xiSetParamFloat( hmv, XI_PRM_FRAMERATE, fval); break;
-       case CV_CAP_PROP_GAIN         : mvret = xiSetParamFloat( hmv, XI_PRM_GAIN, fval); break;
-       case CV_CAP_PROP_EXPOSURE     : mvret = xiSetParamInt( hmv, XI_PRM_EXPOSURE, ival); break;
-       // XIMEA camera properties
-       case CV_CAP_PROP_XI_DOWNSAMPLING  :  mvret = xiSetParamInt( hmv, XI_PRM_DOWNSAMPLING, ival); break;
-       case CV_CAP_PROP_XI_DATA_FORMAT   : mvret = xiSetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, ival); break;
-       case CV_CAP_PROP_XI_OFFSET_X      : mvret = xiSetParamInt( hmv, XI_PRM_OFFSET_X, ival); break;
-       case CV_CAP_PROP_XI_OFFSET_Y      : mvret = xiSetParamInt( hmv, XI_PRM_OFFSET_Y, ival); break;
-       case CV_CAP_PROP_XI_TRG_SOURCE    : mvret = xiSetParamInt( hmv, XI_PRM_TRG_SOURCE, ival); break;
-       case CV_CAP_PROP_XI_GPI_SELECTOR  : mvret = xiSetParamInt( hmv, XI_PRM_GPI_SELECTOR, ival); break;
-       case CV_CAP_PROP_XI_TRG_SOFTWARE  : mvret = xiSetParamInt( hmv, XI_PRM_TRG_SOURCE, 1); break;           
-       case CV_CAP_PROP_XI_GPI_MODE      : mvret = xiSetParamInt( hmv, XI_PRM_GPI_MODE, ival); break; 
-       case CV_CAP_PROP_XI_GPI_LEVEL     : mvret = xiSetParamInt( hmv, XI_PRM_GPI_LEVEL, ival); break;
-       case CV_CAP_PROP_XI_GPO_SELECTOR  : mvret = xiSetParamInt( hmv, XI_PRM_GPO_SELECTOR, ival); break;
-       case CV_CAP_PROP_XI_GPO_MODE      : mvret = xiSetParamInt( hmv, XI_PRM_GPO_MODE, ival); break; 
-       case CV_CAP_PROP_XI_LED_SELECTOR  : mvret = xiSetParamInt( hmv, XI_PRM_LED_SELECTOR, ival); break;
-       case CV_CAP_PROP_XI_LED_MODE      : mvret = xiSetParamInt( hmv, XI_PRM_LED_MODE, ival); break; 
-       case CV_CAP_PROP_XI_AUTO_WB       : mvret = xiSetParamInt( hmv, XI_PRM_AUTO_WB, ival); break;
-       case CV_CAP_PROP_XI_MANUAL_WB     : mvret = xiSetParamInt( hmv, XI_PRM_LED_MODE, ival); break;
-       case CV_CAP_PROP_XI_AEAG          : mvret = xiSetParamInt( hmv, XI_PRM_AEAG, ival); break;
-       case CV_CAP_PROP_XI_EXP_PRIORITY  : mvret = xiSetParamFloat( hmv, XI_PRM_EXP_PRIORITY, fval); break; 
-       case CV_CAP_PROP_XI_AE_MAX_LIMIT  : mvret = xiSetParamInt( hmv, XI_PRM_EXP_PRIORITY, ival); break;
-       case CV_CAP_PROP_XI_AG_MAX_LIMIT  : mvret = xiSetParamFloat( hmv, XI_PRM_AG_MAX_LIMIT, fval); break;
-       case CV_CAP_PROP_XI_AEAG_LEVEL    : mvret = xiSetParamInt( hmv, XI_PRM_AEAG_LEVEL, ival); break; 
-       case CV_CAP_PROP_XI_TIMEOUT       : timeout = ival; break;
-       }
-
-       if(mvret != XI_OK)
-  {
-               errMsg("Set parameter error", mvret);
-               return false;
-       } 
-  else
-               return true; 
-               
+    case CV_CAP_PROP_GAIN         : mvret = xiSetParamFloat( hmv, XI_PRM_GAIN, fval); break;
+    case CV_CAP_PROP_EXPOSURE     : mvret = xiSetParamInt( hmv, XI_PRM_EXPOSURE, ival); break;
+    // XIMEA camera properties
+    case CV_CAP_PROP_XI_DOWNSAMPLING  : mvret = xiSetParamInt( hmv, XI_PRM_DOWNSAMPLING, ival); break;
+    case CV_CAP_PROP_XI_DATA_FORMAT   : mvret = xiSetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, ival);
+        if(mvret == XI_OK) format = ival;
+        break;
+    case CV_CAP_PROP_XI_OFFSET_X      : mvret = xiSetParamInt( hmv, XI_PRM_OFFSET_X, ival); break;
+    case CV_CAP_PROP_XI_OFFSET_Y      : mvret = xiSetParamInt( hmv, XI_PRM_OFFSET_Y, ival); break;
+    case CV_CAP_PROP_XI_TRG_SOURCE    : mvret = xiSetParamInt( hmv, XI_PRM_TRG_SOURCE, ival); break;
+    case CV_CAP_PROP_XI_GPI_SELECTOR  : mvret = xiSetParamInt( hmv, XI_PRM_GPI_SELECTOR, ival); break;
+    case CV_CAP_PROP_XI_TRG_SOFTWARE  : mvret = xiSetParamInt( hmv, XI_PRM_TRG_SOURCE, 1); break;
+    case CV_CAP_PROP_XI_GPI_MODE      : mvret = xiSetParamInt( hmv, XI_PRM_GPI_MODE, ival); break;
+    case CV_CAP_PROP_XI_GPI_LEVEL     : mvret = xiSetParamInt( hmv, XI_PRM_GPI_LEVEL, ival); break;
+    case CV_CAP_PROP_XI_GPO_SELECTOR  : mvret = xiSetParamInt( hmv, XI_PRM_GPO_SELECTOR, ival); break;
+    case CV_CAP_PROP_XI_GPO_MODE      : mvret = xiSetParamInt( hmv, XI_PRM_GPO_MODE, ival); break;
+    case CV_CAP_PROP_XI_LED_SELECTOR  : mvret = xiSetParamInt( hmv, XI_PRM_LED_SELECTOR, ival); break;
+    case CV_CAP_PROP_XI_LED_MODE      : mvret = xiSetParamInt( hmv, XI_PRM_LED_MODE, ival); break;
+    case CV_CAP_PROP_XI_AUTO_WB       : mvret = xiSetParamInt( hmv, XI_PRM_AUTO_WB, ival); break;
+    case CV_CAP_PROP_XI_MANUAL_WB     : mvret = xiSetParamInt( hmv, XI_PRM_LED_MODE, ival); break;
+    case CV_CAP_PROP_XI_AEAG          : mvret = xiSetParamInt( hmv, XI_PRM_AEAG, ival); break;
+    case CV_CAP_PROP_XI_EXP_PRIORITY  : mvret = xiSetParamFloat( hmv, XI_PRM_EXP_PRIORITY, fval); break;
+    case CV_CAP_PROP_XI_AE_MAX_LIMIT  : mvret = xiSetParamInt( hmv, XI_PRM_EXP_PRIORITY, ival); break;
+    case CV_CAP_PROP_XI_AG_MAX_LIMIT  : mvret = xiSetParamFloat( hmv, XI_PRM_AG_MAX_LIMIT, fval); break;
+    case CV_CAP_PROP_XI_AEAG_LEVEL    : mvret = xiSetParamInt( hmv, XI_PRM_AEAG_LEVEL, ival); break;
+    case CV_CAP_PROP_XI_TIMEOUT       : timeout = ival; break;
+    }
+
+    if(mvret != XI_OK)
+    {
+        errMsg("Set parameter error", mvret);
+        return false;
+    }
+    else
+        return true;
+
 }
 
 /**********************************************************************************/
 
-void CvCaptureCAM_XIMEA::errMsg(char* msg, int errNum)
+void CvCaptureCAM_XIMEA::errMsg(const char* msg, int errNum)
 {
-       char buf[512];
-       sprintf( buf, "%s : %d\n", msg, errNum);
-       OutputDebugString(buf);
+#if defined WIN32 || defined _WIN32
+    char buf[512];
+    sprintf( buf, "%s : %d\n", msg, errNum);
+    OutputDebugString(buf);
+#else
+    fprintf(stderr, "%s : %d\n", msg, errNum);
+#endif
 }
 
 /**********************************************************************************/
\ No newline at end of file
index 518ff79..fb32e01 100644 (file)
-/*M///////////////////////////////////////////////////////////////////////////////////////\r
-//\r
-//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r
-//\r
-//  By downloading, copying, installing or using the software you agree to this license.\r
-//  If you do not agree to this license, do not download, install,\r
-//  copy or use the software.\r
-//\r
-//\r
-//                           License Agreement\r
-//                For Open Source Computer Vision Library\r
-//\r
-// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.\r
-// Copyright (C) 2009, Willow Garage Inc., all rights reserved.\r
-// Third party copyrights are property of their respective owners.\r
-//\r
-// Redistribution and use in source and binary forms, with or without modification,\r
-// are permitted provided that the following conditions are met:\r
-//\r
-//   * Redistribution's of source code must retain the above copyright notice,\r
-//     this list of conditions and the following disclaimer.\r
-//\r
-//   * Redistribution's in binary form must reproduce the above copyright notice,\r
-//     this list of conditions and the following disclaimer in the documentation\r
-//     and/or other materials provided with the distribution.\r
-//\r
-//   * The name of the copyright holders may not be used to endorse or promote products\r
-//     derived from this software without specific prior written permission.\r
-//\r
-// This software is provided by the copyright holders and contributors "as is" and\r
-// any express or implied warranties, including, but not limited to, the implied\r
-// warranties of merchantability and fitness for a particular purpose are disclaimed.\r
-// In no event shall the Intel Corporation or contributors be liable for any direct,\r
-// indirect, incidental, special, exemplary, or consequential damages\r
-// (including, but not limited to, procurement of substitute goods or services;\r
-// loss of use, data, or profits; or business interruption) however caused\r
-// and on any theory of liability, whether in contract, strict liability,\r
-// or tort (including negligence or otherwise) arising in any way out of\r
-// the use of this software, even if advised of the possibility of such damage.\r
-//\r
-//M*/\r
-\r
-#include "test_precomp.hpp"\r
-#include "opencv2/highgui/highgui.hpp"\r
-\r
-#ifdef HAVE_FFMPEG\r
-\r
-#include "ffmpeg_codecs.hpp"\r
-\r
-using namespace cv;\r
-using namespace std;\r
-\r
-class CV_FFmpegWriteBigVideoTest : public cvtest::BaseTest\r
-{\r
-public:\r
-    void run(int)\r
-    {\r
-        const int img_r = 4096;\r
-        const int img_c = 4096;\r
-        const double fps0 = 15;\r
-        const double time_sec = 1;\r
-        \r
-        const size_t n = sizeof(codec_bmp_tags)/sizeof(codec_bmp_tags[0]);\r
-\r
-        bool created = false;\r
-\r
-        for (size_t j = 0; j < n; ++j)\r
-        {\r
-        stringstream s; s << codec_bmp_tags[j].tag;\r
-        int tag = codec_bmp_tags[j].tag;\r
-        \r
-        if( tag != MKTAG('H', '2', '6', '3') &&\r
-            tag != MKTAG('H', '2', '6', '1') &&\r
-            //tag != MKTAG('D', 'I', 'V', 'X') &&\r
-            tag != MKTAG('D', 'X', '5', '0') &&\r
-            tag != MKTAG('X', 'V', 'I', 'D') &&\r
-            tag != MKTAG('m', 'p', '4', 'v') &&\r
-            //tag != MKTAG('D', 'I', 'V', '3') &&\r
-            //tag != MKTAG('W', 'M', 'V', '1') &&\r
-            //tag != MKTAG('W', 'M', 'V', '2') &&\r
-            tag != MKTAG('M', 'P', 'E', 'G') &&\r
-            tag != MKTAG('M', 'J', 'P', 'G') &&\r
-            //tag != MKTAG('j', 'p', 'e', 'g') &&\r
-            tag != 0 &&\r
-            tag != MKTAG('I', '4', '2', '0') &&\r
-            //tag != MKTAG('Y', 'U', 'Y', '2') &&\r
-            tag != MKTAG('F', 'L', 'V', '1') )\r
-            continue;\r
-\r
-        const string filename = "output_"+s.str()+".avi";\r
-\r
-        try\r
-        {\r
-            double fps = fps0;\r
-            Size frame_s = Size(img_c, img_r);\r
-            \r
-            if( tag == CV_FOURCC('H', '2', '6', '1') )\r
-                frame_s = Size(352, 288);\r
-            else if( tag == CV_FOURCC('H', '2', '6', '3') )\r
-                frame_s = Size(704, 576);\r
-            /*else if( tag == CV_FOURCC('M', 'J', 'P', 'G') ||\r
-                     tag == CV_FOURCC('j', 'p', 'e', 'g') )\r
-                frame_s = Size(1920, 1080);*/\r
-            \r
-            if( tag == CV_FOURCC('M', 'P', 'E', 'G') )\r
-                fps = 25;\r
-            \r
-            VideoWriter writer(filename, tag, fps, frame_s);\r
-\r
-            if (writer.isOpened() == false)\r
-            {\r
-                ts->printf(ts->LOG, "\n\nFile name: %s\n", filename.c_str());\r
-                ts->printf(ts->LOG, "Codec id: %d   Codec tag: %c%c%c%c\n", j,\r
-                           tag & 255, (tag >> 8) & 255, (tag >> 16) & 255, (tag >> 24) & 255);\r
-                ts->printf(ts->LOG, "Error: cannot create video file.");\r
-                ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);\r
-            }\r
-            else\r
-            {\r
-                Mat img(frame_s, CV_8UC3, Scalar::all(0));\r
-                const int coeff = cvRound(cv::min(frame_s.width, frame_s.height)/(fps0 * time_sec));\r
-\r
-                for (int i = 0 ; i < static_cast<int>(fps * time_sec); i++ )\r
-                {\r
-                    //circle(img, Point2i(img_c / 2, img_r / 2), cv::min(img_r, img_c) / 2 * (i + 1), Scalar(255, 0, 0, 0), 2);\r
-                    rectangle(img, Point2i(coeff * i, coeff * i), Point2i(coeff * (i + 1), coeff * (i + 1)),\r
-                              Scalar::all(255 * (1.0 - static_cast<double>(i) / (fps * time_sec * 2) )), -1);\r
-                    writer << img;\r
-                }\r
-\r
-                if (!created) created = true;\r
-                else remove(filename.c_str());\r
-            }\r
-        }\r
-        catch(...)\r
-        {\r
-            ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);\r
-        }\r
-        ts->set_failed_test_info(cvtest::TS::OK);\r
-\r
-        }\r
-    }\r
-};\r
-\r
-TEST(Highgui_Video, ffmpeg_writebig) { CV_FFmpegWriteBigVideoTest test; test.safe_run(); }\r
-\r
-class CV_FFmpegReadImageTest : public cvtest::BaseTest\r
-{\r
-public:\r
-    void run(int)\r
-    {\r
-        try\r
-        {\r
-            string filename = ts->get_data_path() + "../cv/features2d/tsukuba.png";\r
-            VideoCapture cap(filename);\r
-            Mat img0 = imread(filename, 1);\r
-            Mat img, img_next;\r
-            cap >> img;\r
-            cap >> img_next;\r
-            \r
-            CV_Assert( !img0.empty() && !img.empty() && img_next.empty() );\r
-            \r
-            double diff = norm(img0, img, CV_C);\r
-            CV_Assert( diff == 0 );\r
-        }\r
-        catch(...)\r
-        {\r
-            ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);\r
-        }\r
-        ts->set_failed_test_info(cvtest::TS::OK);\r
-    }\r
-};\r
-\r
-TEST(Highgui_Video, ffmpeg_image) { CV_FFmpegReadImageTest test; test.safe_run(); }\r
-\r
-#endif\r
+/*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.
+//
+//
+//                           License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+//   * Redistribution's of source code must retain the above copyright notice,
+//     this list of conditions and the following disclaimer.
+//
+//   * Redistribution's in binary form must reproduce the above copyright notice,
+//     this list of conditions and the following disclaimer in the documentation
+//     and/or other materials provided with the distribution.
+//
+//   * The name of the copyright holders may not be used to endorse or promote products
+//     derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#include "test_precomp.hpp"
+#include "opencv2/highgui/highgui.hpp"
+
+#ifdef HAVE_FFMPEG
+
+#include "ffmpeg_codecs.hpp"
+
+using namespace cv;
+using namespace std;
+
+class CV_FFmpegWriteBigVideoTest : public cvtest::BaseTest
+{
+public:
+    void run(int)
+    {
+        const int img_r = 4096;
+        const int img_c = 4096;
+        const double fps0 = 15;
+        const double time_sec = 1;
+
+        const size_t n = sizeof(codec_bmp_tags)/sizeof(codec_bmp_tags[0]);
+
+        bool created = false;
+
+        for (size_t j = 0; j < n; ++j)
+        {
+        stringstream s; s << codec_bmp_tags[j].tag;
+        int tag = codec_bmp_tags[j].tag;
+
+        if( tag != MKTAG('H', '2', '6', '3') &&
+            tag != MKTAG('H', '2', '6', '1') &&
+            //tag != MKTAG('D', 'I', 'V', 'X') &&
+            tag != MKTAG('D', 'X', '5', '0') &&
+            tag != MKTAG('X', 'V', 'I', 'D') &&
+            tag != MKTAG('m', 'p', '4', 'v') &&
+            //tag != MKTAG('D', 'I', 'V', '3') &&
+            //tag != MKTAG('W', 'M', 'V', '1') &&
+            //tag != MKTAG('W', 'M', 'V', '2') &&
+            tag != MKTAG('M', 'P', 'E', 'G') &&
+            tag != MKTAG('M', 'J', 'P', 'G') &&
+            //tag != MKTAG('j', 'p', 'e', 'g') &&
+            tag != 0 &&
+            tag != MKTAG('I', '4', '2', '0') &&
+            //tag != MKTAG('Y', 'U', 'Y', '2') &&
+            tag != MKTAG('F', 'L', 'V', '1') )
+            continue;
+
+        const string filename = "output_"+s.str()+".avi";
+
+        try
+        {
+            double fps = fps0;
+            Size frame_s = Size(img_c, img_r);
+
+            if( tag == CV_FOURCC('H', '2', '6', '1') )
+                frame_s = Size(352, 288);
+            else if( tag == CV_FOURCC('H', '2', '6', '3') )
+                frame_s = Size(704, 576);
+            /*else if( tag == CV_FOURCC('M', 'J', 'P', 'G') ||
+                     tag == CV_FOURCC('j', 'p', 'e', 'g') )
+                frame_s = Size(1920, 1080);*/
+
+            if( tag == CV_FOURCC('M', 'P', 'E', 'G') )
+                fps = 25;
+
+            VideoWriter writer(filename, tag, fps, frame_s);
+
+            if (writer.isOpened() == false)
+            {
+                ts->printf(ts->LOG, "\n\nFile name: %s\n", filename.c_str());
+                ts->printf(ts->LOG, "Codec id: %d   Codec tag: %c%c%c%c\n", j,
+                           tag & 255, (tag >> 8) & 255, (tag >> 16) & 255, (tag >> 24) & 255);
+                ts->printf(ts->LOG, "Error: cannot create video file.");
+                ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
+            }
+            else
+            {
+                Mat img(frame_s, CV_8UC3, Scalar::all(0));
+                const int coeff = cvRound(cv::min(frame_s.width, frame_s.height)/(fps0 * time_sec));
+
+                for (int i = 0 ; i < static_cast<int>(fps * time_sec); i++ )
+                {
+                    //circle(img, Point2i(img_c / 2, img_r / 2), cv::min(img_r, img_c) / 2 * (i + 1), Scalar(255, 0, 0, 0), 2);
+                    rectangle(img, Point2i(coeff * i, coeff * i), Point2i(coeff * (i + 1), coeff * (i + 1)),
+                              Scalar::all(255 * (1.0 - static_cast<double>(i) / (fps * time_sec * 2) )), -1);
+                    writer << img;
+                }
+
+                if (!created) created = true;
+                else remove(filename.c_str());
+            }
+        }
+        catch(...)
+        {
+            ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
+        }
+        ts->set_failed_test_info(cvtest::TS::OK);
+
+        }
+    }
+};
+
+TEST(Highgui_Video, ffmpeg_writebig) { CV_FFmpegWriteBigVideoTest test; test.safe_run(); }
+
+class CV_FFmpegReadImageTest : public cvtest::BaseTest
+{
+public:
+    void run(int)
+    {
+        try
+        {
+            string filename = ts->get_data_path() + "../cv/features2d/tsukuba.png";
+            VideoCapture cap(filename);
+            Mat img0 = imread(filename, 1);
+            Mat img, img_next;
+            cap >> img;
+            cap >> img_next;
+
+            CV_Assert( !img0.empty() && !img.empty() && img_next.empty() );
+
+            double diff = norm(img0, img, CV_C);
+            CV_Assert( diff == 0 );
+        }
+        catch(...)
+        {
+            ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
+        }
+        ts->set_failed_test_info(cvtest::TS::OK);
+    }
+};
+
+TEST(Highgui_Video, ffmpeg_image) { CV_FFmpegReadImageTest test; test.safe_run(); }
+
+#endif
index 5923b62..f590c63 100644 (file)
@@ -59,7 +59,7 @@ public:
             ts->printf(cvtest::TS::LOG, "finish reading big image\n");
             if (img.empty()) ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
             ts->printf(cvtest::TS::LOG, "start  writing big image\n");
-            imwrite(string(ts->get_data_path()) + "readwrite/write.png", img);
+            imwrite(cv::tempfile(".png"), img);
             ts->printf(cvtest::TS::LOG, "finish writing big image\n");
         }
         catch(...)
@@ -72,10 +72,14 @@ public:
 
 string ext_from_int(int ext)
 {
+#ifdef HAVE_PNG
     if (ext == 0) return ".png";
+#endif
     if (ext == 1) return ".bmp";
     if (ext == 2) return ".pgm";
+#ifdef HAVE_TIFF
     if (ext == 3) return ".tiff";
+#endif
     return "";
 }
 
@@ -92,16 +96,21 @@ public:
             for (int k = 1; k <= 5; ++k)
             {
                 for (int ext = 0; ext < 4; ++ext) // 0 - png, 1 - bmp, 2 - pgm, 3 - tiff
+                {
+                    if(ext_from_int(ext).empty())
+                        continue;
                     for (int num_channels = 1; num_channels <= 3; num_channels+=2)
                     {
                         ts->printf(ts->LOG, "image type depth:%d   channels:%d   ext: %s\n", CV_8U, num_channels, ext_from_int(ext).c_str());
                         Mat img(img_r * k, img_c * k, CV_MAKETYPE(CV_8U, num_channels), Scalar::all(0));
                         circle(img, Point2i((img_c * k) / 2, (img_r * k) / 2), cv::min((img_r * k), (img_c * k)) / 4 , Scalar::all(255));
-                        ts->printf(ts->LOG, "writing      image : %s\n", string(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext)).c_str());
-                        imwrite(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext), img);
-                        ts->printf(ts->LOG, "reading test image : %s\n", string(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext)).c_str());
 
-                        Mat img_test = imread(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext), CV_LOAD_IMAGE_UNCHANGED);
+                        string img_path = cv::tempfile(ext_from_int(ext).c_str());
+                        ts->printf(ts->LOG, "writing      image : %s\n", img_path.c_str());
+                        imwrite(img_path, img);
+
+                        ts->printf(ts->LOG, "reading test image : %s\n", img_path.c_str());
+                        Mat img_test = imread(img_path, CV_LOAD_IMAGE_UNCHANGED);
 
                         if (img_test.empty()) ts->set_failed_test_info(ts->FAIL_MISMATCH);
 
@@ -115,14 +124,17 @@ public:
                             ts->set_failed_test_info(ts->FAIL_MISMATCH);
                         }
                     }
+                }
 
+#ifdef HAVE_JPEG
                 for (int num_channels = 1; num_channels <= 3; num_channels+=2)
                 {
                     // jpeg
                     ts->printf(ts->LOG, "image type depth:%d   channels:%d   ext: %s\n", CV_8U, num_channels, ".jpg");
                     Mat img(img_r * k, img_c * k, CV_MAKETYPE(CV_8U, num_channels), Scalar::all(0));
                     circle(img, Point2i((img_c * k) / 2, (img_r * k) / 2), cv::min((img_r * k), (img_c * k)) / 4 , Scalar::all(255));
-                    string filename = string(ts->get_data_path() + "readwrite/test_" + char(k + 48) + "_c" + char(num_channels + 48) + "_.jpg");
+
+                    string filename = cv::tempfile(".jpg");
                     imwrite(filename, img);
                     img = imread(filename, CV_LOAD_IMAGE_UNCHANGED);
 
@@ -142,14 +154,17 @@ public:
                         ts->set_failed_test_info(ts->FAIL_MISMATCH);
                     }
                 }
+#endif
 
+#ifdef HAVE_TIFF
                 for (int num_channels = 1; num_channels <= 3; num_channels+=2)
                 {
                     // tiff
                     ts->printf(ts->LOG, "image type depth:%d   channels:%d   ext: %s\n", CV_16U, num_channels, ".tiff");
                     Mat img(img_r * k, img_c * k, CV_MAKETYPE(CV_16U, num_channels), Scalar::all(0));
                     circle(img, Point2i((img_c * k) / 2, (img_r * k) / 2), cv::min((img_r * k), (img_c * k)) / 4 , Scalar::all(255));
-                    string filename = string(ts->get_data_path() + "readwrite/test.tiff");
+
+                    string filename = cv::tempfile(".tiff");
                     imwrite(filename, img);
                     ts->printf(ts->LOG, "reading test image : %s\n", filename.c_str());
                     Mat img_test = imread(filename, CV_LOAD_IMAGE_UNCHANGED);
@@ -171,6 +186,7 @@ public:
                         ts->set_failed_test_info(ts->FAIL_MISMATCH);
                     }
                 }
+#endif
             }
         }
         catch(const cv::Exception & e)
@@ -205,9 +221,7 @@ public:
 TEST(Highgui_Image, write_big) { CV_GrfmtWriteBigImageTest      test; test.safe_run(); }
 #endif
 
-#if defined(HAVE_PNG) && defined(HAVE_TIFF) && defined(HAVE_JPEG)
 TEST(Highgui_Image, write_imageseq) { CV_GrfmtWriteSequenceImageTest test; test.safe_run(); }
-#endif
 
 TEST(Highgui_Image, read_bmp_rle8) { CV_GrfmtReadBMPRLE8Test test; test.safe_run(); }
 
index 3134b8e..e85fa5e 100644 (file)
@@ -155,7 +155,7 @@ void CV_HighGuiTest::ImageTest(const string& dir)
     for(size_t i = 0; i < ext_num; ++i)
     {
         string ext = exts[i];
-        string full_name = "img." + ext;
+        string full_name = cv::tempfile(ext.c_str());
         ts->printf(ts->LOG, " full_name : %s\n", full_name.c_str());
 
         imwrite(full_name, image);
@@ -225,7 +225,7 @@ void CV_HighGuiTest::ImageTest(const string& dir)
 void CV_HighGuiTest::VideoTest(const string& dir, const cvtest::VideoFormat& fmt)
 {
     string src_file = dir + "../cv/shared/video_for_test.avi";
-    string tmp_name = format("video_%s.%s", cvtest::fourccToString(fmt.fourcc).c_str(), fmt.ext.c_str());
+    string tmp_name = cv::tempfile((cvtest::fourccToString(fmt.fourcc) + "."  + fmt.ext).c_str());
 
     ts->printf(ts->LOG, "reading video : %s and converting it to %s\n", src_file.c_str(), tmp_name.c_str());
 
@@ -291,8 +291,8 @@ void CV_HighGuiTest::VideoTest(const string& dir, const cvtest::VideoFormat& fmt
         if (psnr < thresDbell)
         {
             printf("Too low psnr = %gdb\n", psnr);
-            imwrite("img.png", img);
-            imwrite("img1.png", img1);
+            // imwrite("img.png", img);
+            // imwrite("img1.png", img1);
             ts->set_failed_test_info(ts->FAIL_MISMATCH);
             break;
         }
@@ -323,7 +323,7 @@ void CV_HighGuiTest::SpecificImageTest(const string& dir)
 
         stringstream s_digit; s_digit << i;
 
-        string full_name = "img_"+s_digit.str()+".bmp";
+        string full_name = cv::tempfile((s_digit.str() + ".bmp").c_str());
         ts->printf(ts->LOG, " full_name : %s\n", full_name.c_str());
 
         imwrite(full_name, image);
@@ -395,7 +395,7 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor
     int fourcc = fmt.fourcc;
 
     string fourcc_str = cvtest::fourccToString(fourcc);
-    const string video_file = "video_" + fourcc_str + "." + ext;
+    const string video_file = cv::tempfile((fourcc_str + "." + ext).c_str());
 
     Size frame_size(968 & -2, 757 & -2);
     VideoWriter writer(video_file, fourcc, 25, frame_size, true);
index d350b45..92904f5 100755 (executable)
@@ -53,29 +53,27 @@ public:
     {
         framesize = Size(640, 480);
     }
-    
+
     Mat drawFrame(int i)
     {
         Mat mat = Mat::zeros(framesize, CV_8UC3);
-        
+
         mat = Scalar(fabs(cos(i*0.08)*255), fabs(sin(i*0.05)*255), i);
         putText(mat, format("%03d", i), Point(10, 350), 0, 10, Scalar(128, 255, 255), 15);
         return mat;
     }
-    
+
     string getFilename(const cvtest::VideoFormat& fmt)
     {
-        return format("test_video_%s.%s", cvtest::fourccToString(fmt.fourcc).c_str(), fmt.ext.c_str());
+        return cv::tempfile((cvtest::fourccToString(fmt.fourcc) + "." + fmt.ext).c_str());
     }
-    
-    bool CreateTestVideo(const cvtest::VideoFormat& fmt, int framecount)
+
+    bool CreateTestVideo(const cvtest::VideoFormat& fmt, int framecount, string filename)
     {
-        string filename = getFilename(fmt);
-        
         VideoWriter writer(filename, fmt.fourcc, 25, framesize, true);
         if( !writer.isOpened() )
             return false;
-        
+
         for (int i = 0; i < framecount; ++i)
         {
             Mat img = drawFrame(i);
@@ -87,7 +85,7 @@ public:
     void run(int)
     {
         int n_frames = 100;
-        
+
         for( int testcase = 0; ; testcase++ )
         {
             const cvtest::VideoFormat& fmt = cvtest::g_specific_fmt_list[testcase];
@@ -96,82 +94,82 @@ public:
             string filename = getFilename(fmt);
             ts->printf(ts->LOG, "\nFile: %s\n", filename.c_str());
 
-            if( !CreateTestVideo(fmt, n_frames) )
+            if( !CreateTestVideo(fmt, n_frames, filename) )
             {
                 ts->printf(ts->LOG, "\nError: cannot create video file");
                 ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
                 return;
             }
-                
+
             VideoCapture cap(filename);
-            
+
             if (!cap.isOpened())
             {
                 ts->printf(ts->LOG, "\nError: cannot read video file.");
                 ts->set_failed_test_info(ts->FAIL_INVALID_TEST_DATA);
                 return;
             }
-            
+
             int N0 = (int)cap.get(CV_CAP_PROP_FRAME_COUNT);
             cap.set(CV_CAP_PROP_POS_FRAMES, 0);
             int N = (int)cap.get(CV_CAP_PROP_FRAME_COUNT);
-                                
+
             if (N != n_frames || N != N0)
             {
                 ts->printf(ts->LOG, "\nError: returned frame count (N0=%d, N=%d) is different from the reference number %d\n", N0, N, n_frames);
                 ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
                 return;
             }
-            
+
             for (int k = 0; k < N; ++k)
             {
                 int idx = theRNG().uniform(0, N);
-                
+
                 if( !cap.set(CV_CAP_PROP_POS_FRAMES, idx) )
                 {
                     ts->printf(ts->LOG, "\nError: cannot seek to frame %d.\n", idx);
                     ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
                     return;
                 }
-                
+
                 int idx1 = (int)cap.get(CV_CAP_PROP_POS_FRAMES);
-                
+
                 Mat img; cap >> img;
                 Mat img0 = drawFrame(idx);
-                
+
                 if( idx != idx1 )
                 {
                     ts->printf(ts->LOG, "\nError: the current position (%d) after seek is different from specified (%d)\n",
                                idx1, idx);
                     ts->printf(ts->LOG, "Saving both frames ...\n");
                     ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
-                    imwrite("opencv_test_highgui_postest_actual.png", img);
-                    imwrite("opencv_test_highgui_postest_expected.png", img0);
+                    // imwrite("opencv_test_highgui_postest_actual.png", img);
+                    // imwrite("opencv_test_highgui_postest_expected.png", img0);
                     return;
                 }
-                
+
                 if (img.empty())
                 {
                     ts->printf(ts->LOG, "\nError: cannot read a frame at position %d.\n", idx);
                     ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
                     return;
                 }
-                
+
                 double err = PSNR(img, img0);
-                
+
                 if( err < 20 )
                 {
                     ts->printf(ts->LOG, "The frame read after positioning to %d is incorrect (PSNR=%g)\n", idx, err);
                     ts->printf(ts->LOG, "Saving both frames ...\n");
                     ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
-                    imwrite("opencv_test_highgui_postest_actual.png", img);
-                    imwrite("opencv_test_highgui_postest_expected.png", img0);
+                    // imwrite("opencv_test_highgui_postest_actual.png", img);
+                    // imwrite("opencv_test_highgui_postest_expected.png", img0);
                     return;
                 }
             }
         }
     }
-    
+
     Size framesize;
 };
 
index fb4ff58..caf2f58 100644 (file)
@@ -52,10 +52,10 @@ class CV_GrabcutTest : public cvtest::BaseTest
 {
 public:
     CV_GrabcutTest();
-    ~CV_GrabcutTest();    
+    ~CV_GrabcutTest();
 protected:
     bool verify(const Mat& mask, const Mat& exp);
-    void run(int);    
+    void run(int);
 };
 
 CV_GrabcutTest::CV_GrabcutTest() {}
@@ -73,29 +73,29 @@ bool CV_GrabcutTest::verify(const Mat& mask, const Mat& exp)
 }
 
 void CV_GrabcutTest::run( int /* start_from */)
-{       
+{
     cvtest::DefaultRngAuto defRng;
-        
-    Mat img = imread(string(ts->get_data_path()) + "shared/airplane.jpg");    
+
+    Mat img = imread(string(ts->get_data_path()) + "shared/airplane.jpg");
     Mat mask_prob = imread(string(ts->get_data_path()) + "grabcut/mask_prob.png", 0);
     Mat exp_mask1 = imread(string(ts->get_data_path()) + "grabcut/exp_mask1.png", 0);
     Mat exp_mask2 = imread(string(ts->get_data_path()) + "grabcut/exp_mask2.png", 0);
-    
+
     if (img.empty() || (!mask_prob.empty() && img.size() != mask_prob.size()) ||
                        (!exp_mask1.empty() && img.size() != exp_mask1.size()) ||
                        (!exp_mask2.empty() && img.size() != exp_mask2.size()) )
     {
-         ts->set_failed_test_info(cvtest::TS::FAIL_MISSING_TEST_DATA);         
+         ts->set_failed_test_info(cvtest::TS::FAIL_MISSING_TEST_DATA);
          return;
     }
-    
+
     Rect rect(Point(24, 126), Point(483, 294));
     Mat exp_bgdModel, exp_fgdModel;
 
     Mat mask;
     mask = Scalar(0);
     Mat bgdModel, fgdModel;
-    grabCut( img, mask, rect, bgdModel, fgdModel, 0, GC_INIT_WITH_RECT );    
+    grabCut( img, mask, rect, bgdModel, fgdModel, 0, GC_INIT_WITH_RECT );
     grabCut( img, mask, rect, bgdModel, fgdModel, 2, GC_EVAL );
 
     // Multiply images by 255 for more visuality of test data.
@@ -109,16 +109,16 @@ void CV_GrabcutTest::run( int /* start_from */)
         exp_mask1 = (mask & 1) * 255;
         imwrite(string(ts->get_data_path()) + "grabcut/exp_mask1.png", exp_mask1);
     }
-    
+
     if (!verify((mask & 1) * 255, exp_mask1))
-    {        
-        ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);        
+    {
+        ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
         return;
     }
-    
+
     mask = mask_prob;
     bgdModel.release();
-    fgdModel.release(); 
+    fgdModel.release();
     rect = Rect();
     grabCut( img, mask, rect, bgdModel, fgdModel, 0, GC_INIT_WITH_MASK );
     grabCut( img, mask, rect, bgdModel, fgdModel, 1, GC_EVAL );
@@ -128,13 +128,13 @@ void CV_GrabcutTest::run( int /* start_from */)
         exp_mask2 = (mask & 1) * 255;
         imwrite(string(ts->get_data_path()) + "grabcut/exp_mask2.png", exp_mask2);
     }
-    
+
     if (!verify((mask & 1) * 255, exp_mask2))
     {
-        ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);        
+        ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
         return;
-    }                    
-    ts->set_failed_test_info(cvtest::TS::OK);    
+    }
+    ts->set_failed_test_info(cvtest::TS::OK);
 }
 
 TEST(Imgproc_GrabCut, regression) { CV_GrabcutTest test; test.safe_run(); }
index 7ab8fcb..e515c82 100644 (file)
@@ -50,8 +50,8 @@ class CV_WatershedTest : public cvtest::BaseTest
 {
 public:
     CV_WatershedTest();
-    ~CV_WatershedTest();    
-protected:    
+    ~CV_WatershedTest();
+protected:
     void run(int);
 };
 
@@ -59,23 +59,23 @@ CV_WatershedTest::CV_WatershedTest() {}
 CV_WatershedTest::~CV_WatershedTest() {}
 
 void CV_WatershedTest::run( int /* start_from */)
-{      
-    string exp_path = string(ts->get_data_path()) + "watershed/wshed_exp.png"; 
+{
+    string exp_path = string(ts->get_data_path()) + "watershed/wshed_exp.png";
     Mat exp = imread(exp_path, 0);
     Mat orig = imread(string(ts->get_data_path()) + "inpaint/orig.jpg");
     FileStorage fs(string(ts->get_data_path()) + "watershed/comp.xml", FileStorage::READ);
-            
+
     if (orig.empty() || !fs.isOpened())
     {
         ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
         return;
     }
-              
+
     CvSeq* cnts = (CvSeq*)fs["contours"].readObj();
 
     Mat markers(orig.size(), CV_32SC1);
     markers = Scalar(0);
-    IplImage iplmrks = markers;    
+    IplImage iplmrks = markers;
 
     vector<unsigned char> colors(1);
     for(int i = 0; cnts != 0; cnts = cnts->h_next, ++i )
@@ -105,25 +105,25 @@ void CV_WatershedTest::run( int /* start_from */)
 
             if (pixel <= 0 || pixel > compNum)
                 continue; // bad result, doing nothing and going to get error latter;
-            
+
             // repaint in saved color to compare with expected;
             if(exp.data)
-                pixel = colors[pixel];                                        
+                pixel = colors[pixel];
         }
-    }    
+    }
 
     Mat markers8U;
     markers.convertTo(markers8U, CV_8U, 1, 1);
-    
+
     if( exp.empty() || orig.size() != exp.size() )
     {
         imwrite(exp_path, markers8U);
         exp = markers8U;
     }
-                
+
     if (0 != norm(markers8U, exp, NORM_INF))
-    {    
-        ts->set_failed_test_info( cvtest::TS::FAIL_MISMATCH );  
+    {
+        ts->set_failed_test_info( cvtest::TS::FAIL_MISMATCH );
         return;
     }
     ts->set_failed_test_info(cvtest::TS::OK);
diff --git a/modules/java/android_lib/.settings/org.eclipse.jdt.core.prefs b/modules/java/android_lib/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..d995784
--- /dev/null
@@ -0,0 +1,5 @@
+#Wed Jun 29 04:36:40 MSD 2011\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5\r
+org.eclipse.jdt.core.compiler.compliance=1.5\r
+org.eclipse.jdt.core.compiler.source=1.5\r
index e3a6f35..6421379 100644 (file)
@@ -922,7 +922,7 @@ extern "C" {
 \r
         self.save(output_path+"/"+module+".txt", report.getvalue())\r
 \r
-        print "Done %i of %i funcs." % (len(self.ported_func_list), len(self.ported_func_list)+ len(self.skipped_func_list))\r
+        #print "Done %i of %i funcs." % (len(self.ported_func_list), len(self.ported_func_list)+ len(self.skipped_func_list))\r
 \r
 \r
 \r
@@ -1402,7 +1402,7 @@ if __name__ == "__main__":
     import hdr_parser\r
     module = sys.argv[2]\r
     srcfiles = sys.argv[3:]\r
-    print "Generating module '" + module + "' from headers:\n\t" + "\n\t".join(srcfiles)\r
+    #print "Generating module '" + module + "' from headers:\n\t" + "\n\t".join(srcfiles)\r
     generator = JavaWrapperGenerator()\r
     generator.gen(srcfiles, module, dstdir)\r
 \r
index 9600710..348de72 100644 (file)
@@ -1 +1 @@
-ocv_define_module(legacy opencv_calib3d opencv_highgui opencv_video opencv_ml)
+ocv_define_module(legacy opencv_calib3d opencv_video opencv_ml OPTIONAL opencv_highgui)
index 5a6659d..93ab461 100644 (file)
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
  * conditions are met:
- *     Redistributions of source code must retain the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer.
- *     Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials
- *     provided with the distribution.
- *     The name of Contributor may not be used to endorse or
- *     promote products derived from this software without
- *     specific prior written permission.
+ *  Redistributions of source code must retain the above
+ *  copyright notice, this list of conditions and the following
+ *  disclaimer.
+ *  Redistributions in binary form must reproduce the above
+ *  copyright notice, this list of conditions and the following
+ *  disclaimer in the documentation and/or other materials
+ *  provided with the distribution.
+ *  The name of Contributor may not be used to endorse or
+ *  promote products derived from this software without
+ *  specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
@@ -71,26 +71,26 @@ cvExtractSURF( const CvArr* _img, const CvArr* _mask,
         mask = cvarrToMat(_mask);
     vector<KeyPoint> kpt;
     Mat descr;
-    
+
     Ptr<Feature2D> surf = Algorithm::create<Feature2D>("Feature2D.SURF");
     if( surf.empty() )
         CV_Error(CV_StsNotImplemented, "OpenCV was built without SURF support");
-    
+
     surf->set("hessianThreshold", params.hessianThreshold);
     surf->set("nOctaves", params.nOctaves);
     surf->set("nOctaveLayers", params.nOctaveLayers);
     surf->set("upright", params.upright != 0);
     surf->set("extended", params.extended != 0);
-    
+
     surf->operator()(img, mask, kpt, _descriptors ? _OutputArray(descr) : noArray(),
                      useProvidedKeyPts != 0);
-    
+
     if( _keypoints )
         *_keypoints = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvSURFPoint), storage);
-    
+
     if( _descriptors )
-        *_descriptors = cvCreateSeq(0, sizeof(CvSeq), descr.cols*descr.elemSize(), storage);
-    
+        *_descriptors = cvCreateSeq(0, sizeof(CvSeq), surf->descriptorSize() * CV_ELEM_SIZE(surf->descriptorType()), storage);
+
     for( size_t i = 0; i < kpt.size(); i++ )
     {
         if( _keypoints )
@@ -113,7 +113,7 @@ cvGetStarKeypoints( const CvArr* _img, CvMemStorage* storage,
                                               params.suppressNonmaxSize);
     vector<KeyPoint> kpts;
     star->detect(cvarrToMat(_img), kpts, Mat());
-    
+
     CvSeq* seq = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvStarKeypoint), storage);
     for( size_t i = 0; i < kpts.size(); i++ )
     {
index 729cd6c..3f691bc 100644 (file)
 // */
 
 #include "precomp.hpp"
-#include "opencv2/highgui/highgui_c.h"
+#include "opencv2/opencv_modules.hpp"
+#ifdef HAVE_OPENCV_HIGHGUI
+#  include "opencv2/highgui/highgui_c.h"
+#endif
 
 /////////////////////////////// CvImage implementation //////////////////////////////////
 
@@ -112,8 +115,10 @@ bool CvImage::load( const char* filename, const char* imgname, int color )
             img = temp_img;
         }*/
     }
+#ifdef HAVE_OPENCV_HIGHGUI
     else
         img = cvLoadImage( filename, color );
+#endif
 
     attach( img );
     return img != 0;
@@ -161,8 +166,12 @@ void CvImage::save( const char* filename, const char* imgname, const int* params
         return;
     if( icvIsXmlOrYaml( filename ) )
         cvSave( filename, image, imgname );
+#ifdef HAVE_OPENCV_HIGHGUI
     else
         cvSaveImage( filename, image, params );
+#else
+    (void)params;
+#endif
 }
 
 
@@ -175,8 +184,12 @@ void CvImage::write( CvFileStorage* fs, const char* imgname )
 
 void CvImage::show( const char* window_name )
 {
+#ifdef HAVE_OPENCV_HIGHGUI
     if( image )
         cvShowImage( window_name, image );
+#else
+    (void)window_name;
+#endif
 }
 
 
@@ -238,8 +251,10 @@ bool CvMatrix::load( const char* filename, const char* matname, int color )
             m = temp_mat;
         }*/
     }
+#ifdef HAVE_OPENCV_HIGHGUI
     else
         m = cvLoadImageM( filename, color );
+#endif
 
     set( m, false );
     return m != 0;
@@ -287,8 +302,12 @@ void CvMatrix::save( const char* filename, const char* matname, const int* param
         return;
     if( icvIsXmlOrYaml( filename ) )
         cvSave( filename, matrix, matname );
+#ifdef HAVE_OPENCV_HIGHGUI
     else
         cvSaveImage( filename, matrix, params );
+#else
+    (void)params;
+#endif
 }
 
 
@@ -301,8 +320,12 @@ void CvMatrix::write( CvFileStorage* fs, const char* matname )
 
 void CvMatrix::show( const char* window_name )
 {
+#ifdef HAVE_OPENCV_HIGHGUI
     if( matrix )
         cvShowImage( window_name, matrix );
+#else
+    (void)window_name;
+#endif
 }
 
 
index 3e5b445..c758f4c 100644 (file)
@@ -8,7 +8,10 @@
  */
 
 #include "precomp.hpp"
-#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv_modules.hpp"
+#ifdef HAVE_OPENCV_HIGHGUI
+#  include "opencv2/highgui/highgui.hpp"
+#endif
 #include <stdio.h>
 
 namespace cv{
@@ -665,7 +668,11 @@ namespace cv{
             cvMinMaxLoc(m_samples[i], 0, &maxval);
             cvConvertScale(m_samples[i], patch, 255/maxval);
 
+#ifdef HAVE_OPENCV_HIGHGUI
             cvSaveImage(buf, patch);
+#else
+            CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without image I/O support");
+#endif
 
             cvReleaseImage(&patch);
         }
@@ -1794,7 +1801,12 @@ namespace cv{
             sprintf(filename, "%s/%s", path, imagename);
 
             //printf("Reading image %s...", filename);
-            IplImage* img = cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE);
+            IplImage* img = 0;
+#ifdef HAVE_OPENCV_HIGHGUI
+            img = cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE);
+#else
+            CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without image I/O support");
+#endif
             //printf("done\n");
 
             extractPatches (img, patches, patch_size);
index 84b3af5..c03a9e4 100644 (file)
@@ -366,7 +366,7 @@ void CV_CvEMTest::run( int /*start_from*/ )
         int currCode = runCase(caseIndex++, params, trainData, trainLabels, testData, testLabels, sizes);
         code = currCode == cvtest::TS::OK ? code : currCode;
     }
-    
+
     ts->set_failed_test_info( code );
 }
 
@@ -382,7 +382,7 @@ protected:
         samples.at<float>(0,0) = 1;
         samples.at<float>(1,0) = 2;
         samples.at<float>(2,0) = 3;
-        
+
         Mat labels(samples.rows, 1, CV_32S);
 
         CvEMParams params;
@@ -398,7 +398,7 @@ protected:
 
         // Write out
 
-        string filename = tempfile() + ".xml";
+        string filename = cv::tempfile(".xml");
         {
             FileStorage fs = FileStorage(filename, FileStorage::WRITE);
             try
index 34b6abd..a6524bb 100644 (file)
@@ -421,7 +421,7 @@ void CV_StereoMatchingTest::run(int)
         ts->set_failed_test_info( code );
         return;
     }
-    
+
     string fullResultFilename = dataPath + ALGORITHMS_DIR + algorithmName + RESULT_FILE;
     FileStorage resFS( fullResultFilename, FileStorage::READ );
     bool isWrite = true; // write or compare results
@@ -660,7 +660,7 @@ class CV_StereoGCTest : public CV_StereoMatchingTest
 public:
     CV_StereoGCTest()
     {
-        name = "stereogc"; 
+        name = "stereogc";
         fill(rmsEps.begin(), rmsEps.end(), 3.f);
         fracEps[0] = 0.05f; // all
         fracEps[1] = 0.05f; // noOccl
index 9f85608..fc6214e 100644 (file)
@@ -527,7 +527,7 @@ protected:
             firstResult.at<int>(i) = static_cast<int>(em.predict(samples.row(i))[1]);
 
         // Write out
-        string filename = tempfile() + ".xml";
+        string filename = cv::tempfile(".xml");
         {
             FileStorage fs = FileStorage(filename, FileStorage::WRITE);
             try
index 407ad9d..7f820b4 100644 (file)
@@ -62,7 +62,7 @@ protected:
 class CV_AMLTest : public CV_MLBaseTest
 {
 public:
-    CV_AMLTest( const char* _modelName ); 
+    CV_AMLTest( const char* _modelName );
 protected:
     virtual int run_test_case( int testCaseIdx );
     virtual int validate_test_results( int testCaseIdx );
@@ -71,7 +71,7 @@ protected:
 class CV_SLMLTest : public CV_MLBaseTest
 {
 public:
-    CV_SLMLTest( const char* _modelName ); 
+    CV_SLMLTest( const char* _modelName );
 protected:
     virtual int run_test_case( int testCaseIdx );
     virtual int validate_test_results( int testCaseIdx );
index bc6ffab..707ba91 100644 (file)
@@ -84,7 +84,7 @@ int CV_SLMLTest::validate_test_results( int testCaseIdx )
     // 1. compare files
     ifstream f1( fname1.c_str() ), f2( fname2.c_str() );
     string s1, s2;
-    int lineIdx = 0; 
+    int lineIdx = 0;
     CV_Assert( f1.is_open() && f2.is_open() );
     for( ; !f1.eof() && !f2.eof(); lineIdx++ )
     {
index ec9419a..78aa4aa 100644 (file)
@@ -1,2 +1,2 @@
 set(the_description "Object Detection")
-ocv_define_module(objdetect OPTIONAL opencv_highgui)
+ocv_define_module(objdetect opencv_core opencv_imgproc OPTIONAL opencv_highgui)
index 21ec4be..683d21c 100644 (file)
@@ -44,7 +44,7 @@
 
 #include <string>
 
-#ifdef HAVE_CVCONFIG_H 
+#ifdef HAVE_CVCONFIG_H
 #include "cvconfig.h"
 #endif
 
@@ -61,7 +61,7 @@ const CvRect true_bounding_boxes[3] = {cvRect(0, 45, 362, 452), cvRect(304, 0, 6
 
 class CV_LatentSVMDetectorTest : public cvtest::BaseTest
 {
-protected:    
+protected:
     void run(int);
     bool isEqual(CvRect r1, CvRect r2, int eps);
 };
@@ -75,7 +75,7 @@ bool CV_LatentSVMDetectorTest::isEqual(CvRect r1, CvRect r2, int eps)
 }
 
 void CV_LatentSVMDetectorTest::run( int /* start_from */)
-{      
+{
     string img_path = string(ts->get_data_path()) + "latentsvmdetector/cat.jpg";
     string model_path = string(ts->get_data_path()) + "latentsvmdetector/models_VOC2007/cat.xml";
     int numThreads = -1;
@@ -102,7 +102,7 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
     }
 
     CvMemStorage* storage = cvCreateMemStorage(0);
-    CvSeq* detections = 0;         
+    CvSeq* detections = 0;
     detections = cvLatentSvmDetectObjects(image, detector, storage, 0.5f, numThreads);
     if (detections->total != num_detections)
     {
index b1da5cc..a047dbe 100644 (file)
@@ -49,8 +49,8 @@ class CV_InpaintTest : public cvtest::BaseTest
 {
 public:
     CV_InpaintTest();
-    ~CV_InpaintTest();    
-protected:    
+    ~CV_InpaintTest();
+protected:
     void run(int);
 };
 
@@ -61,43 +61,40 @@ CV_InpaintTest::~CV_InpaintTest() {}
 
 void CV_InpaintTest::run( int )
 {
-    string folder = string(ts->get_data_path()) + "inpaint/";    
-    Mat orig = imread(folder + "orig.jpg");    
+    string folder = string(ts->get_data_path()) + "inpaint/";
+    Mat orig = imread(folder + "orig.jpg");
     Mat exp1 = imread(folder + "exp1.png");
     Mat exp2 = imread(folder + "exp2.png");
-    Mat mask = imread(folder + "mask.png");    
+    Mat mask = imread(folder + "mask.png");
 
     if (orig.empty() || exp1.empty() || exp2.empty() || mask.empty())
     {
-        ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );  
+        ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
         return;
     }
 
-    Mat inv_mask;    
+    Mat inv_mask;
     mask.convertTo(inv_mask, CV_8UC3, -1.0, 255.0);
-            
+
     Mat mask1ch;
     cv::cvtColor(mask, mask1ch, CV_BGR2GRAY);
 
     Mat test = orig.clone();
-    test.setTo(Scalar::all(255), mask1ch);   
+    test.setTo(Scalar::all(255), mask1ch);
 
     Mat res1, res2;
     inpaint( test, mask1ch, res1, 5, CV_INPAINT_NS );
-    inpaint( test, mask1ch, res2, 5, CV_INPAINT_TELEA );    
-    
-    imwrite("d:/exp1.png", res1);
-    imwrite("d:/exp2.png", res2);
-    
+    inpaint( test, mask1ch, res2, 5, CV_INPAINT_TELEA );
+
     Mat diff1, diff2;
     absdiff( orig, res1, diff1 );
     absdiff( orig, res2, diff2 );
-        
+
     double n1 = norm(diff1.reshape(1), NORM_INF, inv_mask.reshape(1));
     double n2 = norm(diff2.reshape(1), NORM_INF, inv_mask.reshape(1));
-  
+
     if (n1 != 0 || n2 != 0)
-    {        
+    {
         ts->set_failed_test_info( cvtest::TS::FAIL_MISMATCH );
         return;
     }
@@ -109,9 +106,9 @@ void CV_InpaintTest::run( int )
     n2 = norm(diff2.reshape(1), NORM_INF, mask.reshape(1));
 
     const int jpeg_thres = 3;
-    if (n1 > jpeg_thres || n2 > jpeg_thres)   
+    if (n1 > jpeg_thres || n2 > jpeg_thres)
     {
-        ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );       
+        ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
         return;
     }
 
index d9bed76..2ffb445 100644 (file)
@@ -37,8 +37,6 @@ for l in open("%s/api" % sys.argv[1]):
 # Validation: check that any optional arguments are last
 had_error = False
 for (f, args, ty, flags) in api:
-    if f == 'PolarToCart':
-        print f, [(a.init != None) for a in args]
     has_init = [(a.init != None) for a in args if not 'O' in a.flags]
     if True in has_init and not all(has_init[has_init.index(True):]):
         print 'Error in definition for "%s", optional arguments must be last' % f
@@ -130,7 +128,7 @@ def has_optional(al):
 def gen(name, args, ty, flags):
   yield ""
   if has_optional(args):
-      yield "static PyObject *pycv%s(PyObject *self, PyObject *args, PyObject *kw)" % cname(name) 
+      yield "static PyObject *pycv%s(PyObject *self, PyObject *args, PyObject *kw)" % cname(name)
   else:
       yield "static PyObject *pycv%s(PyObject *self, PyObject *args)" % cname(name)
   if 'doconly' in flags:
@@ -185,7 +183,7 @@ def gen(name, args, ty, flags):
     in_args = [ a for a in args if not 'O' in a.flags ]
     fmt0 = "".join([ fmap[a.ty] for a in in_args if not a.init])
     fmt1 = "".join([ fmap[a.ty] for a in in_args if a.init])
-        
+
     yield ''
     if len(fmt0 + fmt1) > 0:
       if len(fmt1) > 0:
index 27e4841..1300ff2 100644 (file)
@@ -52,6 +52,7 @@
 #define GTEST_INCLUDE_GTEST_GTEST_H_
 
 #include <limits>
+#include <ostream>
 #include <vector>
 
 // Copyright 2005, Google Inc.
 //     GTEST_OS_LINUX_ANDROID - Google Android
 //   GTEST_OS_MAC      - Mac OS X
 //   GTEST_OS_NACL     - Google Native Client (NaCl)
+//   GTEST_OS_OPENBSD  - OpenBSD
+//   GTEST_OS_QNX      - QNX
 //   GTEST_OS_SOLARIS  - Sun Solaris
 //   GTEST_OS_SYMBIAN  - Symbian
 //   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)
 //   GTEST_FLAG()       - references a flag.
 //   GTEST_DECLARE_*()  - declares a flag.
 //   GTEST_DEFINE_*()   - defines a flag.
-//   GetArgvs()         - returns the command line as a vector of strings.
+//   GetInjectableArgvs() - returns the command line as a vector of strings.
 //
 // Environment variable utilities:
 //   GetEnv()             - gets the value of an environment variable.
 #define GTEST_OS_WINDOWS_MINGW 0
 #define GTEST_OS_WINDOWS_DESKTOP 0
 #define GTEST_OS_MAC 0
-#define GTEST_OS_MAC_IOS 0
 #define GTEST_OS_LINUX 0
 #define GTEST_OS_LINUX_ANDROID 0
 #define GTEST_OS_ZOS 0
 #define GTEST_OS_AIX 0
 #define GTEST_OS_HPUX 0
 #define GTEST_OS_NACL 0
-
+#define GTEST_OS_OPENBSD 0
+#define GTEST_OS_QNX 0
 
 #ifdef __CYGWIN__
 # undef GTEST_OS_CYGWIN
 #elif defined __APPLE__
 # undef GTEST_OS_MAC
 # define GTEST_OS_MAC 1
-# include <TargetConditionals.h>
-# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
-#  undef GTEST_OS_MAC_IOS
-#  define GTEST_OS_MAC_IOS 1
-# endif
-#include <TargetConditionals.h>
-#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
-# undef GTEST_OS_MAC_IOS
-# define GTEST_OS_MAC_IOS 1
-#endif
 #elif defined __linux__
 # undef GTEST_OS_LINUX
 # define GTEST_OS_LINUX 1
 #elif defined __native_client__
 # undef GTEST_OS_NACL
 # define GTEST_OS_NACL 1
+#elif defined __OpenBSD__
+# undef GTEST_OS_OPENBSD
+# define GTEST_OS_OPENBSD 1
+#elif defined __QNX__
+# undef GTEST_OS_QNX
+# define GTEST_OS_QNX 1
 #endif  // __CYGWIN__
 
 // Brings in definitions for functions used in the testing::internal::posix
 #   define GTEST_HAS_RTTI 0
 #  endif  // __GXX_RTTI
 
+// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
+// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
+// first version with C++ support.
+# elif defined(__clang__)
+
+#  define GTEST_HAS_RTTI __has_feature(cxx_rtti)
+
 // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
 // both the typeid and dynamic_cast features are present.
 # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
 //
 // To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
 // to your compiler flags.
-# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX)
+# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
+    || GTEST_OS_QNX)
 #endif  // GTEST_HAS_PTHREAD
 
 #if GTEST_HAS_PTHREAD
 // defining __GNUC__ and friends, but cannot compile GCC's tuple
 // implementation.  MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
 // Feature Pack download, which we cannot assume the user has.
-# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \
-    || _MSC_VER >= 1600
+// QNX's QCC compiler is a modified GCC but it doesn't support TR1 tuple.
+# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
+      && !GTEST_OS_QNX) || _MSC_VER >= 1600
 #  define GTEST_USE_OWN_TR1_TUPLE 0
 # else
 #  define GTEST_USE_OWN_TR1_TUPLE 1
 #if GTEST_HAS_TR1_TUPLE
 
 # if GTEST_USE_OWN_TR1_TUPLE
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
+// This file was GENERATED by command:
+//     pump.py gtest-tuple.h.pump
+// DO NOT EDIT BY HAND!!!
 
 // Copyright 2009 Google Inc.
 // All Rights Reserved.
@@ -745,34 +755,54 @@ template <bool kIndexValid, int kIndex, class Tuple>
 struct TupleElement;
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> { typedef T0 type; };
+struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> {
+  typedef T0 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> { typedef T1 type; };
+struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> {
+  typedef T1 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> { typedef T2 type; };
+struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> {
+  typedef T2 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> { typedef T3 type; };
+struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> {
+  typedef T3 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> { typedef T4 type; };
+struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> {
+  typedef T4 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> { typedef T5 type; };
+struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> {
+  typedef T5 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> { typedef T6 type; };
+struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> {
+  typedef T6 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> { typedef T7 type; };
+struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> {
+  typedef T7 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> { typedef T8 type; };
+struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> {
+  typedef T8 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> { typedef T9 type; };
+struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> {
+  typedef T9 type;
+};
 
 }  // namespace gtest_internal
 
@@ -1313,37 +1343,59 @@ inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
 template <typename Tuple> struct tuple_size;
 
 template <GTEST_0_TYPENAMES_(T)>
-struct tuple_size<GTEST_0_TUPLE_(T)> { static const int value = 0; };
+struct tuple_size<GTEST_0_TUPLE_(T)> {
+  static const int value = 0;
+};
 
 template <GTEST_1_TYPENAMES_(T)>
-struct tuple_size<GTEST_1_TUPLE_(T)> { static const int value = 1; };
+struct tuple_size<GTEST_1_TUPLE_(T)> {
+  static const int value = 1;
+};
 
 template <GTEST_2_TYPENAMES_(T)>
-struct tuple_size<GTEST_2_TUPLE_(T)> { static const int value = 2; };
+struct tuple_size<GTEST_2_TUPLE_(T)> {
+  static const int value = 2;
+};
 
 template <GTEST_3_TYPENAMES_(T)>
-struct tuple_size<GTEST_3_TUPLE_(T)> { static const int value = 3; };
+struct tuple_size<GTEST_3_TUPLE_(T)> {
+  static const int value = 3;
+};
 
 template <GTEST_4_TYPENAMES_(T)>
-struct tuple_size<GTEST_4_TUPLE_(T)> { static const int value = 4; };
+struct tuple_size<GTEST_4_TUPLE_(T)> {
+  static const int value = 4;
+};
 
 template <GTEST_5_TYPENAMES_(T)>
-struct tuple_size<GTEST_5_TUPLE_(T)> { static const int value = 5; };
+struct tuple_size<GTEST_5_TUPLE_(T)> {
+  static const int value = 5;
+};
 
 template <GTEST_6_TYPENAMES_(T)>
-struct tuple_size<GTEST_6_TUPLE_(T)> { static const int value = 6; };
+struct tuple_size<GTEST_6_TUPLE_(T)> {
+  static const int value = 6;
+};
 
 template <GTEST_7_TYPENAMES_(T)>
-struct tuple_size<GTEST_7_TUPLE_(T)> { static const int value = 7; };
+struct tuple_size<GTEST_7_TUPLE_(T)> {
+  static const int value = 7;
+};
 
 template <GTEST_8_TYPENAMES_(T)>
-struct tuple_size<GTEST_8_TUPLE_(T)> { static const int value = 8; };
+struct tuple_size<GTEST_8_TUPLE_(T)> {
+  static const int value = 8;
+};
 
 template <GTEST_9_TYPENAMES_(T)>
-struct tuple_size<GTEST_9_TUPLE_(T)> { static const int value = 9; };
+struct tuple_size<GTEST_9_TUPLE_(T)> {
+  static const int value = 9;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct tuple_size<GTEST_10_TUPLE_(T)> { static const int value = 10; };
+struct tuple_size<GTEST_10_TUPLE_(T)> {
+  static const int value = 10;
+};
 
 template <int k, class Tuple>
 struct tuple_element {
@@ -1646,7 +1698,8 @@ inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
 // pops up a dialog window that cannot be suppressed programmatically.
 #if (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
      (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
-     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX)
+     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
+     GTEST_OS_OPENBSD || GTEST_OS_QNX)
 # define GTEST_HAS_DEATH_TEST 1
 # include <vector>  // NOLINT
 #endif
@@ -1777,6 +1830,13 @@ inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
 # define GTEST_NO_INLINE_
 #endif
 
+// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
+#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
+# define GTEST_HAS_CXXABI_H_ 1
+#else
+# define GTEST_HAS_CXXABI_H_ 0
+#endif
+
 namespace testing {
 
 class Message;
@@ -1904,6 +1964,7 @@ class scoped_ptr {
       ptr_ = p;
     }
   }
+
  private:
   T* ptr_;
 
@@ -2161,11 +2222,12 @@ GTEST_API_ String GetCapturedStderr();
 
 #if GTEST_HAS_DEATH_TEST
 
-// A copy of all command line arguments.  Set by InitGoogleTest().
-extern ::std::vector<String> g_argvs;
+const ::std::vector<testing::internal::string>& GetInjectableArgvs();
+void SetInjectableArgvs(const ::std::vector<testing::internal::string>*
+                             new_argvs);
 
-// GTEST_HAS_DEATH_TEST implies we have ::std::string.
-const ::std::vector<String>& GetArgvs();
+// A copy of all command line arguments.  Set by InitGoogleTest().
+extern ::std::vector<testing::internal::string> g_argvs;
 
 #endif  // GTEST_HAS_DEATH_TEST
 
@@ -2192,22 +2254,37 @@ inline void SleepMilliseconds(int n) {
 // use it in user tests, either directly or indirectly.
 class Notification {
  public:
-  Notification() : notified_(false) {}
+  Notification() : notified_(false) {
+    GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
+  }
+  ~Notification() {
+    pthread_mutex_destroy(&mutex_);
+  }
 
   // Notifies all threads created with this notification to start. Must
   // be called from the controller thread.
-  void Notify() { notified_ = true; }
+  void Notify() {
+    pthread_mutex_lock(&mutex_);
+    notified_ = true;
+    pthread_mutex_unlock(&mutex_);
+  }
 
   // Blocks until the controller thread notifies. Must be called from a test
   // thread.
   void WaitForNotification() {
-    while(!notified_) {
+    for (;;) {
+      pthread_mutex_lock(&mutex_);
+      const bool notified = notified_;
+      pthread_mutex_unlock(&mutex_);
+      if (notified)
+        break;
       SleepMilliseconds(10);
     }
   }
 
  private:
-  volatile bool notified_;
+  pthread_mutex_t mutex_;
+  bool notified_;
 
   GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
 };
@@ -2315,21 +2392,23 @@ class MutexBase {
   void Lock() {
     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
     owner_ = pthread_self();
+    has_owner_ = true;
   }
 
   // Releases this mutex.
   void Unlock() {
-    // We don't protect writing to owner_ here, as it's the caller's
-    // responsibility to ensure that the current thread holds the
+    // Since the lock is being released the owner_ field should no longer be
+    // considered valid. We don't protect writing to has_owner_ here, as it's
+    // the caller's responsibility to ensure that the current thread holds the
     // mutex when this is called.
-    owner_ = 0;
+    has_owner_ = false;
     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
   }
 
   // Does nothing if the current thread holds the mutex. Otherwise, crashes
   // with high probability.
   void AssertHeld() const {
-    GTEST_CHECK_(owner_ == pthread_self())
+    GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
         << "The current thread is not holding the mutex @" << this;
   }
 
@@ -2340,7 +2419,14 @@ class MutexBase {
   // have to be public.
  public:
   pthread_mutex_t mutex_;  // The underlying pthread mutex.
-  pthread_t owner_;  // The thread holding the mutex; 0 means no one holds it.
+  // has_owner_ indicates whether the owner_ field below contains a valid thread
+  // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
+  // accesses to the owner_ field should be protected by a check of this field.
+  // An alternative might be to memset() owner_ to all zeros, but there's no
+  // guarantee that a zero'd pthread_t is necessarily invalid or even different
+  // from pthread_self().
+  bool has_owner_;
+  pthread_t owner_;  // The thread holding the mutex.
 };
 
 // Forward-declares a static mutex.
@@ -2348,8 +2434,13 @@ class MutexBase {
     extern ::testing::internal::MutexBase mutex
 
 // Defines and statically (i.e. at link time) initializes a static mutex.
+// The initialization list here does not explicitly initialize each field,
+// instead relying on default initialization for the unspecified fields. In
+// particular, the owner_ field (a pthread_t) is not explicitly initialized.
+// This allows initialization to work whether pthread_t is a scalar or struct.
+// The flag -Wmissing-field-initializers must not be specified for this to work.
 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
-    ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, 0 }
+    ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false }
 
 // The Mutex class can only be used for mutexes created at runtime. It
 // shares its API with MutexBase otherwise.
@@ -2357,7 +2448,7 @@ class Mutex : public MutexBase {
  public:
   Mutex() {
     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
-    owner_ = 0;
+    has_owner_ = false;
   }
   ~Mutex() {
     GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
@@ -2507,6 +2598,8 @@ class ThreadLocal {
 class Mutex {
  public:
   Mutex() {}
+  void Lock() {}
+  void Unlock() {}
   void AssertHeld() const {}
 };
 
@@ -2637,6 +2730,10 @@ inline bool IsUpper(char ch) {
 inline bool IsXDigit(char ch) {
   return isxdigit(static_cast<unsigned char>(ch)) != 0;
 }
+inline bool IsXDigit(wchar_t ch) {
+  const unsigned char low_byte = static_cast<unsigned char>(ch);
+  return ch == low_byte && isxdigit(low_byte) != 0;
+}
 
 inline char ToLower(char ch) {
   return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
@@ -2774,6 +2871,23 @@ inline void Abort() { abort(); }
 
 }  // namespace posix
 
+// MSVC "deprecates" snprintf and issues warnings wherever it is used.  In
+// order to avoid these warnings, we need to use _snprintf or _snprintf_s on
+// MSVC-based platforms.  We map the GTEST_SNPRINTF_ macro to the appropriate
+// function in order to achieve that.  We use macro definition here because
+// snprintf is a variadic function.
+#if defined(_MSC_VER) && _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
+// MSVC 2005 and above support variadic macros.
+# define GTEST_SNPRINTF_(buffer, size, format, ...) \
+     _snprintf_s(buffer, size, size, format, __VA_ARGS__)
+#elif defined(_MSC_VER)
+// Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't
+// complain about _snprintf.
+# define GTEST_SNPRINTF_ _snprintf
+#else
+# define GTEST_SNPRINTF_ snprintf
+#endif
+
 // The maximum number a BiggestInt can represent.  This definition
 // works no matter BiggestInt is represented in one's complement or
 // two's complement.
@@ -2826,7 +2940,6 @@ class TypeWithSize<4> {
 template <>
 class TypeWithSize<8> {
  public:
-
 #if GTEST_OS_WINDOWS
   typedef __int64 Int;
   typedef unsigned __int64 UInt;
@@ -2863,6 +2976,10 @@ typedef TypeWithSize<8>::Int TimeInMillis;  // Represents time in milliseconds.
 #define GTEST_DEFINE_string_(name, default_val, doc) \
     GTEST_API_ ::testing::internal::String GTEST_FLAG(name) = (default_val)
 
+// Thread annotations
+#define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
+#define GTEST_LOCK_EXCLUDED_(locks)
+
 // Parses 'str' for a 32-bit signed integer.  If successful, writes the result
 // to *value and returns true; otherwise leaves *value unchanged and returns
 // false.
@@ -2944,9 +3061,9 @@ const char* StringFromGTestEnv(const char* flag, const char* default_val);
 #endif
 
 #include <string.h>
-
 #include <string>
 
+
 namespace testing {
 namespace internal {
 
@@ -2978,15 +3095,6 @@ class GTEST_API_ String {
  public:
   // Static utility methods
 
-  // Returns the input enclosed in double quotes if it's not NULL;
-  // otherwise returns "(null)".  For example, "\"Hello\"" is returned
-  // for input "Hello".
-  //
-  // This is useful for printing a C string in the syntax of a literal.
-  //
-  // Known issue: escape sequences are not handled yet.
-  static String ShowCStringQuoted(const char* c_str);
-
   // Clones a 0-terminated C string, allocating memory using new.  The
   // caller is responsible for deleting the return value using
   // delete[].  Returns the cloned string, or NULL if the input is
@@ -3035,10 +3143,6 @@ class GTEST_API_ String {
   // returned.
   static String ShowWideCString(const wchar_t* wide_c_str);
 
-  // Similar to ShowWideCString(), except that this function encloses
-  // the converted string in double quotes.
-  static String ShowWideCStringQuoted(const wchar_t* wide_c_str);
-
   // Compares two wide C strings.  Returns true iff they have the same
   // content.
   //
@@ -3119,14 +3223,14 @@ class GTEST_API_ String {
   // Converting a ::std::string or ::string containing an embedded NUL
   // character to a String will result in the prefix up to the first
   // NUL character.
-  String(const ::std::string& str) {
+  String(const ::std::string& str) {  // NOLINT
     ConstructNonNull(str.c_str(), str.length());
   }
 
   operator ::std::string() const { return ::std::string(c_str(), length()); }
 
 #if GTEST_HAS_GLOBAL_STRING
-  String(const ::string& str) {
+  String(const ::string& str) {  // NOLINT
     ConstructNonNull(str.c_str(), str.length());
   }
 
@@ -3502,11 +3606,11 @@ class GTEST_API_ FilePath {
 
 // #ifdef __GNUC__ is too general here.  It is possible to use gcc without using
 // libstdc++ (which is where cxxabi.h comes from).
-# ifdef __GLIBCXX__
+# if GTEST_HAS_CXXABI_H_
 #  include <cxxabi.h>
 # elif defined(__HP_aCC)
 #  include <acxx_demangle.h>
-# endif  // __GLIBCXX__
+# endif  // GTEST_HASH_CXXABI_H_
 
 namespace testing {
 namespace internal {
@@ -3519,20 +3623,20 @@ String GetTypeName() {
 # if GTEST_HAS_RTTI
 
   const char* const name = typeid(T).name();
-#  if defined(__GLIBCXX__) || defined(__HP_aCC)
+#  if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
   int status = 0;
   // gcc's implementation of typeid(T).name() mangles the type name,
   // so we have to demangle it.
-#   ifdef __GLIBCXX__
+#   if GTEST_HAS_CXXABI_H_
   using abi::__cxa_demangle;
-#   endif // __GLIBCXX__
+#   endif  // GTEST_HAS_CXXABI_H_
   char* const readable_name = __cxa_demangle(name, 0, 0, &status);
   const String name_str(status == 0 ? readable_name : name);
   free(readable_name);
   return name_str;
 #  else
   return name;
-#  endif  // __GLIBCXX__ || __HP_aCC
+#  endif  // GTEST_HAS_CXXABI_H_ || __HP_aCC
 
 # else
 
@@ -6753,7 +6857,9 @@ struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
 // INSTANTIATE_TYPED_TEST_CASE_P().
 
 template <typename T>
-struct TypeList { typedef Types1<T> type; };
+struct TypeList {
+  typedef Types1<T> type;
+};
 
 template <typename T1, typename T2, typename T3, typename T4, typename T5,
     typename T6, typename T7, typename T8, typename T9, typename T10,
@@ -6848,7 +6954,7 @@ class TestInfoImpl;                    // Opaque implementation of TestInfo
 class UnitTestImpl;                    // Opaque implementation of UnitTest
 
 // How many times InitGoogleTest() has been called.
-extern int g_init_gtest_count;
+GTEST_API_ extern int g_init_gtest_count;
 
 // The text used in failure messages to indicate the start of the
 // stack trace.
@@ -6921,67 +7027,6 @@ class GTEST_API_ ScopedTrace {
 template <typename T>
 String StreamableToString(const T& streamable);
 
-// The Symbian compiler has a bug that prevents it from selecting the
-// correct overload of FormatForComparisonFailureMessage (see below)
-// unless we pass the first argument by reference.  If we do that,
-// however, Visual Age C++ 10.1 generates a compiler error.  Therefore
-// we only apply the work-around for Symbian.
-#if defined(__SYMBIAN32__)
-# define GTEST_CREF_WORKAROUND_ const&
-#else
-# define GTEST_CREF_WORKAROUND_
-#endif
-
-// When this operand is a const char* or char*, if the other operand
-// is a ::std::string or ::string, we print this operand as a C string
-// rather than a pointer (we do the same for wide strings); otherwise
-// we print it as a pointer to be safe.
-
-// This internal macro is used to avoid duplicated code.
-#define GTEST_FORMAT_IMPL_(operand2_type, operand1_printer)\
-inline String FormatForComparisonFailureMessage(\
-    operand2_type::value_type* GTEST_CREF_WORKAROUND_ str, \
-    const operand2_type& /*operand2*/) {\
-  return operand1_printer(str);\
-}\
-inline String FormatForComparisonFailureMessage(\
-    const operand2_type::value_type* GTEST_CREF_WORKAROUND_ str, \
-    const operand2_type& /*operand2*/) {\
-  return operand1_printer(str);\
-}
-
-GTEST_FORMAT_IMPL_(::std::string, String::ShowCStringQuoted)
-#if GTEST_HAS_STD_WSTRING
-GTEST_FORMAT_IMPL_(::std::wstring, String::ShowWideCStringQuoted)
-#endif  // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_STRING
-GTEST_FORMAT_IMPL_(::string, String::ShowCStringQuoted)
-#endif  // GTEST_HAS_GLOBAL_STRING
-#if GTEST_HAS_GLOBAL_WSTRING
-GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)
-#endif  // GTEST_HAS_GLOBAL_WSTRING
-
-#undef GTEST_FORMAT_IMPL_
-
-// The next four overloads handle the case where the operand being
-// printed is a char/wchar_t pointer and the other operand is not a
-// string/wstring object.  In such cases, we just print the operand as
-// a pointer to be safe.
-#define GTEST_FORMAT_CHAR_PTR_IMPL_(CharType)                       \
-  template <typename T>                                             \
-  String FormatForComparisonFailureMessage(CharType* GTEST_CREF_WORKAROUND_ p, \
-                                           const T&) { \
-    return PrintToString(static_cast<const void*>(p));              \
-  }
-
-GTEST_FORMAT_CHAR_PTR_IMPL_(char)
-GTEST_FORMAT_CHAR_PTR_IMPL_(const char)
-GTEST_FORMAT_CHAR_PTR_IMPL_(wchar_t)
-GTEST_FORMAT_CHAR_PTR_IMPL_(const wchar_t)
-
-#undef GTEST_FORMAT_CHAR_PTR_IMPL_
-
 // Constructs and returns the message for an equality assertion
 // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
 //
@@ -7523,13 +7568,19 @@ struct RemoveConst<const T> { typedef T type; };  // NOLINT
 // MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
 // definition to fail to remove the const in 'const int[3]' and 'const
 // char[3][4]'.  The following specialization works around the bug.
-// However, it causes trouble with GCC and thus needs to be
-// conditionally compiled.
-#if defined(_MSC_VER) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
 template <typename T, size_t N>
 struct RemoveConst<const T[N]> {
   typedef typename RemoveConst<T>::type type[N];
 };
+
+#if defined(_MSC_VER) && _MSC_VER < 1400
+// This is the only specialization that allows VC++ 7.1 to remove const in
+// 'const int[3] and 'const int[3][4]'.  However, it causes trouble with GCC
+// and thus needs to be conditionally compiled.
+template <typename T, size_t N>
+struct RemoveConst<T[N]> {
+  typedef typename RemoveConst<T>::type type[N];
+};
 #endif
 
 // A handy wrapper around RemoveConst that works when the argument
@@ -8208,6 +8259,17 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
 // The symbol "fail" here expands to something into which a message
 // can be streamed.
 
+// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
+// NDEBUG mode. In this case we need the statements to be executed, the regex is
+// ignored, and the macro must accept a streamed message even though the message
+// is never printed.
+# define GTEST_EXECUTE_STATEMENT_(statement, regex) \
+  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+  if (::testing::internal::AlwaysTrue()) { \
+     GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
+  } else \
+    ::testing::Message()
+
 // A class representing the parsed contents of the
 // --gtest_internal_run_death_test flag, as it existed when
 // RUN_ALL_TESTS was called.
@@ -8309,6 +8371,17 @@ GTEST_DECLARE_string_(death_test_style);
 
 #if GTEST_HAS_DEATH_TEST
 
+namespace internal {
+
+// Returns a Boolean value indicating whether the caller is currently
+// executing in the context of the death test child process.  Tools such as
+// Valgrind heap checkers may need this to modify their behavior in death
+// tests.  IMPORTANT: This is an internal utility.  Using it may break the
+// implementation of death tests.  User code MUST NOT use it.
+GTEST_API_ bool InDeathTestChild();
+
+}  // namespace internal
+
 // The following macros are useful for writing death tests.
 
 // Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
@@ -8333,7 +8406,7 @@ GTEST_DECLARE_string_(death_test_style);
 //   for (int i = 0; i < 5; i++) {
 //     EXPECT_DEATH(server.ProcessRequest(i),
 //                  "Invalid request .* in ProcessRequest()")
-//         << "Failed to die on request " << i);
+//                  << "Failed to die on request " << i;
 //   }
 //
 //   ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
@@ -8503,10 +8576,10 @@ class GTEST_API_ KilledBySignal {
 # ifdef NDEBUG
 
 #  define EXPECT_DEBUG_DEATH(statement, regex) \
-  do { statement; } while (::testing::internal::AlwaysFalse())
+  GTEST_EXECUTE_STATEMENT_(statement, regex)
 
 #  define ASSERT_DEBUG_DEATH(statement, regex) \
-  do { statement; } while (::testing::internal::AlwaysFalse())
+  GTEST_EXECUTE_STATEMENT_(statement, regex)
 
 # else
 
@@ -9105,8 +9178,8 @@ class linked_ptr_internal {
   // framework.
 
   // Join an existing circle.
-  // L < g_linked_ptr_mutex
-  void join(linked_ptr_internal const* ptr) {
+  void join(linked_ptr_internal const* ptr)
+      GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
     MutexLock lock(&g_linked_ptr_mutex);
 
     linked_ptr_internal const* p = ptr;
@@ -9117,8 +9190,8 @@ class linked_ptr_internal {
 
   // Leave whatever circle we're part of.  Returns true if we were the
   // last member of the circle.  Once this is done, you can join() another.
-  // L < g_linked_ptr_mutex
-  bool depart() {
+  bool depart()
+      GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
     MutexLock lock(&g_linked_ptr_mutex);
 
     if (next_ == this) return true;
@@ -9861,9 +9934,12 @@ void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
   }
 }
 // This overload prints a (const) char array compactly.
-GTEST_API_ void UniversalPrintArray(const char* begin,
-                                    size_t len,
-                                    ::std::ostream* os);
+GTEST_API_ void UniversalPrintArray(
+    const char* begin, size_t len, ::std::ostream* os);
+
+// This overload prints a (const) wchar_t array compactly.
+GTEST_API_ void UniversalPrintArray(
+    const wchar_t* begin, size_t len, ::std::ostream* os);
 
 // Implements printing an array type T[N].
 template <typename T, size_t N>
@@ -9904,19 +9980,72 @@ class UniversalPrinter<T&> {
 // Prints a value tersely: for a reference type, the referenced value
 // (but not the address) is printed; for a (const) char pointer, the
 // NUL-terminated string (but not the pointer) is printed.
+
 template <typename T>
-void UniversalTersePrint(const T& value, ::std::ostream* os) {
-  UniversalPrint(value, os);
-}
-inline void UniversalTersePrint(const char* str, ::std::ostream* os) {
-  if (str == NULL) {
-    *os << "NULL";
-  } else {
-    UniversalPrint(string(str), os);
+class UniversalTersePrinter {
+ public:
+  static void Print(const T& value, ::std::ostream* os) {
+    UniversalPrint(value, os);
   }
-}
-inline void UniversalTersePrint(char* str, ::std::ostream* os) {
-  UniversalTersePrint(static_cast<const char*>(str), os);
+};
+template <typename T>
+class UniversalTersePrinter<T&> {
+ public:
+  static void Print(const T& value, ::std::ostream* os) {
+    UniversalPrint(value, os);
+  }
+};
+template <typename T, size_t N>
+class UniversalTersePrinter<T[N]> {
+ public:
+  static void Print(const T (&value)[N], ::std::ostream* os) {
+    UniversalPrinter<T[N]>::Print(value, os);
+  }
+};
+template <>
+class UniversalTersePrinter<const char*> {
+ public:
+  static void Print(const char* str, ::std::ostream* os) {
+    if (str == NULL) {
+      *os << "NULL";
+    } else {
+      UniversalPrint(string(str), os);
+    }
+  }
+};
+template <>
+class UniversalTersePrinter<char*> {
+ public:
+  static void Print(char* str, ::std::ostream* os) {
+    UniversalTersePrinter<const char*>::Print(str, os);
+  }
+};
+
+#if GTEST_HAS_STD_WSTRING
+template <>
+class UniversalTersePrinter<const wchar_t*> {
+ public:
+  static void Print(const wchar_t* str, ::std::ostream* os) {
+    if (str == NULL) {
+      *os << "NULL";
+    } else {
+      UniversalPrint(::std::wstring(str), os);
+    }
+  }
+};
+#endif
+
+template <>
+class UniversalTersePrinter<wchar_t*> {
+ public:
+  static void Print(wchar_t* str, ::std::ostream* os) {
+    UniversalTersePrinter<const wchar_t*>::Print(str, os);
+  }
+};
+
+template <typename T>
+void UniversalTersePrint(const T& value, ::std::ostream* os) {
+  UniversalTersePrinter<T>::Print(value, os);
 }
 
 // Prints a value using the type inferred by the compiler.  The
@@ -9925,7 +10054,10 @@ inline void UniversalTersePrint(char* str, ::std::ostream* os) {
 // NUL-terminated string.
 template <typename T>
 void UniversalPrint(const T& value, ::std::ostream* os) {
-  UniversalPrinter<T>::Print(value, os);
+  // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
+  // UniversalPrinter with T directly.
+  typedef T T1;
+  UniversalPrinter<T1>::Print(value, os);
 }
 
 #if GTEST_HAS_TR1_TUPLE
@@ -10018,7 +10150,7 @@ Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
 template <typename T>
 ::std::string PrintToString(const T& value) {
   ::std::stringstream ss;
-  internal::UniversalTersePrint(value, &ss);
+  internal::UniversalTersePrinter<T>::Print(value, &ss);
   return ss.str();
 }
 
@@ -10692,7 +10824,7 @@ class ValueArray2 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};
     return ValuesIn(array);
   }
 
@@ -10711,7 +10843,8 @@ class ValueArray3 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_)};
     return ValuesIn(array);
   }
 
@@ -10732,7 +10865,8 @@ class ValueArray4 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_)};
     return ValuesIn(array);
   }
 
@@ -10754,7 +10888,8 @@ class ValueArray5 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};
     return ValuesIn(array);
   }
 
@@ -10778,7 +10913,9 @@ class ValueArray6 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_)};
     return ValuesIn(array);
   }
 
@@ -10803,7 +10940,9 @@ class ValueArray7 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_)};
     return ValuesIn(array);
   }
 
@@ -10830,7 +10969,9 @@ class ValueArray8 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};
     return ValuesIn(array);
   }
 
@@ -10858,7 +10999,10 @@ class ValueArray9 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_)};
     return ValuesIn(array);
   }
 
@@ -10887,7 +11031,10 @@ class ValueArray10 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_)};
     return ValuesIn(array);
   }
 
@@ -10918,7 +11065,10 @@ class ValueArray11 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};
     return ValuesIn(array);
   }
 
@@ -10950,8 +11100,11 @@ class ValueArray12 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_)};
     return ValuesIn(array);
   }
 
@@ -10985,8 +11138,11 @@ class ValueArray13 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_)};
     return ValuesIn(array);
   }
 
@@ -11021,8 +11177,11 @@ class ValueArray14 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};
     return ValuesIn(array);
   }
 
@@ -11058,8 +11217,12 @@ class ValueArray15 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_)};
     return ValuesIn(array);
   }
 
@@ -11098,8 +11261,12 @@ class ValueArray16 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_)};
     return ValuesIn(array);
   }
 
@@ -11139,8 +11306,12 @@ class ValueArray17 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};
     return ValuesIn(array);
   }
 
@@ -11181,8 +11352,13 @@ class ValueArray18 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_)};
     return ValuesIn(array);
   }
 
@@ -11224,8 +11400,13 @@ class ValueArray19 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_)};
     return ValuesIn(array);
   }
 
@@ -11269,8 +11450,13 @@ class ValueArray20 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};
     return ValuesIn(array);
   }
 
@@ -11316,8 +11502,14 @@ class ValueArray21 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_)};
     return ValuesIn(array);
   }
 
@@ -11364,8 +11556,14 @@ class ValueArray22 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_)};
     return ValuesIn(array);
   }
 
@@ -11414,9 +11612,14 @@ class ValueArray23 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_,
-        v23_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};
     return ValuesIn(array);
   }
 
@@ -11466,9 +11669,15 @@ class ValueArray24 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_)};
     return ValuesIn(array);
   }
 
@@ -11519,9 +11728,15 @@ class ValueArray25 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_)};
     return ValuesIn(array);
   }
 
@@ -11574,9 +11789,15 @@ class ValueArray26 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};
     return ValuesIn(array);
   }
 
@@ -11631,9 +11852,16 @@ class ValueArray27 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_)};
     return ValuesIn(array);
   }
 
@@ -11689,9 +11917,16 @@ class ValueArray28 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_)};
     return ValuesIn(array);
   }
 
@@ -11748,9 +11983,16 @@ class ValueArray29 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};
     return ValuesIn(array);
   }
 
@@ -11809,9 +12051,17 @@ class ValueArray30 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_)};
     return ValuesIn(array);
   }
 
@@ -11872,9 +12122,17 @@ class ValueArray31 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_)};
     return ValuesIn(array);
   }
 
@@ -11936,9 +12194,17 @@ class ValueArray32 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};
     return ValuesIn(array);
   }
 
@@ -12002,9 +12268,18 @@ class ValueArray33 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_)};
     return ValuesIn(array);
   }
 
@@ -12069,9 +12344,18 @@ class ValueArray34 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_)};
     return ValuesIn(array);
   }
 
@@ -12137,10 +12421,18 @@ class ValueArray35 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_,
-        v35_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};
     return ValuesIn(array);
   }
 
@@ -12208,10 +12500,19 @@ class ValueArray36 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_)};
     return ValuesIn(array);
   }
 
@@ -12281,10 +12582,19 @@ class ValueArray37 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_)};
     return ValuesIn(array);
   }
 
@@ -12355,10 +12665,19 @@ class ValueArray38 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};
     return ValuesIn(array);
   }
 
@@ -12430,10 +12749,20 @@ class ValueArray39 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_)};
     return ValuesIn(array);
   }
 
@@ -12507,10 +12836,20 @@ class ValueArray40 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_)};
     return ValuesIn(array);
   }
 
@@ -12586,10 +12925,20 @@ class ValueArray41 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};
     return ValuesIn(array);
   }
 
@@ -12666,10 +13015,21 @@ class ValueArray42 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_)};
     return ValuesIn(array);
   }
 
@@ -12747,10 +13107,21 @@ class ValueArray43 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_)};
     return ValuesIn(array);
   }
 
@@ -12830,10 +13201,21 @@ class ValueArray44 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};
     return ValuesIn(array);
   }
 
@@ -12914,10 +13296,22 @@ class ValueArray45 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_)};
     return ValuesIn(array);
   }
 
@@ -13000,10 +13394,22 @@ class ValueArray46 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_), static_cast<T>(v46_)};
     return ValuesIn(array);
   }
 
@@ -13088,11 +13494,22 @@ class ValueArray47 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_,
-        v47_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};
     return ValuesIn(array);
   }
 
@@ -13178,11 +13595,23 @@ class ValueArray48 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
-        v48_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
+        static_cast<T>(v48_)};
     return ValuesIn(array);
   }
 
@@ -13269,11 +13698,23 @@ class ValueArray49 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
-        v48_, v49_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
+        static_cast<T>(v48_), static_cast<T>(v49_)};
     return ValuesIn(array);
   }
 
@@ -13361,11 +13802,23 @@ class ValueArray50 {
 
   template <typename T>
   operator ParamGenerator<T>() const {
-    const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v11_,
-        v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v23_,
-        v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v35_,
-        v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v47_,
-        v48_, v49_, v50_};
+    const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
+        static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
+        static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
+        static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
+        static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
+        static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
+        static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
+        static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
+        static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
+        static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
+        static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
+        static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
+        static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
+        static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
+        static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
+        static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
+        static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};
     return ValuesIn(array);
   }
 
@@ -16483,7 +16936,7 @@ inline internal::ParamGenerator<bool> Bool() {
 // Boolean flags:
 //
 // class FlagDependentTest
-//     : public testing::TestWithParam<tuple(bool, bool)> > {
+//     : public testing::TestWithParam<tuple<bool, bool> > {
 //   virtual void SetUp() {
 //     // Assigns external_flag_1 and external_flag_2 values from the tuple.
 //     tie(external_flag_1, external_flag_2) = GetParam();
@@ -16799,6 +17252,7 @@ class GTEST_API_ TestPartResult {
 
   // Returns true iff the test part fatally failed.
   bool fatally_failed() const { return type_ == kFatalFailure; }
+
  private:
   Type type_;
 
@@ -17743,7 +18197,6 @@ class GTEST_API_ TestInfo {
   const TestResult* result() const { return &result_; }
 
  private:
-
 #if GTEST_HAS_DEATH_TEST
   friend class internal::DefaultDeathTestFactory;
 #endif  // GTEST_HAS_DEATH_TEST
@@ -18178,11 +18631,13 @@ class GTEST_API_ UnitTest {
 
   // Returns the TestCase object for the test that's currently running,
   // or NULL if no test is running.
-  const TestCase* current_test_case() const;
+  const TestCase* current_test_case() const
+      GTEST_LOCK_EXCLUDED_(mutex_);
 
   // Returns the TestInfo object for the test that's currently running,
   // or NULL if no test is running.
-  const TestInfo* current_test_info() const;
+  const TestInfo* current_test_info() const
+      GTEST_LOCK_EXCLUDED_(mutex_);
 
   // Returns the random seed used at the start of the current test run.
   int random_seed() const;
@@ -18192,7 +18647,8 @@ class GTEST_API_ UnitTest {
   // value-parameterized tests and instantiate and register them.
   //
   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-  internal::ParameterizedTestCaseRegistry& parameterized_test_registry();
+  internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
+      GTEST_LOCK_EXCLUDED_(mutex_);
 #endif  // GTEST_HAS_PARAM_TEST
 
   // Gets the number of successful test cases.
@@ -18223,6 +18679,10 @@ class GTEST_API_ UnitTest {
   // Gets the number of tests that should run.
   int test_to_run_count() const;
 
+  // Gets the time of the test program start, in ms from the start of the
+  // UNIX epoch.
+  TimeInMillis start_timestamp() const;
+
   // Gets the elapsed time, in milliseconds.
   TimeInMillis elapsed_time() const;
 
@@ -18261,7 +18721,8 @@ class GTEST_API_ UnitTest {
                          const char* file_name,
                          int line_number,
                          const internal::String& message,
-                         const internal::String& os_stack_trace);
+                         const internal::String& os_stack_trace)
+      GTEST_LOCK_EXCLUDED_(mutex_);
 
   // Adds a TestProperty to the current TestResult object. If the result already
   // contains a property with the same key, the value will be updated.
@@ -18294,10 +18755,12 @@ class GTEST_API_ UnitTest {
 
   // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
   // Google Test trace stack.
-  void PushGTestTrace(const internal::TraceInfo& trace);
+  void PushGTestTrace(const internal::TraceInfo& trace)
+      GTEST_LOCK_EXCLUDED_(mutex_);
 
   // Pops a trace from the per-thread Google Test trace stack.
-  void PopGTestTrace();
+  void PopGTestTrace()
+      GTEST_LOCK_EXCLUDED_(mutex_);
 
   // Protects mutable state in *impl_.  This is mutable as some const
   // methods need to lock it too.
@@ -18352,24 +18815,101 @@ GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
 
 namespace internal {
 
+// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
+// value of type ToPrint that is an operand of a comparison assertion
+// (e.g. ASSERT_EQ).  OtherOperand is the type of the other operand in
+// the comparison, and is used to help determine the best way to
+// format the value.  In particular, when the value is a C string
+// (char pointer) and the other operand is an STL string object, we
+// want to format the C string as a string, since we know it is
+// compared by value with the string object.  If the value is a char
+// pointer but the other operand is not an STL string object, we don't
+// know whether the pointer is supposed to point to a NUL-terminated
+// string, and thus want to print it as a pointer to be safe.
+//
+// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
+
+// The default case.
+template <typename ToPrint, typename OtherOperand>
+class FormatForComparison {
+ public:
+  static ::std::string Format(const ToPrint& value) {
+    return ::testing::PrintToString(value);
+  }
+};
+
+// Array.
+template <typename ToPrint, size_t N, typename OtherOperand>
+class FormatForComparison<ToPrint[N], OtherOperand> {
+ public:
+  static ::std::string Format(const ToPrint* value) {
+    return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);
+  }
+};
+
+// By default, print C string as pointers to be safe, as we don't know
+// whether they actually point to a NUL-terminated string.
+
+#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType)                \
+  template <typename OtherOperand>                                      \
+  class FormatForComparison<CharType*, OtherOperand> {                  \
+   public:                                                              \
+    static ::std::string Format(CharType* value) {                      \
+      return ::testing::PrintToString(static_cast<const void*>(value)); \
+    }                                                                   \
+  }
+
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
+
+#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
+
+// If a C string is compared with an STL string object, we know it's meant
+// to point to a NUL-terminated string, and thus can print it as a string.
+
+#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
+  template <>                                                           \
+  class FormatForComparison<CharType*, OtherStringType> {               \
+   public:                                                              \
+    static ::std::string Format(CharType* value) {                      \
+      return ::testing::PrintToString(value);                           \
+    }                                                                   \
+  }
+
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
+
+#if GTEST_HAS_GLOBAL_STRING
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
+#endif
+
+#if GTEST_HAS_GLOBAL_WSTRING
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);
+#endif
+
+#if GTEST_HAS_STD_WSTRING
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
+#endif
+
+#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
+
 // Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
 // operand to be used in a failure message.  The type (but not value)
 // of the other operand may affect the format.  This allows us to
 // print a char* as a raw pointer when it is compared against another
-// char*, and print it as a C string when it is compared against an
-// std::string object, for example.
-//
-// The default implementation ignores the type of the other operand.
-// Some specialized versions are used to handle formatting wide or
-// narrow C strings.
+// char* or void*, and print it as a C string when it is compared
+// against an std::string object, for example.
 //
 // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
 template <typename T1, typename T2>
 String FormatForComparisonFailureMessage(const T1& value,
                                          const T2& /* other_operand */) {
-  // C++Builder compiles this incorrectly if the namespace isn't explicitly
-  // given.
-  return ::testing::PrintToString(value);
+  return FormatForComparison<T1, T2>::Format(value);
 }
 
 // The helper function for {ASSERT|EXPECT}_EQ.
@@ -18381,7 +18921,7 @@ AssertionResult CmpHelperEQ(const char* expected_expression,
 #ifdef _MSC_VER
 # pragma warning(push)          // Saves the current warning state.
 # pragma warning(disable:4389)  // Temporarily disables warning on
-                               // signed/unsigned mismatch.
+                                // signed/unsigned mismatch.
 #endif
 
   if (expected == actual) {
@@ -18517,11 +19057,11 @@ GTEST_IMPL_CMP_HELPER_(NE, !=);
 // Implements the helper function for {ASSERT|EXPECT}_LE
 GTEST_IMPL_CMP_HELPER_(LE, <=);
 // Implements the helper function for {ASSERT|EXPECT}_LT
-GTEST_IMPL_CMP_HELPER_(LT, < );
+GTEST_IMPL_CMP_HELPER_(LT, <);
 // Implements the helper function for {ASSERT|EXPECT}_GE
 GTEST_IMPL_CMP_HELPER_(GE, >=);
 // Implements the helper function for {ASSERT|EXPECT}_GT
-GTEST_IMPL_CMP_HELPER_(GT, > );
+GTEST_IMPL_CMP_HELPER_(GT, >);
 
 #undef GTEST_IMPL_CMP_HELPER_
 
@@ -18792,12 +19332,6 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 // usually want the fail-fast behavior of FAIL and ASSERT_*, but those
 // writing data-driven tests often find themselves using ADD_FAILURE
 // and EXPECT_* more.
-//
-// Examples:
-//
-//   EXPECT_TRUE(server.StatusIsOK());
-//   ASSERT_FALSE(server.HasPendingRequest(port))
-//       << "There are still pending requests " << "on port " << port;
 
 // Generates a nonfatal failure with a generic message.
 #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
@@ -18895,7 +19429,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-// This file is AUTOMATICALLY GENERATED on 09/24/2010 by command
+// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
 // 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
 //
 // Implements a family of generic predicate assertion macros.
@@ -18966,7 +19500,7 @@ AssertionResult AssertPred1Helper(const char* pred_text,
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, v1),\
+  GTEST_ASSERT_(pred_format(#v1, v1), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED1.  Don't use
@@ -19012,7 +19546,7 @@ AssertionResult AssertPred2Helper(const char* pred_text,
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED2.  Don't use
@@ -19065,7 +19599,7 @@ AssertionResult AssertPred3Helper(const char* pred_text,
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED3.  Don't use
@@ -19125,7 +19659,7 @@ AssertionResult AssertPred4Helper(const char* pred_text,
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED4.  Don't use
@@ -19192,7 +19726,7 @@ AssertionResult AssertPred5Helper(const char* pred_text,
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED5.  Don't use
index f62e4a4..cac280b 100644 (file)
@@ -96,13 +96,13 @@ def query_yes_no(stdout, question, default="yes"):
         else:
             stdout.write("Please respond with 'yes' or 'no' "\
                              "(or 'y' or 'n').\n")
-                             
+
 def getRunningProcessExePathByName_win32(name):
     from ctypes import windll, POINTER, pointer, Structure, sizeof
     from ctypes import c_long , c_int , c_uint , c_char , c_ubyte , c_char_p , c_void_p
-    
+
     class PROCESSENTRY32(Structure):
-        _fields_ = [ ( 'dwSize' , c_uint ) , 
+        _fields_ = [ ( 'dwSize' , c_uint ) ,
                     ( 'cntUsage' , c_uint) ,
                     ( 'th32ProcessID' , c_uint) ,
                     ( 'th32DefaultHeapID' , c_uint) ,
@@ -111,25 +111,25 @@ def getRunningProcessExePathByName_win32(name):
                     ( 'th32ParentProcessID' , c_uint) ,
                     ( 'pcPriClassBase' , c_long) ,
                     ( 'dwFlags' , c_uint) ,
-                    ( 'szExeFile' , c_char * 260 ) , 
+                    ( 'szExeFile' , c_char * 260 ) ,
                     ( 'th32MemoryBase' , c_long) ,
                     ( 'th32AccessKey' , c_long ) ]
-                    
+
     class MODULEENTRY32(Structure):
-        _fields_ = [ ( 'dwSize' , c_long ) , 
+        _fields_ = [ ( 'dwSize' , c_long ) ,
                     ( 'th32ModuleID' , c_long ),
                     ( 'th32ProcessID' , c_long ),
                     ( 'GlblcntUsage' , c_long ),
                     ( 'ProccntUsage' , c_long ) ,
                     ( 'modBaseAddr' , c_long ) ,
-                    ( 'modBaseSize' , c_long ) , 
+                    ( 'modBaseSize' , c_long ) ,
                     ( 'hModule' , c_void_p ) ,
                     ( 'szModule' , c_char * 256 ),
                     ( 'szExePath' , c_char * 260 ) ]
-                
+
     TH32CS_SNAPPROCESS = 2
     TH32CS_SNAPMODULE = 0x00000008
-    
+
     ## CreateToolhelp32Snapshot
     CreateToolhelp32Snapshot= windll.kernel32.CreateToolhelp32Snapshot
     CreateToolhelp32Snapshot.reltype = c_long
@@ -150,7 +150,7 @@ def getRunningProcessExePathByName_win32(name):
     Module32First = windll.kernel32.Module32First
     Module32First.argtypes = [ c_void_p , POINTER(MODULEENTRY32) ]
     Module32First.rettype = c_int
-                    
+
     hProcessSnap = c_void_p(0)
     hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS , 0 )
 
@@ -180,7 +180,7 @@ def getRunningProcessExePathByName_posix(name):
     for pid in pids:
         try:
             path = os.readlink(os.path.join('/proc', pid, 'exe'))
-            if path and path.endswith(name):  
+            if path and path.endswith(name):
                 return path
         except:
             pass
@@ -195,7 +195,7 @@ def getRunningProcessExePathByName(name):
             return None
     except:
         return None
-        
+
 class RunInfo(object):
     def setCallback(self, name, callback):
         setattr(self, name, callback)
@@ -224,7 +224,7 @@ class RunInfo(object):
         except:
             pass
         cachefile.close()
-        
+
         # fix empty tests dir
         if not self.tests_dir:
             self.tests_dir = self.path
@@ -236,12 +236,12 @@ class RunInfo(object):
         else:
             self.adb = None
 
-        # detect target platform    
+        # detect target platform
         if self.android_executable or self.android_abi or self.ndk_path:
             self.targetos = "android"
         else:
             self.targetos = hostos
-            
+
         if self.targetos == "android":
             # fix adb tool location
             if not self.adb:
@@ -250,7 +250,7 @@ class RunInfo(object):
                 self.adb = "adb"
             if options.adb_serial:
                 self.adb = [self.adb, "-s", options.adb_serial]
-           else:
+            else:
                 self.adb = [self.adb]
             try:
                 output = Popen(self.adb + ["shell", "ls"], stdout=PIPE, stderr=PIPE).communicate()
@@ -317,23 +317,23 @@ class RunInfo(object):
             self.targetarch = "x86"
         else:
             self.targetarch = "unknown"
-            
+
         # fix CUDA attributes
         self.with_cuda = self.with_cuda == "ON"
         if self.cuda_library and self.cuda_library.endswith("-NOTFOUND"):
             self.cuda_library = None
         self.has_cuda = self.with_cuda and self.cuda_library and self.targetarch in ["x86", "x64"]
-            
+
         self.hardware = None
-        
+
         self.getSvnVersion(self.cmake_home, "cmake_home_svn")
         if self.opencv_home == self.cmake_home:
             self.opencv_home_svn = self.cmake_home_svn
         else:
             self.getSvnVersion(self.opencv_home, "opencv_home_svn")
-            
+
         self.tests = self.getAvailableTestApps()
-        
+
     def getSvnVersion(self, path, name):
         if not path:
             setattr(self, name, None)
@@ -352,7 +352,7 @@ class RunInfo(object):
                     setattr(self, name, None)
             except OSError:
                 setattr(self, name, None)
-        
+
     def tryGetSvnVersionWithTortoise(self, path, name):
         try:
             wcrev = "SubWCRev.exe"
@@ -377,7 +377,7 @@ class RunInfo(object):
             if dir:
                 import shutil
                 shutil.rmtree(dir)
-                
+
     def isTest(self, fullpath):
         if not os.path.isfile(fullpath):
             return False
@@ -388,14 +388,14 @@ class RunInfo(object):
         if self.targetos == "android" and fullpath.endswith(".apk"):
             return True
         return True
-                
+
     def getAvailableTestApps(self):
         if self.tests_dir and os.path.isdir(self.tests_dir):
             files = glob.glob(os.path.join(self.tests_dir, self.nameprefix + "*"))
             files = [f for f in files if self.isTest(f)]
             return files
         return []
-    
+
     def getLogName(self, app, timestamp):
         app = os.path.basename(app)
         if app.endswith(".exe"):
@@ -508,17 +508,17 @@ class RunInfo(object):
                 hw = ""
             tstamp = timestamp.strftime("%Y-%m-%d--%H-%M-%S")
             return "%s_%s_%s_%s%s%s.xml" % (app, self.targetos, self.targetarch, hw, rev, tstamp)
-        
+
     def getTest(self, name):
         # full path
         if self.isTest(name):
             return name
-        
+
         # name only
         fullname = os.path.join(self.tests_dir, name)
         if self.isTest(fullname):
             return fullname
-        
+
         # name without extension
         fullname += ".exe"
         if self.isTest(fullname):
@@ -527,7 +527,7 @@ class RunInfo(object):
             fullname += ".apk"
             if self.isTest(fullname):
                 return fullname
-        
+
         # short name for OpenCV tests
         for t in self.tests:
             if t == name:
@@ -547,7 +547,7 @@ class RunInfo(object):
             if fname == name:
                 return t
         return None
-    
+
     def runAdb(self, *args):
         cmd = self.adb[:]
         cmd.extend(args)
@@ -559,7 +559,7 @@ class RunInfo(object):
         except OSError:
             pass
         return None
-    
+
     def isRunnable(self):
         if self.error:
             return False
@@ -585,7 +585,7 @@ class RunInfo(object):
                 if hw:
                     self.hardware = hw.groups()[0].strip()
         return True
-    
+
     def runTest(self, path, workingDir, _stdout, _stderr, args = []):
         if self.error:
             return
@@ -593,13 +593,13 @@ class RunInfo(object):
         timestamp = datetime.datetime.now()
         logfile = self.getLogName(path, timestamp)
         exe = os.path.abspath(path)
-        
+
         userlog = [a for a in args if a.startswith("--gtest_output=")]
         if len(userlog) == 0:
             args.append("--gtest_output=xml:" + logfile)
         else:
             logfile = userlog[0][userlog[0].find(":")+1:]
-        
+
         if self.targetos == "android" and exe.endswith(".apk"):
             print "running java tests:", exe
             try:
@@ -653,10 +653,11 @@ class RunInfo(object):
         elif self.targetos == "android":
             hostlogpath = ""
             usercolor = [a for a in args if a.startswith("--gtest_color=")]
-            if len(userlog) == 0 and _stdout.isatty() and hostos != "nt":
+            if len(usercolor) == 0 and _stdout.isatty() and hostos != "nt":
                 args.append("--gtest_color=yes")
             try:
-                andoidcwd = "/data/bin/" + getpass.getuser().replace(" ","") + "_" + self.options.mode +"/"
+                tempdir = "/data/local/tmp/"
+                andoidcwd = tempdir + getpass.getuser().replace(" ","") + "_" + self.options.mode +"/"
                 exename = os.path.basename(exe)
                 androidexe = andoidcwd + exename
                 #upload
@@ -692,6 +693,9 @@ class RunInfo(object):
                         return
                     #rm log
                     Popen(self.adb + ["shell", "rm " + andoidcwd + logfile], stdout=_stdout, stderr=_stderr).wait()
+
+                # clean temporary files
+                Popen(self.adb + ["shell", "rm " + tempdir + "__opencv_temp.*"], stdout=_stdout, stderr=_stderr).wait()
             except OSError:
                 pass
             if os.path.isfile(hostlogpath):
@@ -704,16 +708,27 @@ class RunInfo(object):
             else:
                 cmd.extend(args)
             print >> _stderr, "Running:", " ".join(cmd)
-            try: 
+            try:
                 Popen(cmd, stdout=_stdout, stderr=_stderr, cwd = workingDir).wait()
             except OSError:
                 pass
-            
+
+            # clean temporary files
+            temp_path = os.environ.get('OPENCV_TEMP_PATH')
+            if not temp_path:
+                if hostos == "nt":
+                    temp_path = tempfile.gettempdir()
+                else:
+                    temp_path = "/tmp"
+
+            for filename in glob.glob(os.path.join(temp_path, "__opencv_temp.*")) :
+                os.remove( filename )
+
             logpath = os.path.join(workingDir, logfile)
             if os.path.isfile(logpath):
                 return logpath
             return None
-            
+
     def runTests(self, tests, _stdout, _stderr, workingDir, args = []):
         if self.error:
             return []
@@ -747,10 +762,10 @@ def getRunArgs(args):
 if __name__ == "__main__":
     test_args = [a for a in sys.argv if a.startswith("--perf_") or a.startswith("--gtest_")]
     argv =      [a for a in sys.argv if not(a.startswith("--perf_") or a.startswith("--gtest_"))]
-    
+
     parser = OptionParser()
     parser.add_option("-t", "--tests", dest="tests", help="comma-separated list of modules to test", metavar="SUITS", default="")
-    
+
     parser.add_option("-w", "--cwd", dest="cwd", help="working directory for tests", metavar="PATH", default=".")
     parser.add_option("-a", "--accuracy", dest="accuracy", help="look for accuracy tests instead of performance tests", action="store_true", default=False)
     parser.add_option("-l", "--longname", dest="useLongNames", action="store_true", help="generate log files with long names", default=False)
@@ -759,26 +774,26 @@ if __name__ == "__main__":
     parser.add_option("", "--serial", dest="adb_serial", help="Android: directs command to the USB device or emulator with the given serial number", metavar="serial number", default="")
     parser.add_option("", "--package", dest="junit_package", help="Android: run jUnit tests for specified package", metavar="package", default="")
     parser.add_option("", "--help-tests", dest="help", help="Show help for test executable", action="store_true", default=False)
-    
+
     (options, args) = parser.parse_args(argv)
 
     if options.accuracy:
         options.mode = "test"
     else:
         options.mode = "perf"
-    
+
     run_args = getRunArgs(args[1:] or ['.'])
-    
+
     if len(run_args) == 0:
         print >> sys.stderr, "Usage:\n", os.path.basename(sys.argv[0]), "<build_path>"
         exit(1)
-        
+
     tests = [s.strip() for s in options.tests.split(",") if s]
-            
+
     if len(tests) != 1 or len(run_args) != 1:
         #remove --gtest_output from params
         test_args = [a for a in test_args if not a.startswith("--gtest_output=")]
-    
+
     logs = []
     for path in run_args:
         info = RunInfo(path, options)
@@ -789,5 +804,5 @@ if __name__ == "__main__":
             info.test_data_path = options.test_data_path
             logs.extend(info.runTests(tests, sys.stdout, sys.stderr, options.cwd, test_args))
 
-    if logs:            
+    if logs:
         print >> sys.stderr, "Collected:", " ".join(logs)
index 2798bfa..f2cd000 100644 (file)
@@ -40,6 +40,7 @@
 
 #ifdef __GNUC__
 #  pragma GCC diagnostic ignored "-Wmissing-declarations"
+#  pragma GCC diagnostic ignored "-Wmissing-field-initializers"
 #endif
 
 // The following lines pull in the real gtest *.cc files.
@@ -300,7 +301,7 @@ class GTEST_API_ SingleFailureChecker {
         (substr));\
     {\
       ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
-          ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS,\
+          ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
           &gtest_failures);\
       if (::testing::internal::AlwaysTrue()) { statement; }\
     }\
@@ -313,6 +314,7 @@ class GTEST_API_ SingleFailureChecker {
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <time.h>
 #include <wchar.h>
 #include <wctype.h>
 
@@ -514,6 +516,12 @@ GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
 // Formats the given time in milliseconds as seconds.
 GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);
 
+// Converts the given time in milliseconds to a date string in the ISO 8601
+// format, without the timezone information.  N.B.: due to the use the
+// non-reentrant localtime() function, this function is not thread safe.  Do
+// not use it in any code that can be called from multiple threads.
+GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms);
+
 // Parses a string for an Int32 flag, in the form of "--flag=value".
 //
 // On success, stores the value of the flag in *value, and returns
@@ -592,6 +600,7 @@ class GTestFlagSaver {
     GTEST_FLAG(stream_result_to) = stream_result_to_;
     GTEST_FLAG(throw_on_failure) = throw_on_failure_;
   }
+
  private:
   // Fields for saving the original values of flags.
   bool also_run_disabled_tests_;
@@ -834,8 +843,11 @@ class OsStackTraceGetterInterface {
 class OsStackTraceGetter : public OsStackTraceGetterInterface {
  public:
   OsStackTraceGetter() : caller_frame_(NULL) {}
-  virtual String CurrentStackTrace(int max_depth, int skip_count);
-  virtual void UponLeavingGTest();
+
+  virtual String CurrentStackTrace(int max_depth, int skip_count)
+      GTEST_LOCK_EXCLUDED_(mutex_);
+
+  virtual void UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_);
 
   // This string is inserted in place of stack frames that are part of
   // Google Test's implementation.
@@ -950,6 +962,10 @@ class GTEST_API_ UnitTestImpl {
   // Gets the number of tests that should run.
   int test_to_run_count() const;
 
+  // Gets the time of the test program start, in ms from the start of the
+  // UNIX epoch.
+  TimeInMillis start_timestamp() const { return start_timestamp_; }
+
   // Gets the elapsed time, in milliseconds.
   TimeInMillis elapsed_time() const { return elapsed_time_; }
 
@@ -1008,7 +1024,7 @@ class GTEST_API_ UnitTestImpl {
   // For example, if Foo() calls Bar(), which in turn calls
   // CurrentOsStackTraceExceptTop(1), Foo() will be included in the
   // trace but Bar() and CurrentOsStackTraceExceptTop() won't.
-  String CurrentOsStackTraceExceptTop(int skip_count);
+  String CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;
 
   // Finds and returns a TestCase with the given name.  If one doesn't
   // exist, creates one and returns it.
@@ -1282,6 +1298,10 @@ class GTEST_API_ UnitTestImpl {
   // Our random number generator.
   internal::Random random_;
 
+  // The time of the test program start, in ms from the start of the
+  // UNIX epoch.
+  TimeInMillis start_timestamp_;
+
   // How long the test took to run, in milliseconds.
   TimeInMillis elapsed_time_;
 
@@ -1613,7 +1633,7 @@ UInt32 Random::Generate(UInt32 range) {
 // Test.  g_init_gtest_count is set to the number of times
 // InitGoogleTest() has been called.  We don't protect this variable
 // under a mutex as it is only accessed in the main thread.
-int g_init_gtest_count = 0;
+GTEST_API_ int g_init_gtest_count = 0;
 static bool GTestIsInitialized() { return g_init_gtest_count != 0; }
 
 // Iterates over a vector of TestCases, keeping a running sum of the
@@ -1668,7 +1688,7 @@ void AssertHelper::operator=(const Message& message) const {
 }
 
 // Mutex for linked pointers.
-GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
+GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
 
 // Application pathname gotten in InitGoogleTest.
 String g_executable_path;
@@ -2125,17 +2145,6 @@ TimeInMillis GetTimeInMillis() {
 
 // class String
 
-// Returns the input enclosed in double quotes if it's not NULL;
-// otherwise returns "(null)".  For example, "\"Hello\"" is returned
-// for input "Hello".
-//
-// This is useful for printing a C string in the syntax of a literal.
-//
-// Known issue: escape sequences are not handled yet.
-String String::ShowCStringQuoted(const char* c_str) {
-  return c_str ? String::Format("\"%s\"", c_str) : String("(null)");
-}
-
 // Copies at most length characters from str into a newly-allocated
 // piece of memory of size length+1.  The memory is allocated with new[].
 // A terminating null byte is written to the memory, and a pointer to it
@@ -2476,8 +2485,8 @@ AssertionResult CmpHelperSTREQ(const char* expected_expression,
 
   return EqFailure(expected_expression,
                    actual_expression,
-                   String::ShowCStringQuoted(expected),
-                   String::ShowCStringQuoted(actual),
+                   PrintToString(expected),
+                   PrintToString(actual),
                    false);
 }
 
@@ -2492,8 +2501,8 @@ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
 
   return EqFailure(expected_expression,
                    actual_expression,
-                   String::ShowCStringQuoted(expected),
-                   String::ShowCStringQuoted(actual),
+                   PrintToString(expected),
+                   PrintToString(actual),
                    true);
 }
 
@@ -2841,15 +2850,6 @@ String String::ShowWideCString(const wchar_t * wide_c_str) {
   return String(internal::WideStringToUtf8(wide_c_str, -1).c_str());
 }
 
-// Similar to ShowWideCString(), except that this function encloses
-// the converted string in double quotes.
-String String::ShowWideCStringQuoted(const wchar_t* wide_c_str) {
-  if (wide_c_str == NULL) return String("(null)");
-
-  return String::Format("L\"%s\"",
-                        String::ShowWideCString(wide_c_str).c_str());
-}
-
 // Compares two wide C strings.  Returns true iff they have the same
 // content.
 //
@@ -2875,8 +2875,8 @@ AssertionResult CmpHelperSTREQ(const char* expected_expression,
 
   return EqFailure(expected_expression,
                    actual_expression,
-                   String::ShowWideCStringQuoted(expected),
-                   String::ShowWideCStringQuoted(actual),
+                   PrintToString(expected),
+                   PrintToString(actual),
                    false);
 }
 
@@ -2891,8 +2891,8 @@ AssertionResult CmpHelperSTRNE(const char* s1_expression,
 
   return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
                             << s2_expression << "), actual: "
-                            << String::ShowWideCStringQuoted(s1)
-                            << " vs " << String::ShowWideCStringQuoted(s2);
+                            << PrintToString(s1)
+                            << " vs " << PrintToString(s2);
 }
 
 // Compares two C strings, ignoring case.  Returns true iff they have
@@ -4015,8 +4015,6 @@ class PrettyUnitTestResultPrinter : public TestEventListener {
 
  private:
   static void PrintFailedTests(const UnitTest& unit_test);
-
-  internal::String test_case_name_;
 };
 
   // Fired before each iteration of tests starts.
@@ -4063,11 +4061,10 @@ void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
 }
 
 void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
-  test_case_name_ = test_case.name();
   const internal::String counts =
       FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
   ColoredPrintf(COLOR_GREEN, "[----------] ");
-  printf("%s from %s", counts.c_str(), test_case_name_.c_str());
+  printf("%s from %s", counts.c_str(), test_case.name());
   if (test_case.type_param() == NULL) {
     printf("\n");
   } else {
@@ -4078,7 +4075,7 @@ void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
 
 void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {
   ColoredPrintf(COLOR_GREEN,  "[ RUN      ] ");
-  PrintTestName(test_case_name_.c_str(), test_info.name());
+  PrintTestName(test_info.test_case_name(), test_info.name());
   printf("\n");
   fflush(stdout);
 }
@@ -4101,7 +4098,7 @@ void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
   } else {
     ColoredPrintf(COLOR_RED, "[  FAILED  ] ");
   }
-  PrintTestName(test_case_name_.c_str(), test_info.name());
+  PrintTestName(test_info.test_case_name(), test_info.name());
   if (test_info.result()->Failed())
     PrintFullTestCommentIfPresent(test_info);
 
@@ -4117,12 +4114,11 @@ void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
 void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {
   if (!GTEST_FLAG(print_time)) return;
 
-  test_case_name_ = test_case.name();
   const internal::String counts =
       FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
   ColoredPrintf(COLOR_GREEN, "[----------] ");
   printf("%s from %s (%s ms total)\n\n",
-         counts.c_str(), test_case_name_.c_str(),
+         counts.c_str(), test_case.name(),
          internal::StreamableToString(test_case.elapsed_time()).c_str());
   fflush(stdout);
 }
@@ -4507,6 +4503,32 @@ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
   return ss.str();
 }
 
+// Converts the given epoch time in milliseconds to a date string in the ISO
+// 8601 format, without the timezone information.
+std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
+  // Using non-reentrant version as localtime_r is not portable.
+  time_t seconds = static_cast<time_t>(ms / 1000);
+#ifdef _MSC_VER
+# pragma warning(push)          // Saves the current warning state.
+# pragma warning(disable:4996)  // Temporarily disables warning 4996
+                                // (function or variable may be unsafe).
+  const struct tm* const time_struct = localtime(&seconds);  // NOLINT
+# pragma warning(pop)           // Restores the warning state again.
+#else
+  const struct tm* const time_struct = localtime(&seconds);  // NOLINT
+#endif
+  if (time_struct == NULL)
+    return "";  // Invalid ms value
+
+  return String::Format("%d-%02d-%02dT%02d:%02d:%02d",  // YYYY-MM-DDThh:mm:ss
+                        time_struct->tm_year + 1900,
+                        time_struct->tm_mon + 1,
+                        time_struct->tm_mday,
+                        time_struct->tm_hour,
+                        time_struct->tm_min,
+                        time_struct->tm_sec);
+}
+
 // Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
 void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,
                                                      const char* data) {
@@ -4556,16 +4578,17 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
   for (int i = 0; i < result.total_part_count(); ++i) {
     const TestPartResult& part = result.GetTestPartResult(i);
     if (part.failed()) {
-      if (++failures == 1)
+      if (++failures == 1) {
         *stream << ">\n";
-      *stream << "      <failure message=\""
-              << EscapeXmlAttribute(part.summary()).c_str()
-              << "\" type=\"\">";
+      }
       const string location = internal::FormatCompilerIndependentFileLocation(
           part.file_name(), part.line_number());
-      const string message = location + "\n" + part.message();
-      OutputXmlCDataSection(stream,
-                            RemoveInvalidXmlCharacters(message).c_str());
+      const string summary = location + "\n" + part.summary();
+      *stream << "      <failure message=\""
+              << EscapeXmlAttribute(summary.c_str())
+              << "\" type=\"\">";
+      const string detail = location + "\n" + part.message();
+      OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
       *stream << "</failure>\n";
     }
   }
@@ -4603,10 +4626,11 @@ void XmlUnitTestResultPrinter::PrintXmlUnitTest(FILE* out,
   fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
   fprintf(out,
           "<testsuites tests=\"%d\" failures=\"%d\" disabled=\"%d\" "
-          "errors=\"0\" time=\"%s\" ",
+          "errors=\"0\" timestamp=\"%s\" time=\"%s\" ",
           unit_test.total_test_count(),
           unit_test.failed_test_count(),
           unit_test.disabled_test_count(),
+          FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp()).c_str(),
           FormatTimeInMillisAsSeconds(unit_test.elapsed_time()).c_str());
   if (GTEST_FLAG(shuffle)) {
     fprintf(out, "random_seed=\"%d\" ", unit_test.random_seed());
@@ -4812,8 +4836,8 @@ void StreamingListener::MakeConnection() {
 
 // Pushes the given source file location and message onto a per-thread
 // trace stack maintained by Google Test.
-// L < UnitTest::mutex_
-ScopedTrace::ScopedTrace(const char* file, int line, const Message& message) {
+ScopedTrace::ScopedTrace(const char* file, int line, const Message& message)
+    GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
   TraceInfo trace;
   trace.file = file;
   trace.line = line;
@@ -4823,8 +4847,8 @@ ScopedTrace::ScopedTrace(const char* file, int line, const Message& message) {
 }
 
 // Pops the info pushed by the c'tor.
-// L < UnitTest::mutex_
-ScopedTrace::~ScopedTrace() {
+ScopedTrace::~ScopedTrace()
+    GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
   UnitTest::GetInstance()->PopGTestTrace();
 }
 
@@ -4838,14 +4862,14 @@ ScopedTrace::~ScopedTrace() {
 //   skip_count - the number of top frames to be skipped; doesn't count
 //                against max_depth.
 //
-// L < mutex_
-// We use "L < mutex_" to denote that the function may acquire mutex_.
-String OsStackTraceGetter::CurrentStackTrace(int, int) {
+String OsStackTraceGetter::CurrentStackTrace(int /* max_depth */,
+                                             int /* skip_count */)
+    GTEST_LOCK_EXCLUDED_(mutex_) {
   return String("");
 }
 
-// L < mutex_
-void OsStackTraceGetter::UponLeavingGTest() {
+void OsStackTraceGetter::UponLeavingGTest()
+    GTEST_LOCK_EXCLUDED_(mutex_) {
 }
 
 const char* const
@@ -4999,6 +5023,12 @@ int UnitTest::total_test_count() const { return impl()->total_test_count(); }
 // Gets the number of tests that should run.
 int UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); }
 
+// Gets the time of the test program start, in ms from the start of the
+// UNIX epoch.
+internal::TimeInMillis UnitTest::start_timestamp() const {
+    return impl()->start_timestamp();
+}
+
 // Gets the elapsed time, in milliseconds.
 internal::TimeInMillis UnitTest::elapsed_time() const {
   return impl()->elapsed_time();
@@ -5052,12 +5082,13 @@ Environment* UnitTest::AddEnvironment(Environment* env) {
 // assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call
 // this to report their results.  The user code should use the
 // assertion macros instead of calling this directly.
-// L < mutex_
-void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
-                                 const char* file_name,
-                                 int line_number,
-                                 const internal::String& message,
-                                 const internal::String& os_stack_trace) {
+void UnitTest::AddTestPartResult(
+    TestPartResult::Type result_type,
+    const char* file_name,
+    int line_number,
+    const internal::String& message,
+    const internal::String& os_stack_trace)
+        GTEST_LOCK_EXCLUDED_(mutex_) {
   Message msg;
   msg << message;
 
@@ -5141,7 +5172,6 @@ int UnitTest::Run() {
   // process. In either case the user does not want to see pop-up dialogs
   // about crashes - they are expected.
   if (impl()->catch_exceptions() || in_death_test_child_process) {
-
 # if !GTEST_OS_WINDOWS_MOBILE
     // SetErrorMode doesn't exist on CE.
     SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
@@ -5172,7 +5202,6 @@ int UnitTest::Run() {
           0x0,                                    // Clear the following flags:
           _WRITE_ABORT_MSG | _CALL_REPORTFAULT);  // pop-up window, core dump.
 # endif
-
   }
 #endif  // GTEST_HAS_SEH
 
@@ -5190,16 +5219,16 @@ const char* UnitTest::original_working_dir() const {
 
 // Returns the TestCase object for the test that's currently running,
 // or NULL if no test is running.
-// L < mutex_
-const TestCase* UnitTest::current_test_case() const {
+const TestCase* UnitTest::current_test_case() const
+    GTEST_LOCK_EXCLUDED_(mutex_) {
   internal::MutexLock lock(&mutex_);
   return impl_->current_test_case();
 }
 
 // Returns the TestInfo object for the test that's currently running,
 // or NULL if no test is running.
-// L < mutex_
-const TestInfo* UnitTest::current_test_info() const {
+const TestInfo* UnitTest::current_test_info() const
+    GTEST_LOCK_EXCLUDED_(mutex_) {
   internal::MutexLock lock(&mutex_);
   return impl_->current_test_info();
 }
@@ -5210,9 +5239,9 @@ int UnitTest::random_seed() const { return impl_->random_seed(); }
 #if GTEST_HAS_PARAM_TEST
 // Returns ParameterizedTestCaseRegistry object used to keep track of
 // value-parameterized tests and instantiate and register them.
-// L < mutex_
 internal::ParameterizedTestCaseRegistry&
-    UnitTest::parameterized_test_registry() {
+    UnitTest::parameterized_test_registry()
+        GTEST_LOCK_EXCLUDED_(mutex_) {
   return impl_->parameterized_test_registry();
 }
 #endif  // GTEST_HAS_PARAM_TEST
@@ -5229,15 +5258,15 @@ UnitTest::~UnitTest() {
 
 // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
 // Google Test trace stack.
-// L < mutex_
-void UnitTest::PushGTestTrace(const internal::TraceInfo& trace) {
+void UnitTest::PushGTestTrace(const internal::TraceInfo& trace)
+    GTEST_LOCK_EXCLUDED_(mutex_) {
   internal::MutexLock lock(&mutex_);
   impl_->gtest_trace_stack().push_back(trace);
 }
 
 // Pops a trace from the per-thread Google Test trace stack.
-// L < mutex_
-void UnitTest::PopGTestTrace() {
+void UnitTest::PopGTestTrace()
+    GTEST_LOCK_EXCLUDED_(mutex_) {
   internal::MutexLock lock(&mutex_);
   impl_->gtest_trace_stack().pop_back();
 }
@@ -5273,6 +5302,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
       post_flag_parse_init_performed_(false),
       random_seed_(0),  // Will be overridden by the flag before first use.
       random_(0),  // Will be reseeded before first use.
+      start_timestamp_(0),
       elapsed_time_(0),
 #if GTEST_HAS_DEATH_TEST
       internal_run_death_test_flag_(NULL),
@@ -5504,6 +5534,7 @@ bool UnitTestImpl::RunAllTests() {
 
   TestEventListener* repeater = listeners()->repeater();
 
+  start_timestamp_ = GetTimeInMillis();
   repeater->OnTestProgramStart(*parent_);
 
   // How many times to repeat the tests?  We don't want to repeat them
@@ -5865,7 +5896,7 @@ bool SkipPrefix(const char* prefix, const char** pstr) {
 // part can be omitted.
 //
 // Returns the value of the flag, or NULL if the parsing failed.
-static const char* ParseFlagValue(const char* str,
+const char* ParseFlagValue(const char* str,
                            const char* flag,
                            bool def_optional) {
   // str and flag must not be NULL.
@@ -6240,13 +6271,18 @@ void InitGoogleTest(int* argc, wchar_t** argv) {
 
 #if GTEST_HAS_DEATH_TEST
 
-# if GTEST_OS_MAC && !GTEST_OS_MAC_IOS
+# if GTEST_OS_MAC
 #  include <crt_externs.h>
 # endif  // GTEST_OS_MAC
 
 # include <errno.h>
 # include <fcntl.h>
 # include <limits.h>
+
+# if GTEST_OS_LINUX
+#  include <signal.h>
+# endif  // GTEST_OS_LINUX
+
 # include <stdarg.h>
 
 # if GTEST_OS_WINDOWS
@@ -6256,6 +6292,10 @@ void InitGoogleTest(int* argc, wchar_t** argv) {
 #  include <sys/wait.h>
 # endif  // GTEST_OS_WINDOWS
 
+# if GTEST_OS_QNX
+#  include <spawn.h>
+# endif  // GTEST_OS_QNX
+
 #endif  // GTEST_HAS_DEATH_TEST
 
 
@@ -6301,13 +6341,42 @@ GTEST_DEFINE_string_(
     "Indicates the file, line number, temporal index of "
     "the single death test to run, and a file descriptor to "
     "which a success code may be sent, all separated by "
-    "colons.  This flag is specified if and only if the current "
+    "the '|' characters.  This flag is specified if and only if the current "
     "process is a sub-process launched for running a thread-safe "
     "death test.  FOR INTERNAL USE ONLY.");
 }  // namespace internal
 
 #if GTEST_HAS_DEATH_TEST
 
+namespace internal {
+
+// Valid only for fast death tests. Indicates the code is running in the
+// child process of a fast style death test.
+static bool g_in_fast_death_test_child = false;
+
+// Returns a Boolean value indicating whether the caller is currently
+// executing in the context of the death test child process.  Tools such as
+// Valgrind heap checkers may need this to modify their behavior in death
+// tests.  IMPORTANT: This is an internal utility.  Using it may break the
+// implementation of death tests.  User code MUST NOT use it.
+bool InDeathTestChild() {
+# if GTEST_OS_WINDOWS
+
+  // On Windows, death tests are thread-safe regardless of the value of the
+  // death_test_style flag.
+  return !GTEST_FLAG(internal_run_death_test).empty();
+
+# else
+
+  if (GTEST_FLAG(death_test_style) == "threadsafe")
+    return !GTEST_FLAG(internal_run_death_test).empty();
+  else
+    return g_in_fast_death_test_child;
+#endif
+}
+
+}  // namespace internal
+
 // ExitedWithCode constructor.
 ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
 }
@@ -7017,6 +7086,7 @@ DeathTest::TestRole NoExecDeathTest::AssumeRole() {
     // Event forwarding to the listeners of event listener API mush be shut
     // down in death test subprocesses.
     GetUnitTestImpl()->listeners()->SuppressEventForwarding();
+    g_in_fast_death_test_child = true;
     return EXECUTE_TEST;
   } else {
     GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
@@ -7036,6 +7106,11 @@ class ExecDeathTest : public ForkingDeathTest {
       ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }
   virtual TestRole AssumeRole();
  private:
+  static ::std::vector<testing::internal::string>
+  GetArgvsForDeathTestChildProcess() {
+    ::std::vector<testing::internal::string> args = GetInjectableArgvs();
+    return args;
+  }
   // The name of the file in which the death test is located.
   const char* const file_;
   // The line number on which the death test is located.
@@ -7070,6 +7145,7 @@ class Arguments {
   char* const* Argv() {
     return &args_[0];
   }
+
  private:
   std::vector<char*> args_;
 };
@@ -7081,7 +7157,7 @@ struct ExecDeathTestArgs {
   int close_fd;       // File descriptor to close; the read end of a pipe
 };
 
-#  if GTEST_OS_MAC && !GTEST_OS_MAC_IOS
+#  if GTEST_OS_MAC
 inline char** GetEnviron() {
   // When Google Test is built as a framework on MacOS X, the environ variable
   // is unavailable. Apple's documentation (man environ) recommends using
@@ -7095,6 +7171,7 @@ extern "C" char** environ;
 inline char** GetEnviron() { return environ; }
 #  endif  // GTEST_OS_MAC
 
+#  if !GTEST_OS_QNX
 // The main function for a threadsafe-style death test child process.
 // This function is called in a clone()-ed process and thus must avoid
 // any potentially unsafe operations like malloc or libc functions.
@@ -7127,6 +7204,7 @@ static int ExecDeathTestChildMain(void* child_arg) {
                                 GetLastErrnoDescription().c_str()));
   return EXIT_FAILURE;
 }
+#  endif  // !GTEST_OS_QNX
 
 // Two utility routines that together determine the direction the stack
 // grows.
@@ -7137,25 +7215,76 @@ static int ExecDeathTestChildMain(void* child_arg) {
 // GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
 // StackLowerThanAddress into StackGrowsDown, which then doesn't give
 // correct answer.
-bool StackLowerThanAddress(const void* ptr) GTEST_NO_INLINE_;
-bool StackLowerThanAddress(const void* ptr) {
+void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_;
+void StackLowerThanAddress(const void* ptr, bool* result) {
   int dummy;
-  return &dummy < ptr;
+  *result = (&dummy < ptr);
 }
 
 static bool StackGrowsDown() {
   int dummy;
-  return StackLowerThanAddress(&dummy);
+  bool result;
+  StackLowerThanAddress(&dummy, &result);
+  return result;
 }
 
-// A threadsafe implementation of fork(2) for threadsafe-style death tests
-// that uses clone(2).  It dies with an error message if anything goes
-// wrong.
-static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
+// Spawns a child process with the same executable as the current process in
+// a thread-safe manner and instructs it to run the death test.  The
+// implementation uses fork(2) + exec.  On systems where clone(2) is
+// available, it is used instead, being slightly more thread-safe.  On QNX,
+// fork supports only single-threaded environments, so this function uses
+// spawn(2) there instead.  The function dies with an error message if
+// anything goes wrong.
+static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
   ExecDeathTestArgs args = { argv, close_fd };
   pid_t child_pid = -1;
 
-#  if GTEST_HAS_CLONE
+#  if GTEST_OS_QNX
+  // Obtains the current directory and sets it to be closed in the child
+  // process.
+  const int cwd_fd = open(".", O_RDONLY);
+  GTEST_DEATH_TEST_CHECK_(cwd_fd != -1);
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC));
+  // We need to execute the test program in the same environment where
+  // it was originally invoked.  Therefore we change to the original
+  // working directory first.
+  const char* const original_dir =
+      UnitTest::GetInstance()->original_working_dir();
+  // We can safely call chdir() as it's a direct system call.
+  if (chdir(original_dir) != 0) {
+    DeathTestAbort(String::Format("chdir(\"%s\") failed: %s",
+                                  original_dir,
+                                  GetLastErrnoDescription().c_str()));
+    return EXIT_FAILURE;
+  }
+
+  int fd_flags;
+  // Set close_fd to be closed after spawn.
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD));
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD,
+                                        fd_flags | FD_CLOEXEC));
+  struct inheritance inherit = {0};
+  // spawn is a system call.
+  child_pid = spawn(args.argv[0], 0, NULL, &inherit, args.argv, GetEnviron());
+  // Restores the current working directory.
+  GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1);
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd));
+
+#  else   // GTEST_OS_QNX
+#   if GTEST_OS_LINUX
+  // When a SIGPROF signal is received while fork() or clone() are executing,
+  // the process may hang. To avoid this, we ignore SIGPROF here and re-enable
+  // it after the call to fork()/clone() is complete.
+  struct sigaction saved_sigprof_action;
+  struct sigaction ignore_sigprof_action;
+  memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action));
+  sigemptyset(&ignore_sigprof_action.sa_mask);
+  ignore_sigprof_action.sa_handler = SIG_IGN;
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction(
+      SIGPROF, &ignore_sigprof_action, &saved_sigprof_action));
+#   endif  // GTEST_OS_LINUX
+
+#   if GTEST_HAS_CLONE
   const bool use_fork = GTEST_FLAG(death_test_use_fork);
 
   if (!use_fork) {
@@ -7172,14 +7301,19 @@ static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
 
     GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
   }
-#  else
+#   else
   const bool use_fork = true;
-#  endif  // GTEST_HAS_CLONE
+#   endif  // GTEST_HAS_CLONE
 
   if (use_fork && (child_pid = fork()) == 0) {
       ExecDeathTestChildMain(&args);
       _exit(0);
   }
+#  endif  // GTEST_OS_QNX
+#  if GTEST_OS_LINUX
+  GTEST_DEATH_TEST_CHECK_SYSCALL_(
+      sigaction(SIGPROF, &saved_sigprof_action, NULL));
+#  endif  // GTEST_OS_LINUX
 
   GTEST_DEATH_TEST_CHECK_(child_pid != -1);
   return child_pid;
@@ -7216,7 +7350,7 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
                      GTEST_FLAG_PREFIX_, kInternalRunDeathTestFlag,
                      file_, line_, death_test_index, pipe_fd[1]);
   Arguments args;
-  args.AddArguments(GetArgvs());
+  args.AddArguments(GetArgvsForDeathTestChildProcess());
   args.AddArgument(filter_flag.c_str());
   args.AddArgument(internal_flag.c_str());
 
@@ -7227,7 +7361,7 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
   // is necessary.
   FlushInfoLog();
 
-  const pid_t child_pid = ExecDeathTestFork(args.Argv(), pipe_fd[0]);
+  const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]);
   GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
   set_child_pid(child_pid);
   set_read_fd(pipe_fd[0]);
@@ -7862,6 +7996,11 @@ void FilePath::Normalize() {
 # include <mach/vm_map.h>
 #endif  // GTEST_OS_MAC
 
+#if GTEST_OS_QNX
+# include <devctl.h>
+# include <sys/procfs.h>
+#endif  // GTEST_OS_QNX
+
 
 // Indicates that this translation unit is part of Google Test's
 // implementation.  It must come before gtest-internal-inl.h is
@@ -7904,6 +8043,26 @@ size_t GetThreadCount() {
   }
 }
 
+#elif GTEST_OS_QNX
+
+// Returns the number of threads running in the process, or 0 to indicate that
+// we cannot detect it.
+size_t GetThreadCount() {
+  const int fd = open("/proc/self/as", O_RDONLY);
+  if (fd < 0) {
+    return 0;
+  }
+  procfs_info process_info;
+  const int status =
+      devctl(fd, DCMD_PROC_INFO, &process_info, sizeof(process_info), NULL);
+  close(fd);
+  if (status == EOK) {
+    return static_cast<size_t>(process_info.num_threads);
+  } else {
+    return 0;
+  }
+}
+
 #else
 
 size_t GetThreadCount() {
@@ -8295,7 +8454,6 @@ class CapturedStream {
  public:
   // The ctor redirects the stream to a temporary file.
   CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
-
 # if GTEST_OS_WINDOWS
     char temp_dir_path[MAX_PATH + 1] = { '\0' };  // NOLINT
     char temp_file_path[MAX_PATH + 1] = { '\0' };  // NOLINT
@@ -8312,10 +8470,15 @@ class CapturedStream {
                                     << temp_file_path;
     filename_ = temp_file_path;
 # else
-    // There's no guarantee that a test has write access to the
-    // current directory, so we create the temporary file in the /tmp
-    // directory instead.
+    // There's no guarantee that a test has write access to the current
+    // directory, so we create the temporary file in the /tmp directory instead.
+    // We use /tmp on most systems, and /mnt/sdcard on Android. That's because
+    // Android doesn't have /tmp.
+#  if GTEST_OS_LINUX_ANDROID
+    char name_template[] = "/mnt/sdcard/gtest_captured_stream.XXXXXX";
+#  else
     char name_template[] = "/tmp/captured_stream.XXXXXX";
+#  endif  // GTEST_OS_LINUX_ANDROID
     const int captured_fd = mkstemp(name_template);
     filename_ = name_template;
 # endif  // GTEST_OS_WINDOWS
@@ -8434,11 +8597,23 @@ String GetCapturedStderr() { return GetCapturedStream(&g_captured_stderr); }
 #if GTEST_HAS_DEATH_TEST
 
 // A copy of all command line arguments.  Set by InitGoogleTest().
-::std::vector<String> g_argvs;
+::std::vector<testing::internal::string> g_argvs;
+
+static const ::std::vector<testing::internal::string>* g_injected_test_argvs =
+                                        NULL;  // Owned.
 
-// Returns the command line as a vector of strings.
-const ::std::vector<String>& GetArgvs() { return g_argvs; }
+void SetInjectableArgvs(const ::std::vector<testing::internal::string>* argvs) {
+  if (g_injected_test_argvs != argvs)
+    delete g_injected_test_argvs;
+  g_injected_test_argvs = argvs;
+}
 
+const ::std::vector<testing::internal::string>& GetInjectableArgvs() {
+  if (g_injected_test_argvs != NULL) {
+    return *g_injected_test_argvs;
+  }
+  return g_argvs;
+}
 #endif  // GTEST_HAS_DEATH_TEST
 
 #if GTEST_OS_WINDOWS_MOBILE
@@ -8605,14 +8780,6 @@ namespace {
 
 using ::std::ostream;
 
-#if GTEST_OS_WINDOWS_MOBILE  // Windows CE does not define _snprintf_s.
-# define snprintf _snprintf
-#elif defined(_MSC_VER) && _MSC_VER >= 1400  // VC 8.0 and later deprecate snprintf and _snprintf.
-# define snprintf _snprintf_s
-#elif defined(_MSC_VER) && _MSC_VER
-# define snprintf _snprintf
-#endif  // GTEST_OS_WINDOWS_MOBILE
-
 // Prints a segment of bytes in the given object.
 void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
                                 size_t count, ostream* os) {
@@ -8627,7 +8794,7 @@ void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
       else
         *os << '-';
     }
-    snprintf(text, sizeof(text), "%02X", obj_bytes[j]);
+    GTEST_SNPRINTF_(text, sizeof(text), "%02X", obj_bytes[j]);
     *os << text;
   }
 }
@@ -8741,9 +8908,9 @@ static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
   return kSpecialEscape;
 }
 
-// Prints a char c as if it's part of a string literal, escaping it when
+// Prints a wchar_t c as if it's part of a string literal, escaping it when
 // necessary; returns how c was formatted.
-static CharFormat PrintAsWideStringLiteralTo(wchar_t c, ostream* os) {
+static CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) {
   switch (c) {
     case L'\'':
       *os << "'";
@@ -8758,8 +8925,9 @@ static CharFormat PrintAsWideStringLiteralTo(wchar_t c, ostream* os) {
 
 // Prints a char c as if it's part of a string literal, escaping it when
 // necessary; returns how c was formatted.
-static CharFormat PrintAsNarrowStringLiteralTo(char c, ostream* os) {
-  return PrintAsWideStringLiteralTo(static_cast<unsigned char>(c), os);
+static CharFormat PrintAsStringLiteralTo(char c, ostream* os) {
+  return PrintAsStringLiteralTo(
+      static_cast<wchar_t>(static_cast<unsigned char>(c)), os);
 }
 
 // Prints a wide or narrow character c and its code.  '\0' is printed
@@ -8805,48 +8973,63 @@ void PrintTo(wchar_t wc, ostream* os) {
   PrintCharAndCodeTo<wchar_t>(wc, os);
 }
 
-// Prints the given array of characters to the ostream.
-// The array starts at *begin, the length is len, it may include '\0' characters
-// and may not be null-terminated.
-static void PrintCharsAsStringTo(const char* begin, size_t len, ostream* os) {
-  *os << "\"";
+// Prints the given array of characters to the ostream.  CharType must be either
+// char or wchar_t.
+// The array starts at begin, the length is len, it may include '\0' characters
+// and may not be NUL-terminated.
+template <typename CharType>
+static void PrintCharsAsStringTo(
+    const CharType* begin, size_t len, ostream* os) {
+  const char* const kQuoteBegin = sizeof(CharType) == 1 ? "\"" : "L\"";
+  *os << kQuoteBegin;
   bool is_previous_hex = false;
   for (size_t index = 0; index < len; ++index) {
-    const char cur = begin[index];
+    const CharType cur = begin[index];
     if (is_previous_hex && IsXDigit(cur)) {
       // Previous character is of '\x..' form and this character can be
       // interpreted as another hexadecimal digit in its number. Break string to
       // disambiguate.
-      *os << "\" \"";
+      *os << "\" " << kQuoteBegin;
     }
-    is_previous_hex = PrintAsNarrowStringLiteralTo(cur, os) == kHexEscape;
+    is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape;
   }
   *os << "\"";
 }
 
+// Prints a (const) char/wchar_t array of 'len' elements, starting at address
+// 'begin'.  CharType must be either char or wchar_t.
+template <typename CharType>
+static void UniversalPrintCharArray(
+    const CharType* begin, size_t len, ostream* os) {
+  // The code
+  //   const char kFoo[] = "foo";
+  // generates an array of 4, not 3, elements, with the last one being '\0'.
+  //
+  // Therefore when printing a char array, we don't print the last element if
+  // it's '\0', such that the output matches the string literal as it's
+  // written in the source code.
+  if (len > 0 && begin[len - 1] == '\0') {
+    PrintCharsAsStringTo(begin, len - 1, os);
+    return;
+  }
+
+  // If, however, the last element in the array is not '\0', e.g.
+  //    const char kFoo[] = { 'f', 'o', 'o' };
+  // we must print the entire array.  We also print a message to indicate
+  // that the array is not NUL-terminated.
+  PrintCharsAsStringTo(begin, len, os);
+  *os << " (no terminating NUL)";
+}
+
 // Prints a (const) char array of 'len' elements, starting at address 'begin'.
 void UniversalPrintArray(const char* begin, size_t len, ostream* os) {
-  PrintCharsAsStringTo(begin, len, os);
+  UniversalPrintCharArray(begin, len, os);
 }
 
-// Prints the given array of wide characters to the ostream.
-// The array starts at *begin, the length is len, it may include L'\0'
-// characters and may not be null-terminated.
-static void PrintWideCharsAsStringTo(const wchar_t* begin, size_t len,
-                                     ostream* os) {
-  *os << "L\"";
-  bool is_previous_hex = false;
-  for (size_t index = 0; index < len; ++index) {
-    const wchar_t cur = begin[index];
-    if (is_previous_hex && isascii(cur) && IsXDigit(static_cast<char>(cur))) {
-      // Previous character is of '\x..' form and this character can be
-      // interpreted as another hexadecimal digit in its number. Break string to
-      // disambiguate.
-      *os << "\" L\"";
-    }
-    is_previous_hex = PrintAsWideStringLiteralTo(cur, os) == kHexEscape;
-  }
-  *os << "\"";
+// Prints a (const) wchar_t array of 'len' elements, starting at address
+// 'begin'.
+void UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) {
+  UniversalPrintCharArray(begin, len, os);
 }
 
 // Prints the given C string to the ostream.
@@ -8872,7 +9055,7 @@ void PrintTo(const wchar_t* s, ostream* os) {
     *os << "NULL";
   } else {
     *os << ImplicitCast_<const void*>(s) << " pointing to ";
-    PrintWideCharsAsStringTo(s, wcslen(s), os);
+    PrintCharsAsStringTo(s, wcslen(s), os);
   }
 }
 #endif  // wchar_t is native
@@ -8891,13 +9074,13 @@ void PrintStringTo(const ::std::string& s, ostream* os) {
 // Prints a ::wstring object.
 #if GTEST_HAS_GLOBAL_WSTRING
 void PrintWideStringTo(const ::wstring& s, ostream* os) {
-  PrintWideCharsAsStringTo(s.data(), s.size(), os);
+  PrintCharsAsStringTo(s.data(), s.size(), os);
 }
 #endif  // GTEST_HAS_GLOBAL_WSTRING
 
 #if GTEST_HAS_STD_WSTRING
 void PrintWideStringTo(const ::std::wstring& s, ostream* os) {
-  PrintWideCharsAsStringTo(s.data(), s.size(), os);
+  PrintCharsAsStringTo(s.data(), s.size(), os);
 }
 #endif  // GTEST_HAS_STD_WSTRING
 
index ed7f8c4..edde3f8 100644 (file)
@@ -1,3 +1,3 @@
 set(the_description "Video stabilization")
-ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_highgui opencv_photo OPTIONAL opencv_gpu)
+ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d OPTIONAL opencv_gpu opencv_highgui)
 
index b363016..8130817 100644 (file)
 #include "precomp.hpp"
 #include "opencv2/videostab/frame_source.hpp"
 
+#include "opencv2/opencv_modules.hpp"
+#ifdef HAVE_OPENCV_HIGHGUI
+#  include "opencv2/highgui/highgui.hpp"
+#endif
+
 using namespace std;
 
 namespace cv
@@ -50,25 +55,74 @@ namespace cv
 namespace videostab
 {
 
+struct VideoFileSource::VideoReader
+{
+#ifdef HAVE_OPENCV_HIGHGUI
+    mutable VideoCapture vc;
+#endif
+};
+
 VideoFileSource::VideoFileSource(const string &path, bool volatileFrame)
-    : path_(path), volatileFrame_(volatileFrame) { reset(); }
+    : path_(path), volatileFrame_(volatileFrame), reader_(VideoReader()) { reset(); }
 
 
 void VideoFileSource::reset()
 {
-    reader_.release();
-    reader_.open(path_);
-    if (!reader_.isOpened())
+#ifdef HAVE_OPENCV_HIGHGUI
+    reader_.vc.release();
+    reader_.vc.open(path_);
+    if (!reader_.vc.isOpened())
         throw runtime_error("can't open file: " + path_);
+#else
+    CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without video I/O support");
+#endif
 }
 
 
 Mat VideoFileSource::nextFrame()
 {
     Mat frame;
-    reader_ >> frame;
+#ifdef HAVE_OPENCV_HIGHGUI
+    reader_.vc >> frame;
+#endif
     return volatileFrame_ ? frame : frame.clone();
 }
 
+int VideoFileSource::width()
+{
+#ifdef HAVE_OPENCV_HIGHGUI
+    return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_WIDTH));
+#else
+    return 0;
+#endif
+}
+
+int VideoFileSource::height()
+{
+#ifdef HAVE_OPENCV_HIGHGUI
+    return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_HEIGHT));
+#else
+    return 0;
+#endif
+}
+
+int VideoFileSource::count()
+{
+#ifdef HAVE_OPENCV_HIGHGUI
+    return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_COUNT));
+#else
+    return 0;
+#endif
+}
+
+double VideoFileSource::fps()
+{
+#ifdef HAVE_OPENCV_HIGHGUI
+    return reader_.vc.get(CV_CAP_PROP_FPS);
+#else
+    return 0;
+#endif
+}
+
 } // namespace videostab
 } // namespace cv
index ec70beb..c1d8e30 100644 (file)
@@ -50,7 +50,6 @@
 #include <stdexcept>
 #include <iostream>
 #include "opencv2/core/core.hpp"
-#include "opencv2/highgui/highgui.hpp"
 #include "opencv2/imgproc/imgproc.hpp"
 #include "opencv2/video/video.hpp"
 #include "opencv2/features2d/features2d.hpp"
diff --git a/samples/android/color-blob-detection/.settings/org.eclipse.jdt.core.prefs b/samples/android/color-blob-detection/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..d995784
--- /dev/null
@@ -0,0 +1,5 @@
+#Wed Jun 29 04:36:40 MSD 2011\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5\r
+org.eclipse.jdt.core.compiler.compliance=1.5\r
+org.eclipse.jdt.core.compiler.source=1.5\r
index 4d90941..699c1ed 100644 (file)
@@ -1,3 +1,12 @@
+'''\r
+This program illustrates the use of findContours and drawContours.\r
+The original image is put up along with the image of drawn contours.\r
+\r
+Usage:\r
+    contours.py\r
+A trackbar is put up which controls the contour level from -3 to 3\r
+'''\r
+\r
 import numpy as np\r
 import cv2\r
 \r
@@ -30,6 +39,8 @@ def make_image():
     return img\r
 \r
 if __name__ == '__main__':\r
+    print __doc__\r
+\r
     img = make_image()\r
     h, w = img.shape[:2]\r
 \r
index 759b3c1..5a4390f 100644 (file)
@@ -1,8 +1,21 @@
+'''\r
+This sample demonstrates Canny edge detection.\r
+\r
+Usage:\r
+  edge.py [<video source>]\r
+\r
+  Trackbars control edge thresholds.\r
+\r
+'''\r
+\r
 import cv2\r
 import video\r
 import sys\r
 \r
+\r
 if __name__ == '__main__':\r
+    print __doc__\r
+    \r
     try: fn = sys.argv[1]\r
     except: fn = 0\r
 \r
index aabc6b9..4e99a66 100644 (file)
@@ -1,3 +1,28 @@
+'''\r
+The sample demonstrates how to train Random Trees classifier\r
+(or Boosting classifier, or MLP, or Knearest, or Support Vector Machines) using the provided dataset.\r
+\r
+We use the sample database letter-recognition.data\r
+from UCI Repository, here is the link:\r
+\r
+Newman, D.J. & Hettich, S. & Blake, C.L. & Merz, C.J. (1998).\r
+UCI Repository of machine learning databases\r
+[http://www.ics.uci.edu/~mlearn/MLRepository.html].\r
+Irvine, CA: University of California, Department of Information and Computer Science.\r
+\r
+The dataset consists of 20000 feature vectors along with the\r
+responses - capital latin letters A..Z.\r
+The first 10000 samples are used for training\r
+and the remaining 10000 - to test the classifier.\r
+======================================================\r
+USAGE: \r
+  letter_recog.py [--model <model>] \r
+                  [--data <data fn>] \r
+                  [--load <model fn>] [--save <model fn>]\r
+\r
+  Models: RTrees, KNearest, Boost, SVM, MLP\r
+'''\r
+\r
 import numpy as np\r
 import cv2\r
 \r
@@ -77,7 +102,6 @@ class Boost(LetterStatModel):
 \r
 \r
 class SVM(LetterStatModel):\r
-    train_ratio = 0.1\r
     def __init__(self):\r
         self.model = cv2.SVM()\r
 \r
@@ -118,12 +142,11 @@ if __name__ == '__main__':
     import getopt\r
     import sys\r
 \r
+    print  __doc__\r
+\r
     models = [RTrees, KNearest, Boost, SVM, MLP] # NBayes\r
     models = dict( [(cls.__name__.lower(), cls) for cls in models] )\r
 \r
-    print 'USAGE: letter_recog.py [--model <model>] [--data <data fn>] [--load <model fn>] [--save <model fn>]'\r
-    print 'Models: ', ', '.join(models)\r
-    print\r
     \r
     args, dummy = getopt.getopt(sys.argv[1:], '', ['model=', 'data=', 'load=', 'save='])\r
     args = dict(args)\r